:root {
  --ink: #070a0f;
  --surface: #0e141c;
  --surface-2: #151d27;
  --line: #263241;
  --text: #d7dee5;
  --muted: #8f9baa;
  --paper: #f2ead7;
  --cyan: #64e8dc;
  --blue: #69a7ff;
  --violet: #aa8cff;
  --gold: #e2bd6f;
  --green: #75c98f;
  --red: #df7a6f;
  --mono: "JetBrains Mono", monospace;
  --serif: "IBM Plex Serif", serif;
  --pointer-x: 50vw;
  --pointer-y: 50vh;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    var(--ink);
  background-size: 54px 54px;
  color: var(--text);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.65;
}

body::before {
  background: radial-gradient(520px circle at var(--pointer-x) var(--pointer-y), rgba(100,232,220,.09), transparent 70%);
  content: "";
  inset: 0;
  pointer-events: none;
  position: fixed;
  z-index: 20;
}

.state-index { display: grid; gap: .55rem; position: fixed; right: 1.1rem; top: 50%; transform: translateY(-50%); z-index: 45; }
.state-index::before { background: var(--line); content: ""; left: 50%; position: absolute; top: .4rem; bottom: .4rem; width: 1px; z-index: -1; }
.state-index span { align-items: center; background: var(--ink); border: 1px solid var(--line); border-radius: 50%; color: var(--muted); display: flex; font: .5rem var(--mono); height: 25px; justify-content: center; transition: border-color .25s ease, color .25s ease, transform .25s ease; width: 25px; }
.state-index span.is-active { border-color: var(--gold); color: var(--paper); transform: scale(1.18); }

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--cyan); outline-offset: 5px; }

.skip-link { background: var(--paper); color: var(--ink); left: 1rem; padding: .6rem 1rem; position: fixed; top: -5rem; z-index: 200; }
.skip-link:focus { top: 1rem; }

.topbar {
  align-items: center;
  backdrop-filter: blur(18px);
  background: rgba(7,10,15,.84);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: .9rem max(1.25rem, calc((100vw - 1240px) / 2));
  position: sticky;
  top: 0;
  z-index: 50;
}

.identity { align-items: center; display: flex; font: 600 .82rem var(--mono); gap: .7rem; letter-spacing: .03em; }
.identity img { height: 34px; width: 34px; }
.topbar nav { align-items: center; display: flex; font: .75rem var(--mono); gap: 1.25rem; }
.topbar nav a { color: var(--muted); position: relative; }
.topbar nav a::after { background: var(--cyan); bottom: -.35rem; content: ""; height: 1px; left: 0; position: absolute; transform: scaleX(0); transform-origin: left; transition: transform .2s ease; width: 100%; }
.topbar nav a:hover { color: var(--text); }
.topbar nav a:hover::after { transform: scaleX(1); }
.topbar .nav-file { border: 1px solid var(--line); color: var(--paper); padding: .38rem .65rem; }

main, footer { margin: 0 auto; max-width: 1240px; padding-left: 1.5rem; padding-right: 1.5rem; }
section { border-bottom: 1px solid var(--line); padding: clamp(4.5rem, 8vw, 7.5rem) 0; }

.section-code { color: var(--cyan); font: 600 .7rem var(--mono); letter-spacing: .15em; margin: 0 0 .9rem; }
h1, h2, h3 { color: var(--paper); font-family: var(--mono); line-height: 1.12; }
h1 { font-size: clamp(3.5rem, 8vw, 7.8rem); letter-spacing: -.07em; margin: 0; }
h2 { font-size: clamp(2rem, 4vw, 3.5rem); letter-spacing: -.045em; margin: 0; }
h3 { font-size: clamp(1.35rem, 2.4vw, 2rem); letter-spacing: -.035em; margin: .75rem 0; }
p { margin: 0; }

