/* Family page: staging for its scenes (shared look in film.css; motion numbers from film.js and family.js). */

/* the area under the headline and its one line */
.sc { --top: clamp(196px, 25svh, 240px); }

/* ---------- intro: the Family landing comes apart ---------- */
.fa-xr { --w: min(320px, calc((100svh - 150px) * .45)); left: calc(64% - var(--w) / 2); top: calc(50% + 16px - var(--w) * 1.1111); }
.fa-xr .ly-home  { left: 2.778%; top: 12.083%; width: 95%;     --z: .55; }
.fa-xr .ly-acts  { left: 2.778%; top: 22.75%;  width: 95%;     --z: .32; }
.fa-xr .ly-note  { left: 1.667%; top: 36.083%; width: 45.37%;  --z: .9; filter: none; }
.fa-xr .ly-leave { left: 3.333%; top: 57.5%;   width: 93.333%; --z: .42; }
.fa-xr .ly-board { left: 2.778%; top: 71.5%;   width: 94.444%; --z: .68; }
.fa-xr .ly-nav   { left: 2.778%; top: 91.917%; width: 94.444%; --z: .14; }
.fa-xr .toast { opacity: var(--to, 0); transform: translate(calc(var(--dx) * (1 - var(--to, 0))), calc(var(--dy) * (1 - var(--to, 0)))); z-index: 5; }
.ft1 { left: -70%; top: 14%; --dx: 30px; --dy: 10px; }
.ft2 { left: 72%; top: 42%; --dx: -30px; --dy: 10px; }
.ft3 { left: -64%; top: 70%; --dx: 30px; --dy: -10px; }

/* ---------- shopping: a pile sorts itself into aisles ---------- */
.aisles { --g: 1; position: absolute; left: 50%; top: max(calc(var(--top) + 20px), calc(56% - 130px)); width: min(1080px, 92vw); transform: translateX(-50%); display: flex; gap: 22px; align-items: flex-start; }
.aisle { flex: 1; min-width: 0; display: grid; gap: 10px; }
.ais-h { margin: 0 0 2px 4px; font: 700 13px/1 var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); opacity: var(--g); }
.it { --k: 0; position: relative; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 16px; border-radius: 18px; background: #fff; box-shadow: 0 8px 22px -14px rgba(43,35,32,.35);
  transform: translate(calc(var(--sx, 0px) * (1 - var(--g))), calc(var(--sy, 0px) * (1 - var(--g)))) rotate(calc(var(--sr, 0deg) * (1 - var(--g)))); }
