/* Design crew (Shirley + Tvishaa): this file is yours.
   Colors come from Tvishaa's chamber drawings (art/): brick, wood, moss, maze gold,
   and the green / purple / teal of her three Hall doors. The final Council picked her drawings.
   The button lift on hover is Shirley's animation (see "button:hover"). */
:root {
  --stone: #17110a;     /* darkest brick, behind everything */
  --panel: #21170e;     /* dark wood chamber panel */
  --ink: #0b0806;       /* the black outlines in Tvishaa's drawings */
  --text: #f3e6cf;
  --muted: #bba586;
  --torch: #ffce33;     /* main accent: the gold coins in the Maze drawing */
  --wood: #c8923f;      /* door planks */
  --moss: #74b84f;      /* Maze hedges, lightened to read on dark */
  --warlock: #86c6c1;   /* the teal door behind the warlock */

  /* Tvishaa's three Hall doors */
  --door-green: #4f9a2c;
  --door-purple: #8a55c4;
  --door-teal: #2f9ca2;

  /* Fonts: Microsoft fonts that come with Windows and Office.
     Castellar is carved-stone capitals, used for big titles only. */
  --font-title: "Castellar", "Constantia", Georgia, serif;
  --font-body: "Constantia", "Palatino Linotype", Georgia, serif;
  --font-code: "Cascadia Mono", Consolas, "Courier New", monospace;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1); /* fast start, gentle stop */
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--stone);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.55;
}

/* Tvishaa's drawing for the current screen sits behind the panel.
   game.js sets body data-scene, for example show(html, "maze"). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(rgba(12, 8, 4, 0.5), rgba(12, 8, 4, 0.5)),
    var(--scene, none) center / cover no-repeat,
    var(--stone);
}
body[data-scene="door"]    { --scene: url("art/tvishaa-door.jpg"); }
body[data-scene="warlock"] { --scene: url("art/tvishaa-warlock.jpg"); }
body[data-scene="maze"]    { --scene: url("art/tvishaa-maze.jpg"); }
body[data-scene="lab"]     { --scene: url("art/tvishaa-lab.jpg"); }
body[data-scene="hall"]    { --scene: url("art/tvishaa-hall.jpg"); }

/* Title card: Tvishaa's full drawing, shown when you enter a new chamber.
   It fades in and waits for a click, then crossfades into the chamber. Opacity and a small slide only. */
.scene-card {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center; /* centered, but never cut off at the top */
  padding: 16px;
  box-sizing: border-box;
  overflow-y: auto;             /* last resort on very small screens */
  background: #0d0905;
  cursor: pointer;
  opacity: 0;
  transition: opacity 600ms var(--ease-out);
}
.scene-card[hidden] { display: none; }
.scene-card.on { opacity: 1; transition-duration: 450ms; }
.scene-card figure { margin: 0; text-align: center; }
.scene-card img {
  display: block;
  margin: 0 auto;
  width: auto;
  height: auto;
  max-width: min(100%, 1180px);
  /* the drawing gets whatever height is left after the title, button and credit */
  max-height: max(160px, calc(100vh - 240px));
  max-height: max(160px, calc(100dvh - 240px));
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
}
.scene-card figcaption { margin-top: min(16px, 2vh); }
.scene-label { display: block; color: var(--muted); font-size: 17px; font-style: italic; }
.scene-title {
  display: block;
  font-family: var(--font-title);
  font-size: clamp(24px, min(4vw, 5.5vh), 40px);
  line-height: 1.15;
  color: var(--torch);
}
/* while a title card is up, the page behind it doesn't scroll */
body.revealing { overflow: hidden; }
.scene-enter { margin: 14px 0 0; padding: 8px 28px; }
.scene-skip { margin: 10px 0 0; font-size: 14px; color: var(--muted); }

/* The chamber waits behind the card, then slides up a little as it fades in */
main, footer {
  transition: opacity 500ms var(--ease-out) 120ms, transform 500ms var(--ease-out) 120ms;
}
body.revealing main,
body.revealing footer { opacity: 0; transform: translateY(10px); transition: none; }

main {
  max-width: 900px;
  margin: 40px auto 16px;
  padding: 28px 32px;
  background: var(--panel);
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 6px 0 var(--ink);
}

