/* Tideline Phase 7: phones and polish. Loaded after tideline.css and overrides it; phone rules sit under max-width
   media queries so the 1440 layout is unchanged. Tokens only (the takeover keeps its literal white). */

/* ---------- every width: the switch and focus rings on dark surfaces ---------- */
/* The switch keeps its 52×32 look, but its real box is 44 tall: a transparent 6 px border above and below, with the
   track painted only inside it. The knob is positioned from the padding box, so it does not move. The radius is given
   per axis (16 px across, 22 px down the 44 px box) so the painted 52×32 track keeps 16 px round ends: a 99 px radius on
   the taller box would leave 22×16 elliptical corners inside the border. */
.tog{height:44px;border-top:6px solid transparent;border-bottom:6px solid transparent;margin:0;border-radius:16px/22px}
/* tideline.css sets the background shorthand (which resets the clip) on these, so restate it at matching specificity. */
.tog,.tog[aria-checked],.strip .tog,.strip .tog[aria-checked]{background-clip:padding-box}
.tog::before{content:none}
/* A harbor ring disappears on the deep surfaces; use the light ink those surfaces already use (.strip already does). */
.rd.harbor :focus-visible{outline-color:var(--on-deep)}
/* --harbor surfaces are light in dark mode, so their rings follow their own ink. */
.ownturn :focus-visible,.deck.next :focus-visible{outline-color:var(--on-harbor)}

/* ---------- top bar ---------- */
@media (max-width:640px){
  .switch{padding:0;width:44px;justify-content:center;flex-shrink:0}
  /* A 44 px tall year button without changing the bar: the padding is given back by an equal negative margin. */
  .mod .yr{padding:15px 0;margin:-15px 0}
  .room{flex-shrink:0;min-width:44px}
}
@media (max-width:360px){
  .top{gap:4px;padding-left:8px;padding-right:8px}
  .mark{display:none}
}

/* ---------- the meeting strip (mockup phone band) ---------- */
/* A six-column grid. Waiting: round and status | connection (and the wake badge under it); the clock | Your turn;
   Up now, Next, Then in equal thirds; auto-pick | the alert button. Your turn: the title across the top with the
   connection at its right; the clock | Weeks left | wake badge; auto-pick | the alert button. */
@media (max-width:640px){
  .strip{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:6px 10px;align-items:center;padding:8px 12px 10px}
  .strip .sep,.strip .sp1{display:none}
  .strip>*{min-width:0}
  .strip>div:not([class]){grid-column:span 3}
  .strip .st-status{grid-row:1;grid-column:1/4}
  .strip .conn{grid-row:1;grid-column:4/-1;justify-self:end;align-self:start;min-height:0;line-height:14px}
  .strip .wake{grid-row:1;grid-column:4/-1;justify-self:end;align-self:end;line-height:14px;text-align:right}
  .strip .clock{order:3;grid-column:span 3;min-width:0;flex-wrap:wrap;row-gap:2px}
  .strip .st-turn{order:4;grid-column:span 3}
  .strip:not(:has(.clock)) .st-turn{grid-column:1/-1}
  .strip .st-deck{order:5;grid-column:span 2;align-self:start}
  .strip .st-deck .big{font-size:15px;overflow-wrap:anywhere}
  .strip .pillw{order:6;grid-column:span 3;justify-self:start;max-width:100%;padding:0 4px 0 12px;gap:6px}
  .strip .pillw .autonote{max-width:none}
  .strip .alertbtn{order:7;grid-column:span 3;justify-self:start;max-width:100%;white-space:normal}
  .strip .pillw~.alertbtn{justify-self:end}
  /* Your turn */
  .strip .st-title{grid-row:1;grid-column:1/-1;align-self:start}
  .strip .st-title .lbl{padding-right:110px}
  .strip .yourbig{font-size:20px}
  .strip .st-title~.clock,.strip .st-title~.st-turn{grid-column:span 2}
  .strip .st-title~.wake{grid-row:auto;order:5;grid-column:span 2;align-self:center}
}

/* ---------- tabs ---------- */
@media (max-width:640px){
  .tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px}
  .tab{justify-content:center;flex-wrap:wrap;text-align:center;padding:4px 6px;gap:2px 6px;line-height:1.15}
  .tabnote{grid-column:1/-1;padding:2px 4px 8px;text-align:center}
}