.hero { align-items: center; display: grid; gap: clamp(2.5rem, 6vw, 6rem); grid-template-columns: .85fr 1.15fr; min-height: calc(100vh - 66px); }
.role { color: var(--gold); font: 600 clamp(1rem, 2vw, 1.35rem) var(--mono); margin-top: 1rem; }
.mana-spectrum { display: flex; gap: .5rem; margin-top: 1.15rem; }
.mana-spectrum i { border: 1px solid rgba(255,255,255,.35); border-radius: 50%; box-shadow: inset 0 0 0 3px rgba(7,10,15,.4), 0 0 16px currentColor; height: 13px; width: 13px; }
.mana-spectrum i:nth-child(1) { background: #eee6c4; color: #eee6c4; }.mana-spectrum i:nth-child(2) { background: #6bb9dc; color: #6bb9dc; }.mana-spectrum i:nth-child(3) { background: #80658d; color: #80658d; }.mana-spectrum i:nth-child(4) { background: #d36b50; color: #d36b50; }.mana-spectrum i:nth-child(5) { background: #6aa06a; color: #6aa06a; }
.intro { font-size: clamp(1.15rem, 2vw, 1.45rem); margin-top: 1.6rem; max-width: 630px; }
.hero-links { display: flex; flex-wrap: wrap; font: .76rem var(--mono); gap: .7rem; margin-top: 2rem; }
.hero-links a { border-bottom: 1px solid var(--line); padding: .45rem 0; transition: border-color .2s ease, color .2s ease; }
.hero-links a:hover { border-color: var(--cyan); color: var(--cyan); }

.hero-stage { min-width: 0; perspective: 1100px; }
.stage-surface { background: var(--surface); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0,0,0,.45); padding: .7rem; position: relative; transform: rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg)); transform-style: preserve-3d; transition: transform .18s ease; }
.stage-surface::before { border: 1px solid rgba(226,189,111,.35); content: ""; inset: .95rem; pointer-events: none; position: absolute; z-index: 3; }
.stage-surface > img { aspect-ratio: 16 / 11; filter: saturate(.78) contrast(1.05); object-fit: cover; object-position: center 48%; width: 100%; }
.stage-caption { background: rgba(7,10,15,.9); bottom: 1.5rem; display: flex; font: .65rem var(--mono); gap: 1rem; justify-content: space-between; left: 1.5rem; padding: .65rem .8rem; position: absolute; right: 1.5rem; transform: translateZ(35px); }
.stage-caption span:last-child { color: var(--muted); }
.verification-route { background: var(--paper); color: var(--ink); display: flex; flex-wrap: wrap; font: 600 .6rem var(--mono); gap: .4rem; left: -2rem; padding: .55rem .7rem; position: absolute; top: 12%; transform: translateZ(55px) rotate(-2deg); }
.verification-route i { color: #557; font-style: normal; }

.focus-band { align-items: center; display: flex; flex-wrap: wrap; font: .72rem var(--mono); gap: .8rem 1.25rem; justify-content: center; padding: 1.7rem 0; }
.focus-band span { color: var(--text); }
.focus-band b { color: var(--cyan); font-weight: 400; }

.section-head { align-items: end; display: flex; gap: 2rem; justify-content: space-between; margin-bottom: 2.4rem; }
.section-head > p { color: var(--muted); max-width: 440px; }

.project-deck { display: flex; gap: .75rem; min-height: 610px; }
.project-card { flex: 1 1 0; min-width: 0; outline: none; transition: flex .55s cubic-bezier(.2,.8,.2,1), filter .35s ease, opacity .35s ease; }
.project-card::before { color: var(--accent); content: attr(data-slot); display: block; font: .55rem var(--mono); letter-spacing: .12em; padding: 0 0 .45rem .15rem; }
.project-deck:has(.project-card:hover) .project-card:not(:hover), .project-deck:has(.project-card:focus-within) .project-card:not(:focus-within) { filter: saturate(.55); opacity: .58; }
.project-card:hover, .project-card:focus-within, .project-card.is-open { flex: 2.45 1 0; }
.card-surface { background: var(--surface); border: 1px solid var(--line); height: 100%; overflow: hidden; position: relative; transform: perspective(1000px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg)); transform-style: preserve-3d; transition: border-color .25s ease, box-shadow .25s ease, transform .18s ease; }
.project-card:hover .card-surface, .project-card:focus-within .card-surface, .project-card.is-open .card-surface { border-color: var(--accent); box-shadow: 0 26px 65px rgba(0,0,0,.45), 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.card-surface::after { background: radial-gradient(300px circle at var(--local-x, 50%) var(--local-y, 50%), color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%); content: ""; inset: 0; opacity: 0; pointer-events: none; position: absolute; transition: opacity .25s ease; }
.project-card:hover .card-surface::after, .project-card:focus-within .card-surface::after { opacity: 1; }
.card-avid { --accent: var(--cyan); }.card-babel { --accent: var(--violet); }.card-applied { --accent: var(--red); }.card-state { --accent: var(--green); }.card-mana { --accent: var(--gold); }
.project-media { background: #090d13; border-bottom: 1px solid var(--line); height: 43%; overflow: hidden; position: relative; }
.project-media > img { filter: saturate(.72) brightness(.72); height: 100%; object-fit: cover; transition: filter .45s ease, transform .7s cubic-bezier(.2,.8,.2,1); width: 100%; }
.project-card:hover .project-media > img, .project-card:focus-within .project-media > img { filter: saturate(1) brightness(.9); transform: scale(1.07); }
.card-avid .project-media > img { object-position: 53% center; }
.card-mana .project-media > img { object-position: center 42%; }
.diagram-media { align-items: center; display: flex; justify-content: center; padding: 1.2rem; }
.project-body { display: flex; flex-direction: column; height: 57%; padding: 1.25rem; position: relative; z-index: 2; }
.project-meta { color: var(--muted); display: flex; font: .58rem var(--mono); gap: .6rem; justify-content: space-between; text-transform: uppercase; }
.project-body > p { color: var(--muted); font-size: .95rem; }
.project-details { margin-top: auto; opacity: 0; transform: translateY(18px); transition: opacity .3s ease .08s, transform .3s ease .08s; visibility: hidden; }
.project-card:hover .project-details, .project-card:focus-within .project-details, .project-card.is-open .project-details { opacity: 1; transform: none; visibility: visible; }
.detail-label { color: var(--accent); font: .6rem var(--mono); letter-spacing: .12em; margin-bottom: .55rem; text-transform: uppercase; }
.page-links { display: flex; flex-wrap: wrap; gap: .45rem; }
.page-links a { border: 1px solid var(--line); font: .62rem var(--mono); padding: .35rem .5rem; transition: background .2s ease, border-color .2s ease; }
.page-links a:hover { background: color-mix(in srgb, var(--accent) 13%, transparent); border-color: var(--accent); }

.language-map { height: 100%; position: relative; width: 100%; }
.language-map span { background: var(--surface-2); border: 1px solid var(--violet); font: .62rem var(--mono); padding: .3rem .45rem; position: absolute; }
.language-map span:nth-child(1) { left: 0; top: 0; }.language-map span:nth-child(2) { right: 0; top: 0; }.language-map span:nth-child(3) { bottom: 0; left: 0; }.language-map span:nth-child(4) { bottom: 0; right: 0; }
.language-map b { color: var(--paper); font: 600 .62rem/1.4 var(--mono); left: 50%; position: absolute; text-align: center; top: 50%; transform: translate(-50%,-50%); }
.language-map::before, .language-map::after { background: rgba(170,140,255,.5); content: ""; left: 12%; position: absolute; top: 50%; transform-origin: center; width: 76%; height: 1px; }
.language-map::after { transform: rotate(90deg); }
.spec-flow { align-items: stretch; display: flex; flex-direction: column; font: .58rem var(--mono); gap: .22rem; width: 100%; }
.spec-flow span { border: 1px solid rgba(223,122,111,.6); padding: .35rem .45rem; text-align: center; }.spec-flow i { color: var(--red); font-style: normal; line-height: 1; text-align: center; }
.rule-graph { height: 100%; width: 100%; }.rule-graph .edges path { fill: none; stroke: rgba(117,201,143,.52); stroke-width: 2; }.rule-graph .edge-secondary { stroke-dasharray: 5 5 !important; }.rule-graph .nodes circle { fill: #111b18; stroke: var(--green); stroke-width: 2; }.rule-graph .labels text { fill: var(--paper); font: 10px var(--mono); text-anchor: middle; }
.state-media { padding: .65rem; }
.state-media .rule-graph { left: -8%; position: absolute; width: 76%; }
.card-fan { bottom: .65rem; height: 78%; position: absolute; right: .35rem; width: 45%; }
.card-fan img { border: 1px solid rgba(242,234,215,.55); border-radius: 4px; box-shadow: 0 10px 25px rgba(0,0,0,.58); height: 82%; object-fit: cover; position: absolute; right: 4%; top: 8%; transform-origin: bottom center; transition: filter .35s ease, transform .45s cubic-bezier(.2,.8,.2,1); width: 58%; }
.card-fan img:nth-child(1) { filter: saturate(.55); transform: rotate(-13deg) translateX(-31%); }.card-fan img:nth-child(2) { filter: saturate(.72); transform: rotate(-2deg) translateX(-8%); }.card-fan img:nth-child(3) { transform: rotate(11deg) translateX(17%); }
.project-card:hover .card-fan img:nth-child(1), .project-card:focus-within .card-fan img:nth-child(1) { filter: saturate(1); transform: rotate(-17deg) translateX(-42%) translateY(-5%); }.project-card:hover .card-fan img:nth-child(2), .project-card:focus-within .card-fan img:nth-child(2) { filter: saturate(1); transform: rotate(-1deg) translateX(-9%) translateY(-9%); }.project-card:hover .card-fan img:nth-child(3), .project-card:focus-within .card-fan img:nth-child(3) { transform: rotate(15deg) translateX(26%) translateY(-3%); }

.mtg-rule-display { align-items: end; display: flex; height: 330px; justify-content: center; margin: -1rem 0 2rem; overflow: hidden; padding-top: 2rem; }
.mtg-rule-display img { border: 1px solid rgba(242,234,215,.45); border-radius: 9px; box-shadow: 0 24px 45px rgba(0,0,0,.48); height: 270px; object-fit: cover; transform-origin: bottom center; transition: filter .3s ease, transform .4s cubic-bezier(.2,.8,.2,1); width: 190px; }
.mtg-rule-display img:nth-child(1) { filter: saturate(.7); transform: rotate(-9deg) translate(28px, 12px); }.mtg-rule-display img:nth-child(2) { position: relative; transform: translateY(-10px); z-index: 2; }.mtg-rule-display img:nth-child(3) { filter: saturate(.7); transform: rotate(9deg) translate(-28px, 12px); }
.mtg-rule-display:hover img:nth-child(1) { filter: saturate(1); transform: rotate(-13deg) translate(-5px, 2px); }.mtg-rule-display:hover img:nth-child(2) { transform: translateY(-24px); }.mtg-rule-display:hover img:nth-child(3) { filter: saturate(1); transform: rotate(13deg) translate(5px, 2px); }

.visual-links { display: grid; gap: 1rem; grid-template-columns: repeat(3, 1fr); }
.project-index .visual-links { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.visual-link { background: var(--surface); border: 1px solid var(--line); display: grid; grid-template-columns: 110px 1fr; min-height: 120px; overflow: hidden; transition: border-color .25s ease, transform .25s ease; }
.visual-link:hover { border-color: var(--gold); transform: translateY(-6px); }
.visual-link img, .symbol-art { height: 100%; object-fit: cover; width: 110px; }
.visual-link img { filter: saturate(.55); transition: filter .3s ease, transform .4s ease; }.visual-link:hover img { filter: saturate(1); transform: scale(1.08); }
.visual-link span { align-self: center; padding: 1rem; }.visual-link b { display: block; font: .85rem var(--mono); }.visual-link small { color: var(--muted); display: block; font: .72rem var(--mono); margin-top: .4rem; }
.symbol-art { align-items: center; background: linear-gradient(145deg, #151b25, #0a0e14); color: var(--cyan); display: flex; font: 600 1.15rem var(--mono); justify-content: center; }

.about-section { display: grid; gap: 3rem; grid-template-columns: .7fr 1.3fr; }.about-columns { display: grid; gap: 2rem; grid-template-columns: 1fr 1fr; }.about-columns p { color: var(--muted); }
footer { align-items: center; color: var(--muted); display: flex; font: .7rem var(--mono); justify-content: space-between; padding-bottom: 2.5rem; padding-top: 2.5rem; } footer div { display: flex; gap: 1rem; } footer a:hover { color: var(--cyan); }
.inline-link { border-bottom: 1px solid var(--line); color: var(--text); font: .72rem var(--mono); margin-left: .35rem; white-space: nowrap; }
.inline-link:hover { border-color: var(--cyan); color: var(--cyan); }

/* The home is intentionally denser and quieter than the project index. */
.home-page section { padding: clamp(3.2rem, 5.5vw, 5.2rem) 0; }
.home-page .hero {
  gap: clamp(2.5rem, 5vw, 5rem);
  grid-template-columns: 1.08fr .76fr;
  min-height: 620px;
  padding-bottom: clamp(3rem, 5vw, 4.8rem);
  padding-top: clamp(3rem, 5vw, 4.8rem);
}
.home-page .hero h1 { font-size: clamp(3.15rem, 5.4vw, 5.35rem); letter-spacing: -.06em; }
.home-page .intro { font-size: clamp(1.08rem, 1.6vw, 1.3rem); margin-top: 1.35rem; max-width: 560px; }
.home-page .hero-links { margin-top: 1.65rem; }
.home-page .hero-stage { justify-self: end; width: min(100%, 420px); }
.home-page .stage-surface > img { aspect-ratio: 4 / 5; filter: saturate(.82) contrast(1.03); max-height: 510px; object-position: center 24%; }
.home-page .focus-band { padding: 1.35rem 0; }
.home-page .section-head { margin-bottom: 1.8rem; }
.home-page .project-deck { min-height: 555px; }
.home-page .about-section { gap: 2rem; }

.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (max-width: 980px) {
  .state-index { display: none; }
  .hero { grid-template-columns: 1fr; padding-top: 5rem; }
  .hero-stage { max-width: 760px; }
  .project-deck { display: grid; grid-template-columns: repeat(2, 1fr); min-height: 0; }
  .project-card, .project-card:hover, .project-card:focus-within, .project-card.is-open { min-height: 540px; }
  .project-card:last-child { grid-column: 1 / -1; }
  .project-details { opacity: 1; transform: none; visibility: visible; }
  .visual-links { grid-template-columns: 1fr; }
  .home-page .hero { grid-template-columns: 1fr; min-height: 0; padding-top: 4rem; }
  .home-page .hero-stage { justify-self: start; width: min(100%, 520px); }
  .home-page .project-deck { min-height: 0; }
}

@media (max-width: 680px) {
  body { font-size: 16px; }
  .topbar { align-items: flex-start; flex-direction: column; gap: .7rem; }
  .topbar nav { flex-wrap: wrap; gap: .65rem 1rem; }
  section { padding: 4rem 0; }
  .verification-route { left: .2rem; right: .2rem; top: .5rem; }
  .stage-caption { align-items: flex-start; flex-direction: column; gap: .2rem; }
  .section-head, .about-section { align-items: flex-start; display: flex; flex-direction: column; }
  .project-deck { grid-template-columns: 1fr; }
  .project-card, .project-card:hover, .project-card:focus-within, .project-card.is-open { min-height: 560px; }
  .project-card:last-child { grid-column: auto; }
  .about-columns { grid-template-columns: 1fr; }
  footer { align-items: flex-start; flex-direction: column; gap: 1rem; }
  .mtg-rule-display { height: 240px; }.mtg-rule-display img { height: 190px; width: 134px; }
  .home-page section { padding: 3.25rem 0; }
  .home-page .hero { padding-top: 3.5rem; }
  .home-page .hero h1 { font-size: clamp(2.85rem, 15vw, 4.1rem); }
  .home-page .stage-caption { bottom: 1.1rem; left: 1.1rem; right: 1.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
  .card-surface, .stage-surface { transform: none !important; }
}