h1 {
  font-family: var(--font-title);
  font-weight: normal;
  font-size: 40px;
  line-height: 1.1;
  color: var(--torch);
  margin: 0 0 4px;
}
h2 { font-size: 23px; line-height: 1.3; }
.subtitle { margin: 0 0 20px; color: var(--wood); font-size: 20px; font-style: italic; }
.progress { color: var(--muted); font-size: 15px; margin: 0; }
.concept { color: var(--moss); font-weight: bold; margin-top: 2px; }
.story { font-style: italic; color: #e3d2b4; }
.warlock { color: var(--warlock); font-weight: bold; }
.spell { color: var(--torch); font-weight: bold; letter-spacing: 2px; }

pre {
  background: var(--ink);
  padding: 14px;
  border: 1px solid #3a2a18;
  border-radius: 12px;
  overflow-x: auto;
  text-align: left;
  font-size: 15px;
}
code { font-family: var(--font-code); color: #f6ead2; }

button {
  padding: 10px 16px;
  margin: 4px 4px 4px 0;
  border: 2px solid var(--ink);
  border-radius: 16px;
  background: var(--torch);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: bold;
  font-size: 17px;
  cursor: pointer;
  /* Shirley's animation: buttons lift a little when you point at them */
  transition: transform 0.2s, box-shadow 0.2s;
}
button:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.45);
}
button:active { transform: translateY(0); }
button:focus-visible { outline: 3px solid var(--torch); outline-offset: 2px; }
button.secondary { background: transparent; color: var(--torch); border: 2px solid var(--torch); }

