/* PHYSOC public site + TV.
   Palette: cyanotype. A blueprint-blue page with pale "photographic paper" ink,
   and one H-alpha red (656 nm) reserved for whatever is happening next. */

@font-face {
  font-family: 'Archivo';
  src: url('/assets/fonts/archivo-wdth.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #000000;          /* page (the Website screen's Background colour replaces these three) */
  --ink-deep: #000000;     /* footer, wells */
  --ink-raise: #0f0f0f;    /* hover rows */
  --paper: #eaf1f8;        /* main text */
  --paper-dim: #a9c2dd;    /* secondary text */
  --rule: rgba(169, 194, 221, 0.22);
  --grid: rgba(141, 179, 218, 0.28);
  --halpha: #ef5a64;       /* next / live */
  --wide: 125%;
  --measure: 38rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--ink); }
body {
  margin: 0;
  font-family: 'Archivo', system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--paper);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: lining-nums;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-color: var(--halpha); }
:focus-visible { outline: 2px solid var(--paper); outline-offset: 3px; border-radius: 2px; }
img { max-width: 100%; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

h1, h2, h3 { font-stretch: var(--wide); line-height: 1.05; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.6rem, 8vw, 6.25rem); font-weight: 800; letter-spacing: -0.025em; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); font-weight: 750; }
h3 { font-size: 1.25rem; font-weight: 700; }
p { margin: 0 0 1em; max-width: var(--measure); }

