/* =====================================================================
   style.css - Eyeshine Atlas
   Look: a science instrument, not a toy. Dark, calm, exact. The one
   bright color is "eyeshine" gold, like an animal's eyes at night.
   ===================================================================== */

:root {
  --bg: #0d0f12;
  --panel: #151a20;
  --panel-2: #1c232b;
  --line: #2a333d;
  --text: #ece9e2;
  --muted: #9aa3ad;
  --gold: #e8c547;
  --gold-dim: rgba(232, 197, 71, 0.18);
  --measured: #59c3a8;
  --modeled: #e59a4d;
  --bad: #ef6b5b;
  --radius: 14px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --top: 48px;
  --hud: 116px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

/* Top bar and bottom bar take the space they need (safe areas on phones
   included); the desk gets the rest. (Fixed heights clipped the "I can't
   find it" button on some phones - review, 2026-11-18.) */
body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  /* one column exactly as wide as the window: otherwise a picture that
     was once laid out wide could hold the page wide (eagle, 2026-11-19) */
  grid-template-columns: minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

button { font: inherit; cursor: pointer; }

/* ---------- top bar ---------- */
.topbar {
  /* above the card overlay, so "Sources" works while a card is up */
  position: relative;
  z-index: 11;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--top);
  padding: env(safe-area-inset-top) 16px 0;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 650; letter-spacing: 0.02em; white-space: nowrap; }
.brand span { color: var(--gold); }
.round {
  flex: 1;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.link {
  background: none;
  border: 0;
  color: var(--gold);
  padding: 8px 0;
  font-size: 14px;
}

/* ---------- the desk view ---------- */
.stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 8px 16px;
}
.view {
  position: relative;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--line), 0 12px 40px rgba(0, 0, 0, 0.5);
  touch-action: none;           /* our finger is the eye: no scrolling */
  user-select: none;
  -webkit-user-select: none;
}
.view canvas { display: block; width: 100%; height: 100%; }
/* Mantis scene: the gold 3D layer sits on top of the picture. */
.view canvas.overlay { position: absolute; inset: 0; pointer-events: none; }

/* The + the eye is locked on (rounds 1 and 2). */
.cross {
  position: absolute;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  pointer-events: none;
}
.cross::before, .cross::after {
  content: "";
  position: absolute;
  background: #fff;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.55);
}
.cross::before { left: 12px; top: 0; width: 2px; height: 26px; }
.cross::after { top: 12px; left: 0; height: 2px; width: 26px; }

/* The eye's sharp spot when you can move it (round 3). */
.eye {
  position: absolute;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.45), 0 0 18px var(--gold-dim);
  pointer-events: none;
}

/* Round 3: the loupe shows your sharp center at about real size (a phone
   shows the desk ~5x smaller than life). */
.loupe {
  position: absolute;
  width: 116px;
  height: 116px;
  margin: -58px 0 0 -58px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--gold);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  background: var(--bg);
}
.loupe[hidden] { display: none; }
.loupe canvas { width: 100%; height: 100%; display: block; }
.loupe::after {
  /* a tiny dot at the very center: exactly where the eye points */
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
}

