:root {
  --navy: #0a1224;
  --pearl: #f4f1ea;
  --coral: #ff5347;
  --coral-hi: #ff7a70;
  --navy-hi: #1b2a4a;
  --dim: rgba(244, 241, 234, 0.66);
  --display: "Space Grotesk", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; }

html, body {
  background: var(--navy);
  color: var(--pearl);
  font-family: var(--display);
  -webkit-font-smoothing: antialiased;
}

html.js, html.js body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

#space {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(10, 18, 36, 0.85) 100%);
}

/* ---------- panels ---------- */

.panel {
  width: min(88vw, 620px);
  margin: 12vh auto;
}

html.js .panel {
  position: fixed;
  left: 50%;
  top: 50%;
  margin: 0;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.2);
  transform-origin: center;
  will-change: transform, opacity;
  pointer-events: none;
}

html.js .panel.active a, html.js .panel.active button { pointer-events: auto; }

.eyebrow {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 1rem;
}

h1 {
  font-size: clamp(3.2rem, 13vw, 8rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  font-weight: 700;
  text-wrap: balance;
}

h1 .outline {
  color: transparent;
  -webkit-text-stroke: 1.5px var(--coral);
}

h2 {
  font-size: clamp(2.2rem, 7vw, 3.8rem);
  line-height: 1;
  letter-spacing: -0.03em;
  font-weight: 700;
  text-wrap: balance;
}

.hero, .skills, .contact { text-align: center; }
html.js .hero { width: min(94vw, 900px); }

.lede {
  margin: 1.6rem auto 0;
  max-width: 30ch;
  font-size: clamp(1.05rem, 2.6vw, 1.35rem);
  line-height: 1.4;
  color: var(--dim);
}

.cue {
  margin-top: 2.6rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}
.cue span { display: inline-block; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(5px); } }

.meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.2rem 1.5rem;
  margin-top: 0.9rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--pearl);
}
.meta span:last-child { color: var(--dim); }

.sub {
  margin-top: 0.8rem;
  font-size: 0.98rem;
  color: var(--dim);
}

.panel ul:not(.sr-only) {
  list-style: none;
  padding: 0;
  margin-top: 1.5rem;
  display: grid;
  gap: 0.9rem;
}
.panel li {
  padding-left: 1.1rem;
  border-left: 1px solid rgba(244, 241, 234, 0.3);
  font-size: clamp(0.94rem, 2.2vw, 1.05rem);
  line-height: 1.5;
  color: rgba(244, 241, 234, 0.86);
}

a {
  color: var(--pearl);
  text-decoration: underline;
  text-decoration-color: var(--coral);
  text-underline-offset: 0.22em;
  transition: color 0.15s;
}
a:hover { color: var(--coral-hi); }

.links {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem 2rem;
  font-size: clamp(1rem, 2.6vw, 1.25rem);
}

/* the skills heading sits inside the ring of objects, so keep it compact */
.skills h2 { font-size: clamp(1.8rem, 5vw, 2.8rem); }
/* the section's one coral mark */
.skills h2::after {
  content: "";
  display: block;
  width: 2.2rem;
  height: 2px;
  margin: 0.9rem auto 0;
  background: var(--coral);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- HUD ---------- */

.hud {
  position: fixed;
  left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 1.4rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  pointer-events: none;
}
.hud-top { top: 0; }
.hud-bottom { bottom: 0; }
#label { color: var(--pearl); }
html:not(.js) .hud, html:not(.js) .dots { display: none; }

.mark {
  pointer-events: auto;
  font: 700 1rem var(--display);
  letter-spacing: -0.02em;
  color: var(--pearl);
  background: none;
  border: 1px solid rgba(244, 241, 234, 0.5);
  padding: 0.35rem 0.55rem;
  cursor: pointer;
}
.mark:hover { background: var(--pearl); color: var(--navy); }

.dots {
  position: fixed;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
}
.dots button {
  position: relative;
  width: 2rem;
  height: 1.6rem;
  background: none;
  border: 0;
  cursor: pointer;
}
.dots button::before {
  content: "";
  position: absolute;
  right: 0.7rem;
  top: 50%;
  width: 0.5rem;
  height: 1px;
  background: rgba(244, 241, 234, 0.4);
  transition: width 0.2s, background 0.2s;
}
.dots button:hover::before { width: 0.9rem; background: var(--pearl); }
.dots button[aria-current="true"]::before { width: 1.2rem; height: 2px; background: var(--coral); }
.dots button span {
  position: absolute;
  right: 2.3rem;
  top: 50%;
  transform: translateY(-50%);
  white-space: nowrap;
  font: 0.68rem var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pearl);
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.dots button:hover span, .dots button:focus-visible span { opacity: 1; }

:focus-visible { outline: 2px solid var(--coral-hi); outline-offset: 3px; }

@media (max-width: 600px) {
  .hint { display: none; }
  .hud { padding: 0.9rem 1rem; }
  .dots { right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .cue span { animation: none; }
}

/* ---------- section extras ---------- */

html.js .panel[data-side] { width: min(88vw, 560px); }

.stats {
  display: flex;
  gap: 2rem;
  margin-top: 1.4rem;
}
.stats div { flex: 1; }
.stats b {
  display: block;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: transparent;
  -webkit-text-stroke: 1.2px var(--pearl);
}
.stats span {
  display: block;
  margin-top: 0.45rem;
  font: 0.7rem/1.4 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim);
}

.panel ul.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.4rem;
}
.panel .tags li {
  padding: 0.3rem 0.6rem;
  border: 1px solid rgba(244, 241, 234, 0.3);
  font: 0.7rem var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(244, 241, 234, 0.8);
}