.choices { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.choice { background: #2b1f13; color: var(--text); border: 2px solid var(--torch); border-radius: 12px; }
.choice:nth-child(1) { border-color: var(--torch); }
.choice:nth-child(2) { border-color: var(--moss); }
.choice:nth-child(3) { border-color: var(--door-teal); }
.choice:nth-child(4) { border-color: var(--door-purple); }
.choice:nth-child(5) { border-color: var(--wood); }
.choice small { display: block; font-weight: normal; color: var(--muted); }

/* Hall of Illusions: each door matches one of Tvishaa's three arched doors */
.doors { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.door {
  color: var(--text);
  text-align: left;
  border: 3px solid var(--ink);
  border-radius: 48px 48px 12px 12px;
  padding: 22px 12px 12px;
}
.door b { display: block; text-align: center; }
.door:nth-child(1) { background: #22401a; border-color: var(--door-green); }
.door:nth-child(2) { background: #2e1a45; border-color: var(--door-purple); }
.door:nth-child(3) { background: #133d40; border-color: var(--door-teal); }
.door pre { font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }

textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  font: inherit;
  color: var(--text);
  background: var(--ink);
  border: 2px solid #3a2a18;
  border-radius: 8px;
}
textarea:focus { outline: 2px solid var(--torch); }

/* Sanjana's maze counter and key flashcards */
.maze-board {
  width: fit-content;
  padding: 8px 12px;
  margin: 12px 0;
  border: 2px solid var(--torch);
  border-radius: 8px;
  color: var(--torch);
  background: var(--ink);
  font-weight: bold;
  letter-spacing: 1px;
}

.flashcard {
  max-width: 620px;
  margin: 16px 0;
  padding: 18px;
  border: 2px solid var(--torch);
  border-radius: 10px;
  background: var(--ink);
  box-shadow: 0 4px 0 var(--torch);
}

.flashcard-label {
  margin-top: 0;
  color: var(--torch);
  font-weight: bold;
  letter-spacing: 1px;
}

/* Leslie's weak-spot scroll on the escape screen */
.weak-spot {
  padding: 12px 16px;
  background: #ead9b5;
  color: #2a1d0f;
  border: 2px solid var(--ink);
  border-radius: 6px;
}

footer { max-width: 760px; margin: 0 auto 32px; padding: 0 16px; text-align: center; font-size: 14px; color: #e3d2b4; }
footer span { display: inline-block; background: rgba(11, 8, 6, 0.75); padding: 4px 10px; border-radius: 8px; }

/* ---------- Tvishaa's drawings inside each chamber (scenes.js) ---------- */
.stage {
  position: relative;
  container-type: inline-size; /* things on the drawing size with it (cqw units) */
  width: min(100%, calc(var(--fit, 52vh) * var(--ar)));
  margin: 12px auto 18px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 5px 0 var(--ink);
  background: var(--ink);
}
.stage > img { display: block; width: 100%; height: auto; }
.stage-hall { width: 100%; }
.stage-maze { --fit: 40vh; }
.stage-lab { --fit: 34vh; }

/* Her question box / storyline frame, with her door-knob spiral on each side */
.scroll-box {
  position: relative;
  margin: 18px 18px 14px;
  padding: 14px 24px;
  border: 2px solid rgba(255, 206, 51, 0.45);
  border-radius: 14px;
  background: rgba(11, 8, 6, 0.35);
}
.scroll-box::before,
.scroll-box::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 30px;
  height: 30px;
  margin-top: -15px;
  border-radius: 50%;
  background: var(--panel) url("art/spiral.png") center / 24px auto no-repeat;
}
.scroll-box::before { left: -16px; }
.scroll-box::after { right: -16px; transform: scaleX(-1); }
.scroll-box h2 { margin: 6px 0; }
.scroll-box .warlock { margin: 4px 0 0; }
.scroll-box pre { margin: 8px 0 10px; }

/* Her hand-drawn arrow on the maze buttons */
.arrow { height: 1.2em; width: auto; vertical-align: -0.25em; margin-right: 4px; }

/* Maze: Sanjana's counter hangs on the wooden frame, the knight walks her path */
.stage .maze-board { position: absolute; top: 2.5%; left: 2%; margin: 0; font-size: 15px; }
.maze-warning { margin: -6px 0 10px; text-align: center; font-size: 16px; font-style: italic; color: var(--warlock); }
.maze-warning b { font-style: normal; }
.maze-layer { position: absolute; inset: 0; width: 100%; height: 100%; }
#trail {
  fill: none;
  stroke: var(--knight);
  stroke-width: 0.7;
  stroke-dasharray: 1.4 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#knight circle { fill: var(--knight); stroke: var(--ink); stroke-width: 0.55; }

/* Lab: bubbles rise from her cauldron. Green when right, murky when wrong. */
.brew { position: absolute; width: 22%; height: 8%; transform: translate(-50%, -50%); pointer-events: none; }
.brew-tint { position: absolute; inset: -30% -6%; border-radius: 50%; opacity: 0; }
.brew.good .brew-tint {
  background: radial-gradient(closest-side, rgba(170, 255, 120, 0.75), rgba(170, 255, 120, 0));
  mix-blend-mode: screen;
  animation: tint 1.3s var(--ease-out);
}
.brew.bad .brew-tint {
  background: radial-gradient(closest-side, rgba(74, 40, 92, 0.95), rgba(74, 40, 92, 0));
  mix-blend-mode: multiply;
  animation: tint 1.6s var(--ease-out);
}
@keyframes tint { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } }
.bubble {
  position: absolute;
  bottom: 45%;
  width: var(--size);
  aspect-ratio: 1;
  border: 0.22cqw solid var(--ink);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #e2ffcc 0 18%, #7be04a 24%);
  opacity: 0;
  animation: rise 1.2s var(--ease-out) forwards;
}
.brew.bad .bubble { background: radial-gradient(circle at 35% 35%, #b9a6c6 0 18%, #5b4468 24%); }
@keyframes rise {
  0% { opacity: 0; transform: translateY(0) scale(0.6); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-11cqw) scale(1); }
}
.brew-word {
  position: absolute;
  left: 50%;
  bottom: 60%;
  font-family: var(--font-title);
  font-size: 4.4cqw;
  color: var(--torch);
  white-space: nowrap;
  -webkit-text-stroke: 0.45cqw var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 0.4cqw 0 var(--ink);
  opacity: 0;
  animation: word-rise 1.3s var(--ease-out) 150ms forwards;
}
@keyframes word-rise {
  0% { opacity: 0; transform: translate(-50%, 2cqw); }
  30% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -4cqw); }
}

/* Hall: the code sits on her doors, like her sketch */
.hall { container: hall / inline-size; }
.hall-door {
  position: absolute;
  top: 44%;
  width: 16.5%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  cursor: pointer;
}
.hall-door:hover { box-shadow: none; transform: none; }
.door-display {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.4cqw;
  box-sizing: border-box;
  padding: 0.8cqw 0.9cqw 1cqw;
  background: rgba(11, 8, 6, 0.88);
  border: 0.3cqw solid var(--door-color);
  border-radius: 0.9cqw;
  color: var(--text);
  text-align: left;
  font-weight: normal;
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.5s var(--ease-out);
}
.door-display b { text-align: center; font-size: 1.6cqw; }
.door-display pre {
  margin: 0;
  padding: 0.4cqw 0.2cqw;
  border: 0;
  background: none;
  font-size: 1.36cqw;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.door-1 { --door-color: var(--door-green); }
.door-2 { --door-color: var(--door-purple); }
.door-3 { --door-color: var(--door-teal); }
/* Shirley's lift, on the doors too */
.hall-door:not(:disabled):hover .door-display { transform: translateY(-2px); box-shadow: 0 5px 12px rgba(0, 0, 0, 0.45); }
.hall-door:focus-visible { outline: none; }
.hall-door:focus-visible .door-display { outline: 3px solid var(--torch); outline-offset: 2px; }
/* A wrong door: the illusion fades into the wall */
.door-shade {
  position: absolute;
  top: 17%;
  height: 62%;
  border-radius: 50% 50% 2% 2% / 42% 42% 2% 2%;
  pointer-events: none;
  background: rgba(13, 9, 5, 0.78);
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
}
.door-shade.illusion { opacity: 1; }
.hall-door.illusion .door-display { opacity: 0.25; }
.hall-door.real .door-display { box-shadow: 0 0 0 0.4cqw var(--torch); }
.hall-door:disabled { cursor: default; }
.door.illusion { opacity: 0.35; }
.door.real { box-shadow: 0 0 0 3px var(--torch); }
@container hall (min-width: 760px) { .doors { display: none; } }
@container hall (max-width: 759px) {
  .door-display pre { display: none; }
  .door-display { justify-content: center; }
  .door-display b { font-size: 3.4cqw; }
}

/* Final Door: three keyholes on the floor in front of the warlock */
.stage-final { --fit: 44vh; }
.keyholes {
  position: absolute;
  left: 50%;
  bottom: 3%;
  display: flex;
  gap: 2cqw;
  transform: translateX(-50%);
}
.keyhole {
  position: relative;
  width: 4.6cqw;
  aspect-ratio: 1;
  border: 0.35cqw solid var(--ink);
  border-radius: 50%;
  background: #4a3a26;
}
.keyhole::before,
.keyhole::after { content: ""; position: absolute; left: 50%; background: var(--ink); transform: translateX(-50%); }
.keyhole::before { top: 20%; width: 32%; aspect-ratio: 1; border-radius: 50%; }
.keyhole::after { top: 40%; width: 26%; height: 38%; clip-path: polygon(30% 0, 70% 0, 100% 100%, 0 100%); }
.keyhole.filled { background: var(--torch); }
.keyhole.new { animation: key-in 0.45s var(--ease-out); }
@keyframes key-in { from { opacity: 0.2; transform: scale(0.7); } to { opacity: 1; transform: scale(1); } }

/* ---------- The black fade between the game and About (about.js) ---------- */
/* Solid black with a soft lower edge, so it reads as a smooth fade from top to bottom */
.curtain {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 135vh;
  z-index: 20;
  pointer-events: none;
  background: linear-gradient(to bottom, #000 0, #000 74%, rgba(0, 0, 0, 0) 100%);
  transform: translateY(-100%);
  visibility: hidden;
}
.curtain.down {
  visibility: visible;
  transform: translateY(0);
  transition: transform 700ms cubic-bezier(0.65, 0, 0.35, 1);
}
.curtain.lift { opacity: 0; transition: opacity 450ms var(--ease-out); }

/* Link between the game and About, above the panel */
.site-nav { max-width: 900px; margin: 16px auto -24px; padding: 0 16px; text-align: right; }
.link-button {
  margin: 0;
  padding: 6px 12px;
  border: 1px solid rgba(255, 206, 51, 0.5);
  border-radius: 10px;
  background: rgba(11, 8, 6, 0.75);
  color: var(--torch);
  font-size: 15px;
}
body.revealing .site-nav { visibility: hidden; }

/* ---------- About the creators ---------- */
body.viewing-about { --scene: url("art/tvishaa-door.jpg"); }
.about {
  max-width: 900px;
  margin: 40px auto 16px;
  padding: 32px;
  box-sizing: border-box;
  background: var(--panel);
  border: 3px solid var(--ink);
  border-radius: 20px;
  box-shadow: 0 6px 0 var(--ink);
}
.about[hidden], main[hidden] { display: none; }
.about-head h1 { margin-bottom: 4px; }
.about-lead { font-size: 21px; line-height: 1.5; color: #f6ead2; max-width: 62ch; }
.about h2 { font-family: var(--font-title); font-weight: normal; color: var(--torch); font-size: 26px; margin: 32px 0 8px; }
.about > p { max-width: 68ch; }
.about-note { color: var(--muted); font-size: 15px; font-style: italic; margin-top: 0; }

.people { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin: 12px 0 22px; }
.people > .person:last-child:nth-child(odd) { grid-column: 1 / -1; justify-self: center; width: calc(50% - 9px); box-sizing: border-box; }
.person {
  padding: 0 18px 18px;
  background: #2a1e12;
  border: 3px solid var(--ink);
  border-radius: 16px;
  overflow: hidden;
}
.person figure { margin: 0 -18px 14px; }
.person figure img {
  display: block;
  width: 100%;
  height: 130px;
  object-fit: cover;
  border-bottom: 3px solid var(--ink);
}
.person figcaption { padding: 6px 18px 0; font-size: 13px; color: var(--muted); font-style: italic; }
.person h3 { margin: 0; font-size: 25px; color: var(--text); }
.person .role { margin: 2px 0 10px; color: var(--muted); font-size: 15px; }
.person .role b { color: var(--torch); }
.person blockquote {
  margin: 0 0 12px;
  padding: 0 0 0 12px;
  border-left: 1px solid rgba(255, 206, 51, 0.5);
  color: #f6ead2;
  font-style: italic;
}
.started { margin: 0 0 10px; padding: 10px 14px; background: rgba(11, 8, 6, 0.5); border-radius: 10px; }
.started dt { margin-bottom: 6px; color: var(--torch); font-weight: bold; }
.started dd { margin: 0 0 4px; font-size: 15px; line-height: 1.45; color: #ecdcbf; }
.started dd span { color: var(--muted); }
.built { margin: 0; font-size: 15px; line-height: 1.5; }
.started.joined { font-size: 16px; font-style: italic; color: #ecdcbf; }
.person .highlight { margin: 0 0 10px; font-size: 17px; line-height: 1.45; color: #f6ead2; }
.person blockquote.proud { margin: 12px 0 0; }

/* The story: six short steps in a grid (one column on phones) */
.timeline {
  list-style: none;
  margin: 8px 0 14px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  counter-reset: step;
}
.timeline li {
  position: relative;
  padding: 12px 14px 12px 44px;
  background: #2a1e12;
  border: 2px solid var(--ink);
  border-radius: 12px;
  font-size: 15px;
  line-height: 1.45;
  counter-increment: step;
}
.timeline li::before {
  content: counter(step);
  position: absolute;
  left: 12px;
  top: 12px;
  width: 22px;
  height: 22px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--torch);
  color: var(--ink);
  font-size: 13px;
  font-weight: bold;
  line-height: 22px;
  text-align: center;
}
.timeline b { display: block; margin-bottom: 2px; color: var(--torch); }
.growth { padding: 14px 18px; background: rgba(11, 8, 6, 0.5); border-radius: 12px; }
.growth b { color: var(--torch); }

/* From sketch to game: her sketches and Figma roadmap side by side */
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.gallery figure { margin: 0; padding: 10px; background: #2a1e12; border: 3px solid var(--ink); border-radius: 14px; }
.gallery img { display: block; width: 100%; height: 190px; object-fit: cover; object-position: 0% 50%; border-radius: 8px; }
.gallery figcaption { margin-top: 8px; font-size: 15px; }
.gallery-note { margin: 6px 0 0; color: var(--muted); font-size: 15px; font-style: italic; }

.thanks { margin: 26px 0 8px; font-size: 22px; font-style: italic; color: #f6ead2; }
.thanks span { display: block; margin-top: 2px; font-size: 16px; font-style: normal; color: var(--muted); }

.gwc { display: flex; align-items: center; gap: 16px; margin: 26px 0 24px; padding-top: 22px; border-top: 1px solid rgba(255, 206, 51, 0.25); }
.gwc img { width: 88px; height: 88px; border-radius: 50%; border: 3px solid var(--ink); flex: none; }
.gwc p { margin: 0; }
.gwc p span { display: block; font-size: 13px; color: var(--muted); font-style: italic; }
.about-play { font-size: 19px; padding: 12px 24px; }

@media (max-width: 700px) {
  .doors { grid-template-columns: 1fr; }
  main { margin: 16px; padding: 20px; }
  h1 { font-size: 30px; }
  .scroll-box { margin: 16px 10px 12px; padding: 12px 16px; }
  pre { font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
  .about { margin: 16px; padding: 20px; }
  .people, .timeline, .gallery { grid-template-columns: 1fr; }
  .people > .person:last-child:nth-child(odd) { grid-column: auto; width: auto; }
  .site-nav { margin: 12px auto -4px; }
}

@media (prefers-reduced-motion: reduce) {
  button, main, footer, .scene-card, .scene-card.on, .door-display, .door-shade { transition: none; }
  button:hover, body.revealing main, body.revealing footer, .hall-door:hover .door-display { transform: none; }
  .brew-tint, .keyhole.new { animation: none; }
  .curtain, .curtain.down, .curtain.lift { transition: none; }
  .brew.bad .brew-tint { opacity: 0.8; }
}