/* ---------- the wish list ---------- */
/* Every width: the inactive "If nothing on my list is open" switch stays readable (tideline.css dims it to .6, which
   fails AA). "Not active" is still said in words under it; the chosen option keeps its neutral ring, not harbor. */
.lpfoot .inactive .seg{opacity:1}
.lpfoot .inactive .seg button{color:var(--muted)}
.lpfoot .inactive .seg button[aria-checked="true"]{background:var(--raised);color:var(--ink)}

@media (max-width:640px){
  /* The grip is a graphic that must reach 3:1 (its ↑ ↓ buttons are the 44 px equivalent). */
  .grip{color:var(--muted)}
  /* Readiness (mockup phone band): two columns; the turn alert and the Official meeting run full width. */
  .ready .rd-alert,.ready .rd.harbor{grid-column:1/-1}
  /* Allowance follows the turn alert and would sit alone in half a row; let it take the row. */
  .ready .rd-alert+.rd:not(.harbor){grid-column:1/-1;min-height:0}
  /* The turn alert: title, then the select and Test on one wrapping row, then the device state. */
  .ready .rd-alert{align-items:center;gap:6px 8px}
  .ready .rd-alert>.sp1{display:contents}
  .ready .rd-alert b{flex:1 0 100%;order:0}
  .ready .rd-alert .alertsel{flex:1 1 130px;width:auto;margin:0;order:1}
  .ready .rd-alert .btn{flex:0 1 auto;order:2}
  .ready .rd-alert small{flex:1 0 100%;order:3}
  /* Year tiles: the rank badge sits right of the week-number line, never over the date. */
  .wk .rk{top:17px;right:3px}
}
@media (max-width:360px){
  .tl-main{padding-left:8px;padding-right:8px}
  .year{padding:8px}
  .mrow{grid-template-columns:24px repeat(5,minmax(0,1fr));gap:2px}
  .wk .t1 b{font-size:10.5px}
  /* Ranked list: the title takes the full width and wraps; ↑ ↓ Options keep 44 px on their own row under it. */
  .ch:not(.ro) .chm{grid-template-columns:28px 30px minmax(0,1fr);row-gap:0}
  .ch:not(.ro) .chm .grip{grid-row:1/span 2}
  .ch:not(.ro) .chm .cha{grid-column:2/-1;justify-content:flex-end}
}

/* ---------- the meeting: pick order, takeover (every width) ---------- */
/* Pick-order position numbers meet AA (tideline.css uses --faint, 3.3:1 light, 4.2:1 dark). */
.order li .pos{color:var(--muted)}
/* Takeover: every text colour reaches 4.5:1 against all three gradient stops (#127aa0, #0d5470, #062c3b), so the
   eyebrow, sub-line, clock words and hint drop their dim tints and opacity. White is 4.9:1 on the lightest stop and
   #f2fafd is 4.6:1; the grace panel and its button sit on a dark wash instead of a white one, which lifted the
   background towards white. */