/* content settles into place as a section arrives */
html.js .panel > * {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
html.js .panel.in > * { opacity: 1; transform: none; }
html.js .panel.in > :nth-child(2) { transition-delay: 0.06s; }
html.js .panel.in > :nth-child(3) { transition-delay: 0.12s; }
html.js .panel.in > :nth-child(4) { transition-delay: 0.18s; }
html.js .panel.in > :nth-child(5) { transition-delay: 0.24s; }
html.js .panel.in > :nth-child(6) { transition-delay: 0.3s; }
html.js .panel.in > :nth-child(7) { transition-delay: 0.36s; }

@media (max-width: 600px) {
  .panel li { font-size: 0.88rem; line-height: 1.42; }
  .panel ul:not(.sr-only):not(.tags) { gap: 0.65rem; margin-top: 1.1rem; }
  .stats { margin-top: 1rem; gap: 1.2rem; }
  .stats b { font-size: 2rem; }
}
@media (max-width: 600px) and (max-height: 760px) {
  .tags { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  html.js .panel > * { transition: none; }
}

/* ---------- research poster modal ---------- */

.more { margin-top: 1.4rem; }
.text-btn {
  padding: 0;
  background: none;
  border: 0;
  font: inherit;
  font-size: 0.98rem;
  color: var(--pearl);
  text-decoration: underline;
  text-decoration-color: var(--coral);
  text-underline-offset: 0.22em;
  cursor: pointer;
}
.text-btn:hover { color: var(--coral-hi); }

.modal {
  width: min(94vw, 1100px);
  max-height: 92vh;
  margin: auto;
  padding: 0;
  background: var(--navy);
  color: var(--pearl);
  border: 1px solid rgba(244, 241, 234, 0.3);
  user-select: text;
  -webkit-user-select: text;
}
.modal[open] { display: flex; flex-direction: column; }
.modal::backdrop { background: rgba(10, 18, 36, 0.82); backdrop-filter: blur(4px); animation: backdrop-in 0.4s ease-out; }
@keyframes backdrop-in { from { opacity: 0; } }

.modal header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.1rem 1.2rem 1rem;
}
.modal .eyebrow { margin-bottom: 0.5rem; }
.modal h2 { font-size: clamp(1.1rem, 2.6vw, 1.5rem); line-height: 1.2; letter-spacing: -0.01em; }
.modal .close {
  flex: none;
  width: 2.2rem;
  height: 2.2rem;
  background: none;
  border: 1px solid rgba(244, 241, 234, 0.4);
  color: var(--pearl);
  font-size: 0.9rem;
  cursor: pointer;
}
.modal .close:hover { background: var(--pearl); color: var(--navy); }
.poster-scroll { overflow: auto; min-height: 0; background: #fff; }
.poster-scroll img { display: block; width: 100%; height: auto; }
.modal footer { padding: 0.8rem 1.2rem; font: 0.75rem var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }

@media (max-width: 700px) {
  /* keep the poster legible on a phone: let it scroll sideways instead of shrinking */
  .poster-scroll img { width: 900px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .modal::backdrop { animation: none; } }

/* slides inside the modal */
.slide-nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 1.2rem 0.9rem;
}
.slide-nav button {
  padding: 0.4rem 0.7rem;
  background: none;
  border: 1px solid rgba(244, 241, 234, 0.25);
  color: var(--dim);
  font: 0.7rem var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.slide-nav button:hover { color: var(--pearl); border-color: var(--pearl); }
.slide-nav button[aria-current="true"] { color: var(--pearl); border-color: var(--pearl); box-shadow: inset 0 -2px 0 var(--coral); }
.slide-nav .arrows { margin-left: auto; display: flex; gap: 0.4rem; }
.slide { display: flex; flex-direction: column; min-height: 0; }
.slide[hidden] { display: none; }
.slide iframe { display: block; width: 100%; height: min(62vh, 600px); border: 0; border-top: 1px solid rgba(244, 241, 234, 0.15); background: var(--navy); }
.modal .slide:last-of-type footer { text-transform: none; letter-spacing: 0; font: 0.9rem/1.45 var(--display); color: var(--dim); }
@media (max-width: 600px) { .slide-nav .arrows { display: none; } }

/* shared preview modal: a live site, or a section's details */
.viewer-frame { display: block; width: 100%; height: min(70vh, 720px); border: 0; border-top: 1px solid rgba(244, 241, 234, 0.15); background: #fff; }
.viewer-video { display: block; width: 100%; max-height: 72vh; background: #000; border-top: 1px solid rgba(244, 241, 234, 0.15); }
.viewer-frame[hidden], .viewer-video[hidden], .viewer-content[hidden], .modal footer[hidden] { display: none; }
.viewer-content { overflow: auto; min-height: 0; padding: 0.2rem 1.2rem 1.4rem; border-top: 1px solid rgba(244, 241, 234, 0.15); }
.viewer-content > :first-child { margin-top: 1.1rem; }
.prose ul { list-style: none; padding: 0; margin-top: 1.4rem; display: grid; gap: 0.9rem; }
.prose li { padding-left: 1.1rem; border-left: 1px solid rgba(244, 241, 234, 0.3); font-size: 1.05rem; line-height: 1.5; color: rgba(244, 241, 234, 0.86); }
.prose ul.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.prose .tags li { padding: 0.3rem 0.6rem; border: 1px solid rgba(244, 241, 234, 0.3); font: 0.7rem var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: rgba(244, 241, 234, 0.8); }
