/* ==========================================================
   Trenton-Website  ·  styles
   palette: warm cream paper + Berkeley navy/gold + coral pop
   ========================================================== */

:root {
  --bg: #fbf6e9;
  --bg-2: #f5edd6;
  --ink: #15131c;
  --ink-soft: #4a4459;
  --muted: #7a7388;
  --line: #1513201a;

  --navy: #003262;
  --gold: #fdb515;
  --coral: #f25c54;
  --plum: #6c4ab6;

  --display: "Fraunces", ui-serif, Georgia, "Times New Roman", serif;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --rad: 18px;
  --rad-sm: 10px;
  --shadow-card: 0 1px 0 #1513200a, 0 18px 40px -22px #15132040;
  --shadow-card-hover: 0 1px 0 #1513200a, 0 28px 60px -20px #15132060;

  --max: 1180px;
  --pad-x: clamp(1.25rem, 4vw, 3rem);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  /* Establishes positioning context for the absolute .bg-depth-glyphs layer
     so it spans the full document height. */
  position: relative;
}

/* paper grain overlay */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.06;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.7 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ============== SITE-WIDE STACKED DEPTH LAYERS (option 6) ============== */
.bg-depth {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.bg-depth-blobs,
.bg-depth-dots {
  position: absolute;
  inset: -25vh;
  will-change: transform;
}
/* Glyph layer is OUTSIDE .bg-depth so it spans the full document — that way
   glyphs are scattered across every scroll position, not just the first
   viewport's worth of content. */
.bg-depth-glyphs {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  will-change: transform;
}
/* Layer 1: slowest — soft warm blobs (deepest) */
.bg-depth-blobs {
  background:
    radial-gradient(circle at 14% 18%, rgba(253, 181, 21, 0.10) 0%, transparent 22%),
    radial-gradient(circle at 82% 30%, rgba(242, 92, 84, 0.08)  0%, transparent 22%),
    radial-gradient(circle at 36% 70%, rgba(108, 74, 182, 0.07) 0%, transparent 22%),
    radial-gradient(circle at 88% 82%, rgba(0, 50, 98, 0.06)    0%, transparent 22%),
    radial-gradient(circle at 8% 92%,  rgba(253, 181, 21, 0.06) 0%, transparent 18%);
  filter: blur(20px);
  transform: translateY(var(--depth-blobs-y, 0));
}
/* Layer 2: mid — faint dot grid */
.bg-depth-dots {
  background-image: radial-gradient(circle, rgba(21, 19, 32, 0.18) 0.7px, transparent 0.8px);
  background-size: 26px 26px;
  opacity: 0.45;
  transform: translateY(var(--depth-dots-y, 0));
}
/* Layer 3: fastest — drifting math/code glyphs */
.bg-depth-glyphs {
  transform: translateY(var(--depth-glyphs-y, 0));
}
.bg-depth-glyphs span {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: rotate(var(--r));
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(2.6rem, 6.5vw, 5.5rem);
  color: var(--ink);
  opacity: 0.085;
  user-select: none;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) {
  .bg-depth-blobs, .bg-depth-dots, .bg-depth-glyphs { transform: none !important; }
}

/* Pull main content above the depth layer */
main { position: relative; z-index: 2; }

/* hide native cursor on devices that have a fine pointer */
@media (pointer: fine) {
  body { cursor: none; }
  a, button, .magnetic, .card, .poster, .scroll-nudge { cursor: none; }
}

.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 9999;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  will-change: transform;
}
.cursor-dot {
  width: 6px; height: 6px;
  background: var(--ink);
}
.cursor-ring {
  width: 32px; height: 32px;
  border: 1.5px solid var(--ink);
  transition: width .2s ease, height .2s ease, background .2s ease, border-color .2s ease, opacity .2s ease;
  mix-blend-mode: difference;
  filter: invert(1);
}
.cursor-ring.is-hover {
  width: 60px; height: 60px;
  background: var(--gold);
  border-color: transparent;
  mix-blend-mode: normal;
  filter: none;
  opacity: 0.85;
}
@media (pointer: coarse) {
  .cursor-dot, .cursor-ring { display: none; }
}

/* nav */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem var(--pad-x);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  background: color-mix(in oklab, var(--bg) 75%, transparent);
  border-bottom: 1px solid var(--line);
}
.nav-mark {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.nav-mark .dot { color: var(--coral); }
.nav-links {
  display: flex;
  gap: 1.25rem;
  font-size: 0.92rem;
  font-weight: 500;
}
.nav-links a {
  color: var(--ink-soft);
  text-decoration: none;
  position: relative;
  padding: 4px 2px;
  transition: color .2s ease;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; right: 100%;
  bottom: 0;
  height: 2px;
  background: var(--coral);
  transition: right .25s ease;
}
.nav-links a:hover::after { right: 0; }

/* layout */
.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(4rem, 8vw, 7rem) var(--pad-x);
  position: relative;
  z-index: 2;
}
.section-head {
  margin-bottom: 2.5rem;
}
.section-num {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--coral);
  margin-bottom: 0.5rem;
}
.section-head h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.75rem, 3.5vw, 2.6rem);
  letter-spacing: -0.025em;
  margin: 0;
  line-height: 1.1;
}
.section-sub {
  margin: 0.75rem 0 0;
  color: var(--ink-soft);
  font-size: 1.02rem;
  max-width: 60ch;
}
.section-sub code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--bg-2);
  padding: 1px 6px;
  border-radius: 6px;
}

