/* ============================================================================
   MariReeves Theatre — "Tree of Stories" design system
   One system, five moods. Master palette + typography here; rooms override
   a small set of accent tokens (see [data-room] blocks near the bottom).
   Static site (no build) — Cloudflare Pages serves these files directly.
   ========================================================================== */

/* ---- Fonts (Google Fonts; 16px body floor) ---- */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,500;0,600;0,700;1,500&family=Crimson+Text:ital,wght@0,400;0,600;1,400&family=Source+Sans+3:wght@300;400;500;600&display=swap');

/* ---- Master palette (AA-checked in the combinations used) ---- */
:root {
  --midnight:      #17233f;  /* Midnight Blue — primary text / ink */
  --slate:         #3f5375;  /* Slate Blue */
  --sage:          #5f7a5a;  /* Sage Green (text-safe on ivory) */
  --moss:          #b9c8ab;  /* Soft Moss (light accent) */
  --gold:          #a4762b;  /* Antique Gold — AA as text on ivory */
  --gold-bright:   #c8a23f;  /* decorative gold (hover glow) */
  --ivory:         #f8f4ea;  /* Ivory — page ground */
  --linen:         #efe6d4;  /* Warm Linen — alt bands */
  --wood:          #6a5844;  /* Weathered Wood Brown */

  /* semantic (rooms override --accent / --accent-ink / --room-ground / --room-band) */
  --accent:        var(--slate);
  --accent-ink:    var(--midnight);
  --room-ground:   var(--ivory);
  --room-band:     var(--linen);
  --room-motif:    none;

  --text:          #1c2740;
  --text-soft:     #45526e;
  --line:          rgba(23,35,63,.14);
  --maxw:          1080px;
  --gold-decor:    #c8a23f;
}

/* ---- Reset / base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Source Sans 3', system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--room-ground);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .display { font-family: 'Cormorant Garamond', Georgia, serif; line-height: 1.1; color: var(--accent-ink); font-weight: 600; margin: 0 0 .4em; }
h1 { font-size: clamp(2.4rem, 6vw, 4rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h3 { font-size: clamp(1.3rem, 2.6vw, 1.7rem); }
p { margin: 0 0 1rem; max-width: 62ch; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--gold); }
img { max-width: 100%; display: block; }
.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(1.2rem, 4vw, 2.5rem); }

/* quotations / pull-quotes use Crimson Text */
.quote, blockquote { font-family: 'Crimson Text', Georgia, serif; font-size: clamp(1.15rem, 2.4vw, 1.5rem); font-style: italic; color: var(--slate); line-height: 1.5; max-width: 42ch; }
.eyebrow { font-size: .8rem; letter-spacing: .2em; text-transform: uppercase; font-weight: 600; color: var(--gold); margin: 0 0 .6rem; }

/* ---- Accessibility ---- */
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--midnight); color: var(--ivory); padding: .6rem 1rem; z-index: 100; }
.skip:focus { left: .5rem; top: .5rem; }
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---- Header + nav (responsive collapse) ---- */
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--room-ground) 90%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: .7rem; padding-bottom: .7rem; }
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--accent-ink); }
.brand svg { width: 26px; height: 30px; flex: none; }
.brand b { font-family: 'Cormorant Garamond', serif; font-weight: 700; font-size: 1.28rem; letter-spacing: .01em; }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 6px; padding: .4rem .6rem; color: var(--accent-ink); font-size: 1.1rem; cursor: pointer; }
.site-nav ul { display: flex; gap: clamp(.6rem, 2vw, 1.6rem); list-style: none; margin: 0; padding: 0; }
.site-nav a { color: var(--text-soft); text-decoration: none; font-size: .95rem; font-weight: 500; padding: .3rem .1rem; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--accent-ink); border-bottom: 2px solid var(--gold); }

@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .site-nav { position: absolute; top: 100%; left: 0; right: 0; background: var(--room-ground); border-bottom: 1px solid var(--line); max-height: 0; overflow: hidden; transition: max-height .3s ease; }
  .site-nav.open { max-height: 60vh; }
  .site-nav ul { flex-direction: column; gap: 0; padding: .5rem clamp(1.2rem,4vw,2.5rem) 1rem; }
  .site-nav a { display: block; padding: .7rem 0; border-bottom: 1px solid var(--line); }
}

/* ---- Sections / bands / prose ---- */
main { min-height: 55vh; }
.section { padding: clamp(2.6rem, 6vw, 5rem) 0; }
.band { background: var(--room-band); }
.lede { font-size: clamp(1.1rem, 2.2vw, 1.3rem); color: var(--text-soft); max-width: 56ch; }
.center { text-align: center; margin-left: auto; margin-right: auto; }

