/* ============================================================
   A Beginner's Guide to TypiClust — stylesheet
   Clean, editorial, publication-style layout.
   Palette: neutral whites + dark text, muted blue accent,
            soft lavender gradient hero.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  /* Neutrals */
  --bg:            #ffffff;
  --bg-soft:       #f7f7f8;
  --bg-code:       #f5f6f8;
  --border:        #e6e7eb;
  --border-soft:   #eef0f3;
  --text:          #14161a;
  --text-muted:    #5b606b;
  --text-faint:    #8a8f99;

  /* Accent — muted data-blue */
  --accent:        #3a6ff0;
  --accent-ink:    #2a54c9;
  --accent-soft:   #eaf0ff;

  /* Lavender / hero gradient */
  --lav-1:         #e9e2ff;
  --lav-2:         #c9bcf2;
  --lav-3:         #8f7fd0;

  /* Syntax highlighting */
  --code-text:     #1a1f2b;
  --code-comment:  #8a90a0;
  --code-keyword:  #3a6ff0;
  --code-string:   #2e8b5a;
  --code-number:   #c2791f;
  --code-fn:       #7a3fd6;
  --code-type:     #b14a6f;

  /* Typography */
  --font-sans:    "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-serif:   "Source Serif Pro", "Iowan Old Style", "Charter", Georgia, serif;
  --font-mono:    "JetBrains Mono", "SF Mono", "Menlo", Consolas, monospace;

  /* Layout */
  --measure:       680px;          /* ideal reading width */
  --wide:          960px;
  --radius:        10px;
  --radius-sm:     6px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  font-size: 18px;
  line-height: 1.7;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(58,111,240,0.3);
  transition: border-color .15s ease, color .15s ease;
}
a:hover { color: var(--accent-ink); border-bottom-color: var(--accent-ink); }

/* ---------- Top nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.9);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border-soft);
}
.site-header__inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--text);
  border: 0;
}
.nav {
  display: flex;
  gap: 22px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.nav a {
  color: var(--text-muted);
  border: 0;
}
.nav a:hover { color: var(--text); }

/* ---------- Article shell ---------- */
.post {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 18px 18px 46px;
}
.post > * {
  max-width: var(--measure);
  margin-left: auto;
  margin-right: auto;
}
.post > .hero,
.post > .figure-wide {
  max-width: var(--wide);
}

/* ---------- Masthead ---------- */
.kicker {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
  font-weight: 600;
  margin-bottom: 14px;
}
.post-title {
  font-family: var(--font-serif);
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 700;
  margin: 0 0 18px;
  color: var(--text);
}
.post-subtitle {
  font-family: var(--font-serif);
  font-size: clamp(19px, 2vw, 22px);
  line-height: 1.5;
  color: var(--text-muted);
  margin: 0 0 28px;
  font-weight: 400;
}
.byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 40px;
}
.byline .dot { color: var(--text-faint); }
.byline .author { color: var(--text); font-weight: 500; }

/* ---------- Editorial excerpt ---------- */
.excerpt {
  font-family: var(--font-serif);
  font-size: 20px;
  line-height: 1.6;
  color: var(--text);
  padding: 22px 26px;
  border-left: 3px solid var(--accent);
  background: linear-gradient(180deg, var(--accent-soft), transparent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 0 0 44px;
  font-style: italic;
}
.excerpt p { margin: 0; }

/* ---------- Hero ---------- */
.hero {
  margin: 0 auto 48px;
  border-radius: var(--radius);
  overflow: hidden;
  background:
    radial-gradient(1200px 320px at 20% 0%, rgba(143,127,208,0.35), transparent 60%),
    linear-gradient(135deg, var(--lav-1) 0%, var(--lav-2) 55%, var(--lav-3) 100%);
  padding: 56px 36px;
  position: relative;
  box-shadow: 0 1px 0 var(--border-soft), 0 20px 60px -32px rgba(88, 70, 170, 0.35);
}
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(600px 200px at 85% 90%, rgba(255,255,255,0.4), transparent 70%);
  pointer-events: none;
}
.hero__frame {
  position: relative;
  z-index: 1;
  background: #ffffff;
  border-radius: var(--radius-sm);
  padding: 18px;
  box-shadow: 0 2px 24px -8px rgba(45, 30, 95, 0.25);
}
.hero__frame img { border-radius: 4px; }
.hero__caption {
  color: #000000;
  font-size: 13px;
  text-align: center;
  margin-top: 14px;
  letter-spacing: 0.01em;
  position: relative;
  z-index: 1;
}

