:root {
  --ink: #1d2430;
  --ink-soft: #454f5c;
  --paper: rgba(252, 250, 246, 0.92);
  --paper-border: rgba(29, 36, 48, 0.08);
  --light: #f2ede3;
  --light-muted: rgba(242, 237, 227, 0.78);
  --primary: #275e50;
  --primary-hover: #1e4a3f;
  --ring: #1d6a56;
  --radius-m: 12px;
  --radius-l: 20px;
  --radius-pill: 999px;
  --shadow-panel: 0 0 0 1px rgba(29, 36, 48, 0.05), 0 2px 6px -2px rgba(15, 23, 32, 0.08),
    0 24px 60px -24px rgba(15, 23, 32, 0.28);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink);
  background-color: #9db8cf;
}

body.no-webgl::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    180deg,
    #35597e 0%,
    #7fa0bd 34%,
    #ecdcc2 52%,
    #b7c3c4 58%,
    #274b56 76%,
    #10242b 100%
  );
}

h1,
h2,
h3 {
  line-height: 1.12;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

p {
  max-width: 62ch;
}

svg {
  max-width: 100%;
  display: block;
}

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

::selection {
  background: rgba(39, 94, 80, 0.22);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: -100%;
  z-index: 200;
  padding: 12px 16px;
  background: #fff;
  border-radius: var(--radius-m);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-panel);
}

.skip-link:focus {
  top: 16px;
}

/* ============ Canvas ============ */
#canvas-holder {
  position: fixed;
  inset: 0;
  z-index: 0;
}

#canvas-holder canvas {
  width: 100%;
  height: 100%;
  display: block;
}

main {
  position: relative;
  z-index: 1;
}

.container {
  max-width: 75rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

/* ============ Loader ============ */
#loader {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: linear-gradient(180deg, #35597e 0%, #7fa0bd 55%, #d8cdbd 100%);
  opacity: 1;
  transition: opacity 600ms var(--ease-out);
}

#loader.is-done {
  opacity: 0;
  pointer-events: none;
}

.loader-mark {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
}

.loader-mark span {
  color: #ffd9a8;
}

.loader-bar {
  width: 120px;
  height: 2px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.25);
  position: relative;
}

.loader-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 40%;
  border-radius: 999px;
  background: #fff;
  animation: slide 1.1s var(--ease-out) infinite;
}

@keyframes slide {
  from { transform: translateX(-110%); }
  to { transform: translateX(280%); }
}

@media (prefers-reduced-motion: reduce) {
  .loader-bar::after {
    animation: none;
    left: 30%;
  }
}

/* ============ Header ============ */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  transition: background-color 300ms var(--ease-out), box-shadow 300ms var(--ease-out),
    backdrop-filter 300ms var(--ease-out);
}

@supports (backdrop-filter: blur(10px)) {
  .site-header.is-scrolled {
    background: rgba(16, 26, 33, 0.55);
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
  }
}

.header-inner {
  max-width: 75rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
}

.logo,
.nav-list a,
.header-inner .btn {
  transition: color 300ms var(--ease-out);
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.logo span {
  color: var(--primary);
}

.is-scrolled .logo,
.is-scrolled .nav-list a {
  color: var(--light);
}

.is-scrolled .nav-list a:hover {
  color: #fff;
}

.nav-list {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 14px;
  color: var(--ink-soft);
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius-pill);
}

.nav-list a:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.35);
}

.is-scrolled .nav-list a:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 12px 24px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-m);
  transition: transform 150ms var(--ease-out), background-color 150ms var(--ease-out),
    border-color 150ms var(--ease-out), color 150ms var(--ease-out);
}

.btn:active {
  transform: scale(0.97);
}

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

.btn--primary:hover {
  background: var(--primary-hover);
}

.btn--ink {
  background: var(--ink);
  color: var(--light);
}

.btn--ink:hover {
  background: #121821;
}

.btn--outline-ink {
  color: var(--ink);
  border: 1px solid rgba(29, 36, 48, 0.35);
}

.btn--outline-ink:hover {
  background: rgba(255, 255, 255, 0.4);
}

.btn--small {
  min-height: 40px;
  padding: 8px 16px;
}

.btn--large {
  min-height: 52px;
  padding: 16px 44px;
  font-size: 1.0625rem;
}

/* ============ Hero ============ */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding-top: 96px;
  position: relative;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: #274b41;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(39, 75, 65, 0.25);
  border-radius: var(--radius-pill);
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

.kicker {
  margin: 0 0 12px;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}

.kicker--light {
  color: var(--light-muted);
}