/* ============== HERO ============== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7rem var(--pad-x) 4rem;
  overflow: hidden;
  z-index: 2;
}
.hero-inner {
  max-width: 980px;
  width: 100%;
  text-align: left;
  position: relative;
}
.eyebrow {
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--coral);
  margin: 0 0 1.5rem;
}
.name {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(3rem, 11vw, 8rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin: 0 0 1.5rem;
  color: var(--ink);
}
.name span { display: block; }
.name .serif-italic {
  font-style: italic;
  font-weight: 600;
  color: var(--navy);
  padding-left: clamp(2rem, 9vw, 6rem);
}
.hero-tag {
  font-family: var(--display);
  font-size: clamp(1.2rem, 2.6vw, 1.85rem);
  font-weight: 400;
  line-height: 1.4;
  margin: 0 0 1.25rem;
  max-width: 38ch;
  color: var(--ink);
}
.rotator {
  display: inline-block;
  position: relative;
  vertical-align: baseline;
  height: 1.4em;
  min-width: 14ch;
  overflow: hidden;
  font-style: italic;
  color: var(--navy);
  font-weight: 600;
  border-bottom: 3px solid var(--gold);
  padding: 0 0.15em 0.05em;
}
.rotator-word {
  display: inline-block;
  position: absolute;
  left: 0.15em;
  top: 0;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(0.5em);
  transition: opacity .45s ease, transform .45s ease;
}
.rotator-word.is-active {
  opacity: 1;
  transform: translateY(0);
}
.rotator-word.is-leaving {
  opacity: 0;
  transform: translateY(-0.5em);
}

.hero-meta {
  font-family: var(--mono);
  font-size: 0.86rem;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin: 1.5rem 0 2rem;
}
.hero-meta strong { color: var(--ink); font-weight: 600; }
.dot-sep { color: var(--coral); }

.hero-cta {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.95rem 1.6rem;
  font-family: var(--sans);
  font-size: 0.98rem;
  font-weight: 600;
  border-radius: 999px;
  text-decoration: none;
  transition: transform .15s ease, background .2s ease, color .2s ease, box-shadow .2s ease;
  border: 1.5px solid transparent;
  white-space: nowrap;
}
.btn-primary {
  background: var(--ink);
  color: var(--bg);
}
.btn-primary:hover { background: var(--navy); }
.btn-ghost {
  border-color: var(--ink);
  color: var(--ink);
}
.btn-ghost:hover {
  background: var(--ink);
  color: var(--bg);
}

/* hero background blobs */
.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  will-change: transform;
}
.blob-a {
  width: 38vw; height: 38vw;
  background: var(--gold);
  top: -8%; right: -10%;
}
.blob-b {
  width: 30vw; height: 30vw;
  background: var(--coral);
  bottom: -10%; left: 10%;
  opacity: 0.4;
}
.blob-c {
  width: 24vw; height: 24vw;
  background: var(--plum);
  top: 30%; left: -8%;
  opacity: 0.3;
}

/* scroll nudge */
.scroll-nudge {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  width: 26px; height: 42px;
  border: 1.5px solid var(--ink-soft);
  border-radius: 14px;
  display: block;
}
.scroll-nudge span {
  display: block;
  width: 3px; height: 8px;
  background: var(--ink);
  border-radius: 2px;
  margin: 6px auto;
  animation: nudge 1.6s ease-in-out infinite;
}
@keyframes nudge {
  0%, 100% { transform: translateY(0); opacity: 0.6; }
  50%      { transform: translateY(12px); opacity: 0.1; }
}

/* ============== ABOUT ============== */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 2.5rem;
}
.about-prose p {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.18rem;
  line-height: 1.6;
  color: var(--ink);
  margin: 0 0 1.1em;
}
.about-prose mark {
  background: linear-gradient(180deg, transparent 60%, var(--gold) 60%);
  color: inherit;
  padding: 0 2px;
}
.about-prose em { color: var(--coral); font-style: italic; }
.about-prose abbr {
  text-decoration: underline dotted var(--ink-soft);
  cursor: help;
}

.now-card {
  background: var(--bg-2);
  border: 1.5px solid var(--ink);
  border-radius: var(--rad);
  padding: 1.5rem;
  align-self: start;
  position: relative;
  box-shadow: 6px 6px 0 var(--ink);
}
.now-card h3 {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--coral);
  margin: 0 0 1rem;
}
.now-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.8rem;
}
.now-card li {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 0.75rem;
  align-items: baseline;
  font-size: 0.95rem;
}
.now-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--navy);
}

@media (max-width: 760px) {
  .about-grid { grid-template-columns: 1fr; }
}

/* ============== PROJECTS ============== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}
.card {
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: var(--rad);
  padding: 1.4rem 1.4rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transform: rotate(var(--tilt, 0deg));
  transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s ease;
  box-shadow: var(--shadow-card);
  position: relative;
}
.card:hover {
  transform: rotate(0) translateY(-6px);
  box-shadow: var(--shadow-card-hover);
}
.card-tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--navy);
  text-transform: uppercase;
}
.card h3 {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
  line-height: 1.2;
}
.card p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
  line-height: 1.55;
}
.card-stats {
  list-style: none;
  margin: auto 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink);
}
.card-stats strong {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--coral);
  margin-right: 0.25rem;
}
.card-foot {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 1px dashed var(--line);
  padding-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.card-link {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--coral);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: inherit;
}
.card-link:hover { color: var(--ink); }
.card-link-muted {
  color: var(--muted);
  cursor: default;
}
/* ============== CODING SAMPLES (alternating editorial pieces, giant background numerals) ============== */
.samples-pieces {
  display: grid;
  gap: clamp(4rem, 8vh, 7rem);
  margin: 3rem 0 1rem;
  position: relative;
}