/* ---------- Prose ---------- */
.post h2 {
  font-family: var(--font-serif);
  font-size: 30px;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 56px 0 18px;
  font-weight: 700;
  color: var(--text);
}
.post h3 {
  font-size: 20px;
  margin: 36px 0 12px;
  font-weight: 600;
  color: var(--text);
}
.post p {
  margin: 0 0 22px;
}
.post ol, .post ul {
  padding-left: 1.3em;
  margin: 0 0 22px;
}
.post li { margin-bottom: 8px; }
.post li::marker { color: var(--text-faint); }

hr.rule {
  border: 0;
  height: 1px;
  background: var(--border);
  margin: 56px auto;
  width: 80px;
}

/* Inline code */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-code);
  color: var(--accent-ink);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-soft);
}

/* ---------- Callout / NB ---------- */
.callout {
  border-left: 3px solid var(--lav-3);
  background: linear-gradient(180deg, #f6f1ff, transparent 80%);
  padding: 14px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 24px 0 30px;
  font-size: 15.5px;
  color: var(--text);
}
.callout strong { color: #5b4a9c; letter-spacing: 0.02em; }

/* ---------- Pull equation ---------- */
.equation {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 22px;
  margin: 20px 0 28px;
  text-align: center;
  font-family: var(--font-serif);
  font-size: 19px;
  color: var(--text);
  overflow-x: auto;
}

/* ---------- Figure ---------- */
.figure {
  margin: 32px 0 36px;
}
.figure img {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
}
.figure figcaption {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 12px;
  text-align: center;
  font-style: italic;
}

/* ---------- "Lab step" code blocks ---------- */
.lab-step {
  margin: 28px 0 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(20, 22, 26, 0.02),
              0 8px 24px -18px rgba(20, 22, 26, 0.18);
}
.lab-step__header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.lab-step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: 999px;
  text-transform: uppercase;
}
.lab-step__title {
  font-weight: 600;
  color: var(--text);
  font-size: 14px;
}
.lab-step__lang {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.lab-step__dots {
  display: inline-flex;
  gap: 6px;
  margin-right: 4px;
}
.lab-step__dots span {
  width: 10px; height: 10px; border-radius: 50%;
  background: #e4e6ea;
  display: inline-block;
}
.lab-step__dots span:nth-child(1) { background: #ffbfb5; }
.lab-step__dots span:nth-child(2) { background: #ffe0a3; }
.lab-step__dots span:nth-child(3) { background: #b8e6c2; }

.lab-step pre {
  margin: 0;
  padding: 20px 22px;
  overflow-x: auto;
  background: var(--bg-code);
  color: var(--code-text);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.65;
  tab-size: 4;
}
.lab-step pre code {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

/* Console / output block */
.console {
  margin: 24px 0 32px;
  background: #121521;
  color: #e6e7ea;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
  padding: 18px 22px;
  overflow-x: auto;
}
.console .c-dim { color: #8a90a3; }
.console .c-ok  { color: #8fd19e; }
.console .c-hi  { color: #c6b8ff; }

/* ---------- Minimal syntax highlighting ---------- */
.kw { color: var(--code-keyword); font-weight: 600; }
.st { color: var(--code-string); }
.nm { color: var(--code-number); }
.co { color: var(--code-comment); font-style: italic; }
.fn { color: var(--code-fn); }
.ty { color: var(--code-type); }
.dc { color: var(--code-comment); font-style: italic; }

/* ---------- Footer ---------- */
.post-footer {
  margin-top: 24px;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
  color: var(--text-muted);
  font-size: 15px;
}
.post-footer h3 {
  color: var(--text);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0 0 14px;
}

/* ---------- Responsive ---------- */
@media (max-width: 680px) {
  body { font-size: 17px; }
  .post { padding: 32px 20px 72px; }
  .hero { padding: 32px 18px; }
  .hero__frame { padding: 12px; }
  .excerpt { padding: 18px 20px; font-size: 18px; }
  .lab-step pre { font-size: 13px; padding: 16px 18px; }
}
