/* ============================================================
   elegin — shared redesign theme (write-up pages)
   Matches redesign.html. Applied ONLY to the new themed
   example pages; original write-up files are untouched.
   ============================================================ */

:root {
  --bg:        #0b0e14;
  --bg-2:      #11151f;
  --surface:   #151a26;
  --surface-2: #1b2130;
  --border:    #263042;
  --text:      #e6e9ef;
  --text-dim:  #9aa4b6;
  --text-mut:  #6b7688;
  --accent:    #39d98a;
  --accent-2:  #4aa8ff;
  --accent-soft: rgba(57, 217, 138, 0.14);
  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 10px 30px -12px rgba(0,0,0,0.7);
  --maxw:      900px;
  --mono: ui-monospace, "SF Mono", "SFMono-Regular", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(74,168,255,0.10), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(57,217,138,0.08), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 14, 20, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-bar {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: clamp(18px, 4vw, 40px);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.5px;
  color: var(--text);
  text-decoration: none;
}
.brand .dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: pulse 2.6s ease-in-out infinite;
}
.brand .caret { color: var(--accent); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  white-space: nowrap;
}
.back-link:hover { color: var(--text); border-color: var(--accent-2); }

/* ---------- Page hero ---------- */
.page-hero {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding: clamp(34px, 7vw, 64px) clamp(18px, 4vw, 32px) 6px;
}
.page-hero .kicker {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.page-hero h1 {
  margin: 10px 0 6px;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  letter-spacing: -0.02em;
  line-height: 1.08;
}
.page-hero .sub { color: var(--text-mut); font-family: var(--mono); font-size: 0.85rem; }

/* ---------- Reader (injected original content) ---------- */
.reader {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding: 20px clamp(18px, 4vw, 32px) 60px;
}
.reader { overflow-wrap: break-word; }
.reader :where(h1, h2, h3, h4) { letter-spacing: -0.01em; line-height: 1.2; margin-top: 1.6em; }
.reader p { margin: 0 0 1.05em; }
.reader a { color: var(--accent-2); overflow-wrap: anywhere; word-break: break-word; }
.reader a:hover { color: #7cc4ff; }

/* Normalize legacy markup coming from the original page */
.reader img {
  max-width: 100% !important;
  height: auto !important;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  margin: 12px 0;
}
.reader font[color] { color: inherit !important; }   /* neutralize hard-coded colors */
.reader font { font-family: inherit !important; }     /* tame Arial Black etc. */
.reader hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 30px 0;
}
.reader code {
  font-family: var(--mono);
  background: var(--surface-2);
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 0.92em;
}
.reader pre {
  background: #060910;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-dim);
}
.reader pre code { background: none; padding: 0; color: var(--text); }
.reader dfn {
  display: block;
  font-style: italic;
  color: var(--text-dim);
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 16px;
  margin: 12px 0;
}
.reader blockquote {
  border-left: 3px solid var(--accent);
  margin: 0 0 1em;
  padding-left: 16px;
  color: var(--text-dim);
}
.reader table { max-width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
.reader td, .reader th { border: 1px solid var(--border); padding: 6px 10px; }

.loading { color: var(--text-mut); font-family: var(--mono); }
.notice {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-2);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  color: var(--text-dim);
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  padding-block: 34px;
  margin-top: 40px;
}
.site-footer .inner {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: clamp(18px, 4vw, 40px);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}
.site-footer .fine { color: var(--text-mut); font-size: 0.82rem; width: 100%; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
