/* ============================================================================
   toys2.css — the TWO advent toys shipped in the Fable window (Days 4 & 5):
     westhaven/voicemail.html   (.vm-* — Grant's answering machine)
     spyglass/index.html        (.sg-* — the spy glass)

   Both pages link, in order:
     theme.css   (tokens + shared components)                 — read-only
     toys.css    (shared toy primitives: .sharecard/.gate/.seg/.hidden) — read-only
     toys2.css   (this file: only the two new toys)
   The voicemail page ALSO links westhaven.css for the Rench chrome; the spyglass
   page carries a trimmed author-layer chrome inline. Everything below is scoped
   to the .vm- / .sg- namespaces so it never collides with either shared sheet.
   ========================================================================== */

/* Patrick Hand — a kid/pen hand, self-hosted, used ONLY on the canvas message
   slip (the pink While-You-Were-Out keepsake). Not applied to page chrome. */
@font-face {
  font-family: "Patrick Hand";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/patrick-hand-latin.woff2") format("woff2");
}

/* ==========================================================================
   TOY 1 — THE ANSWERING MACHINE  (.vm-*)
   ========================================================================== */

.vm-wrap { max-width: 44rem; margin-inline: auto; }

/* --- the device: a graphite skeuomorph answering machine on the navy page --- */
.vm-machine {
  position: relative;
  border-radius: 18px;
  padding: clamp(1rem, 3vw, 1.6rem);
  background:
    linear-gradient(180deg, #232c3a 0%, #1a2230 46%, #141b27 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    inset 0 -2px 6px rgba(0,0,0,0.55),
    0 22px 50px -22px rgba(0,0,0,0.85),
    0 2px 0 #0c121c;
  border: 1px solid #0c121c;
}
.vm-machine::after {
  /* a faint moulded grain on the plastic */
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background-image: var(--grain); background-size: 150px 150px;
  opacity: 0.05; mix-blend-mode: overlay; pointer-events: none;
}

/* status strip: speaker grille · cassette window · LED + counter */
.vm-face { display: grid; grid-template-columns: 1.1fr 1.3fr 0.9fr; gap: clamp(0.6rem, 2vw, 1rem); align-items: stretch; }
@media (max-width: 560px) { .vm-face { grid-template-columns: 1fr 1fr; } .vm-face .vm-grille { display: none; } }

.vm-grille {
  border-radius: 8px; min-height: 92px;
  background:
    repeating-linear-gradient(180deg, #0d131d 0 3px, #1b2430 3px 6px);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.7), inset 0 0 0 1px #0a0f18;
}

.vm-cassette {
  position: relative; border-radius: 8px; min-height: 92px;
  background: radial-gradient(120% 140% at 50% 0%, #10161f, #05090f 80%);
  box-shadow: inset 0 3px 10px rgba(0,0,0,0.8), inset 0 0 0 1px #0a0f18;
  display: flex; align-items: center; justify-content: space-around;
  padding: 0 12%;
  overflow: hidden;
}
.vm-cassette::before {
  /* the tape span between the two reels */
  content: ""; position: absolute; left: 26%; right: 26%; top: 50%;
  height: 2px; transform: translateY(-50%);
  background: linear-gradient(90deg, transparent, #3a2f1c 12%, #4a3c24 50%, #3a2f1c 88%, transparent);
  opacity: 0.8;
}
.vm-reel {
  width: clamp(30px, 9vw, 40px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #2a333f 0 22%, #171f2a 23% 60%, #0d141d 61%);
  box-shadow: inset 0 0 0 3px #232c38, inset 0 0 8px rgba(0,0,0,0.7);
  position: relative;
}
.vm-reel::before, .vm-reel::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 3px; height: 46%; background: #37414f; border-radius: 2px;
}
.vm-reel::after { transform: rotate(60deg); }
.vm-reel i { position: absolute; inset: 0; margin: auto; width: 3px; height: 46%; background: #37414f; border-radius: 2px; transform: rotate(120deg); display: block; }
.vm-machine.is-playing .vm-reel { animation: vm-spin 1.5s linear infinite; }
@keyframes vm-spin { to { transform: rotate(360deg); } }

.vm-status {
  display: flex; flex-direction: column; gap: 0.5rem; justify-content: center;
  padding: 0.5rem 0.6rem; border-radius: 8px;
  background: #0b1019; box-shadow: inset 0 2px 8px rgba(0,0,0,0.7), inset 0 0 0 1px #0a0f18;
}
.vm-led-row { display: flex; align-items: center; gap: 0.5rem; }
.vm-led {
  width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff6a5a, #b81f19 60%, #5c0f0c);
  box-shadow: 0 0 6px 1px rgba(200,40,32,0.7); flex: 0 0 auto;
}
.vm-machine.is-playing .vm-led { animation: vm-blink 0.9s steps(1) infinite; }
@keyframes vm-blink { 50% { opacity: 0.28; box-shadow: none; } }
.vm-led-label {
  font-family: var(--font-display); text-transform: uppercase;
  letter-spacing: var(--tracking-mid); font-size: var(--fs-100); color: var(--ink-faint);
}
.vm-counter {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 1.7rem; line-height: 1; color: #ffb44a;
  text-shadow: 0 0 8px rgba(226,161,61,0.55); letter-spacing: 0.06em;
}
.vm-counter small { font-size: 0.5em; color: var(--ink-faint); text-shadow: none; letter-spacing: var(--tracking-mid); }

/* the power light (Grant's green box, always listening) */
.vm-power { display: inline-flex; align-items: center; gap: 0.4em; }

/* --- the message form (the "record" slip) --- */
.vm-form { margin-top: clamp(1rem, 3vw, 1.4rem); display: grid; gap: var(--space-4); }
.vm-form .vm-row2 { display: grid; gap: var(--space-4); grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .vm-form .vm-row2 { grid-template-columns: 1fr; } }
/* .input carries `flex: 1 1 14rem` for the horizontal .field rows; inside these
   stacked column formrows that 14rem basis would balloon the height, so reset. */
.vm-form .toy-formrow > .input,
.vm-form .toy-formrow > .toy-select { flex: 0 0 auto; }
.vm-form textarea.input { min-height: 5.5rem; resize: vertical; width: 100%; }
.vm-form .input { width: 100%; }
.vm-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }

/* the record button: chunky, round-cornered, tactile */
.vm-rec {
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: var(--tracking-wide);
  font-size: var(--fs-300); color: var(--cream);
  padding: 0.85em 1.4em; border-radius: 10px;
  background: linear-gradient(180deg, #2b3444 0%, #202836 100%);
  border: 1px solid #0c121c;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 3px 0 #0c121c, 0 6px 14px -6px rgba(0,0,0,0.7);
  display: inline-flex; align-items: center; gap: 0.6em;
  transition: transform var(--dur-1) var(--ease-cold), box-shadow var(--dur-1);
}
.vm-rec:hover { color: var(--gold); }
.vm-rec:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 1px 0 #0c121c; }
.vm-rec .dot { width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff6a5a, #b81f19 60%); box-shadow: 0 0 6px rgba(200,40,32,0.7); }

/* --- the transcript playback panel (teletype) --- */
.vm-tape {
  margin-top: clamp(1.2rem, 3vw, 1.8rem);
  border-radius: var(--radius); border: 1px solid var(--line-soft);
  background:
    linear-gradient(180deg, rgba(8,14,23,0.9), rgba(5,8,14,0.94));
  box-shadow: inset 0 0 40px rgba(0,0,0,0.45);
  padding: clamp(1rem, 3vw, 1.5rem);
  position: relative; overflow: hidden;
}
.vm-tape::before {
  /* faint horizontal scanlines for the machine feel */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(180deg, rgba(232,221,196,0.03) 0 2px, transparent 2px 4px);
}
.vm-tape__label {
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: var(--tracking-mid);
  font-size: var(--fs-100); color: var(--ink-faint); display: flex; align-items: center; gap: 0.5em;
  margin-bottom: var(--space-3);
}
.vm-transcript {
  font-family: var(--font-mono); font-size: clamp(0.92rem, 0.88rem + 0.4vw, 1.06rem);
  line-height: 1.75; color: var(--cream); white-space: pre-wrap; word-break: break-word;
  min-height: 2em; margin: 0;
}
.vm-caret {
  display: inline-block; width: 0.6ch; height: 1.05em; margin-left: 1px;
  background: var(--gold); vertical-align: -0.15em; animation: vm-caret 1s steps(1) infinite;
}
.vm-transcript.is-done .vm-caret { animation: none; opacity: 0.35; }
@keyframes vm-caret { 50% { opacity: 0; } }

.vm-playback { margin-top: var(--space-4); display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.vm-playback small { color: var(--ink-faint); font-style: italic; font-size: var(--fs-200); }

@media (prefers-reduced-motion: reduce) {
  .vm-machine.is-playing .vm-reel,
  .vm-machine.is-playing .vm-led,
  .vm-caret { animation: none; }
}

/* ==========================================================================
   TOY 2 — THE SPY GLASS  (.sg-*)
   ========================================================================== */

.sg-wrap { max-width: 72rem; margin-inline: auto; }

/* the dark street strip you sweep the glass across */
.sg-stage {
  position: relative; width: 100%; aspect-ratio: 1600 / 520;
  border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--line-soft); box-shadow: var(--shadow-3);
  background: linear-gradient(180deg, #060a12, #04070d);
  touch-action: none;                /* pointer moves the glass, not the page */
  cursor: crosshair;
}
@media (max-width: 640px) { .sg-stage { aspect-ratio: 1600 / 760; } }

/* both copies of the street fill the stage identically (pixel-registered) */
.sg-street, .sg-lens-inner { position: absolute; inset: 0; width: 100%; height: 100%; }
.sg-street svg, .sg-lens-inner svg { width: 100%; height: 100%; display: block; }

/* the naked-eye view: dim, cold, unremarkable */
.sg-street { filter: brightness(0.42) saturate(0.5) blur(0.4px); }

/* the focus frame over the display currently under the glass */
.sg-focusframe {
  position: absolute; top: 4%; height: 92%; border-radius: 6px;
  border: 1px solid var(--gold-glow); box-shadow: 0 0 0 1px rgba(226,161,61,0.15) inset;
  opacity: 0; transition: opacity var(--dur-1), transform var(--dur-1) var(--ease-cold);
  pointer-events: none; will-change: transform;
}
.sg-stage.is-focusing .sg-focusframe { opacity: 0.9; }
.sg-focusframe.is-graded { border-color: var(--moss); }

/* the glass itself: a circular brass-rimmed lens, moved by transform only */
.sg-lens {
  position: absolute; top: 0; left: 0;
  width: var(--lens-d, 240px); height: var(--lens-d, 240px);
  border-radius: 50%; overflow: hidden;
  transform: translate3d(-999px, -999px, 0); will-change: transform;
  pointer-events: none;                 /* the stage owns the pointer */
  box-shadow:
    0 0 0 5px #2a2010,
    0 0 0 9px #6b501f,
    0 0 0 12px #c9973a,
    0 0 0 14px #7a5a24,
    0 0 0 16px #241a0c,
    0 14px 34px -8px rgba(0,0,0,0.8),
    inset 0 0 46px rgba(0,0,0,0.5);
}
.sg-lens-inner { filter: brightness(1.05) saturate(1.08); will-change: transform; }
/* glass glare + chromatic edge */
.sg-lens::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background:
    radial-gradient(60% 55% at 32% 28%, rgba(255,255,255,0.16), transparent 60%),
    radial-gradient(120% 120% at 50% 50%, transparent 62%, rgba(0,0,0,0.4) 100%);
}
.sg-stage.is-idle .sg-lens { opacity: 0; }

.sg-hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  font-family: var(--font-display); text-transform: uppercase; letter-spacing: var(--tracking-wide);
  font-size: var(--fs-200); color: var(--ink-faint);
  background: rgba(5,8,14,0.55); padding: 0.4em 0.9em; border-radius: 999px;
  border: 1px solid var(--line-soft); pointer-events: none; transition: opacity var(--dur-1);
}
.sg-stage.is-active .sg-hint { opacity: 0; }

/* focus caption under the strip: which display + a grade prompt */
.sg-caption {
  margin-top: var(--space-4); min-height: 2.4em;
  display: flex; align-items: baseline; gap: 0.8em; flex-wrap: wrap;
}
.sg-caption__name { font-family: var(--font-display); text-transform: uppercase;
  letter-spacing: var(--tracking-mid); font-size: var(--fs-500); color: var(--cream); }
.sg-caption__cue { font-style: italic; color: var(--ink-faint); font-size: var(--fs-300); }
.sg-caption__cue b { color: var(--gold); font-style: normal; }

/* the verdict card that drops in when you grade */
.sg-verdict {
  margin-top: var(--space-4); border-radius: var(--radius);
  border: 1px solid var(--line-soft); border-left: 3px solid var(--gold);
  background: var(--cream-06); padding: clamp(1rem, 3vw, 1.4rem);
  display: grid; grid-template-columns: auto 1fr; gap: clamp(1rem, 3vw, 1.5rem); align-items: center;
}
.sg-verdict.is-hidden { display: none; }
.sg-verdict__num {
  font-family: var(--font-display); font-weight: 300; line-height: 0.85;
  font-size: clamp(3.4rem, 2rem + 8vw, 5.5rem); color: var(--gold); text-align: center;
}
.sg-verdict__num small { display: block; font-size: 0.2em; color: var(--ink-faint);
  letter-spacing: var(--tracking-wide); }
.sg-verdict__num.is-unrated { color: var(--ink-soft); font-size: clamp(2.4rem, 1.4rem + 5vw, 3.6rem); }
.sg-verdict__name { font-family: var(--font-display); text-transform: uppercase;
  letter-spacing: var(--tracking-mid); font-size: var(--fs-200); color: var(--ink-faint); margin-bottom: 0.3em; }
.sg-verdict__lines { font-size: var(--fs-500); color: var(--ink); line-height: var(--lh-snug); }
@media (min-width: 560px) { .sg-verdict.is-anim { animation: sg-drop var(--dur-2) var(--ease-cold); } }
@keyframes sg-drop { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* progress: 8 dots that fill as you grade */
.sg-progress { display: flex; align-items: center; gap: 0.9rem; margin-top: var(--space-5); flex-wrap: wrap; }
.sg-progress__dots { display: inline-flex; gap: 0.4rem; }
.sg-dot {
  width: 12px; height: 12px; border-radius: 50%;
  border: 1.5px solid var(--line); background: transparent; transition: background var(--dur-1), border-color var(--dur-1);
}
.sg-dot.is-done { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 6px var(--gold-glow); }
.sg-progress__label { font-family: var(--font-display); text-transform: uppercase;
  letter-spacing: var(--tracking-mid); font-size: var(--fs-200); color: var(--ink-faint); }

@media (prefers-reduced-motion: reduce) {
  .sg-verdict.is-anim { animation: none; }
  .sg-focusframe, .sg-lens-inner, .sg-lens { transition: none; }
}