.it .ck { position: relative; flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--muted); }
.it .ck::before { content: ""; position: absolute; inset: -2px; border-radius: 50%; background: var(--accent); opacity: var(--k); transform: scale(calc(.4 + var(--k) * .6)); }
.it .ck svg { position: absolute; inset: 3px; width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; opacity: var(--k); }
.it b { position: relative; flex: 1; min-width: 0; font: 400 16px/1.2 var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.it b s { position: absolute; left: 0; right: 0; top: 54%; height: 1.5px; background: var(--ink); transform-origin: 0 50%; transform: scaleX(var(--k)); }
.it em { font: 600 14px/1 var(--body); font-style: normal; color: var(--muted); white-space: nowrap; }
.it .by { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--fam); color: #fff; font: 700 10px/22px var(--body); font-style: normal; text-align: center; opacity: var(--k); transform: scale(calc(.5 + var(--k) * .5)); }
.shop-toast { left: 50%; bottom: clamp(26px, 7svh, 64px); transform: translate(-50%, calc((1 - var(--r, 1)) * 16px)); opacity: var(--r, 1); }

/* ---------- meals: plates, then the vote ---------- */
.plates { position: absolute; left: 50%; top: calc(var(--top) + 10px); transform: translateX(-50%); display: flex; gap: clamp(8px, 1.6vw, 22px); }
.pl { display: grid; justify-items: center; gap: 4px; width: 64px; opacity: min(1, var(--r, 1)); transform: scale(calc(.4 + var(--r, 1) * .6)); }
.pl i { width: 58px; height: 58px; border-radius: 50%; background: #fff; display: grid; place-items: center; font: 700 22px/1 var(--body); font-style: normal; box-shadow: 0 6px 16px -10px rgba(43,35,32,.4); }
.pl.on i { border: 2.5px solid var(--accent); }
.pl b { margin-top: 4px; font: 600 14px/1 var(--body); color: var(--muted); }
.pl.on b { color: var(--accent); }
.pl em { font: 400 14px/1 var(--body); font-style: normal; color: var(--ink); }
.mcol { position: absolute; left: 50%; top: calc(var(--top) + 150px); width: min(560px, 92vw); transform: translateX(-50%); display: grid; gap: 18px; justify-items: center; }
.vote { width: 100%; padding: 6px 22px 8px; border-radius: 26px; background: #fff; box-shadow: var(--lift); }
.vote-h { padding: 16px 0 14px; font: 700 18px/1.2 var(--body); border-bottom: 1.5px solid var(--line); }
.vo { --v: 0; display: flex; align-items: center; gap: 12px; padding: 14px 0; }
.vo + .vo { border-top: 1.5px solid var(--line); }
.vo > div { flex: 1; min-width: 0; }
.vo b { display: block; font: 400 17px/1.25 var(--body); }
.vo.mine b { font-weight: 700; }
.vo em { display: grid; margin-top: 4px; font: 400 15px/1.2 var(--body); font-style: normal; color: var(--muted); }
.vo em > span { grid-area: 1 / 1; }
.vo .n0 { opacity: calc(1 - var(--v)); } .vo .n1 { opacity: var(--v); }
.vo .av { --as: 30px; opacity: var(--v); transform: translateY(calc((1 - var(--v)) * -26px)) scale(calc(.6 + var(--v) * .4)); }
.vo .btn { position: relative; display: grid; place-items: center; min-width: 88px; height: 44px; padding: 0 18px; border-radius: 999px; border: 2px solid var(--accent); color: var(--accent); font: 600 16px/1 var(--body); overflow: hidden; }
.vo .btn > span { grid-area: 1 / 1; position: relative; }
.vo.mine .btn::before { content: ""; position: absolute; inset: 0; background: var(--accent); opacity: var(--v); }
.vo.mine .b0 { opacity: calc(1 - var(--v)); } .vo.mine .b1 { opacity: var(--v); color: #fff; }
.vote-toast { left: 50%; bottom: 7px; transform: translate(-50%, calc((1 - var(--r, 0)) * 12px)); opacity: var(--r, 0); }
.groc { display: inline-flex; align-items: center; gap: 10px; height: 56px; padding: 0 28px; border-radius: 999px; background: var(--accent); color: #fff; font: 700 17px/1 var(--body); opacity: var(--r, 1); transform: translateY(calc((1 - var(--r, 1)) * 16px)); }
.groc svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- chores: a turn crosses over ---------- */
.ask { position: absolute; left: 50%; top: calc(var(--top) + 6px); width: min(470px, 92vw); margin-left: calc(min(470px, 92vw) / -2); padding: 20px 20px 18px; border-radius: 24px; border: 2px solid var(--accent); background: #fff; box-shadow: var(--lift); }
.ask b { display: block; font: 700 17px/1.3 var(--body); }
.ask em { display: block; margin-top: 4px; font: 400 15px/1.3 var(--body); font-style: normal; color: var(--muted); }
.ask-b { display: flex; gap: 12px; margin-top: 16px; }
.ask-b span { flex: 1; display: grid; place-items: center; height: 46px; border-radius: 999px; font: 700 16px/1 var(--body); }
.ask .no { border: 2px solid var(--accent); color: var(--accent); }
.ask .yes { background: var(--accent); color: #fff; transform: scale(calc(1 - var(--acc, 0) * (1 - var(--acc, 0)) * .3)); }
.sides { position: absolute; inset: 0; pointer-events: none; }
.side { position: absolute; left: var(--cx); top: var(--hy); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; font: 700 18px/1 var(--body); opacity: var(--in); }
.side .av { --as: 40px; }
.turn { position: absolute; left: 0; top: 0; width: var(--tw); display: grid; align-content: center; gap: 4px; height: 70px; padding: 0 20px; border-radius: 20px; background: #fff; box-shadow: 0 10px 26px -16px rgba(43,35,32,.42);
  transform: translate(var(--tx, 0px), var(--ty, 0px)); opacity: var(--to, 1); }
.turn b { font: 600 17px/1.15 var(--body); }
.turn em { font: 400 14px/1.2 var(--body); font-style: normal; color: var(--muted); }
.t-dish { display: grid; grid-template-areas: "b" "e"; }
.t-dish b { grid-area: b; } .t-dish em { grid-area: e; }
.t-dish .w0 { opacity: calc(1 - var(--sw, 0)); } .t-dish .w1 { opacity: var(--sw, 0); }
.t-none { background: transparent; box-shadow: none; border: 2px dashed var(--field); }
.t-tom { background: var(--accent-bg); }

/* ---------- money: spends fly into the ring ---------- */
.bud { position: absolute; left: 50%; top: var(--by, 50%); transform: translateX(-50%); display: flex; align-items: center; gap: 36px; }
.ring { width: var(--rs, 260px); height: var(--rs, 260px); transform: rotate(-90deg); flex: none; }
.r-bg { fill: none; stroke: #E9DED2; stroke-width: 22; }
.r-fg { fill: none; stroke: var(--accent); stroke-width: 22; stroke-linecap: round; }
.bud-t { display: grid; gap: 6px; }
.bud-t small { font: 600 15px/1 var(--body); color: var(--muted); }
.bud-t b { font: 700 clamp(36px, 4vw, 54px)/1.05 var(--body); letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bud-t em { font: 400 17px/1.3 var(--body); font-style: normal; color: var(--muted); }
.sp { position: absolute; left: 0; top: 0; display: grid; grid-template-columns: auto auto; column-gap: 18px; align-items: center; padding: 12px 18px; border-radius: 18px; background: #fff; box-shadow: 0 10px 26px -16px rgba(43,35,32,.42); white-space: nowrap;
  transform: translate(-50%, -50%) translate(var(--tx, 0px), var(--ty, 0px)) rotate(var(--rz, 0deg)) scale(var(--s, 1)); opacity: var(--o, 1); }
.sp b { font: 600 16px/1.2 var(--body); }
.sp em { grid-row: 2; font: 400 14px/1.2 var(--body); font-style: normal; color: var(--muted); }
.sp i { grid-row: 1 / 3; grid-column: 2; font: 700 17px/1 var(--body); font-style: normal; }

/* ---------- kids: Zawadi's card comes apart ---------- */
.kids { --x: 1; position: absolute; inset: 0; }
.kids > * { position: absolute; left: 50%; top: var(--ky, 53%); max-width: none; }
.kc { width: var(--kw, 520px); height: auto; border-radius: 22px; box-shadow: var(--lift); transform: translate(-50%, -50%); }
.kb { transform: translate(-50%, -50%) translate(calc(var(--x) * 0px), calc(14px + var(--x) * var(--kby, 236px))) scale(calc(.96 + var(--x) * .04)); opacity: calc(.7 + var(--x) * .3); }
.kp { width: var(--pw, min(320px, 23vw)); transform: translate(-50%, -50%) translate(calc(var(--px) * var(--x)), calc(var(--py) * var(--x))) scale(calc(.55 + var(--x) * .45)); opacity: min(1, calc(var(--x) * 2)); }
img.kp { height: auto; border-radius: 18px; box-shadow: 0 14px 30px -18px rgba(43,35,32,.45); }
span.kp { display: grid; gap: 4px; padding: 16px 20px; border-radius: 18px; background: #fff; box-shadow: 0 14px 30px -18px rgba(43,35,32,.45); }
span.kp b { font: 600 17px/1.2 var(--body); }
span.kp em { font: 400 15px/1.2 var(--body); font-style: normal; color: var(--muted); }
.kp-sci { grid-template-columns: auto 1fr; column-gap: 14px; }
.kp-sci .ckc { grid-row: 1 / 3; align-self: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--field); }
.kids { --kh: min(470px, 33vw); }
.kp-term { --px: calc(var(--kh) * -1); --py: -70px; }
.kp-sci  { --px: calc(var(--kh) * -1); --py: 74px; }
.kp-fee  { --px: var(--kh); --py: -60px; }
.kp-kit  { --px: var(--kh); --py: 40px; }

/* ---------- documents (dark): fingerprint, unlock, fan out ---------- */
.s-docs .bgfill { background: var(--night); }
.lock { --fp: 1; --un: 1; position: absolute; left: 50%; top: 56%; width: 160px; height: 160px; border-radius: 50%; background: var(--night-2); display: grid; place-items: center;
  transform: translate(-50%, -50%) translateY(calc(var(--un) * var(--lift-y, -230px))) scale(calc(1 - var(--un) * .5)); }
.fpr { width: 92px; height: 92px; fill: none; stroke: var(--accent-hi); stroke-width: 4; stroke-linecap: round; }
.fpr path { opacity: .16; }
.fpr path:nth-child(1) { opacity: clamp(.16, calc(var(--fp) * 6 - 0), 1); }
.fpr path:nth-child(2) { opacity: clamp(.16, calc(var(--fp) * 6 - 1), 1); }
.fpr path:nth-child(3) { opacity: clamp(.16, calc(var(--fp) * 6 - 2), 1); }
.fpr path:nth-child(4) { opacity: clamp(.16, calc(var(--fp) * 6 - 3), 1); }
.fpr path:nth-child(5) { opacity: clamp(.16, calc(var(--fp) * 6 - 4), 1); }
.fpr path:nth-child(6) { opacity: clamp(.16, calc(var(--fp) * 6 - 5), 1); }
.padlock { position: absolute; right: 4px; bottom: 4px; width: 46px; height: 46px; padding: 10px; border-radius: 50%; background: var(--accent); fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.padlock .shackle { transform: translateY(calc(var(--un) * -3px)) rotate(calc(var(--un) * -22deg)); transform-origin: 16px 11px; transform-box: view-box; }
.docs { --o: 1; --dw: min(480px, 88vw); position: absolute; left: 50%; top: var(--dy0, 36%); width: var(--dw); margin-left: calc(var(--dw) / -2); }
.docs img { position: absolute; left: 0; top: 0; width: 100%; height: auto; max-width: none; border-radius: 18px;
  transform: translateY(calc(var(--i) * var(--dw) * .262 * var(--o))) scale(calc(.9 + var(--o) * .1)); opacity: min(1, calc(var(--o) * 3 - var(--i) * .5)); }
.docs img:nth-child(1) { --i: 0; } .docs img:nth-child(2) { --i: 1; } .docs img:nth-child(3) { --i: 2; } .docs img:nth-child(4) { --i: 3; }

/* ---------- notes: lands, read, leaves ---------- */
.board { position: absolute; left: 50%; top: max(calc(var(--top) + 250px), calc(50% + 30px)); width: min(560px, 92vw); height: auto; max-width: none; transform: translate(-50%, calc((1 - var(--r, 1)) * 30px - var(--bu, 0) * var(--nlift, 0px))); opacity: var(--r, 1); }
.sticky { --n: 1; --rd: 0; position: absolute; left: calc(50% - min(560px, 92vw) / 2 - 20px); top: max(calc(var(--top) + 10px), calc(50% - 210px)); width: 280px; height: auto; max-width: none; z-index: 2;
  transform: translate(calc(var(--rd) * -140px), calc(var(--rd) * -220px)) rotate(calc(-4deg - (1 - var(--n)) * 14deg - var(--rd) * 24deg)) scale(calc(1 + (1 - var(--n)) * .35));
  opacity: calc(min(1, var(--n) * 2) * (1 - var(--rd))); }
.read { position: absolute; left: calc(50% - min(560px, 92vw) / 2 + 300px); top: max(calc(var(--top) + 110px), calc(50% - 110px)); display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 999px; background: var(--ink); color: #fff; font: 600 15px/1 var(--body);
  opacity: var(--r, 0); transform: translateX(calc((1 - var(--r, 0)) * -14px)); }
.read svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2; }

/* ---------- us ---------- */
.ucol { --uw: min(560px, 90vw); position: absolute; left: 50%; top: max(calc(var(--top) + 16px), calc(52% - 200px)); width: var(--uw); transform: translateX(-50%); display: grid; gap: 18px; }
.us-date { width: 100%; height: auto; border-radius: 24px; box-shadow: var(--lift); }
.ideas { display: flex; gap: 14px; justify-content: center; }
.idea { position: relative; width: calc(var(--uw) / 3 - 10px); height: calc(var(--uw) * 245 / 663); overflow: hidden; border-radius: 18px; box-shadow: 0 14px 30px -18px rgba(43,35,32,.45);
  transform: translateY(calc((1 - var(--r, 1)) * 70px)) rotate(calc((1 - var(--r, 1)) * var(--rz))); opacity: min(1, calc(var(--r, 1) * 2)); }
.idea img { position: absolute; top: 0; height: 100%; width: auto; max-width: none; }
.i1 { --rz: -10deg; } .i1 img { left: 0; }
.i2 { --rz: 4deg; } .i2 img { left: calc(var(--uw) / -3); }
.i3 { --rz: 10deg; } .i3 img { left: calc(var(--uw) * -2 / 3); }

/* ---------- the house: dealt into columns ---------- */
.cols { position: absolute; left: 50%; top: max(calc(var(--top) + 14px), calc(52% - 150px)); width: min(1160px, 94vw); transform: translateX(-50%); display: flex; gap: 22px; align-items: flex-start; }
.col { flex: 1; min-width: 0; display: grid; gap: 12px; }
.col h3 { margin: 0 0 2px 4px; font: 700 13px/1 var(--body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); opacity: var(--in); }
.hc { width: 100%; height: auto; border-radius: 18px; box-shadow: 0 12px 28px -18px rgba(43,35,32,.45);
  transform: translate(calc(var(--dx, 0px) * (1 - var(--d, 1))), calc(var(--dy, 0px) * (1 - var(--d, 1)))) rotate(calc(var(--rz, 0deg) * (1 - var(--d, 1)))); opacity: min(1, calc(var(--d, 1) * 4)); }

/* shopping rows: the strike runs under the name only, the quantity sits at the right */
.it b { flex: 0 1 auto; }
.it em { margin-left: auto; }

/* ---------- small screens: every scene composed for a phone ---------- */
@media (max-width: 719px) {
  /* clear the 56 px header; family.js puts the line under the headline and centres the content below */
  .sc .hl { top: 72px; font-size: clamp(30px, 8.6vw, 38px); }
  .sc .sub { font-size: 15px; line-height: 1.4; }
  .sc { --top: 190px; }

  /* intro: a bigger phone; toasts kept inside the screen */
  .fa-xr { --w: min(250px, 64vw, calc((100svh - 300px) * .45)); left: calc(50% - var(--w) / 2); top: auto; bottom: 28px; }
  .ft1 { left: -26%; top: 8%; } .ft2 { left: auto; right: -22%; top: 44%; } .ft3 { left: -24%; top: 76%; }
  .fa-xr .toast { font-size: 13px; }

  /* shopping */
  .aisles { flex-direction: column; gap: 12px; top: var(--py, var(--top)); width: calc(100vw - 32px); }
  .aisle { width: 100%; gap: 7px; }
  .it { height: 48px; border-radius: 14px; padding: 0 14px; gap: 11px; }
  .it b { font-size: 16px; } .it em { font-size: 14px; }
  .it .ck { width: 22px; height: 22px; } .it .ck svg { inset: 2px; width: 14px; height: 14px; }
  .ais-h { font-size: 12px; }
  .shop-toast { bottom: 22px; }

  /* meals: the week as two rows of plates, then the vote */
  .plates { top: var(--py, var(--top)); flex-wrap: wrap; justify-content: center; width: min(330px, calc(100vw - 24px)); row-gap: 12px; column-gap: 8px; }
  .pl { width: 70px; } .pl i { width: 48px; height: 48px; font-size: 18px; } .pl b, .pl em { font-size: 13px; }
  .mcol { top: var(--py2, calc(var(--top) + 190px)); width: calc(100vw - 32px); gap: 16px; }
  .vote { padding: 4px 16px 6px; border-radius: 22px; } .vote-h { font-size: 16px; padding: 14px 0 12px; }
  .vo { padding: 11px 0; gap: 10px; } .vo b { font-size: 15px; } .vo em { font-size: 13px; }
  .vo .btn { min-width: 74px; height: 40px; padding: 0 12px; font-size: 15px; } .vo .av { --as: 28px; }
  .vote-toast { bottom: 2px; font-size: 13px; white-space: normal; width: max-content; max-width: calc(100vw - 32px); }
  .groc { height: 52px; font-size: 16px; }

  /* chores: ask card, names and turns as one centred group */
  .ask { top: var(--ay, var(--top)); width: calc(100vw - 32px); margin-left: calc((100vw - 32px) / -2); padding: 18px 18px 16px; }
  .ask { padding: 20px 18px 18px; } .ask b { font-size: 17px; } .ask em { font-size: 15px; }
  .ask-b span { height: 48px; }
  .turn { height: 80px; padding: 0 16px; border-radius: 18px; gap: 6px; } .turn b { font-size: 17px; } .turn em { font-size: 14px; }
  .side { font-size: 17px; } .side .av { --as: 38px; }

  /* money: ring and total on top, the spends below it, inside the screen */
  .bud { flex-direction: column; gap: 14px; text-align: center; }
  .bud-t { justify-items: center; gap: 4px; } .bud-t b { font-size: 34px; } .bud-t em { font-size: 15px; } .bud-t small { font-size: 14px; }
  .sp { width: calc(100vw - 32px); grid-template-columns: 1fr auto; padding: 10px 16px; border-radius: 14px; column-gap: 14px; } .sp b { font-size: 15px; } .sp em { font-size: 13px; } .sp i { font-size: 15px; }

  /* kids: Zawadi's card, then her four pieces stacked; Baraka's card stays on desktop */
  .kids { --kw: calc(100vw - 32px); --pw: calc(100vw - 32px); }
  .kb { display: none; }
  .kp { transform: translate(-50%, -50%) translateY(calc(var(--py, 0px) * var(--x))) scale(calc(.7 + var(--x) * .3)); }
  span.kp { padding: 12px 16px; } span.kp b { font-size: 16px; } span.kp em { font-size: 14px; }

  /* documents */
  .lock { width: 124px; height: 124px; } .fpr { width: 72px; height: 72px; }
  .docs { --dw: calc(100vw - 32px); top: var(--dyp, 40%); }

  /* notes: a big sticky with the read pill, the board under it */
  .sticky { left: 16px; top: var(--ny, var(--top)); width: var(--sw, 260px); }
  .board { top: var(--ny2, calc(var(--top) + 260px)); width: calc(100vw - 32px); }
  .read { left: auto; right: 16px; top: calc(var(--ny, var(--top)) + var(--sw, 260px) * .878 - 30px); font-size: 14px; padding: 12px 16px; z-index: 3; }

  /* us */
  .ucol { --uw: calc(100vw - 32px); top: var(--py, var(--top)); gap: 14px; }

  /* the house: one column, the extra cards dropped */
  .cols { flex-direction: column; gap: 14px; top: var(--py, var(--top)); width: calc(100vw - 32px); }
  .col { width: 100%; gap: 8px; }
  .col h3 { font-size: 12px; }
  .hc.dk { display: none; }
}
@media (max-width: 380px) {
  .read { right: 8px; }
  .pl { width: 66px; }
}
