/* ============ base ============ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 750;
  font-stretch: 118%;
  line-height: 1.06;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

p {
  margin: 0 0 1rem;
  max-width: var(--prose-max);
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration-color: var(--primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--duration-fast) var(--ease-out),
    text-decoration-color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--primary-deep);
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: var(--radius);
}

.deep :focus-visible {
  outline-color: var(--bioluminescent);
}

::selection {
  background: var(--primary);
  color: #fff;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

svg {
  display: block;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: var(--z-skip);
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--radius);
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
  color: var(--bg);
}

/* ============ shared layout ============ */

.wrap {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

section {
  padding-block: var(--space-section);
  scroll-margin-top: 5rem;
}

/* station label — the one deliberate label system (a real depth axis) */
.station {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: var(--space-block);
  font-size: var(--text-sm);
  font-weight: 520;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.station::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border: 1.5px solid var(--primary);
  border-radius: 50%;
  flex: none;
}

.station .depth {
  color: var(--primary);
  font-weight: 650;
}

.station::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.deep .station {
  color: var(--foam-muted);
}

.deep .station .depth {
  color: var(--bioluminescent);
}

.deep .station::before {
  border-color: var(--bioluminescent);
}

.deep .station::after {
  background: var(--abyss-line);
}

section > .wrap > h2,
.section-title {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-block);
}

/* ============ nav ============ */

.site-nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: var(--z-nav);
  background: color-mix(in oklch, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--duration-normal) var(--ease-out);
}

.site-nav.scrolled {
  border-bottom-color: var(--line);
}

.site-nav .wrap {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 3.75rem;
}

.brand {
  font-weight: 750;
  font-stretch: 115%;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover {
  color: var(--primary);
}

.nav-links {
  display: flex;
  gap: 1.4rem;
  margin-left: auto;
  font-size: var(--text-sm);
  font-weight: 520;
}

.nav-links a {
  text-decoration: none;
  color: var(--muted);
}

.nav-links a:hover,
.nav-links a[aria-current] {
  color: var(--ink);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.62rem 1.15rem;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.btn:hover {
  background: var(--primary-deep);
  border-color: var(--primary-deep);
  color: #fff;
}

.btn:active {
  transform: translateY(1px);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink);
}

.btn-ghost:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

.nav-resume {
  margin-left: 0.25rem;
}

/* ============ depth gauge ============ */

.gauge {
  position: fixed;
  top: 50%;
  right: clamp(0.75rem, 2vw, 2rem);
  transform: translateY(-50%);
  z-index: var(--z-gauge);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.85rem;
  font-size: 0.72rem;
  font-weight: 550;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.gauge-readout {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
}

.gauge-track {
  position: relative;
  width: 1px;
  height: min(38vh, 21rem);
  background: var(--line);
}

.gauge-dot {
  position: absolute;
  left: 50%;
  top: 0;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
}

.gauge-ticks {
  display: contents;
}

.gauge-ticks a {
  position: absolute;
  right: -0.3rem;
  width: 0.9rem;
  height: 1px;
  background: var(--muted);
  text-decoration: none;
}

.gauge-ticks a span {
  position: absolute;
  right: 1.3rem;
  top: 50%;
  translate: 0 -50%;
  opacity: 0;
  white-space: nowrap;
  transition: opacity var(--duration-fast) var(--ease-out);
}

.gauge-ticks a:hover span,
.gauge-ticks a:focus-visible span {
  opacity: 1;
}

.gauge-station {
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

body.in-deep .gauge {
  color: var(--foam-muted);
}

body.in-deep .gauge-readout {
  color: var(--bioluminescent);
}

body.in-deep .gauge-track {
  background: var(--abyss-line);
}

body.in-deep .gauge-ticks a {
  background: var(--foam-muted);
}

@media (max-width: 899px) {
  .gauge {
    display: none;
  }
}

/* ============ hero ============ */

.hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  align-items: center;
  padding-top: 6rem;
  overflow: clip;
}

.hero .wrap {
  position: relative;
  z-index: 1;
  width: 100%;
}

.hero h1 {
  font-size: var(--text-hero);
  max-width: 12ch;
  margin-bottom: 1.4rem;
}

.hero-tagline {
  font-size: var(--text-lg);
  font-weight: 500;
  max-width: 34ch;
  line-height: 1.35;
  margin-bottom: 1.1rem;
}

.hero-tagline em {
  font-style: normal;
  color: var(--primary);
}

.hero-sub {
  color: var(--muted);
  max-width: 52ch;
  margin-bottom: 2.2rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 3.2rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  font-size: var(--text-sm);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.hero-meta .live {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent-text);
  font-weight: 600;
}

.live-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.4s var(--ease-out) infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.hero-contours {
  position: absolute;
  inset: auto 0 -2px 0;
  width: 100%;
  height: clamp(10rem, 28vw, 20rem);
  color: var(--primary);
  pointer-events: none;
}

/* ============ contour divider ============ */

.divider {
  position: relative;
  z-index: var(--z-divider);
  height: clamp(3rem, 8vw, 6rem);
  width: 100%;
  color: var(--line);
  pointer-events: none;
}

/* ============ reduced motion ============ */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============ responsive ============ */

@media (max-width: 899px) {
  .about-grid,
  .research-grid,
  .project {
    grid-template-columns: 1fr;
  }

  .project-head {
    margin-bottom: 0.25rem;
  }
}

@media (max-width: 640px) {
  .nav-links {
    display: none;
  }

  .site-nav .wrap {
    justify-content: space-between;
    gap: 0.75rem;
  }

  .brand {
    font-size: 0.92rem;
  }

  .nav-resume {
    padding: 0.5rem 0.85rem;
  }

  .hero {
    min-height: 88vh;
  }

  .timeline > li,
  .log-list li,
  .goals-list li {
    grid-template-columns: 1fr;
  }

  .when {
    padding-top: 0;
  }

  .hero-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}