/* Giant 01 / 02 numeral sitting behind each piece — drifts with parallax */
.sample-numeral {
  position: absolute;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(9rem, 26vw, 22rem);
  letter-spacing: -0.06em;
  line-height: 0.85;
  color: var(--coral);
  opacity: 0.08;
  z-index: 0;
  top: -1rem;
  right: -1rem;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  will-change: transform;
  transform: translateY(var(--numeral-y, 0));
}
.sample-piece-flip .sample-numeral {
  right: auto;
  left: -1rem;
  top: auto;
  bottom: -1rem;
  color: var(--plum);
}
@media (prefers-reduced-motion: reduce) {
  .sample-numeral { transform: none; }
}

.sample-piece {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  position: relative;
}
.sample-piece-flip {
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
}
.sample-piece-flip .sample-frame { grid-column: 2; grid-row: 1; }
.sample-piece-flip .sample-body  { grid-column: 1; grid-row: 1; }

.sample-frame {
  position: relative;
  padding: 12px;
  background:
    linear-gradient(135deg, #1d1729 0%, #2a2438 30%, #15131c 55%, #2a2438 80%, #1d1729 100%);
  border-radius: 6px;
  box-shadow:
    0 1px 0 #ffffff10 inset,
    0 -1px 0 #00000080 inset,
    0 22px 50px -22px #15132060,
    0 8px 18px -10px #15132040;
  transform: rotate(var(--rot, 0deg)) translateY(var(--frame-y, 0px));
  transition: transform .4s cubic-bezier(.2,.8,.2,1);
  width: clamp(240px, 32vw, 400px);
  max-width: 100%;
  overflow: hidden;
  will-change: transform;
}
.sample-frame::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 4px;
  border: 1px solid #ffffff20;
  pointer-events: none;
  z-index: 2;
}
.sample-frame:hover { transform: rotate(0); }
.sample-frame img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
  -webkit-user-drag: none;
  user-select: none;
  cursor: zoom-in;
}

.sample-body { padding: 0.5rem 0; }
.sample-eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  color: var(--coral);
  margin-bottom: 0.4rem;
}
.sample-body h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.3rem, 2.2vw, 1.7rem);
  letter-spacing: -0.018em;
  line-height: 1.15;
  margin: 0 0 0.7rem;
}
.sample-body p {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.04rem;
  line-height: 1.55;
  color: var(--ink);
  margin: 0 0 0.9rem;
}
.sample-caveat {
  font-family: var(--sans) !important;
  font-size: 0.86rem !important;
  line-height: 1.5 !important;
  color: var(--ink-soft) !important;
  background: var(--bg-2);
  border-left: 3px solid var(--coral);
  padding: 0.7rem 0.9rem !important;
  border-radius: 4px;
  margin-bottom: 0.9rem !important;
}
.sample-caveat strong {
  font-family: var(--display);
  font-weight: 700;
  color: var(--ink);
}
.sample-caveat em {
  font-style: italic;
  color: var(--coral);
}
.sample-stats {
  list-style: none;
  margin: 0 0 0.9rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-family: var(--mono);
  font-size: 0.82rem;
}
.sample-stats strong {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--coral);
  margin-right: 0.25rem;
}
.sample-downloads {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.sample-downloads a {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 500;
  background: var(--bg-2);
  border: 1px solid var(--ink);
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  transition: background .15s ease, color .15s ease, transform .15s ease;
  white-space: nowrap;
}
.sample-downloads a:hover {
  background: var(--ink);
  color: var(--bg);
  transform: translateY(-1px);
}

@media (max-width: 760px) {
  .samples-pieces { gap: 2.5rem; }
  .sample-piece,
  .sample-piece-flip {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .sample-piece-flip .sample-frame,
  .sample-piece-flip .sample-body {
    grid-column: 1;
    grid-row: auto;
  }
  .sample-frame {
    transform: rotate(0);
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
  }
  .sample-numeral {
    font-size: clamp(7rem, 32vw, 12rem);
    opacity: 0.06;
  }
}

.card-grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}
.card-downloads {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.card-downloads a {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 500;
  background: var(--bg-2);
  border: 1px solid var(--ink);
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  transition: background .15s ease, color .15s ease, transform .15s ease;
  white-space: nowrap;
}
.card-downloads a:hover {
  background: var(--ink);
  color: var(--bg);
  transform: translateY(-1px);
}
.card-link-muted:hover { color: var(--muted); }
button.card-link[disabled] {
  cursor: inherit;
  opacity: 0.7;
}

/* Card with image/video media at the top */
.card-with-media {
  padding-top: 0;
  overflow: hidden;
}
.card-media {
  display: block;
  margin: 0 -1.4rem;
  aspect-ratio: 4 / 3;
  background: var(--bg-2);
  border-bottom: 1.5px solid var(--ink);
  overflow: hidden;
  position: relative;
  text-decoration: none;
}
.card-media img,
.card-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s cubic-bezier(.2,.8,.2,1);
}
.card-with-media > .card-media:first-child {
  margin-top: 0;
  border-top-left-radius: calc(var(--rad) - 2px);
  border-top-right-radius: calc(var(--rad) - 2px);
}
.card-media-video { aspect-ratio: 16 / 11; background: #000; }
.card-media-video video { object-fit: contain; background: #000; }
.card-with-media:hover .card-media img { transform: scale(1.04); }
.card-with-media .card-tag { padding-top: 1rem; }

/* ============== DIPLOMA FRAME ============== */
.diploma-frame {
  margin: 0 0 3rem;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: center;
}
.diploma-frame-inner {
  position: relative;
  padding: 14px;
  background:
    linear-gradient(135deg, #f5e3b3 0%, #e3c275 30%, #b8923a 55%, #e3c275 80%, #f5e3b3 100%);
  border-radius: 6px;
  box-shadow:
    0 1px 0 #fff8 inset,
    0 -1px 0 #0006 inset,
    0 6px 14px -6px rgba(21, 19, 32, 0.45),
    0 24px 48px -16px rgba(21, 19, 32, 0.55),
    0 60px 120px -32px rgba(21, 19, 32, 0.45);
  transform: rotate(-1.2deg);
  transition: transform .4s cubic-bezier(.2,.8,.2,1);
}
.diploma-frame-inner::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 4px;
  border: 1px solid #00000040;
  pointer-events: none;
}
.diploma-frame-inner:hover { transform: rotate(0); }
.diploma-frame-inner img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
  -webkit-user-drag: none;
  user-select: none;
  cursor: zoom-in;
}
.diploma-frame figcaption {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1rem 0;
}
.diploma-eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--coral);
}
.diploma-title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.diploma-meta {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink-soft);
}
@media (max-width: 760px) {
  .diploma-frame { grid-template-columns: 1fr; gap: 1.25rem; }
  .diploma-frame-inner { transform: rotate(-0.6deg); }
}