.marks { position: absolute; inset: 0; pointer-events: none; }
.mark {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--mono);
  font-size: 12px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(13, 15, 18, 0.82);
  border: 1px solid var(--bad);
  color: var(--text);
  white-space: nowrap;
  animation: fade 1.4s forwards;
}
.mark.found { border-color: var(--gold); }
.ring {
  position: absolute;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  box-shadow: 0 0 22px var(--gold);
  animation: pulse 1.2s ease-out infinite;
}
@keyframes fade { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
@keyframes pulse { from { transform: scale(0.8); opacity: 1; } to { transform: scale(1.4); opacity: 0.2; } }

/* ---------- bottom bar ---------- */
.hud {
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.prompt { margin: 0; font-size: 15px; line-height: 1.35; }
.timer { height: 4px; background: var(--panel-2); border-radius: 2px; overflow: hidden; }
.timer-fill { height: 100%; width: 0; background: var(--gold); }
.hud-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.readout { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: pre-line; }
.ghost {
  background: none;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 14px;
}
.ghost[hidden] { display: none; }

/* ---------- cards ---------- */
.card-wrap {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(8, 10, 12, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 10;
}
.card-wrap[hidden] { display: none; }
.card {
  width: min(460px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 20px 18px;
}
.kicker {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}
.card h1 { margin: 0 0 10px; font-size: 24px; line-height: 1.2; font-weight: 650; }
.card-body { color: var(--text); font-size: 16px; line-height: 1.5; }
.card-body p { margin: 0 0 10px; }
.card-body .muted { color: var(--muted); font-size: 14px; }
.card-body .big {
  font-family: var(--mono);
  font-size: 28px;
  color: var(--gold);
  margin: 4px 0 12px;
}
.card-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.primary {
  background: var(--gold);
  color: #16130a;
  border: 0;
  border-radius: 999px;
  padding: 11px 20px;
  font-weight: 650;
  font-size: 15px;
}
.secondary {
  background: none;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 15px;
}

/* ---------- receipts ---------- */
.receipts {
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.receipts::backdrop { background: rgba(8, 10, 12, 0.75); }
.receipts-head { display: flex; justify-content: space-between; align-items: center; }
.receipts h2 { margin: 0; font-size: 20px; }
.receipts h3 { font-size: 15px; margin: 20px 0 8px; color: var(--gold); }
.receipts-intro { color: var(--muted); font-size: 14px; line-height: 1.5; }
.receipt-list, .limit-list { list-style: none; margin: 0; padding: 0; }
.receipt-list li {
  border-top: 1px solid var(--line);
  padding: 12px 0;
  font-size: 15px;
  line-height: 1.45;
}
.receipt-list .src { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.limit-list li { font-size: 14px; line-height: 1.45; padding: 6px 0 6px 14px; position: relative; color: var(--text); }
.limit-list li::before { content: "–"; position: absolute; left: 0; color: var(--muted); }
.tag {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 6px;
  vertical-align: 1px;
}
.tag.measured { background: rgba(89, 195, 168, 0.15); color: var(--measured); }
.tag.modeled { background: rgba(229, 154, 77, 0.15); color: var(--modeled); }
/* ---------- "Through its eye": the view switch ---------- */
.eye-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.eye-bar[hidden] { display: none; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 13px;
  padding: 9px 13px;
}
.seg button.on { background: var(--gold); color: #16130a; font-weight: 650; }

.photo-list a { color: var(--text); }
.card-hero {
  display: block;
  width: 100%;
  max-height: 210px;
  object-fit: cover;
  object-position: 50% 88%; /* keep the head and wings in the frame */
  border-radius: 10px;
  margin: 2px 0 12px;
}
/* a card button that is waiting (for the photos to load) */
.card-actions button:disabled { opacity: 0.55; cursor: default; }
/* a picture key on a card: two small photos side by side, each with a
   label under it (the bee's round 2: which flower is which) */
.key { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 2px 0 12px; }
.key figure { margin: 0; text-align: center; }
.key img { display: block; width: 96px; max-width: 100%; height: auto; margin: 0 auto 4px; }
.key figcaption { font-size: 13px; line-height: 1.35; color: var(--muted); }
.key figcaption b { color: var(--text); }
/* ---------- the dog scene ---------- */
/* a label for something nobody has measured */
.tag.needs { background: rgba(239, 107, 91, 0.15); color: var(--bad); }
/* a short photo on top of a card */
.card-hero.short { max-height: 112px; object-position: 50% 42%; }
/* three pictures in a key (the three hidden shapes) */
.key.three { grid-template-columns: 1fr 1fr 1fr; }
.key.three img { width: 60px; }
/* bigger pictures in a key (the same patch of lawn, two ways) */
.key.big img { width: 132px; border-radius: 8px; }
/* the list of myths on the reveal cards */
.myths { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 9px; font-size: 15px; line-height: 1.4; }
.myths s { color: var(--muted); text-decoration-color: var(--bad); }
.myths .tag { margin-left: 4px; white-space: nowrap; }
/* the field-of-view chart */
.fieldchart { display: block; width: 100%; max-width: 320px; height: auto; margin: 2px auto 6px; }
/* round 3: the answer buttons */
.answers { display: flex; flex-wrap: wrap; gap: 8px; }
.answers[hidden] { display: none; }
.answers .ghost { flex: 1 1 40%; }
/* the eye view's dials */
.dials { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); }
.dials[hidden] { display: none; }
.dial-check { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--text); }
.dial-check input { accent-color: var(--gold); width: 16px; height: 16px; margin: 0; }
.dial-slide { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.dial-slide input { flex: 1; min-width: 0; accent-color: var(--gold); }
.timer[hidden] { display: none; }
/* a tap that missed the ball */
.mark.miss { animation: miss-fade 0.85s ease-out forwards; }
@keyframes miss-fade { from { opacity: 1; } to { opacity: 0; } }

/* ---------- the horse scene ---------- */
/* one picture in a key (the wolf, as it looks in the field) */
.key.one { grid-template-columns: 1fr; }
.key.one img { width: 190px; border-radius: 8px; }
/* (room kept for the wolf's picture while the photos load, so the card doesn't jump) */
#wolfKey { min-height: 132px; }
/* the view from above, as a small drawing on a card */
.above { display: block; width: 150px; max-width: 100%; height: auto; margin: 0 auto 8px; }
.key.charts .above { width: 108px; margin-bottom: 2px; }
/* round 3's results, one line for each pair */
.tally { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 4px; font-size: 15px; }
.tally b { font-family: var(--mono); font-size: 13px; color: var(--muted); font-weight: 600; }
/* two example colors side by side */
.swatch { display: flex; width: 96px; height: 40px; margin: 0 auto 4px; border-radius: 8px; overflow: hidden; }
.swatch i { flex: 1; }
/* a bottom-bar button that can't be used yet (no animal is out) */
.ghost:disabled { opacity: 0.45; cursor: default; }
/* the eye view's two switches sit side by side */
body.horse .dials { justify-content: flex-start; gap: 22px; }

/* ---------- the eagle scene ---------- */
/* three views side by side (yours, the eagle's, up close) */
body.eagle .key.three img, body.cat .key.three img, body.spider .key.three img { width: 92px; border-radius: 8px; }
body.eagle .answers .ghost, body.cat .answers .ghost, body.spider .answers .ghost { flex: 1 1 28%; }
body.eagle .dials, body.cat .dials, body.spider .dials { flex-wrap: wrap; row-gap: 8px; }
body.eagle .dials .dial-slide, body.cat .dials .dial-slide, body.spider .dials .dial-slide { flex: 1 1 220px; min-width: 0; }
/* the spider's answers: up to four, two to a row */
body.spider .answers .ghost { flex: 1 1 40%; }
/* the mantis shrimp: two answers side by side, dials wrap */
body.shrimp .answers .ghost { flex: 1 1 40%; }
body.shrimp .dials { flex-wrap: wrap; row-gap: 8px; } /* a fixed starting width (not 100%), so it wraps onto its own line without stretching the page */

/* a wide strip of photos: show all of it, don't crop */
.card-hero.wide { max-height: none; object-fit: contain; object-position: 50% 50%; }
.photo-list li { font-size: 13px; color: var(--muted); }
.tag.inferred { background: rgba(140, 170, 230, 0.15); color: #9fb8ec; }

/* ---------- bar charts on the cards (dragonfly times) ---------- */
.bars { display: grid; gap: 6px; margin: 4px 0 14px; }
.bar-row {
  display: grid;
  grid-template-columns: 10.5em 1fr 4.6em;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
}
/* longer labels and values (the bee's distances and visit counts) */
.bars.wide .bar-row { grid-template-columns: 8.6em 1fr 7.4em; }
.bar-label { color: var(--muted); }
.bar { height: 10px; background: var(--panel-2); border-radius: 5px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 5px; }
.bar.df i { background: var(--gold); }
.bar.you i { background: #7fd1c7; }
.bar.ref i { background: var(--muted); }
.bar-val { text-align: right; }

/* ---------- debug panel (?debug=1) ---------- */
.debug {
  position: fixed;
  right: 8px;
  top: 56px;
  z-index: 20;
  background: rgba(21, 26, 32, 0.94);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 12px;
  display: grid;
  gap: 6px;
  width: 220px;
}
.debug label { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.debug input[type="range"] { width: 100px; }

.noscript { padding: 24px; }

/* A phone turned sideways leaves the picture tiny: ask to turn it back.
   Only where the main pointer is a finger (pointer: coarse). A short,
   wide window on a computer can't be "turned upright", so there the
   scene simply plays, smaller. (The dragonfly's script pauses on the
   same rule: keep the two the same.) */
.rotate-note { display: none; }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .rotate-note {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 30;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center;
    background: var(--bg);
    font-size: 18px;
  }
}

/* A short, wide window on a computer. The picture is tall, so give it
   the window's full height: the bottom bar moves to the right of the
   picture. The cards use the width, so they need less scrolling. */
@media (orientation: landscape) and (max-height: 500px) and (pointer: fine) {
  body { grid-template-columns: 1fr minmax(260px, 360px); grid-template-rows: auto 1fr; }
  .topbar { grid-column: 1 / -1; }
  .stage { grid-column: 1; grid-row: 2; }
  .hud {
    grid-column: 2;
    grid-row: 2;
    justify-content: center;
    border-top: none;
    border-left: 1px solid var(--line);
  }
  .card { width: min(760px, 100%); padding: 16px 20px 14px; }
  .card-hero.wide { max-height: 90px; }
  .key img { width: 64px; }
  .key.big img { width: 96px; }
  .card-hero.short { max-height: 70px; }
  .key.one img { width: 150px; }
  .above { width: 108px; }
  .key.charts .above { width: 96px; }
}

@media (min-width: 900px) {
  :root { --hud: 104px; }
  .prompt { font-size: 16px; }
}

/* ---------- the Atlas home page ---------- */
a.brand { color: var(--text); text-decoration: none; }
body.home { display: block; height: auto; min-height: 100dvh; overflow: auto; }
.home-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; height: 52px; padding: 0 16px;
  background: rgba(13, 15, 18, 0.86); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.home-main { max-width: 1080px; margin: 0 auto; padding: 0 16px 48px; }
.home-hero { padding: 40px 0 28px; }
.home-hero .kicker { font-family: var(--mono); color: var(--gold); letter-spacing: 0.12em; text-transform: uppercase; font-size: 13px; margin: 0 0 12px; }
.home-hero h1 { font-size: clamp(30px, 6vw, 52px); line-height: 1.08; margin: 0 0 16px; letter-spacing: -0.01em; }
.home-hero h1 span { color: var(--muted); font-weight: 600; }
.home-lede { color: var(--text); opacity: 0.9; font-size: 17px; line-height: 1.55; max-width: 620px; margin: 0 0 22px; }
.home-start { display: inline-block; background: var(--gold); color: #16130a; font-weight: 700; text-decoration: none;
  padding: 13px 22px; border-radius: 999px; }
.home-start:hover { filter: brightness(1.06); }
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.home-card { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; color: var(--text); text-decoration: none; transition: transform 0.15s ease, border-color 0.15s ease; }
.home-card:hover, .home-card:focus-visible { transform: translateY(-2px); border-color: var(--gold); outline: none; }
.home-pic { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: #000; }
.home-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.home-text { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 18px; }
.home-num { font-family: var(--mono); font-size: 12px; color: var(--gold); letter-spacing: 0.08em; }
.home-num i { color: var(--measured); font-style: normal; }
.home-text b { font-size: 20px; }
.home-twist { color: var(--muted); line-height: 1.45; font-size: 15px; }
.home-how { margin-top: 44px; padding: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.home-how h2 { margin: 0 0 10px; font-size: 22px; }
.home-how p { line-height: 1.55; color: var(--text); opacity: 0.9; }
.home-labels { list-style: none; padding: 0; margin: 12px 0 14px; display: grid; gap: 8px; }
.home-labels li { color: var(--muted); line-height: 1.4; }
.home-labels .tag { margin-right: 8px; }
.home-small { font-size: 13px; color: var(--muted) !important; }
.home-plain { padding: 16px 32px; line-height: 2; }
.home-plain a { color: var(--gold); }