/* ---- Cards (works / list items) ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.1rem; margin-top: 2rem; }
.card { display: block; background: color-mix(in srgb, var(--ivory) 60%, #fff); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: 1.4rem 1.5rem; text-decoration: none; color: var(--text); transition: transform .18s ease, box-shadow .2s ease; }
.card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px -20px rgba(23,35,63,.55); }
.card h3 { margin-bottom: .3rem; }
.card p { margin: 0; font-size: .98rem; color: var(--text-soft); }

/* ---- Image slots (labeled in dev, graceful empty in prod) ---- */
.image-slot { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; background:
  linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, var(--room-band)), var(--room-band));
  border: 1px dashed color-mix(in srgb, var(--accent) 40%, transparent); display: grid; place-items: center; overflow: hidden; }
.image-slot[data-orient="portrait"] { aspect-ratio: 3 / 4; }
.image-slot .slot-note { font-family: 'Source Sans 3', sans-serif; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: color-mix(in srgb, var(--accent-ink) 55%, transparent); }
/* dev label (visible only when the page carries ?dev or html[data-dev]) */
.image-slot::after { content: attr(data-slot); position: absolute; top: 8px; left: 8px; font: 600 10px/1 'Source Sans 3', monospace; letter-spacing: .1em; color: var(--ivory); background: var(--midnight); padding: 3px 6px; border-radius: 4px; opacity: 0; }
html[data-dev] .image-slot::after { opacity: .85; }

/* ---- Room header (each room: shared frame + own accent + bg treatment + header slot) ---- */
.room-header { padding: clamp(2.4rem,6vw,4.5rem) 0 clamp(1.4rem,3vw,2.2rem); background: var(--room-motif), linear-gradient(180deg, var(--room-band), var(--room-ground)); }
.room-header .eyebrow { color: var(--accent); }
.back-link { display: inline-block; margin-bottom: 1rem; font-size: .9rem; color: var(--text-soft); text-decoration: none; }
.back-link:hover { color: var(--accent-ink); }

/* ---- Footer ---- */
.site-footer { background: var(--midnight); color: #cdd6e6; padding: 2.4rem 0; margin-top: 2rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: space-between; }
.site-footer a { color: #cdd6e6; text-decoration: none; font-size: .9rem; }
.site-footer a:hover { color: var(--gold-decor); }
.site-footer nav ul { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; list-style: none; margin: 0; padding: 0; }
.site-footer .tag { font-family: 'Cormorant Garamond', serif; font-size: 1.05rem; color: var(--gold-decor); }
.draft { }  /* drafts carry data-draft; no visible production styling */
html[data-dev] [data-draft]{ outline: 1px dashed color-mix(in srgb, var(--gold) 60%, transparent); outline-offset: 3px; }

/* ---- Home hero + tree artwork ---- */
/* Warm paper-toned band that echoes the artwork's cream ground, fading down into the page. */
.hero { text-align: center; padding: clamp(2rem,5vw,4rem) 0 clamp(2.6rem,6vw,4.5rem); background: linear-gradient(180deg, #e9dcc2 0%, #efe6d4 55%, var(--ivory) 100%); }
.hero .tree-wrap { max-width: 640px; margin: 0 auto 2rem; }
.hero h1 { margin-bottom: .3rem; }
.hero .welcome { margin: 1.4rem auto 0; }
/* The hero image. A soft feathered mask dissolves the paper's edges into the band (no hard rectangle);
   the artwork's own vignette does the rest. Subtle whole-image warming on hover/focus. */
#tree { display: block; outline-offset: 6px; }
.hero-img {
  width: 100%; height: auto; display: block;
  -webkit-mask-image: radial-gradient(ellipse 92% 88% at 50% 47%, #000 62%, transparent 100%);
          mask-image: radial-gradient(ellipse 92% 88% at 50% 47%, #000 62%, transparent 100%);
  transition: filter 520ms ease;
}
#tree:hover .hero-img, #tree:focus-within .hero-img { filter: saturate(1.12) brightness(1.05) sepia(.12) hue-rotate(-8deg); }
@media (prefers-reduced-motion: reduce) {
  .hero-img { transition: none; }
  #tree:hover .hero-img, #tree:focus-within .hero-img { filter: none; }
}

/* ---- Room accent overrides — one system, five moods ---- */
[data-room="shakespeare"]  { --accent:#2f5d3a; --accent-ink:#22432b; --room-ground:#f6f4ea; --room-band:#e9efdf; --gold:#9a7524; }
[data-room="fairytales"]   { --accent:#43689c; --accent-ink:#2c4670; --room-ground:#f4f7fb; --room-band:#e7eef7; }
[data-room="sappho"]       { --accent:#2f3f6e; --accent-ink:#26335c; --room-ground:#faf9f5; --room-band:#eee9de; --gold:#a67f2d; }
[data-room="rabia"]        { --accent:#3a4a6b; --accent-ink:#2c3956; --room-ground:#f4f5f2; --room-band:#e8e6db; }
[data-room="helenkeller"]  { --accent:#5578a0; --accent-ink:#3a5675; --room-ground:#f7f9fb; --room-band:#eef2f2; }