.tk-eye{opacity:1;color:#fff}
.tk-d,.takeover .clock .w,.tk-hint,.tk-grace .grace small{color:#f2fafd}
.takeover .clock .w{opacity:1}
.tk-grace .grace{background:#062c3b8c;border-color:#ffffff59}
.tk-grace .btn{background:#062c3b8c;color:#fff;border-color:#ffffff80}
@media (max-width:360px){
  /* A 568 px tall phone: the heading is at most 48 px and the clock steps down, so the button and hint stay on screen. */
  .tk-in{gap:10px}
  .tk-h{font-size:clamp(40px,14vw,48px)}
  .takeover .clock .t{font-size:36px}
  .takeover .clock.urgent .t{font-size:44px}
}

/* ---------- the meeting and Rehearse on phones ---------- */
@media (max-width:640px){
  /* Tide gauge (the overview while waiting): legible month labels at 320, clipped rather than overlapping; the
     legend on one or two lines. */
  .tl-mo{font-size:9px;letter-spacing:0}
  .tl-mo span{padding-left:2px;text-overflow:clip}
  .legend{gap:4px 10px;font-size:11.5px}
  .legend span{gap:4px}
  /* My confirmed weeks: the To plan placeholders in two columns; confirmed weeks and the consortium note keep the row. */
  .myweeks{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
  .myweeks>.mw:not(.todo),.myweeks>.mw.todo:only-child{grid-column:1/-1}
  .mw.todo{min-height:40px}
  /* The untested-alert callout: icon and text, then Test under them at full width. */
  .side>.callout.neu[role="note"]{align-items:flex-start}
  .side>.callout.neu[role="note"]>.sp1{flex:1 1 0;min-width:0}
  .side>.callout.neu[role="note"]>.btn{flex:1 0 100%;white-space:normal}
  /* Latest chip and the deck banner wrap their text inside the card. */
  .latest-chip>span:not(.gdot),.deck>div{min-width:0;overflow-wrap:anywhere}
  /* Your turn (mockup scrPTurn): the proposal card and its Confirm first, then the gauge, then the Year. The gauge
     columns are tabindex -1, so the visual reorder adds no focus stop out of order. */
  .meeting.turn{display:flex;flex-direction:column;gap:12px}
  .meeting.turn>.turnlay{display:contents}
  .meeting.turn>.turnlay>.col.sticky{order:1}
  .meeting.turn>.gauge{order:2;margin-bottom:0}
  .meeting.turn>.turnlay>.col:not(.sticky){order:3}
  /* Rehearse: the lab buttons wrap and share each row, every one at least 44 tall. */
  .labctl .row .btn{flex:1 1 auto;min-height:44px;white-space:normal}
  /* The ribbon and the lab controls sit above the practice turn card; for the VAA Scheduler the tabs take a second
     row (the desk tabs), so these two are tighter and the card's Confirm stays above the fold at 390x844. */
  .practice-ribbon{margin-bottom:8px;padding:6px 12px}
  .labctl{padding:10px 12px;gap:6px;margin-bottom:10px}
}

/* ---------- afterwards and past years on phones (mockup scrPAfter) ---------- */
@media (max-width:640px){
  /* The postcard comes before the gauge; the gauge columns are tabindex -1, so no focus stop moves. */
  .meeting.done{display:flex;flex-direction:column;gap:12px}
  .meeting.done>.after{order:1;margin-bottom:0}
  .meeting.done>.gauge{order:2;margin-bottom:0}
  /* The popover and the Year card follow, in their own order, so the weeks and the review button come first. */
  .meeting.done>:not(.after):not(.gauge){order:3}
  /* A 96 px sky: the sun and the horizon svg sit higher so the sun is not cut off. */
  .pc-sky{height:96px}
  .pc-sky .sun{top:16px;width:64px;height:64px;margin-left:-32px;box-shadow:0 0 40px #ffd77a}
  .pc-sky svg{height:48px}
  .pc-body{padding:16px;gap:12px}
  .pc-title{font-size:26px}
  /* Two-column weeks; consortium weeks are compact and keep AA (full ink/muted text, no opacity). */
  .pc-weeks{grid-template-columns:repeat(2,minmax(0,1fr))}
  .pcw{min-width:0;overflow-wrap:anywhere}
  .pcw.cons{min-height:0;padding:8px 10px}
  .pcw.cons b{font-size:14px}
  .pcw.cons small{font-size:11.5px;line-height:1.3;opacity:1;color:var(--muted)}
  /* 44 px touch targets on the afterwards and archive buttons. */
  .after .btn.sm,.ribbon .btn.sm{min-height:44px}
  /* Year menu: full width, every item at least 44 tall. */
  .yearmenu{left:8px;right:8px;min-width:0;width:auto}
  .yearmenu button,.yearmenu a{min-height:44px;width:100%}
  /* The ribbon text wraps inside the strip. */
  .ribbon{padding:8px 12px;overflow-wrap:anywhere}
  .ribbon>*{min-width:0}
  .strip.archive{min-width:0}
}

/* ---------- the Scheduler desk on phones (overflow only; the desk itself is Phase 6's) ---------- */
@media (max-width:640px){
  /* Setup's "Setting up YYYY" chooser sits at the right of the header (or wraps under the title); its menu opened
     from the chooser's left edge and ran 31 px past a 390 px screen. On phones the menu hangs from the header's right
     edge, just under the chooser, so it stays on screen wherever the chooser wraps. */
  .setuphead{position:relative}
  .yearpick{position:static}
  .yearpick .menu{left:auto;right:0;top:auto;margin-top:6px;max-width:100%}
}