.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- announcement banner (switched on in the portal) ---------- */
.banner { background: var(--halpha); color: var(--on-halpha, #fff); font-weight: 600; font-size: 0.98rem; position: relative; z-index: 3; }
.banner .wrap { padding-top: 0.6rem; padding-bottom: 0.6rem; display: flex; gap: 1rem; flex-wrap: wrap; align-items: baseline; }
.banner a { color: inherit; }
.spacer-4 { height: 4rem; }

/* ---------- header ---------- */
.site-header {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.25rem var(--gutter);
  max-width: 72rem; margin: 0 auto;
}
.wordmark {
  font-stretch: var(--wide); font-weight: 850; font-size: 1.35rem; letter-spacing: -0.02em;
  text-decoration: none;
}
.site-nav { display: flex; gap: clamp(0.75rem, 2.5vw, 2rem); align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.site-nav a { text-decoration: none; font-size: 0.98rem; color: var(--paper-dim); }
.site-nav a:hover, .site-nav a[aria-current='page'] { color: var(--paper); }
.site-nav a[aria-current='page'] { text-decoration: underline; text-decoration-color: var(--halpha); text-decoration-thickness: 2px; }

.button {
  display: inline-flex; align-items: center; gap: 0.5em;
  padding: 0.7em 1.25em; border-radius: 999px;
  background: var(--paper); color: var(--ink);
  font-weight: 650; text-decoration: none; font-size: 1rem;
  border: 1.5px solid var(--paper);
}
.button:hover { background: #fff; }
.button.ghost { background: transparent; color: var(--paper); border-color: var(--rule); }
.button.ghost:hover { border-color: var(--paper); }
.site-nav .button { color: var(--ink); padding: 0.45em 1em; font-size: 0.95rem; }

/* ---------- hero ---------- */
.hero { position: relative; min-height: min(92vh, 56rem); display: flex; flex-direction: column; margin-top: -4.5rem; }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero { touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; } /* holding a finger drops a mass, so no zoom, text selection or long-press menu */
.hero-body {
  position: relative; z-index: 1; margin-top: auto;
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(16rem, 1fr); gap: 3rem; align-items: end;
  padding-top: 8rem; padding-bottom: clamp(2.5rem, 7vh, 5rem);
  pointer-events: none;
}
.hero-body a, .hero-body button { pointer-events: auto; }
.hero h1 { max-width: 11ch; }
/* letters split up by spacetime.js so they can bend toward the cursor */
[data-warp] .word { display: inline-block; white-space: nowrap; }
[data-warp] .ch { display: inline-block; will-change: transform; }
.hero .lede { font-size: 1.2rem; color: var(--paper-dim); margin-top: 1.25rem; max-width: 30rem; }
.hero .actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.75rem; }

/* the next event, pinned in the hero */
.next-up { border-left: 2px solid var(--halpha); padding: 0.25rem 0 0.25rem 1.25rem; }
.next-up .when { color: var(--halpha); font-weight: 650; font-size: 0.95rem; }
.next-up h2 { font-size: clamp(1.4rem, 2.4vw, 1.9rem); margin: 0.35rem 0 0.5rem; }
.next-up .meta { color: var(--paper-dim); font-size: 0.98rem; margin: 0; }
.next-up a { text-decoration: none; }
.next-up a:hover h2 { text-decoration: underline; text-decoration-color: var(--halpha); }

/* ---------- easter egg: the strange star and the wormhole ---------- */
.anomaly {
  position: absolute; z-index: 1; top: 38%; right: 22%;
  width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%;
  background: radial-gradient(circle, var(--paper) 0 1.5px, transparent 2.5px);
  cursor: pointer; opacity: 0.45;
  animation: twinkle 4s ease-in-out infinite;
}
.anomaly:hover, .anomaly:focus-visible {
  opacity: 1;
  background: radial-gradient(circle, var(--paper) 0 2px, rgba(239, 90, 100, 0.35) 3px, transparent 9px);
}
@keyframes twinkle { 0%, 100% { opacity: 0.25; } 50% { opacity: 0.6; } }
@media (max-width: 760px) { .anomaly { top: 22%; right: 12%; } }

.wormhole-open, .wormhole-open body { overflow: hidden; }
.wormhole {
  position: fixed; z-index: 20; width: 340px; height: 340px; margin: -170px 0 0 -170px;
  border-radius: 50%; pointer-events: none;
  background:
    radial-gradient(circle, #000 0 22%, transparent 46%),
    conic-gradient(from 0deg, var(--halpha), var(--ink), var(--paper-dim), var(--ink), var(--halpha));
  -webkit-mask: radial-gradient(circle, #000 40%, transparent 70%);
          mask: radial-gradient(circle, #000 40%, transparent 70%);
  animation: wormhole-open 900ms cubic-bezier(.2, .8, .2, 1) both, wormhole-spin 1.6s linear infinite;
}
.wormhole.closing { animation: wormhole-close 400ms ease-in both; }
@keyframes wormhole-open { from { transform: scale(0) rotate(0deg); } to { transform: scale(1) rotate(180deg); } }
@keyframes wormhole-spin { to { rotate: 360deg; } }
@keyframes wormhole-close { to { transform: scale(0); opacity: 0; } }

.wormhole-card {
  position: fixed; z-index: 21; left: 50%; top: 50%;
  width: min(92vw, 720px); padding: 1.25rem;
  transform: translate(-50%, -50%);
  background: var(--ink-deep); border: 1px solid var(--rule); border-radius: 18px;
  box-shadow: 0 30px 120px rgba(0, 0, 0, 0.6);
  text-align: center;
  animation: emerge 700ms cubic-bezier(.2, 1.3, .3, 1) both;
}
.wormhole-card.leaving { animation: vanish 450ms ease-in both; }
@keyframes emerge {
  from { transform: translate(calc(-50% + var(--from-x)), calc(-50% + var(--from-y))) scale(0.05) rotate(-200deg); opacity: 0; }
  to { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
}
@keyframes vanish {
  to { transform: translate(calc(-50% + var(--from-x)), calc(-50% + var(--from-y))) scale(0.05) rotate(200deg); opacity: 0; }
}
.wormhole-video { aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; background: #000; }
.wormhole-video iframe { width: 100%; height: 100%; border: 0; display: block; }
.wormhole-card p { margin: 1rem auto; color: var(--paper-dim); }

/* ---------- sections ---------- */
.section { padding: clamp(3.5rem, 9vw, 7rem) 0; }
.section + .section { border-top: 1px solid var(--rule); }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 2rem; flex-wrap: wrap; }
.section-head a { color: var(--paper-dim); }
.page-title { padding: clamp(3rem, 8vw, 6rem) 0 2rem; }
.page-title p { color: var(--paper-dim); font-size: 1.2rem; margin-top: 1rem; }

/* ---------- event list: a timeline, so dates lead ---------- */
.events { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.event {
  display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) auto; gap: 1.5rem; align-items: start;
  padding: 1.5rem 0; border-bottom: 1px solid var(--rule);
}
.event-date { font-stretch: var(--wide); line-height: 1; }
.event-date .d { display: block; font-size: 2.6rem; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.event-date .m { display: block; font-size: 0.95rem; color: var(--paper-dim); margin-top: 0.3rem; }
.event-date .m + .m { margin-top: 0.1rem; }
.event-date .tba { font-size: 1.1rem; font-weight: 700; color: var(--paper-dim); }
.event h3 { margin-bottom: 0.35rem; }
.event .meta { color: var(--paper-dim); margin: 0 0 0.5rem; font-size: 0.98rem; }
.event .blurb { margin: 0; }
.event .go { align-self: center; white-space: nowrap; }
.event.is-next .event-date .d { color: var(--halpha); }
.events.past .event { grid-template-columns: 6.5rem minmax(0, 1fr); opacity: 0.75; padding: 1rem 0; }
.events.past .event-date .d { font-size: 1.6rem; }
.empty { color: var(--paper-dim); padding: 1.5rem 0; border-top: 1px solid var(--rule); }

/* ---------- what we do ---------- */
.offer { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.5rem 3rem; }
@media (min-width: 1000px) { .offer { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 560px) { .offer { grid-template-columns: 1fr; } }
.offer h3 { margin-bottom: 0.6rem; }
.offer p { color: var(--paper-dim); margin: 0; }

/* ---------- about: team ---------- */
.team { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0; border-top: 1px solid var(--rule); }
.team li { padding: 1rem 0; border-bottom: 1px solid var(--rule); }
.team .name { font-weight: 650; display: block; }
.team .pos { color: var(--paper-dim); font-size: 0.95rem; }
.prose h2 { margin: 3rem 0 1rem; }
.prose ul { padding-left: 1.2rem; max-width: var(--measure); }
.prose ul.team { padding-left: 0; max-width: none; }

/* ---------- past papers ---------- */
.papers-search { width: 100%; max-width: 32rem; font: inherit; color: var(--paper); background: var(--ink-deep); border: 1.5px solid var(--rule); border-radius: 999px; padding: 0.7rem 1.2rem; }
.papers-search:focus { border-color: var(--paper); outline: none; }
.course { border-bottom: 1px solid var(--rule); }
.course summary { cursor: pointer; padding: 1rem 0; display: flex; justify-content: space-between; font-stretch: var(--wide); font-weight: 700; font-size: 1.15rem; }
.course summary span { font-stretch: 100%; font-weight: 400; color: var(--paper-dim); font-size: 0.95rem; }
.course ul { columns: 2 16rem; padding: 0 0 1rem 1.2rem; margin: 0; }
.course li { break-inside: avoid; padding: 0.15rem 0; }

/* ---------- footer ---------- */
.site-footer { background: var(--ink-deep); padding: 3rem 0 4rem; color: var(--paper-dim); font-size: 0.95rem; }
.site-footer .cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 3rem; }
.site-footer h2 { font-size: 1rem; color: var(--paper); margin-bottom: 0.6rem; font-stretch: 100%; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin: 0.3rem 0; }
.site-footer .small { margin-top: 2.5rem; font-size: 0.85rem; }

@media (max-width: 760px) {
  .hero-body { grid-template-columns: 1fr; gap: 2rem; padding-top: 6rem; }
  .event { grid-template-columns: 4.5rem minmax(0, 1fr); gap: 1rem; }
  .event .go { grid-column: 2; justify-self: start; }
  .event-date .d { font-size: 2rem; }
  .events.past .event { grid-template-columns: 4.5rem minmax(0, 1fr); }
  .site-footer .cols { grid-template-columns: 1fr; }
  .site-header { flex-wrap: wrap; }
  .site-nav { width: 100%; justify-content: flex-start; gap: 1.1rem; }
  .site-nav .button { margin-left: auto; }
  .site-nav a:not(.button) { font-size: 0.95rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

.paper-meta { color: var(--paper-dim); font-size: 0.9rem; margin-left: 0.4rem; }

/* ---------- easter eggs: the peeking cat and its games (assets/js/peeking-cat.js, cat-game.js, orbit-game.js) ---------- */

/* The cat's head sits behind the letter (z-index -1 inside the letter's own stacking context) and its
   paws sit in front. Positions are in em so they scale with the title. See the comments in peeking-cat.js. */
.ch.has-cat { position: relative; isolation: isolate; display: inline-block; }
.cat-peek, .cat-trigger {
  position: absolute;
  /* --cat-centre and --cat-rim are set per letter by peeking-cat.js (where the letter's middle and top edge are) */
  left: calc(var(--cat-centre, 0.385em) - 0.3em);
  top: calc(var(--cat-rim, 0.32em) - 0.27em);
  width: 0.6em;
  height: 0.4em;
}
.cat-peek { z-index: -1; pointer-events: none; transition: translate 200ms ease; }
.cat-trigger { all: unset; position: absolute; left: calc(var(--cat-centre, 0.385em) - 0.3em); top: calc(var(--cat-rim, 0.32em) - 0.27em); width: 0.6em; height: 0.4em; cursor: pointer; border-radius: 0.1em; }
.cat-trigger::before { content: ''; position: absolute; inset: -8px; } /* bigger tap target on phones */
.cat-trigger svg, .cat-peek { display: block; overflow: visible; }
.cat-trigger svg { width: 100%; height: 100%; }
.has-cat:has(.cat-trigger:hover) .cat-peek { translate: 0 -0.025em; } /* peeks up a little further */
.cat-trigger:focus-visible { outline: 3px solid var(--halpha); outline-offset: 2px; }

.cat-game-open, .cat-game-open body { overflow: hidden; }
.cat-game {
  padding: 0;
  border: 0;
  background: none;
  width: min(560px, calc(100vw - 1.5rem));
  max-height: calc(100dvh - 1.5rem);
  overflow: auto;
  font-stretch: 100%;
}
.cat-game::backdrop { background: rgb(0 0 0 / 0.7); }
.cat-game[open] { animation: cat-pop 220ms cubic-bezier(.2, .9, .3, 1.2); }
@keyframes cat-pop { from { scale: 0.92; opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cat-game[open] { animation: none; } .cat-peek { transition: none; } }
.cat-game svg [hidden] { display: none; }

.sc { margin: 0 6px 8px 0; background: #FFFDF8; border: 3px solid #3B2A20; border-radius: 22px; box-shadow: 6px 6px 0 #3B2A20; padding: 16px 18px 18px; color: #3B2A20; }
.sc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sc-head h2 { margin: 0; font-size: 1.3rem; font-weight: 600; font-stretch: 100%; letter-spacing: 0; color: #3B2A20; }
.sc-buttons { display: flex; gap: 8px; }
.sc-icon { all: unset; cursor: pointer; width: 34px; height: 34px; display: grid; place-items: center; border: 2.5px solid #3B2A20; border-radius: 50%; background: #fff; color: #3B2A20; }
.sc-icon:focus-visible { outline: 3px solid #EF9F27; outline-offset: 2px; }
.sc-hud { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 8px; }
.sc-pill { background: #FAEEDA; border: 2.5px solid #3B2A20; border-radius: 14px; padding: 6px 10px; text-align: center; }
.sc-pill span { display: block; font-size: 12px; color: #854F0B; }
.sc-pill b { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sc-meter { height: 12px; border: 2.5px solid #3B2A20; border-radius: 12px; background: #fff; overflow: hidden; }
.sc-meter i { display: block; height: 100%; width: 100%; background: #639922; }
.sc-stage { margin-top: 12px; background: #FAEEDA; border: 2.5px solid #3B2A20; border-radius: 16px; overflow: hidden; aspect-ratio: 420 / 260; }
.sc-stage svg { display: block; }
.sc-msg { min-height: 42px; margin: 12px 2px; font-size: 15px; line-height: 1.45; color: #633806; }
.sc-go { all: unset; box-sizing: border-box; cursor: pointer; width: 100%; text-align: center; padding: 12px; border: 3px solid #3B2A20; border-radius: 14px; background: #EF9F27; color: #3B2A20; font-weight: 600; font-size: 17px; box-shadow: 0 4px 0 #3B2A20; }
.sc-go:active { transform: translateY(3px); box-shadow: 0 1px 0 #3B2A20; }
.sc-go:focus-visible { outline: 3px solid #3B2A20; outline-offset: 3px; }
@media (max-width: 420px) { .sc-pill b { font-size: 16px; } .sc-pill span { font-size: 11px; } }

/* Orbit the cat (About page) */
.oc-stage { margin-top: 12px; border: 2.5px solid #3B2A20; border-radius: 16px; overflow: hidden; aspect-ratio: 420 / 300; background: #1F2A44; touch-action: none; }
.oc-stage canvas { display: block; width: 100%; height: 100%; cursor: grab; }
.oc-row { display: flex; align-items: center; gap: 10px; margin: 10px 2px 0; font-size: 14px; color: #633806; }
.oc-row label { width: 64px; }
.oc-row input { flex: 1; accent-color: #EF9F27; }
.oc-row output { width: 48px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Sponsors page: each tier is a metal, each sponsor a periodic table tile ---------- */

.element-iridium  { --metal: #c4b0f0; --metal-lo: #8a6bd1; --metal-ink: #1f1338; }
.element-gold     { --metal: #f0cf6b; --metal-lo: #c99a2e; --metal-ink: #2b1f04; }
.element-silver   { --metal: #cfd2d6; --metal-lo: #9a9fa6; --metal-ink: #1e2023; }

.tier { margin: 0 0 3.5rem; }
.tier-head { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 1.25rem; }
.tier-head h2 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); }

.element {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  aspect-ratio: 1; padding: 1.4em 0.9em 1em; border-radius: 6px; text-decoration: none;
  color: var(--metal-ink);
  background: linear-gradient(145deg, var(--metal) 0%, var(--metal) 45%, var(--metal-lo) 100%);
  border: 2px solid var(--metal-lo);
  transition: transform 150ms ease;
}
a.element:hover { transform: translateY(-3px); }
a.element:focus-visible { outline: 3px solid var(--halpha); outline-offset: 3px; }
.element .z { position: absolute; top: 0.55em; left: 0.7em; font-weight: 700; font-size: 0.95em; font-variant-numeric: tabular-nums; }
.element .tag, .element .mass { position: absolute; top: 0.55em; right: 0.7em; font-size: 0.8em; font-weight: 600; opacity: 0.75; }
.element .sym { font-stretch: var(--wide); font-weight: 800; font-size: 3.2em; line-height: 1; letter-spacing: -0.02em; }
.element .el-name { margin-top: 0.35em; font-weight: 650; text-align: center; line-height: 1.2; }
.element .blurb { margin-top: 0.45em; font-size: 0.85em; text-align: center; line-height: 1.35; opacity: 0.85; }
/* The logo plate has a fixed shape (wide), and the logo is scaled to fit inside it whatever its size */
.element .logo { position: relative; width: 78%; aspect-ratio: 2.2 / 1; background: #fff; border-radius: 4px; flex: none; }
.element .logo img { position: absolute; inset: 0.45em; width: calc(100% - 0.9em); height: calc(100% - 0.9em); object-fit: contain; }

/* the tier's own element, beside its heading */
.element-key { width: 6.5rem; flex: none; padding: 1.2em 0.4em 0.9em; font-size: 0.85rem; }
.element-key .sym { font-size: 2.4em; }
.element-key .mass { position: static; margin-top: 0.15em; opacity: 0.8; }

.elements { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.9rem; }
.tier-iridium .elements { grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); font-size: 1.05rem; }
.tier-gold .elements { grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr)); }
.tier-silver .elements { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); font-size: 0.9rem; }
.tier-iridium .element { aspect-ratio: 5 / 4; }

.element-empty { background: transparent; color: var(--paper-dim); border-style: dashed; }
.element-empty .sym { opacity: 0.6; }

.sponsor-pitch { border-top: 1px solid var(--rule); margin-top: 1rem; }
.sponsor-pitch h2 { margin-top: 2.5rem; }
@media (prefers-reduced-motion: reduce) { .element { transition: none; } }

/* Five menu items: tighten them on narrow phones so Join stays on the same line */
@media (max-width: 440px) {
  .site-nav { gap: 0.75rem; }
  .site-nav a:not(.button) { font-size: 0.86rem; }
  .site-nav .button { padding: 0.4em 0.8em; font-size: 0.86rem; }
}

/* Nucleosynthesis (Events page): a tall jar, kept short enough to fit on screen with the card */
.ng .ng-stage {
  width: min(100%, calc((100dvh - 23rem) * 360 / 560)); min-width: 220px; margin: 12px auto 0;
  aspect-ratio: 360 / 560; border: 2.5px solid #3B2A20; border-radius: 16px; overflow: hidden; background: #1F2A44; touch-action: none;
}
.ng .ng-stage canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }
.ng .ng-stage canvas:focus-visible { outline: 3px solid #EF9F27; outline-offset: -3px; }
.ng .sc-msg { min-height: 2.6em; margin: 10px 2px 4px; }
.ng-chain { display: flex; flex-wrap: wrap; gap: 2px 12px; margin: 0 2px 12px; font-size: 12px; color: #854F0B; line-height: 1.6; }
.ng-chain span { white-space: nowrap; }

/* Binary merger on phones: the ring that fills while you hold a finger on the grid (spacetime.js) */
@property --fill { syntax: '<number>'; inherits: false; initial-value: 0; }
.hold-ring {
  position: absolute; z-index: 3; width: 64px; height: 64px; margin: -32px 0 0 -32px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(var(--halpha) calc(var(--fill) * 1turn), rgb(255 255 255 / 0.15) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
  animation: hold-fill linear forwards;
}
@keyframes hold-fill { to { --fill: 1; } }

/* ---------- About page: "How PhySoc is run" chart (assets/js/structure.js) ---------- */

.structure { margin-top: 3rem; }
.structure-intro { color: var(--paper-dim); margin: 0.25rem 0 1.25rem; }
.prose ul.org-row { padding-left: 0; max-width: none; } /* not a text list */

/* leader on the left, arrow, their team(s) in a row on the right */
.org-leader-row {
  display: grid; grid-template-columns: 11rem 2.5rem minmax(0, 1fr); align-items: start;
  grid-template-areas: "lead arrow teams" "lone . teams";
  grid-template-rows: auto 1fr; /* the lead card's row hugs the card, so lone reports sit right under it */
}
.org-lead { grid-area: lead; }
.org-left { grid-area: arrow; }
.org-teams { grid-area: teams; }
.org-lone { grid-area: lone; display: flex; flex-direction: column; }
.org-left { display: flex; justify-content: center; padding-top: 2.1rem; color: var(--paper-dim); }
.org-lead-up { width: 11rem; }
.org-up { display: flex; justify-content: center; align-items: center; height: 1.9rem; color: var(--paper-dim); }
.org-teams { display: grid; gap: 1rem; }
.org-label { margin: 0 0 0.45rem; font-size: 0.85rem; color: var(--paper-dim); }
.org-row { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); align-items: start; }
.org-member { display: flex; flex-direction: column; min-width: 0; }
.org-front b { overflow-wrap: anywhere; }

/* the card: both faces share one grid cell, so it's as tall as whichever face needs more room */
.org-card { display: grid; width: 100%; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; perspective: 900px; }
.org-card:focus-visible { outline: 3px solid var(--halpha); outline-offset: 3px; border-radius: 10px; }
.org-face {
  grid-area: 1 / 1; position: relative; display: flex; flex-direction: column; gap: 0.25rem;
  min-height: 4.6rem; padding: 0.85rem 2.3rem 1.9rem 0.85rem; border-radius: 10px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform 500ms cubic-bezier(.3, .7, .3, 1);
}
.org-front { background: var(--ink-raise); border: 1px solid var(--rule); }
.org-front b { font-stretch: var(--wide); font-size: 1rem; line-height: 1.15; }
.org-sym { position: absolute; top: 0.55rem; right: 0.75rem; font-size: 1.35rem; line-height: 1; color: var(--paper-dim); }
.org-flip { position: absolute; bottom: 0.55rem; right: 0.6rem; transition: transform 300ms ease; }
.org-front .org-flip { color: #fff; }
.org-back { position: absolute; inset: 0; background: var(--paper); color: var(--ink); transform: rotateY(180deg); font-size: 0.86rem; line-height: 1.38; padding-bottom: 2rem; }
/* the card is sized by whichever face is showing, so it only grows while flipped */
.org-card.flipped .org-back { position: relative; inset: auto; }
.org-card.flipped .org-front { position: absolute; inset: 0; }
.org-back b { font-size: 0.9rem; }
.org-card.flipped .org-front { transform: rotateY(-180deg); }
.org-card.flipped .org-back { transform: rotateY(0deg); }
.org-card:hover .org-front { border-color: var(--paper-dim); }
.org-card:hover .org-flip { transform: rotate(-30deg); }
.org-subcom .org-front { background: transparent; border-style: dashed; }

/* folding a member's team away */
.org-toggle {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 0.35rem; margin-top: 0.4rem; padding: 0.2rem 0.65rem;
  border: 1px solid var(--rule); border-radius: 99px; background: none; color: var(--paper-dim); font: inherit; font-size: 0.8rem; cursor: pointer;
}
.org-toggle:hover { color: var(--paper); border-color: var(--paper-dim); }
.org-toggle:focus-visible { outline: 3px solid var(--halpha); outline-offset: 2px; }
.org-count { min-width: 1.4em; padding: 0 0.35em; border-radius: 99px; background: var(--rule); color: var(--paper); text-align: center; font-variant-numeric: tabular-nums; }
.org-toggle svg { transition: transform 300ms ease; }
.org-member.open .org-toggle svg { transform: rotate(180deg); }
.org-fold { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 350ms ease; }
.org-fold > div { overflow: hidden; }
.org-member.open .org-fold { grid-template-rows: 1fr; }

/* phones: one column, each leader's people indented under them with a bracket line */
@media (max-width: 640px) {
  .org-leader-row { display: block; margin-bottom: 1rem; }
  .org-lead { max-width: 14rem; }
  .org-left, .org-lead-up, .org-lone > .org-up { display: none; }
  .org-teams, .org-lone { margin: 0.6rem 0 0 0.9rem; padding-left: 0.9rem; border-left: 2px solid var(--rule); gap: 0.8rem; }
  .org-lone { display: grid; gap: 0.6rem; max-width: 13rem; }
  .org-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .org-face, .org-fold, .org-toggle svg, .org-flip { transition: none; }
}