/* ============== RESEARCH WALL (timeline rail + poster rows) ============== */
.research-wall {
  display: grid;
  grid-template-columns: clamp(48px, 5vw, 64px) 1fr;
  gap: 0 clamp(0.75rem, 2vw, 1.75rem);
  margin: 3rem 0 2.5rem;
  position: relative;
}

/* Timeline rail (left column, spans full wall height).
   Negative margin shifts it leftward into the section's padding so the line
   sits closer to the page edge — gives more breathing room to the captions. */
.timeline-rail {
  grid-column: 1;
  grid-row: 1 / -1;
  position: relative;
  margin-left: clamp(-2rem, -2.5vw, -0.5rem);
}
.timeline-rail::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-50%);
  background:
    linear-gradient(to bottom,
      transparent 0%,
      var(--gold) 3%,
      var(--coral) 50%,
      var(--gold) 97%,
      transparent 100%);
  border-radius: 2px;
}

/* The single moving year marker — sticks to mid-viewport while user scrolls */
.timeline-marker {
  position: sticky;
  top: 38vh;
  width: clamp(48px, 4.4vw, 60px);
  aspect-ratio: 1;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(0.82rem, 1vw, 0.95rem);
  letter-spacing: -0.01em;
  color: var(--ink);
  background: var(--gold);
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  box-shadow:
    0 0 0 6px rgba(253, 181, 21, 0.22),
    0 4px 0 #15132030;
  z-index: 5;
  transition: transform 0.25s cubic-bezier(.34,1.56,.64,1);
}
.timeline-marker.tick {
  /* small bounce when year changes */
  transform: scale(1.12);
}

.research-pieces {
  grid-column: 2;
  display: grid;
  gap: 3rem;
}
.research-piece {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}
.research-piece-flip {
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
}
.research-piece-flip .research-frame { grid-column: 2; grid-row: 1; }
.research-piece-flip .research-caption { grid-column: 1; grid-row: 1; }

.research-frame {
  position: relative;
  padding: 12px;
  background:
    linear-gradient(135deg, #f5e3b3 0%, #e3c275 30%, #b8923a 55%, #e3c275 80%, #f5e3b3 100%);
  border-radius: 6px;
  box-shadow:
    0 1px 0 #fff8 inset,
    0 -1px 0 #0006 inset,
    0 5px 12px -4px rgba(21, 19, 32, 0.4),
    0 20px 40px -14px rgba(21, 19, 32, 0.5),
    0 50px 90px -28px rgba(21, 19, 32, 0.4);
  transform: rotate(var(--rot, 0deg));
  transition: transform .4s cubic-bezier(.2,.8,.2,1);
  /* Cap so portrait-orientation posters don't tower off the viewport.
     Scales with viewport: ~280px on tablets, up to 400px on large screens. */
  width: clamp(240px, 32vw, 400px);
  max-width: 100%;
}
.research-frame::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 4px;
  border: 1px solid #00000040;
  pointer-events: none;
}
.research-frame:hover { transform: rotate(0); }
.research-frame img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
  -webkit-user-drag: none;
  user-select: none;
}
.research-frame-empty {
  aspect-ratio: 4 / 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  text-align: center;
  padding: 1.5rem;
  font-family: var(--mono);
  font-size: 0.78rem;
}
.research-frame-empty strong {
  display: block;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink);
  margin-bottom: 0.3rem;
  background: rgba(255,255,255,0.5);
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
}
.research-frame-empty span {
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.4);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.research-caption { padding: 0.5rem 0; }
.research-eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  color: var(--coral);
  margin-bottom: 0.4rem;
}
.research-caption h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.25rem, 2.1vw, 1.65rem);
  letter-spacing: -0.018em;
  line-height: 1.15;
  margin: 0 0 0.6rem;
}
.research-caption p {
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--ink);
  margin: 0 0 0.6rem;
}
.research-cite {
  font-family: var(--mono) !important;
  font-weight: 500 !important;
  font-size: 0.8rem !important;
  color: var(--ink-soft) !important;
  border-top: 1px dashed var(--line);
  padding-top: 0.5rem;
  margin-top: 0.4rem !important;
}

