/* Altarifi LAB — site styles
   Shared by every page outside the course lesson files.
   Tokens match the 0606 lesson design system. */

@font-face { font-family: "Source Serif 4"; font-weight: 600; font-style: normal; font-display: swap;
  src: url("fonts/source-serif-4-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 700; font-style: normal; font-display: swap;
  src: url("fonts/source-serif-4-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("fonts/source-sans-3-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-weight: 600; font-style: normal; font-display: swap;
  src: url("fonts/source-sans-3-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-style: normal; font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-style: normal; font-display: swap;
  src: url("fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  --paper: #FCFBF8;
  --panel: #FFFFFF;
  --panel-2: #F3F4F1;
  --ink: #1B2230;
  --ink-2: #3F4A5C;
  --muted: #6C7686;
  --rule: #D9DEE5;
  --rule-soft: #E9ECF0;
  --pen: #A6362B;
  --uni: #3B4A8C;
  --uni-bg: #EDEFF8;
  --uni-edge: #CFD5EC;
  --ok: #1F7A52;
  --gline: #E4E8EE;
  --gaxis: #9AA5B3;
  --c-curve: #2E4CA6;
  --c-tan: #B23A2C;
  --c-nor: #1F7A52;
  --wa: #1F7A52;
  --wa-ink: #FFFFFF;

  --f-display: "Source Serif 4", Georgia, "Times New Roman", serif;
  --f-body: "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --s-xs: 0.78rem;
  --s-sm: 0.875rem;
  --s-0: 1rem;
  --s-1: 1.18rem;
  --s-2: 1.5rem;
  --s-3: 2.1rem;
  --s-4: clamp(2.2rem, 5.2vw, 3.3rem);

  --w: 1040px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12161D;
    --panel: #1A202A;
    --panel-2: #212936;
    --ink: #E7EBF0;
    --ink-2: #B6BFCC;
    --muted: #8B95A5;
    --rule: #2E3846;
    --rule-soft: #242D39;
    --pen: #E08878;
    --uni: #9AA8E4;
    --uni-bg: #1A1F33;
    --uni-edge: #303A5C;
    --ok: #5CB98C;
    --gline: #232C38;
    --gaxis: #5E6B7A;
    --c-curve: #7E93E8;
    --c-tan: #E08878;
    --c-nor: #5CB98C;
    --wa: #2F8F63;
    --wa-ink: #FFFFFF;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: var(--s-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; }
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--uni); outline-offset: 3px; border-radius: 2px; }

.wrap { max-width: var(--w); margin: 0 auto; padding: 0 1.4rem; }

/* ---------- header ---------- */
.site-head { border-bottom: 1px solid var(--rule); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 64px; }
.wordmark {
  font-family: var(--f-display); font-weight: 700; font-size: 1.22rem; letter-spacing: 0.01em;
  text-decoration: none; color: var(--ink); white-space: nowrap;
}
.wordmark em { font-style: normal; color: var(--c-tan); }
.nav { display: flex; gap: 1.3rem; align-items: center; }
.nav a { font-size: var(--s-sm); font-weight: 600; color: var(--ink-2); text-decoration: none; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px; }

/* ---------- type ---------- */
.eyebrow {
  font-family: var(--f-mono); font-size: var(--s-xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--pen);
}
h1, h2, h3 { font-family: var(--f-display); font-weight: 700; margin: 0; text-wrap: balance; }
h1 { font-size: var(--s-4); line-height: 1.05; letter-spacing: -0.02em; }
h2 { font-size: var(--s-3); line-height: 1.15; letter-spacing: -0.012em; font-weight: 600; }
h3 { font-size: var(--s-1); line-height: 1.3; font-weight: 600; }
p { margin: 0; max-width: 64ch; }
.lead { font-size: var(--s-1); color: var(--ink-2); line-height: 1.55; }
.muted { color: var(--muted); }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

/* ---------- buttons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--f-body); font-weight: 600; font-size: var(--s-sm);
  padding: 0.72rem 1.1rem; border-radius: 3px; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: background-color .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--ink-2); }
.btn-wa { background: var(--wa); color: var(--wa-ink); }
.btn-wa:hover { filter: brightness(1.07); }
.btn-ghost { border-color: var(--rule); color: var(--ink); background: transparent; }
.btn-ghost:hover { border-color: var(--ink-2); }
.btn svg { width: 18px; height: 18px; flex: none; }

/* ---------- sections ---------- */
.section { padding: 4.2rem 0; }
.section + .section { border-top: 1px solid var(--rule-soft); }
.section-head { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 2rem; }

/* ---------- hero ---------- */
.hero { padding: 3.6rem 0 3.4rem; }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 3rem; align-items: center; }
.hero-copy { display: flex; flex-direction: column; gap: 1.2rem; }
.hero-lab { display: flex; flex-direction: column; gap: 0.6rem; }
.lab-frame {
  background: var(--panel); border: 1px solid var(--rule); border-radius: 4px; padding: 0.6rem;
}
.lab-frame svg { display: block; width: 100%; height: auto; touch-action: none; cursor: grab; user-select: none; }
.lab-frame svg.dragging { cursor: grabbing; }
.lab-readout {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.4rem 1rem;
  font-family: var(--f-mono); font-size: var(--s-xs); color: var(--muted); padding: 0 0.2rem;
}
.lab-readout b { font-weight: 500; color: var(--ink); }
.lab-readout .r-tan b { color: var(--c-tan); }
.lab-readout .r-state { color: var(--muted); }
.lab-readout .r-state.flat { color: var(--c-nor); }

/* ---------- course feature ---------- */
.feature {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem 2rem; align-items: end;
  background: var(--panel); border: 1px solid var(--rule); border-left: 4px solid var(--ink);
  border-radius: 0 4px 4px 0; padding: 1.8rem 1.9rem; text-decoration: none; color: inherit;
  transition: border-color .15s;
}
.feature:hover { border-color: var(--ink-2); border-left-color: var(--c-tan); }
.feature-body { display: flex; flex-direction: column; gap: 0.55rem; }
.feature .code { font-family: var(--f-mono); font-size: var(--s-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.feature h3 { font-size: var(--s-2); }
.feature .go { font-weight: 600; font-size: var(--s-sm); white-space: nowrap; }

/* ---------- three-up ---------- */
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; }
.trio article { display: flex; flex-direction: column; gap: 0.5rem; padding-top: 1rem; border-top: 2px solid var(--ink); }
.trio .k { font-family: var(--f-mono); font-size: var(--s-xs); letter-spacing: 0.08em; text-transform: uppercase; }
.trio .k.curve { color: var(--c-curve); }
.trio .k.tan { color: var(--c-tan); }
.trio .k.nor { color: var(--c-nor); }
.trio p { color: var(--ink-2); font-size: 0.97rem; }

/* ---------- author ---------- */
.author { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 3rem; align-items: start; }
.author dl { margin: 0; display: grid; gap: 0.9rem; }
.author dt { font-family: var(--f-mono); font-size: var(--s-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.author dd { margin: 0.15rem 0 0; color: var(--ink); }

/* ---------- contact ---------- */
.contact { background: var(--panel-2); }
.contact .wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem 3rem; align-items: center; }
.contact .email { font-family: var(--f-mono); font-size: var(--s-sm); color: var(--ink-2); }
.contact .email a { color: var(--ink); }

/* ---------- breadcrumb ---------- */
.crumbs { font-family: var(--f-mono); font-size: var(--s-xs); color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.4rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs span[aria-hidden] { opacity: 0.6; }

/* ---------- course page ---------- */
.course-head { padding: 2.6rem 0 2.2rem; border-bottom: 1px solid var(--rule); }
.course-head .wrap { display: flex; flex-direction: column; gap: 1rem; }
.facts { display: flex; flex-wrap: wrap; gap: 0.45rem 1.4rem; font-family: var(--f-mono); font-size: var(--s-xs); color: var(--muted); }
.facts span { white-space: nowrap; }

.topic { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 2.5rem 3rem; align-items: start; }
.topic-intro { display: flex; flex-direction: column; gap: 1rem; position: sticky; top: 1.5rem; }
.lessons { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.lessons li { border-bottom: 1px solid var(--rule); }
.lessons a {
  display: grid; grid-template-columns: 2.6rem minmax(0, 1fr) auto; gap: 0.2rem 0.9rem; align-items: baseline;
  padding: 1rem 0.3rem; text-decoration: none; color: inherit; transition: background-color .15s;
}
.lessons a:hover { background: var(--panel); }
.lessons .n { font-family: var(--f-mono); font-size: var(--s-sm); color: var(--c-tan); }
.lessons .t { font-weight: 600; }
.lessons .d { grid-column: 2; color: var(--muted); font-size: 0.93rem; }
.lessons .arrow { grid-row: 1; grid-column: 3; color: var(--muted); font-family: var(--f-mono); }
.lessons a:hover .arrow { color: var(--ink); }

/* ---------- footer ---------- */
.site-foot { border-top: 1px solid var(--rule); padding: 2.2rem 0 2.6rem; }
.site-foot .wrap { display: flex; flex-direction: column; gap: 0.6rem; }
.site-foot p { font-size: var(--s-xs); color: var(--muted); max-width: 78ch; }
.site-foot .brand-line { font-family: var(--f-display); font-weight: 700; font-size: var(--s-sm); color: var(--ink); }
.site-foot .brand-line em { font-style: normal; color: var(--c-tan); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .hero .wrap, .author, .topic { grid-template-columns: minmax(0, 1fr); gap: 2.2rem; }
  .topic-intro { position: static; }
  .trio { grid-template-columns: minmax(0, 1fr); gap: 1.6rem; }
  .contact .wrap { grid-template-columns: minmax(0, 1fr); }
  .feature { grid-template-columns: minmax(0, 1fr); }
  .section { padding: 3.2rem 0; }
}
@media (max-width: 520px) {
  .wrap { padding: 0 1rem; }
  .hero { padding: 2.2rem 0 2.4rem; }
  .nav { gap: 0.9rem; }
  .feature { padding: 1.4rem 1.2rem; }
  .actions .btn { flex: 1 1 auto; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- print ---------- */
@media print {
  .site-head .nav, .actions, .hero-lab { display: none !important; }
  body { background: #fff; color: #111; }
}
