/* ==========================================================================
   ALMANAC — ProfessorClock Books
   Shared design system for professorclockbooks.com, aligned with the
   Time Traveler's Digest Almanac. Two themes: Paper (default, surface/cream)
   and Night Orrery (chrome/void black). No UI gradients: depth comes from
   the double frame (outer frame-weight line + inner hairline).
   ========================================================================== */

:root {
  /* --- Almanac core --- */
  --surface: #f3ecdd;          /* Paper field */
  --surface-2: #faf5ea;
  --surface-3: #e9e0cc;
  --chrome: #0c0a09;           /* Night Orrery field / masthead */
  --chrome-2: #171412;
  --chrome-3: #24201b;
  --gold: #e3ad2b;             /* the only action color */
  --gold-deep: #b4821a;

  /* --- The Order of the Fixed Path release palette (fp-) ---
     Sampled from the Book One cover and spread. */
  --fp-paper: #f1e6cc;         /* spread parchment */
  --fp-gold: #f2b630;          /* the golden path / primary action */
  --fp-vermilion: #c2321d;     /* "Book One of Three" banner red */
  --fp-ultra: #1e3f9a;         /* ultramarine chip & night sky */
  --fp-sun-red: #e0283c;       /* the red moon over the city */
  --fp-planet-slate: #4c6a86;  /* the blue planet's slate */
  --fp-path-cream: #fbedbe;    /* glow along the path */

  /* --- Line weights --- */
  --frame: 3px;                /* outer frame-weight line */
  --hair: 1px;                 /* inner hairline */
  --frame-gap: 5px;

  /* --- Radii (UI only — never applied to book art) --- */
  --r-pill: 999px;
  --r-arch: 999px 999px 0 0;
  --r-circle: 50%;
  --r-art: 0;                  /* book art is always square-cornered */

  /* --- Type roles --- */
  --f-display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --f-read: "Old Standard TT", Georgia, "Times New Roman", serif;
  --f-ui: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-data: "Courier Prime", "Courier New", monospace;

  --shell: 1240px;
  --gutter: clamp(18px, 4vw, 40px);
  --sec: clamp(56px, 8vw, 112px);

  /* --- Paper theme (default) semantic tokens --- */
  --field: var(--surface);
  --field-2: var(--surface-2);
  --field-3: var(--surface-3);
  --ink: #15120f;
  --ink-2: #4e453a;
  --ink-3: #6a5f50;
  --rule: #15120f;
  --rule-soft: #cdc0a6;
  --world-fiction: var(--fp-vermilion);
  --world-fact: var(--fp-ultra);
  --on-gold: #000;
  color-scheme: light;
}

