/* ==========================================================================
   AI Advent Calendar — main stylesheet
   Sections: 1 Fonts · 2 Tokens · 3 Base · 4 Layout (Task 0)
             5 Doors (Task 4) · 6 Reader (Task 6) · 7 A11y & responsive (Task 7)
   ========================================================================== */

/* ---------- 1 Fonts (self-hosted, SIL OFL — see assets/fonts/LICENSE-*) ---------- */
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 400; font-display: swap; src: url("../assets/fonts/playfair-display-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Playfair Display"; font-style: italic; font-weight: 400; font-display: swap; src: url("../assets/fonts/playfair-display-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 700; font-display: swap; src: url("../assets/fonts/playfair-display-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 900; font-display: swap; src: url("../assets/fonts/playfair-display-latin-900-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400; font-display: swap; src: url("../assets/fonts/source-serif-4-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 400; font-display: swap; src: url("../assets/fonts/source-serif-4-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 600; font-display: swap; src: url("../assets/fonts/source-serif-4-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 600; font-display: swap; src: url("../assets/fonts/source-serif-4-latin-600-italic.woff2") format("woff2"); }

/* ---------- 2 Tokens ---------- */
:root {
  /* Palette — hard-code these same hex values in SVG assets */
  --holly:        #1f4d3a;   /* deep holly green */
  --holly-light:  #2f6b52;
  --cranberry:    #9e1b32;   /* cranberry red */
  --cranberry-dk: #7a1426;
  --card:         #f4ead5;   /* cream card stock */
  --card-shade:   #e6d8b8;
  --gold:         #c9a227;   /* antique gold */
  --gold-light:   #e3c868;
  --night:        #14213d;   /* ink-navy sky */
  --night-deep:   #0b1428;
  --ink:          #2a2420;   /* warm off-black text */
  --snow:         #fbf8f1;

  /* Type */
  --font-display: "Playfair Display", "Georgia", "Times New Roman", serif;
  --font-body:    "Source Serif 4", "Georgia", "Times New Roman", serif;
  --step--1: clamp(0.85rem, 0.82rem + 0.15vw, 0.95rem);
  --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --step-1:  clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --step-2:  clamp(1.6rem, 1.4rem + 1vw, 2.2rem);
  --step-3:  clamp(2.1rem, 1.7rem + 2vw, 3.4rem);

  /* Space, shape, depth */
  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 1rem; --space-4: 1.5rem; --space-5: 2.5rem; --space-6: 4rem;
  --radius: 6px;
  --shadow-paper: 0 1px 1px rgb(0 0 0 / 0.15), 0 4px 10px rgb(0 0 0 / 0.25);
  --measure: 62ch;
  --ease-hinge: cubic-bezier(0.3, 0.7, 0.2, 1);
  --focus-ring: 0 0 0 3px var(--snow), 0 0 0 6px var(--cranberry);
}

/* ---------- 3 Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--snow);
  background-color: var(--night-deep);
  background: var(--night-deep) radial-gradient(ellipse at top, var(--night) 0%, var(--night-deep) 70%) fixed;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; }
a { color: var(--gold-light); }
:focus-visible { outline: 2px solid transparent; outline-offset: 2px; box-shadow: var(--focus-ring); border-radius: var(--radius); }  /* transparent outline shows in forced-colors mode */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: var(--space-3); top: -4rem; background: var(--card); color: var(--ink); padding: var(--space-2) var(--space-3); z-index: 100; }
.skip-link:focus { top: var(--space-3); }

/* ---------- 4 Layout ---------- */
.site-header { text-align: center; padding: var(--space-5) var(--space-3) var(--space-3); }
.site-kicker { margin: 0; font-family: var(--font-display); font-style: italic; color: var(--gold-light); font-size: var(--step-1); }
.site-title { font-size: var(--step-3); font-weight: 900; color: var(--card); letter-spacing: 0.01em; text-shadow: 0 2px 0 var(--cranberry-dk); }
.site-status { margin: var(--space-2) 0 0; min-height: 1.6em; color: var(--card-shade); }

.calendar {
  position: relative;
  width: min(100% - 2rem, 1200px);
  margin: 0 auto var(--space-5);
  aspect-ratio: 16 / 10;
  border: 10px solid var(--card);
  outline: 2px solid var(--gold);
  outline-offset: -16px;
  border-radius: var(--radius);
  box-shadow: 0 20px 50px rgb(0 0 0 / 0.5);
  overflow: hidden;
  isolation: isolate;
}
.calendar__scene { position: absolute; inset: 0; z-index: -1; }
.calendar__scene-img { width: 100%; height: 100%; object-fit: cover; }
.doors { list-style: none; margin: 0; padding: 0; position: absolute; inset: 0; }

.toast {
  position: fixed; left: 50%; bottom: var(--space-4); transform: translate(-50%, calc(100% + 3rem));
  background: var(--card); color: var(--ink); font-family: var(--font-display);
  padding: var(--space-2) var(--space-4); border-radius: 999px; box-shadow: var(--shadow-paper);
  border: 2px solid var(--gold); transition: transform 250ms ease, visibility 0s linear 250ms; visibility: hidden; z-index: 50; max-width: calc(100% - 2rem); text-align: center;
}
.toast.is-visible { transform: translate(-50%, 0); visibility: visible; transition: transform 250ms ease, visibility 0s; }

.site-footer { text-align: center; padding: var(--space-4) var(--space-3) var(--space-5); color: var(--card-shade); font-size: var(--step--1); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- 5 Doors: see css/doors.css (Task 4) ---------- */

/* ---------- 6 Reader: see css/reader.css (Task 6) ---------- */

/* ---------- 7 Accessibility & responsive (Task 7) ---------- */
/* The toast pill (#toast-pill) is visual only and aria-hidden; #toast is the
   always-present, visually hidden live region (see js/toast.js).
   Door and reader a11y rules live at the end of css/doors.css and css/reader.css
   (marked Task 7) because those files load after this one. */
/* left: 50% halves the space a shrink-to-fit pill can use; size it to its text instead. */
.toast { width: max-content; max-width: calc(100vw - 2rem); }
@media (forced-colors: active) {
  .toast { border-color: CanvasText; }
}