@media (max-width: 760px) {
  .research-wall {
    grid-template-columns: 1fr;
  }
  .research-pieces { gap: 2.25rem; }
  .timeline-rail { display: none; }
  .research-piece { grid-template-columns: 1fr; gap: 1rem; }
  .research-piece-flip .research-frame,
  .research-piece-flip .research-caption {
    grid-column: 1;
    grid-row: auto;
  }
  .research-frame {
    transform: rotate(0);
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
  }
}

/* ============== POSTER LIGHTBOX ============== */
.poster-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}
.poster-lightbox[hidden] { display: none; }
body.lightbox-open { overflow: hidden; }

.poster-lightbox-bg {
  position: absolute;
  inset: 0;
  background: rgba(13, 9, 22, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  cursor: zoom-out;
}
.poster-lightbox-stage {
  position: relative;
  z-index: 1;
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
}
.poster-lightbox img {
  max-width: 95vw;
  max-height: 95vh;
  width: auto;
  height: auto;
  cursor: grab;
  transform-origin: center center;
  -webkit-user-drag: none;
  user-select: none;
  display: block;
}
.poster-lightbox img:active { cursor: grabbing; }

.poster-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 3;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  border: 0;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
  font-family: var(--sans);
}
.poster-lightbox-close:hover { background: rgba(255, 255, 255, 0.25); transform: scale(1.05); }

.poster-lightbox-controls {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  gap: 0.4rem;
  align-items: center;
  background: rgba(0, 0, 0, 0.7);
  padding: 0.4rem 0.55rem;
  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.poster-lightbox-controls button {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 0;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease;
}
.poster-lightbox-controls button:hover { background: rgba(255, 255, 255, 0.25); }
.poster-lightbox-hint {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.7);
  padding: 0 0.6rem 0 0.4rem;
}
@media (max-width: 600px) {
  .poster-lightbox-hint { display: none; }
}

/* ============== POSTERS ============== */
.poster-wall {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 2rem;
  align-items: start;  /* polaroids hang from the top, heights can vary */
  margin-top: 2.5rem;
}
/* Polaroid-style frame: white border, photo on top, handwritten label below.
   No outer aspect-ratio — let each frame match its media's true shape so
   nothing gets cropped (photos are 4:5, the badge video is 9:16). */
.poster {
  background: #fff;
  border-radius: var(--rad-sm);
  border: 1.5px solid var(--ink);
  position: relative;
  transform: rotate(var(--rot, 0deg));
  transition: transform .35s cubic-bezier(.2,.8,.2,1);
  box-shadow:
    0 4px 10px -2px rgba(21, 19, 32, 0.35),
    0 18px 36px -10px rgba(21, 19, 32, 0.5),
    0 44px 80px -22px rgba(21, 19, 32, 0.4);
  padding: 12px 12px 40px;
  margin: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.poster:hover {
  transform: rotate(0) scale(1.04);
}
.poster-pin {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px; height: 12px;
  background: var(--coral);
  border-radius: 50%;
  box-shadow: 0 2px 4px #15132060, inset -2px -2px 3px #00000040;
  z-index: 2;
}
.poster-media {
  width: 100%;
  background: var(--bg-2);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  /* Default aspect for photos (matches the SROP 4:5 phone shots).
     Video frame overrides this below to 9:16 so the badge cam is
     full-bleed without side-cropping. */
  aspect-ratio: 4 / 5;
}
.poster-media img,
.poster-media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
}
.poster-media img { cursor: zoom-in; }
.poster-media-video {
  background: #000;
  aspect-ratio: 9 / 16;
}
.poster-media-video video { object-fit: cover; }
.poster figcaption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-style: italic;
  font-weight: 500;
  font-size: 0.82rem;
  color: var(--ink-soft);
  padding: 0 0.5rem;
  background: #fff;
  text-align: center;
}
/* Legacy placeholder support — kept in case we go back to text-only posters */
.poster-empty {
  text-align: center;
  padding: 1rem;
  color: var(--muted);
}

/* ============== RESEARCH ============== */
.research-list {
  display: grid;
  gap: 1.5rem;
}
.research-item {
  border-left: 3px solid var(--gold);
  padding: 0.5rem 0 0.5rem 1.5rem;
  position: relative;
}
.research-item::before {
  content: "";
  position: absolute;
  left: -8px; top: 12px;
  width: 13px; height: 13px;
  background: var(--gold);
  border: 2px solid var(--ink);
  border-radius: 50%;
}
.research-item header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}
.research-item h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.2rem;
  margin: 0;
  letter-spacing: -0.015em;
}
.research-item .when {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--navy);
}
.research-item p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.97rem;
}

