/* fam.box/new: the "more WOW" draft. On top of style.css, Table system v1 tokens only. Night bands come from tokens.css
   ([data-theme="night"] on the element). Motion follows system.md 5; everything is still with prefers-reduced-motion. */

.wow { background: var(--fb-paper); }
.wow .bar[data-theme="night"] { background: rgba(19,36,29,.9); box-shadow: 0 1px 0 var(--fb-line); color: var(--fb-ink); }
.wow .bar .brand { color: var(--fb-ink); }

/* The stage: the real table, lit like a screen in an evening kitchen. */
.stage { --pad: clamp(8px, 2vw, 24px); position: relative; isolation: isolate; overflow: hidden; background: var(--fb-paper); padding: var(--pad) var(--pad) 0; }
.stage::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(55% 45% at 50% 0%, rgba(229,182,90,.20), transparent 70%),
              radial-gradient(35% 45% at 100% 70%, rgba(159,184,214,.14), transparent 70%),
              radial-gradient(30% 40% at 0% 85%, rgba(127,167,123,.12), transparent 70%); }
.stage-in { display: grid; max-width: 1640px; margin: 0 auto; }
.stage-in > * { grid-area: 1 / 1; }
.gather { place-self: center; overflow: visible; width: clamp(120px, 14vw, 168px); height: auto; opacity: 0; }
.gather circle { transform-box: fill-box; transform-origin: center; }
.frame-wrap { position: relative; z-index: 1; border-radius: clamp(14px, 2vw, 28px); overflow: hidden; background: #F4EFE3;
  box-shadow: 0 0 0 1px rgba(255,255,255,.07), 0 40px 90px -30px rgba(0,0,0,.75), 0 0 140px -30px rgba(229,182,90,.35); }
.wow .table-frame { height: calc(100vh - var(--bar) - 56px - var(--pad)); height: calc(100svh - var(--bar) - 56px - var(--pad)); }
.wow .more { height: 56px; background: none; box-shadow: none; color: var(--fb-ink); }
.wow .more:hover { color: var(--fb-mustard); }