.hero-title {
  margin: 0;
  font-size: clamp(2.5rem, 1.4rem + 5.4vw, 4.75rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
  text-shadow: 0 1px 24px rgba(255, 255, 255, 0.25);
}

.lede {
  margin: 20px 0 0;
  font-size: clamp(1.0625rem, 1rem + 0.4vw, 1.25rem);
  color: var(--ink-soft);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero-meta {
  margin: 28px 0 0;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}

.hero-meta strong {
  color: var(--ink);
  font-weight: 600;
}

.scroll-hint {
  position: absolute;
  bottom: 32px;
  left: clamp(1rem, 4vw, 2rem);
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(29, 36, 48, 0.62);
}

.scroll-line {
  width: 1px;
  height: 44px;
  background: linear-gradient(180deg, rgba(29, 36, 48, 0.5), transparent);
}

/* ============ Zones & panels ============ */
.zone {
  display: flex;
  justify-content: center;
  padding: 22vh clamp(1rem, 4vw, 2rem) 10vh;
}

.panel {
  width: min(68rem, 100%);
  background: var(--paper);
  border: 1px solid var(--paper-border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-panel);
  padding: clamp(1.5rem, 4.5vw, 4rem);
}

.panel--split {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: clamp(2rem, 6vw, 4.5rem);
}

.section-head h2 {
  font-size: clamp(1.75rem, 1rem + 2.5vw, 2.5rem);
  margin: 0 0 8px;
}

.section-head p {
  color: var(--ink-soft);
  margin: 0 0 40px;
}

/* ============ Projects ============ */
.project p {
  color: var(--ink-soft);
}

.project--featured {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: stretch;
  padding-bottom: clamp(1.5rem, 4vw, 3rem);
  border-bottom: 1px solid var(--paper-border);
  margin-bottom: clamp(1.5rem, 4vw, 3rem);
  position: relative;
}

.project--featured .project-body {
  order: 1;
}

.project--featured h3 {
  font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2rem);
}

.project-visual {
  order: 2;
  display: flex;
  align-items: flex-end;
  border-radius: var(--radius-m);
  overflow: hidden;
}

.project-visual svg {
  width: 100%;
  height: auto;
}

.project-visual--a {
  color: var(--primary);
  background: linear-gradient(160deg, rgba(39, 94, 80, 0.12), rgba(39, 94, 80, 0.04));
}

.bento-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.5rem, 3vw, 2.5rem);
}

.project-topline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.project-topline h3 {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.year {
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  color: #7a8290;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.tags li {
  font-size: 0.8125rem;
  color: #4c5560;
  padding: 4px 12px;
  background: rgba(29, 36, 48, 0.05);
  border-radius: var(--radius-pill);
}

.project-link {
  display: inline-block;
  margin-top: 14px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
}

.project-link::after {
  content: " →";
  display: inline-block;
  transition: transform 150ms var(--ease-out);
}

.project-link:hover::after {
  transform: translateX(3px);
}

/* ============ About ============ */
.about-grid p,
.panel p {
  color: var(--ink-soft);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  margin: 32px 0 0;
  padding-top: 24px;
  border-top: 1px solid var(--paper-border);
}

.stats div {
  min-width: 120px;
}

.stats dt {
  order: 2;
  font-size: 0.875rem;
  color: #7a8290;
}

.stats dd {
  order: 1;
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.skills h3 {
  margin: 24px 0 12px;
  font-size: 0.9375rem;
  color: #7a8290;
}

.skills h3:first-child {
  margin-top: 0;
}

.skills .tags li {
  font-size: 0.9375rem;
  padding: 8px 16px;
  background: #fff;
  border: 1px solid var(--paper-border);
}

/* ============ Experience timeline ============ */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 32px;
  padding: 24px 0 24px 24px;
  border-left: 1px solid rgba(29, 36, 48, 0.16);
}

.timeline li + li {
  border-top: 1px solid var(--paper-border);
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -4.5px;
  top: 34px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

.when {
  margin: 0.35em 0 0;
  font-size: 0.875rem;
  color: #7a8290;
  font-variant-numeric: tabular-nums;
}

.timeline h3 {
  margin: 0 0 8px;
  font-size: 1.125rem;
}

.timeline p {
  margin: 0;
}

/* ============ Water footer ============ */
.water-footer {
  position: relative;
  margin-top: 14vh;
  padding: 18vh 0 0;
  color: var(--light);
  text-shadow: 0 1px 18px rgba(8, 20, 26, 0.45);
}

.water-footer::before {
  content: "";
  position: absolute;
  inset: -20vh 0 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(13, 31, 38, 0) 0%, rgba(13, 31, 38, 0.38) 55%, rgba(9, 22, 28, 0.72) 100%);
  pointer-events: none;
}

.footer-headline {
  margin: 0;
  font-size: clamp(2.5rem, 1.4rem + 5.4vw, 4.75rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.footer-sub {
  margin: 20px 0 0;
  font-size: 1.0625rem;
  color: var(--light-muted);
}

.footer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
  margin-top: 32px;
}

.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.socials a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 18px;
  color: var(--light);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(242, 237, 227, 0.4);
  border-radius: var(--radius-pill);
  transition: background-color 150ms var(--ease-out);
}

.socials a:hover {
  background: rgba(242, 237, 227, 0.14);
}

.footer-base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14vh;
  padding: 20px 0;
  border-top: 1px solid rgba(242, 237, 227, 0.22);
  font-size: 0.875rem;
  color: var(--light-muted);
}

.footer-base a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ============ Responsive ============ */
@media (max-width: 56.25em) {
  .panel--split {
    grid-template-columns: 1fr;
  }

  .project--featured {
    grid-template-columns: 1fr;
  }

  .project-visual {
    order: 0;
    min-height: 140px;
  }

  .bento-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timeline li {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

@media (max-width: 40em) {
  .nav-list li:nth-child(n + 3) {
    display: none;
  }

  .header-cta {
    display: none;
  }

  .bento-row {
    grid-template-columns: 1fr;
  }

  .zone {
    padding-top: 14vh;
  }

  .scroll-hint {
    display: 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;
  }
}