/* ============== EXPERIENCE ============== */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  border-top: 1px solid var(--line);
}
.timeline li {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1.25rem;
  padding: 1rem 0.5rem;
  border-bottom: 1px solid var(--line);
  transition: background .2s ease;
}
.timeline li:hover { background: var(--bg-2); }
.t-when {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--navy);
  letter-spacing: 0.04em;
}
.t-what { color: var(--ink); font-size: 0.98rem; }
.t-what strong { font-weight: 600; }

@media (max-width: 600px) {
  .timeline li { grid-template-columns: 1fr; gap: 0.25rem; }
}

.award-strip {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.award-strip span {
  font-family: var(--mono);
  font-size: 0.82rem;
  background: var(--bg-2);
  border: 1px solid var(--ink);
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
}

/* ============== CONTACT ============== */
.contact-card {
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--rad);
  padding: clamp(2rem, 5vw, 3.5rem);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.contact-card::after {
  content: "";
  position: absolute;
  inset: -40%;
  background: radial-gradient(circle at 30% 30%, var(--gold) 0%, transparent 40%),
              radial-gradient(circle at 70% 70%, var(--coral) 0%, transparent 40%);
  opacity: 0.18;
  pointer-events: none;
}
.contact-line {
  font-family: var(--display);
  font-size: 1.25rem;
  margin: 0 auto 1.5rem;
  max-width: 38ch;
  position: relative;
}
.contact-email {
  display: inline-block;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  color: var(--gold);
  text-decoration: none;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
  position: relative;
  transition: color .2s ease, transform .2s ease;
}
.contact-email:hover { color: var(--bg); transform: scale(1.02); }
.contact-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  position: relative;
}
.contact-links a {
  color: var(--bg);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: border-color .2s ease;
}
.contact-links a:hover { border-color: var(--gold); }

/* ============== FOOTER ============== */
.foot {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.5rem var(--pad-x);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.foot-egg kbd {
  font-family: var(--mono);
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
}

/* ============== REVEAL ============== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .7s ease, transform .7s cubic-bezier(.2,.8,.2,1);
}
.reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}

/* confetti */
.confetti {
  position: fixed;
  top: -20px;
  width: 10px; height: 14px;
  pointer-events: none;
  z-index: 9998;
  border-radius: 2px;
  will-change: transform, opacity;
}

/* ============== GAME MODAL (2048) ============== */
.game-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.game-modal[hidden] { display: none; }
body.game-open { overflow: hidden; }
.game-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(21, 19, 32, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.game-modal-panel {
  position: relative;
  background: var(--bg);
  border: 1.5px solid var(--ink);
  border-radius: var(--rad);
  box-shadow: 0 30px 80px -20px #15132080;
  width: 100%;
  max-width: min(95vw, 640px);
  padding: clamp(0.85rem, 2vw, 1.5rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: calc(100vh - 1rem);
  max-height: 100dvh;
  overflow-y: auto;
}
.game-modal-panel-wide { max-width: min(96vw, 980px); }
.ants-panel { max-width: min(96vw, 1180px); }
.wg-body {
  min-height: 200px;
  align-items: center;
  justify-content: center;
}
.wg-canvas {
  display: block;
  background: #0e0a18;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  touch-action: none;
}
.wg-canvas[hidden] { display: none; }

.wg-howto {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--ink-soft);
  background: var(--bg-2);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
}
.wg-howto strong {
  font-family: var(--display);
  font-weight: 700;
  color: var(--ink);
  font-size: 0.95rem;
  display: inline;
  margin-right: 0.35rem;
}
.wg-howto kbd {
  font-family: var(--mono);
  font-size: 0.72rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  padding: 1px 5px;
  border-radius: 4px;
  margin: 0 1px;
}
.wg-legend {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  border-radius: 50%;
  vertical-align: -2px;
  margin: 0 2px;
}
.wg-legend-avatar {
  background: #f25c54;
  box-shadow: 0 0 0 1.5px #003262;
}
.wg-legend-apple {
  background: #fdb515;
  box-shadow: 0 0 0 1px #003262;
}

.wg-status {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1rem;
  text-align: center;
  color: var(--ink);
  background: var(--gold);
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  letter-spacing: -0.005em;
}
.wg-status[hidden] { display: none; }

.wg-foot { gap: 0.75rem; }
.wg-music {
  font-family: var(--mono);
  font-size: 0.78rem;
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.wg-music:hover {
  color: var(--ink);
  border-color: var(--ink);
}
.wg-music[aria-pressed="false"] {
  color: var(--muted);
}

.wg-howto-details {
  font-family: var(--mono);
  font-size: 0.78rem;
}
.wg-howto-details summary {
  cursor: pointer;
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: var(--bg-2);
  border: 1px dashed var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  transition: color .15s ease, background .15s ease;
}
.wg-howto-details summary:hover { color: var(--ink); }
.wg-howto-details summary::-webkit-details-marker { display: none; }
.wg-howto-details[open] summary {
  color: var(--ink);
  background: var(--bg);
}
.wg-howto-details .wg-howto { margin-top: 0.5rem; }
.wg-howto {
  display: grid;
  gap: 0.35rem;
}
.wg-howto-row {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  background: var(--bg-2);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
}
.wg-howto-row strong {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--ink);
  min-width: 50px;
}

/* Mode / algorithm / difficulty controls */
.wg-controls {
  display: grid;
  gap: 0.5rem;
}
.wg-control-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.wg-control-row[hidden] { display: none; }
.wg-control-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--coral);
  min-width: 80px;
}