/* The opening moment (under 2 s): the chairs gather round the table, the halo breathes out, the real table rises. */
@media (prefers-reduced-motion: no-preference) {
  .gather { animation: gather-out 400ms var(--fb-ease-leave) 1050ms both; opacity: 1; }
  .gather .ch { animation: chair-in 620ms var(--fb-ease-chair) var(--d) both; }
  .gather .tbl { animation: table-in 520ms var(--fb-ease-chair) 120ms both; }
  .gather .halo { animation: halo 900ms var(--fb-ease) 480ms both; }
  .frame-wrap { animation: rise 640ms var(--fb-ease) 900ms both; }
  .stage.skip .gather { display: none; }
  .stage.skip .frame-wrap { animation: none; }
  .wow .more svg { animation: bob 1600ms ease-in-out 2400ms 3; }
}
@keyframes chair-in { from { transform: translate(var(--dx), var(--dy)) scale(.3); opacity: 0; } 50% { opacity: 1; } to { transform: none; opacity: 1; } }
@keyframes table-in { from { transform: scale(.2); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes halo { from { transform: scale(.6); opacity: 0; } 30% { opacity: .9; } to { transform: scale(1.5); opacity: 0; } }
@keyframes gather-out { to { transform: scale(1.12); opacity: 0; } }
@keyframes rise { from { transform: translateY(56px) scale(.965); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bob { 50% { transform: translateY(4px); } }

/* The story: Night band with lamplight; each beat is a small scene that plays while it is on screen. */
.story { position: relative; isolation: isolate; overflow: hidden; background: var(--fb-paper); color: var(--fb-ink); }
.story .glow { position: absolute; inset: -10% 0; z-index: -1; pointer-events: none;
  background: radial-gradient(40% 22% at 15% 8%, rgba(229,182,90,.16), transparent 70%),
              radial-gradient(38% 18% at 90% 38%, rgba(159,184,214,.13), transparent 70%),
              radial-gradient(42% 20% at 10% 70%, rgba(127,167,123,.11), transparent 70%),
              radial-gradient(40% 18% at 85% 95%, rgba(229,182,90,.12), transparent 70%); }
.story .section { gap: clamp(64px, 10vw, 128px); }
.story-head { display: flex; flex-direction: column; gap: 20px; max-width: 820px; }
.story .say { font-size: clamp(44px, 7vw, 96px); line-height: .98; max-width: 12ch; text-wrap: balance; }
.story .sub { color: var(--fb-ink-soft); }
.story .kicker { color: var(--fb-mustard); }
.beat { display: grid; gap: 28px; align-items: center; }
.beat-text { display: flex; flex-direction: column; gap: 16px; max-width: 520px; }
.beat h2 { font-size: clamp(32px, 4vw, 48px); }
.tag { align-self: flex-start; padding: 5px 12px; border-radius: var(--fb-radius-pill); background: var(--fb-mustard-wash); color: var(--fb-ink); font-size: 14px; font-weight: 700; }
@media (min-width: 900px) {
  .beat { grid-template-columns: 5fr 7fr; gap: clamp(40px, 6vw, 88px); }
  .beat:nth-of-type(odd) .beat-text { order: 2; }
}
.scene { margin: 0; border-radius: var(--fb-radius-block); background: #F4EFE3; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 30px 70px -30px rgba(0,0,0,.7), 0 0 100px -40px rgba(229,182,90,.4); }
.scene svg { display: block; width: 100%; height: auto; }
.t { font-family: var(--fb-font-text); font-size: 15px; fill: #1F3B2F; }
.t.s { font-size: 16px; } .t.xs { font-size: 14px; } .t.b { font-weight: 700; } .t.m { fill: #55695E; }
.t.c { text-anchor: middle; } .t.g { font-family: var(--fb-font-display); font-size: 26px; } .t.big { font-family: var(--fb-font-display); font-size: 56px; }
/* The still picture (no JavaScript, reduced motion, off screen): the end of each story. */
.s-tell .dots, .s-letter .scan, .s-letter .add-b, .s-jar .coin, .s-jar .plus, .s-jar .n-a, .s-star .fly, .s-star .bits, .s-star .p-a { opacity: 0; }
.s-jar .arc { stroke-dashoffset: 378.2; }  /* 1 110 of 2 400 on a ring of 703.7 */
.scene :is(.me, .reply, .chip, .typing-cover, .scan, .d, .add, .coin, .level, .plus, .tick-fill, .tick, .fly, .fill, .bits > *) { transform-box: fill-box; transform-origin: center; }
.s-tell .typing-cover { transform-origin: right; transform: scaleX(0); }

/* Parallax: the scenes drift a little against the words as the page scrolls (browsers that can; others stay still). */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .scene { animation: drift linear both; animation-timeline: view(); animation-range: cover; }
    .story .glow { animation: glow-drift linear both; animation-timeline: view(); animation-range: cover; }
  }
}
@keyframes drift { from { transform: translateY(36px); } to { transform: translateY(-36px); } }
@keyframes glow-drift { from { transform: translateY(-6%); } to { transform: translateY(6%); } }

@media (prefers-reduced-motion: no-preference) {
  /* 1. Telegram to the table, 9 s */
  .s-tell.play .me { animation: tell-me 9s var(--fb-ease) infinite; }
  .s-tell.play .typing-cover { animation: tell-type 9s steps(28, end) infinite; }
  .s-tell.play .dots { animation: tell-dots 9s linear infinite; }
  .s-tell.play .reply { animation: tell-reply 9s var(--fb-ease) infinite; }
  .s-tell.play .chip { animation: tell-chip 9s infinite; }
  .s-tell.play .wash { animation: tell-wash 9s linear infinite; }
  /* 2. A letter becomes dates, 9 s */
  .s-letter.play .scan { animation: let-scan 9s var(--fb-ease) infinite; }
  .s-letter.play .hl { animation: let-hl 9s linear infinite; }
  .s-letter.play .h2 { animation-delay: .4s; } .s-letter.play .h3 { animation-delay: .8s; }
  .s-letter.play .d { animation: let-d 9s infinite; }
  .s-letter.play .d2 { animation-delay: .45s; } .s-letter.play .d3 { animation-delay: .9s; }
  .s-letter.play .add { animation: let-add 9s var(--fb-ease) infinite; }
  .s-letter.play .add-bg { animation: let-add-bg 9s linear infinite; }
  .s-letter.play .add-a { animation: let-add-a 9s linear infinite; }
  .s-letter.play .add-b { animation: let-add-b 9s linear infinite; }
  /* 3. A coin in the Lapland jar, 7 s */
  .s-jar.play .say { animation: jar-say 7s var(--fb-ease) infinite; }
  .s-jar.play .coin { animation: jar-coin 7s infinite; }
  .s-jar.play .arc { animation: jar-arc 7s var(--fb-ease) infinite; }
  .s-jar.play .level { animation: jar-level 7s var(--fb-ease) infinite; }
  .s-jar.play .plus { animation: jar-plus 7s var(--fb-ease) infinite; }
  .s-jar.play .n-a { animation: jar-na 7s linear infinite; }
  .s-jar.play .n-b { animation: jar-nb 7s linear infinite; }
  /* 4. A child's star fills, 7 s */
  .s-star.play .tick-fill, .s-star.play .tick { animation: star-tick 7s var(--fb-ease-chair) infinite; }
  .s-star.play .fly { animation: star-fly 7s var(--fb-ease) infinite; }
  .s-star.play .fill { animation: star-fill 7s var(--fb-ease) infinite; }
  .s-star.play .bits > * { animation: star-bit 7s var(--fb-ease) infinite; }
  .s-star.play .p-a { animation: star-pa 7s linear infinite; }
  .s-star.play .p-b { animation: star-pb 7s linear infinite; }
}

@keyframes tell-me { 0%, 3% { opacity: 0; transform: translateY(10px); } 8%, 93% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes tell-type { 0%, 8% { transform: scaleX(1); } 30%, 100% { transform: scaleX(0); } }
@keyframes tell-dots { 0%, 33% { opacity: 0; } 35%, 43% { opacity: 1; } 45%, 100% { opacity: 0; } }
@keyframes tell-reply { 0%, 44% { opacity: 0; transform: translateY(10px); } 49%, 93% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes tell-chip {
  0%, 50% { opacity: 0; transform: translate(170px, -128px) scale(.8); }
  54% { opacity: 1; transform: translate(170px, -128px) scale(1.06); animation-timing-function: var(--fb-ease-chair); }
  66%, 93% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: none; } }
@keyframes tell-wash { 0%, 64% { opacity: 0; } 68% { opacity: 1; } 93% { opacity: 1; } 100% { opacity: 0; } }

@keyframes let-scan { 0%, 4% { opacity: 0; transform: translateY(0); } 6% { opacity: 1; } 32% { opacity: 1; transform: translateY(240px); } 35%, 100% { opacity: 0; transform: translateY(240px); } }
@keyframes let-hl { 0%, 12% { opacity: .25; } 15%, 93% { opacity: 1; } 100% { opacity: .25; } }
@keyframes let-d { 0%, 36% { opacity: 0; transform: translateX(-150px) scale(.9); } 37% { animation-timing-function: var(--fb-ease-chair); opacity: .6; transform: translateX(-150px) scale(.9); }
  44%, 93% { opacity: 1; transform: none; } 100% { opacity: 0; transform: none; } }
@keyframes let-add { 0%, 52% { opacity: 0; transform: translateY(12px); } 57%, 93% { opacity: 1; transform: none; } 64% { transform: scale(.96); } 67% { transform: none; } 100% { opacity: 0; } }
@keyframes let-add-bg { 0%, 64% { fill: #1F3B2F; } 66%, 100% { fill: #F6E7C2; } }
@keyframes let-add-a { 0%, 64% { opacity: 1; } 66%, 100% { opacity: 0; } }
@keyframes let-add-b { 0%, 65% { opacity: 0; } 67%, 100% { opacity: 1; } }

@keyframes jar-say { 0%, 4% { opacity: 0; transform: translateY(10px); } 10%, 93% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes jar-coin {
  0%, 18% { opacity: 0; transform: translateY(-150px); animation-timing-function: cubic-bezier(.5, 0, .9, .5); }
  20% { opacity: 1; transform: translateY(-150px); animation-timing-function: cubic-bezier(.5, 0, .9, .5); }
  33% { opacity: 1; transform: translateY(14px) scale(1, .9); animation-timing-function: var(--fb-ease-chair); }
  38% { opacity: 1; transform: translateY(0); }
  44% { opacity: 0; transform: translateY(30px) scale(.4); }
  100% { opacity: 0; transform: translateY(30px) scale(.4); } }
@keyframes jar-arc { 0%, 40% { stroke-dashoffset: 422.2; } 58%, 93% { stroke-dashoffset: 378.2; } 100% { stroke-dashoffset: 422.2; } }
@keyframes jar-level { 0%, 40% { transform: translateY(8px); } 58%, 93% { transform: none; } 100% { transform: translateY(8px); } }
@keyframes jar-plus { 0%, 42% { opacity: 0; transform: translateY(16px); } 48% { opacity: 1; transform: none; } 70% { opacity: 1; } 78%, 100% { opacity: 0; transform: translateY(-10px); } }
@keyframes jar-na { 0%, 46% { opacity: 1; } 50%, 93% { opacity: 0; } 100% { opacity: 1; } }
@keyframes jar-nb { 0%, 46% { opacity: 0; } 50%, 93% { opacity: 1; } 100% { opacity: 0; } }

@keyframes star-tick { 0%, 10% { opacity: 0; transform: scale(.4); } 16%, 93% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes star-fly { 0%, 18% { opacity: 0; transform: none; } 22% { opacity: 1; transform: translateY(-10px); } 40% { opacity: 1; transform: translate(124px, 10px) scale(1.1); } 44%, 100% { opacity: 0; transform: translate(130px, 10px) scale(.6); } }
@keyframes star-fill { 0%, 40% { transform: translateY(18px); } 56%, 93% { transform: none; } 100% { transform: translateY(18px); } }
@keyframes star-bit { 0%, 55% { opacity: 0; transform: none; } 58% { opacity: 1; } 76% { opacity: 1; transform: translate(var(--x), var(--y)) rotate(var(--r)); } 84%, 100% { opacity: 0; transform: translate(var(--x), calc(var(--y) + 24px)) rotate(var(--r)); } }
@keyframes star-pa { 0%, 54% { opacity: 1; } 57%, 93% { opacity: 0; } 100% { opacity: 1; } }
@keyframes star-pb { 0%, 54% { opacity: 0; } 57%, 93% { opacity: 1; } 100% { opacity: 0; } }

/* Your family, here: the name they type goes on a drawn table and on to "Make one for us". */
.yours-in { display: grid; gap: 40px; align-items: center; }
@media (min-width: 900px) { .yours-in { grid-template-columns: 5fr 6fr; gap: clamp(40px, 6vw, 88px); } }
.yours-text { display: flex; flex-direction: column; gap: 16px; max-width: 520px; }
.yours .kicker { color: var(--fb-ink-muted); }
.name-form { display: flex; flex-direction: column; gap: 16px; margin-top: 8px; }
.name-form .btn { align-self: flex-start; }
.note { font-size: 15px; color: var(--fb-ink-muted); }
.mini { margin: 0; background: var(--fb-surface); border-radius: var(--fb-radius-panel); padding: clamp(20px, 3vw, 32px); display: flex; flex-direction: column; gap: 18px;
  box-shadow: 0 30px 60px -36px rgba(31,59,47,.55), inset 0 0 0 1px var(--fb-line); }
.mini-head { display: flex; align-items: center; gap: 16px; min-width: 0; }
.mini-head svg { flex: none; }
.mini-head div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mini-head b { font-family: var(--fb-font-display); font-weight: 400; font-size: clamp(28px, 3.4vw, 40px); line-height: 1.05; overflow-wrap: anywhere; }
.mini-head span { font-size: 15px; font-weight: 700; color: var(--fb-ink-muted); overflow-wrap: anywhere; }
.mini-head b.bump { animation: bump var(--fb-dur-chair) var(--fb-ease-chair); }
@keyframes bump { from { transform: translateY(-8px); opacity: .4; } }
.mini-ribbon { position: relative; height: 10px; border-radius: 5px; background: var(--fb-ribbon); }
.mini-ribbon i { position: absolute; left: 58%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: var(--fb-mustard); box-shadow: 0 0 0 4px var(--fb-surface); }
.mini-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 14px; }
.mini-card { background: var(--fb-paper); border-radius: 22px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--fb-depth-pressed); }
.mini-card p { display: flex; align-items: center; gap: 10px; font-size: 16px; color: var(--fb-ink-soft); }
.mini-card p i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.mini-card p b { color: var(--fb-ink); }
.mini-card.ring { align-items: flex-start; }
.mini-label { font: var(--fb-type-label); letter-spacing: .08em; text-transform: uppercase; color: var(--fb-ink-muted); }

/* Two plans with a little depth */
.wplan { position: relative; background: linear-gradient(180deg, var(--fb-surface), var(--fb-paper)); }
.plan-pic { display: block; margin-bottom: 4px; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .wplan { transition: transform var(--fb-dur-chair) var(--fb-ease-chair), box-shadow var(--fb-dur-chair) var(--fb-ease); }
  .wplan:hover { transform: translateY(-6px); box-shadow: inset 0 0 0 2px var(--fb-ink), 0 28px 50px -28px rgba(31,59,47,.55), 0 0 0 6px var(--fb-mustard-wash); }
  .wplan.own:hover { box-shadow: inset 0 0 0 1px var(--fb-line-strong), 0 28px 50px -28px rgba(31,59,47,.55), 0 0 0 6px var(--fb-mustard-wash); }
}