/* Night Orrery theme */
[data-theme="night"] {
  --field: var(--chrome);
  --field-2: var(--chrome-2);
  --field-3: var(--chrome-3);
  --ink: #f3ecdd;
  --ink-2: #d6cbb5;
  --ink-3: #b0a48e;
  --rule: #f3ecdd;
  --rule-soft: #3d3931;
  --world-fiction: #f0644c;    /* lifted vermilion for contrast on void */
  --world-fact: #9db3f0;       /* lifted ultramarine for contrast on void */
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body {
  margin: 0;
  background: var(--field);
  color: var(--ink);
  font-family: var(--f-read);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
::selection { background: var(--gold); color: #000; }
:focus-visible { outline: 3px solid var(--world-fiction); outline-offset: 3px; }
h1, h2, h3, h4, p, figure, blockquote { margin: 0; }

.al-shell { width: 100%; max-width: var(--shell); margin: 0 auto; padding-inline: var(--gutter); }
.al-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.al-skip { position: absolute; left: 12px; top: -80px; z-index: 200; background: var(--gold); color: #000; padding: 10px 18px; border-radius: var(--r-pill); font: 800 12px/1 var(--f-ui); letter-spacing: .14em; text-transform: uppercase; text-decoration: none; }
.al-skip:focus { top: 12px; }

/* ---------- Type roles ---------- */
.al-display, .al-h1, .al-h2, .al-h3 {
  font-family: var(--f-display);
  text-transform: uppercase;
  line-height: .9;
  letter-spacing: .005em;
}
.al-h1 { font-weight: 900; font-size: clamp(54px, 9.4vw, 136px); }
.al-h2 { font-weight: 800; font-size: clamp(38px, 5.6vw, 80px); }
.al-h3 { font-weight: 700; font-size: clamp(24px, 2.4vw, 32px); line-height: 1; }
.al-read { font-family: var(--f-read); font-size: 17.5px; line-height: 1.65; color: var(--ink-2); }
.al-lede { font-family: var(--f-read); font-size: clamp(19px, 1.7vw, 22px); line-height: 1.55; color: var(--ink-2); max-width: 62ch; }
.al-quote { font-family: var(--f-read); font-style: italic; font-size: clamp(22px, 2.4vw, 32px); line-height: 1.3; color: var(--ink); }
.al-kicker, .al-label, .al-price {
  font-family: var(--f-ui);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: 12px;
  line-height: 1.3;
}
.al-price { font-size: 15px; letter-spacing: .12em; color: var(--ink); }
.al-meta { font-family: var(--f-ui); font-weight: 600; font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
/* Telemetry: decorative only — always duplicated by real text elsewhere. */
.al-telemetry { font-family: var(--f-data); font-size: 11.5px; letter-spacing: .06em; color: var(--ink-3); }

/* ---------- Buttons: gold is the only action color ---------- */
.al-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 14px 28px;
  background: var(--fp-gold); color: var(--on-gold);
  border: 0; border-radius: var(--r-pill);
  font-family: var(--f-ui); font-size: 13px; font-weight: 800;
  letter-spacing: .16em; text-transform: uppercase; line-height: 1;
  text-decoration: none; cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}
.al-btn:hover { background: var(--gold); transform: translateY(-1px); }
.al-btn:active { transform: translateY(0); }
.al-btn[disabled] { opacity: .65; cursor: progress; }
.al-btn--sm { min-height: 40px; padding: 10px 18px; font-size: 11.5px; }
.al-btn--wide { width: 100%; }
.al-btn .al-arrow { font-size: 1.15em; letter-spacing: 0; }
/* Non-action navigation: plain tracked text link, no competing color */
.al-link {
  font-family: var(--f-ui); font-weight: 800; font-size: 12px;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px;
  text-underline-offset: 6px; text-decoration-color: var(--rule-soft);
}
.al-link:hover { text-decoration-color: var(--gold); }

/* ---------- Double frame ---------- */
.al-frame { position: relative; border: var(--frame) solid var(--rule); padding: calc(var(--frame-gap) + 1px); background: var(--field-2); }
.al-frame::before { content: ""; position: absolute; inset: var(--frame-gap); border: var(--hair) solid var(--rule); pointer-events: none; }
.al-frame > .al-frame__in { position: relative; padding: clamp(20px, 3vw, 36px); }
.al-frame--flat { background: transparent; }

/* ---------- Book art: strictly square-cornered ---------- */
.al-art, .al-art img { border-radius: var(--r-art) !important; }
.al-art { position: relative; display: block; background: var(--chrome); }
.al-art img { width: 100%; height: auto; }

/* ---------- World declaration (Fact vs Fiction) ---------- */
.al-world {
  display: inline-flex; align-items: stretch;
  font-family: var(--f-ui); font-size: 11.5px; font-weight: 800;
  letter-spacing: .18em; text-transform: uppercase; line-height: 1;
  border: var(--hair) solid currentColor; border-radius: var(--r-pill);
  overflow: hidden;
}
.al-world > b { padding: 8px 12px; color: var(--field); font-weight: 900; }
.al-world > span { padding: 8px 14px 8px 10px; }
.al-world--fiction { color: var(--world-fiction); }
.al-world--fiction > b { background: var(--world-fiction); }
.al-world--fact { color: var(--world-fact); }
.al-world--fact > b { background: var(--world-fact); }

/* Section header rule that carries the world marker */
.al-worldbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px;
  padding-bottom: 14px; margin-bottom: clamp(28px, 4vw, 48px);
  position: relative;
  border-bottom: var(--frame) solid var(--rule);
}
.al-worldbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: calc(-1 * var(--frame) - 4px); border-bottom: var(--hair) solid var(--rule); }
.al-worldbar[data-world="fiction"], .al-worldbar[data-world="fiction"]::after { border-bottom-color: var(--world-fiction); }
.al-worldbar[data-world="fact"], .al-worldbar[data-world="fact"]::after { border-bottom-color: var(--world-fact); }
.al-worldbar--bare { border-bottom: 0; margin-bottom: 0; }
.al-worldbar--bare::after { display: none; }

/* ---------- Numbered circle marker ---------- */
.al-num {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: var(--r-circle); border: var(--hair) solid var(--rule);
  font-family: var(--f-ui); font-weight: 900; font-size: 14px; font-variant-numeric: tabular-nums;
}

/* ---------- Theme toggle ---------- */
.al-theme {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; color: inherit; cursor: pointer;
  border: var(--hair) solid currentColor; border-radius: var(--r-pill);
  padding: 8px 14px; font: 800 11px/1 var(--f-ui); letter-spacing: .16em; text-transform: uppercase;
}
.al-theme .al-theme__dot { width: 10px; height: 10px; border-radius: var(--r-circle); background: currentColor; }