.wg-seg {
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  flex-wrap: wrap;
}
.wg-seg button {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.wg-seg button:hover { color: var(--ink); }
.wg-seg button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}
.wg-seg button[aria-pressed="true"] .wg-chaser-chip {
  filter: brightness(1.2);
}

.wg-toggle {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--bg-2);
  color: var(--ink-soft);
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.wg-toggle[aria-pressed="true"] {
  background: var(--coral);
  color: var(--bg);
  border-color: var(--coral);
}

#wg-seed-input {
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink);
  width: 14ch;
  outline-offset: 2px;
}
#wg-seed-input:focus {
  outline: 2px solid var(--coral);
}
#wg-seed-input::placeholder { color: var(--muted); }

/* Chaser chip shapes — for HUD + algorithm buttons */
.wg-chaser-chip {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  vertical-align: -0.12em;
  background: currentColor;
  margin-right: 0.1em;
}
.wg-chaser-greedy { color: #e63946; }
.wg-chaser-dfs    { color: #6c4ab6; clip-path: polygon(50% 100%, 100% 0, 0 0); }
.wg-chaser-bfs    { color: #1d8a7a; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.wg-chaser-astar  { color: #003262; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }

#wg-chasers-info .wg-chaser-chip {
  margin-right: 4px;
}

/* ============== ANTS ============== */
.ants-disclaimer {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--ink-soft);
  background: var(--bg-2);
  border: 1px dashed var(--coral);
  border-radius: 8px;
  padding: 0.7rem 0.95rem;
}
.ants-disclaimer strong {
  font-family: var(--display);
  color: var(--coral);
  font-weight: 700;
  font-size: 0.85rem;
  margin-right: 0.25rem;
}
.ants-disclaimer code {
  font-family: var(--mono);
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.92em;
}
.ants-disclaimer a { color: var(--coral); }

.ants-controls { display: grid; gap: 0.5rem; }
.ants-control-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.ants-types {
  position: sticky;
  top: -1px;
  z-index: 6;
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.7rem 0.4rem 0.85rem;
  margin: 0 -0.5rem;
  background: var(--bg);
  border-top: 1px dashed var(--line);
  border-bottom: 1.5px solid var(--ink);
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  flex-wrap: nowrap;
  align-items: stretch;
}
.ant-card {
  flex: 0 0 auto;
  min-width: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg-2);
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  padding: 0.6rem 0.7rem 0.55rem;
  cursor: pointer;
  font-family: var(--sans);
  transition: transform .15s ease, background .15s ease, border-color .15s ease, opacity .15s ease, box-shadow .15s ease;
}
.ant-card:hover { transform: translateY(-3px); border-color: var(--coral); }
.ant-card.selected {
  background: var(--gold);
  border-color: var(--coral);
  box-shadow: 0 0 0 3px var(--coral);
  transform: translateY(-3px);
}
.ant-card.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.ant-card.disabled:hover { transform: none; border-color: var(--ink); }
.ant-card img {
  width: 52px;
  height: 52px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.ant-card-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  line-height: 1.15;
}
.ant-card-cost {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  font-weight: 600;
}
.ant-card.selected .ant-card-label,
.ant-card.selected .ant-card-cost { color: var(--ink); }

