/* The SAT / English / TOEFL switch (js/section-switch.js): the toggle, and the
   full-screen transition played when moving from one section to another.
   --n is how many sections are offered, --at which of them is chosen. */

.sec-switch{
  position:relative; display:inline-grid; grid-template-columns:repeat(var(--n,2),1fr); align-items:stretch;
  padding:4px; border-radius:999px; background:var(--paper-card,#fff); border:1.5px solid var(--line,rgba(22,33,63,.12));
  box-shadow:0 6px 18px rgba(22,33,63,.08); font-family:var(--body,'IBM Plex Sans',sans-serif); isolation:isolate;
}
.sec-switch[hidden]{ display:none !important; }
.sec-switch button{
  position:relative; z-index:1; border:0; background:none; cursor:pointer; font:inherit; font-weight:600; font-size:.9rem;
  padding:9px 18px; border-radius:999px; color:var(--ink-soft,#2C3A63); white-space:nowrap; transition:color .25s ease;
  display:inline-flex; align-items:center; justify-content:center; gap:7px;
}
.sec-switch button .sec-ic{ font-family:var(--mono,'IBM Plex Mono',monospace); font-size:.78rem; font-weight:700; }
.sec-switch button[aria-pressed="true"]{ color:#fff; }
.sec-switch .sec-thumb{
  position:absolute; z-index:0; top:4px; bottom:4px; left:4px; width:calc((100% - 8px) / var(--n,2)); border-radius:999px; transform:translateX(calc(100% * var(--at,0)));
  background:linear-gradient(135deg,#16213F,#2C3A63); transition:transform .35s cubic-bezier(.65,0,.35,1), background .35s ease;
}
.sec-switch[data-on="english"] .sec-thumb{ background:linear-gradient(135deg,#0B6E63,#2B3A8F); }
.sec-switch[data-on="toefl"] .sec-thumb{ background:linear-gradient(135deg,#4A2A8A,#A8402F); }
.sec-switch button:focus-visible{ outline:2px solid var(--gold,#E8A23C); outline-offset:2px; }
.sec-switch.big button{ font-size:1rem; padding:11px 22px; }
@media(max-width:420px){ .sec-switch button{ padding:8px 12px; font-size:.84rem; } }
@media(max-width:560px){
  .sec-switch.sec-3 button, .sec-switch.sec-3.big button{ padding:9px 13px; font-size:.86rem; }
  .sec-switch.sec-3 .sec-ic{ display:none; }
}
html[data-theme="dark"] .sec-switch{ background:#182034; border-color:rgba(233,238,248,.14); }
html[data-theme="dark"] .sec-switch button{ color:#9FAEC6; }
html[data-theme="dark"] .sec-switch button[aria-pressed="true"]{ color:#fff; }

/* ---- the transition ---- */
.sec-ov{
  position:fixed; inset:0; z-index:9999; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px;
  color:#fff; pointer-events:all; clip-path:circle(0 at var(--x,50%) var(--y,50%));
}
.sec-ov.sat{ background:radial-gradient(circle at 30% 20%,#2C3A63,#16213F 70%); }
.sec-ov.english{ background:radial-gradient(circle at 70% 25%,#2B3A8F,#0B6E63 72%); }
.sec-ov.toefl{ background:radial-gradient(circle at 28% 78%,#A8402F,#4A2A8A 46%,#1B1640 82%); }
.sec-ov .sec-word{ font-family:var(--display,'Fraunces',serif); font-weight:700; font-size:clamp(3rem,11vw,7.5rem); line-height:1; letter-spacing:-.02em; display:flex; }
.sec-ov.sat .sec-word{ color:#E8A23C; }
.sec-ov .sec-word span{ display:inline-block; opacity:0; transform:translateY(60%) rotate(6deg); }
.sec-ov .sec-sub{ font-family:var(--mono,'IBM Plex Mono',monospace); font-size:.9rem; letter-spacing:.18em; text-transform:uppercase; opacity:0; transform:translateY(10px);
  max-width:92vw; padding:0 16px; text-align:center; line-height:1.7; }
@media(max-width:560px){ .sec-ov .sec-sub{ font-size:.68rem; letter-spacing:.12em; } }
.sec-ov .sec-orbit{ position:absolute; inset:0; overflow:hidden; pointer-events:none; }
.sec-ov .sec-orbit i{
  position:absolute; font-style:normal; font-family:var(--mono,'IBM Plex Mono',monospace); font-weight:700; font-size:1.1rem;
  color:rgba(255,255,255,.22); opacity:0;
}

/* Leaving: the circle grows from the button, then the word rises. */
.sec-ov.leave{ animation:secGrow .62s cubic-bezier(.65,0,.35,1) forwards; }
.sec-ov.leave .sec-word span{ animation:secRise .5s cubic-bezier(.2,.8,.2,1) forwards; animation-delay:calc(.22s + var(--i) * .045s); }
.sec-ov.leave .sec-sub{ animation:secFade .4s ease forwards .45s; }
.sec-ov.leave .sec-orbit i{ animation:secFloat 1.2s ease-out forwards; animation-delay:calc(.25s + var(--i) * .03s); }

/* Arriving: the word flies away and the cover lifts to reveal the page. */
.sec-ov.arrive{ clip-path:circle(150% at 50% 50%); animation:secLift .7s cubic-bezier(.65,0,.35,1) forwards .38s; }
.sec-ov.arrive .sec-word span{ opacity:1; transform:none; animation:secAway .45s cubic-bezier(.5,0,.75,0) forwards; animation-delay:calc(.05s + var(--i) * .035s); }
.sec-ov.arrive .sec-sub{ opacity:1; transform:none; animation:secAway .35s ease forwards .05s; }

@keyframes secGrow{ to{ clip-path:circle(150% at var(--x,50%) var(--y,50%)); } }
@keyframes secRise{ to{ opacity:1; transform:none; } }
@keyframes secFade{ to{ opacity:.85; transform:none; } }
@keyframes secFloat{ 0%{ opacity:0; transform:translateY(30px) scale(.8); } 40%{ opacity:1; } 100%{ opacity:.9; transform:translateY(-40px) scale(1); } }
@keyframes secAway{ to{ opacity:0; transform:translateY(-70%) rotate(-4deg); } }
@keyframes secLift{ to{ clip-path:circle(0 at 50% -10%); } }

/* While the cover is up on arrival, hold the page's own entrance animations back. */
html.sec-arriving body{ overflow:hidden; }

@media (prefers-reduced-motion: reduce){
  .sec-ov{ display:none !important; }
  .sec-switch .sec-thumb{ transition:none; }
}