.ants-body {
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ants-grid {
  display: grid;
  width: 100%;
  background: #0e0a18;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  overflow: hidden;
  gap: 1px;
  padding: 1px;
}
.ants-grid[hidden] { display: none; }

.ants-cell {
  position: relative;
  aspect-ratio: 1;
  min-height: clamp(28px, 5.5vw, 80px);
  background: #1a1325;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: outline-color .12s ease;
  outline: 2px solid transparent;
  outline-offset: -2px;
}
.ants-cell-tunnel:hover,
.ants-cell-water:hover { outline-color: var(--gold); }

.ants-cell-base,
.ants-cell-hive {
  cursor: default;
  font-size: 1.6rem;
  background: var(--bg-2);
  color: var(--ink);
}
.ants-cell-base { border-right: 2px solid var(--coral); }
.ants-cell-hive { border-left: 2px solid var(--coral); }

.ants-sprite {
  width: 70%;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}
.ants-ant {
  position: relative;
  z-index: 2;
}
.ants-ant-contained {
  position: absolute;
  width: 36%;
  bottom: 4px;
  right: 4px;
  z-index: 3;
}
.ants-bee {
  position: absolute;
  width: 50%;
  z-index: 4;
  filter: drop-shadow(0 1px 2px #00000060);
}

/* HP badges */
.ants-hp {
  position: absolute;
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
  line-height: 1.1;
  box-shadow: 0 1px 2px #00000060;
}
.ants-hp-ant {
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(245, 237, 214, 0.95);
  color: var(--ink);
  border: 1px solid #00000040;
  z-index: 5;
}
.ants-hp-bee {
  top: 2px;
  right: 2px;
  background: rgba(230, 57, 70, 0.95);
  color: white;
  z-index: 5;
  font-size: 0.58rem;
  padding: 0 3px;
}
.ants-hp-low { background: var(--coral); color: white; }

/* QueenAnt distinguishing glow — first queen only (handled in JS via .is-queen) */
.ants-ant.is-queen {
  filter: drop-shadow(0 0 4px var(--gold)) drop-shadow(0 0 8px #fdb51580);
}
.ants-ant.is-queen + .ants-hp-ant {
  background: var(--gold);
  border-color: var(--ink);
}

@media (max-width: 720px) {
  .ant-card { min-width: 84px; padding: 0.45rem 0.5rem; }
  .ant-card img { width: 40px; height: 40px; }
  .ant-card-label { font-size: 0.74rem; }
  .ant-card-cost { font-size: 0.72rem; }
}
@media (max-width: 480px) {
  .ant-card { min-width: 68px; padding: 0.35rem 0.4rem; gap: 0.18rem; }
  .ant-card img { width: 32px; height: 32px; }
  .ant-card-label { font-size: 0.68rem; }
  .ant-card-cost { font-size: 0.68rem; }
  .ants-disclaimer { font-size: 0.72rem; padding: 0.55rem 0.7rem; }
}
.game-modal-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 0.75rem;
}
.game-modal-head h2 {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.6rem;
  margin: 0;
  letter-spacing: -0.025em;
}
.game-modal-meta {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.game-modal-meta span {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 50px;
}
.game-meta-label {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--coral);
}
.game-modal-meta strong {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--ink);
}
.game-modal-close {
  background: transparent;
  border: 0;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0 0.25rem;
  transition: color .15s ease, transform .15s ease;
}
.game-modal-close:hover { color: var(--coral); transform: scale(1.1); }
.game-modal-body {
  position: relative;
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.game-modal-loading {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink-soft);
  text-align: center;
  padding: 2rem 1rem;
  line-height: 1.5;
}
.game-board {
  position: relative;
  background: var(--bg-2);
  padding: 4px;
  border-radius: 12px;
  width: 100%;
  max-width: min(72vmin, 580px);
  aspect-ratio: 1;
  touch-action: none;
  overflow: hidden;
  margin: 0 auto;
}
.game-board[hidden] { display: none; }

/* Background grid cells (16, statically positioned). */
.g2048-cell {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 25%;
  height: 25%;
  padding: 4px;
  pointer-events: none;
}
.g2048-cell-inner {
  width: 100%;
  height: 100%;
  background: #ffffff60;
  border-radius: 8px;
}

/* Tiles overlay the cells; positions driven by transform translate. */
.g2048-tile {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 25%;
  height: 25%;
  padding: 4px;
  transition: transform 150ms cubic-bezier(.32,.06,.13,1.02);
  pointer-events: none;
  z-index: 1;
  will-change: transform;
}
.g2048-tile-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.2rem, 5vw, 2rem);
  border-radius: 8px;
  user-select: none;
  background: #ffffff80;
  color: var(--ink);
  transition: background-color 120ms ease, color 120ms ease;
}
.g2048-tile.bloom .g2048-tile-inner {
  animation: g2048-bloom 280ms cubic-bezier(.34,1.56,.64,1);
}
@keyframes g2048-bloom {
  0%   { transform: scale(0.3); opacity: 0; }
  60%  { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* Tile color variants applied to the inner element. */
.g2048-tile.v2 .g2048-tile-inner    { background: #f5edd6; color: var(--ink); }
.g2048-tile.v4 .g2048-tile-inner    { background: #efe2b3; color: var(--ink); }
.g2048-tile.v8 .g2048-tile-inner    { background: #fdb515; color: var(--bg); }
.g2048-tile.v16 .g2048-tile-inner   { background: #fc9c2d; color: var(--bg); }
.g2048-tile.v32 .g2048-tile-inner   { background: #f25c54; color: var(--bg); }
.g2048-tile.v64 .g2048-tile-inner   { background: #e63946; color: var(--bg); }
.g2048-tile.v128 .g2048-tile-inner  { background: #6c4ab6; color: var(--bg); font-size: clamp(1.05rem, 4.4vw, 1.7rem); }
.g2048-tile.v256 .g2048-tile-inner  { background: #5a3aa3; color: var(--bg); font-size: clamp(1.05rem, 4.4vw, 1.7rem); }
.g2048-tile.v512 .g2048-tile-inner  { background: #003262; color: var(--bg); font-size: clamp(1.05rem, 4.4vw, 1.7rem); }
.g2048-tile.v1024 .g2048-tile-inner { background: #002645; color: var(--gold); font-size: clamp(0.9rem, 3.6vw, 1.5rem); }
.g2048-tile.v2048 .g2048-tile-inner {
  background: var(--gold);
  color: var(--ink);
  font-size: clamp(0.9rem, 3.6vw, 1.5rem);
  box-shadow: 0 0 0 3px var(--ink) inset, 0 0 24px var(--gold);
}
.game-modal-status {
  position: absolute;
  inset: 0;
  background: rgba(251, 246, 233, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--ink);
  border-radius: 12px;
  letter-spacing: -0.01em;
}
.game-modal-status[hidden] { display: none; }
.game-modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--line);
}
.game-modal-hint {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
}
.game-modal-restart {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.88rem;
  background: var(--ink);
  color: var(--bg);
  border: 0;
  border-radius: 999px;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  transition: background .15s ease;
}
.game-modal-restart:hover { background: var(--navy); }
.game-modal-credit {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
  text-align: center;
  padding-top: 0.25rem;
}
.game-modal-credit a { color: var(--coral); }
.game-modal-credit strong { color: var(--ink); font-weight: 600; }

@media (max-width: 480px) {
  .game-modal-panel { padding: 1rem; }
  .game-modal-meta strong { font-size: 1.05rem; }
  .game-modal-foot { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
}

/* ============== A11Y ============== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .cursor-dot, .cursor-ring { display: none; }
  body { cursor: auto; }
}
