/* Shared styles for every page: tokens, type, nav, footer, reusable pieces. */

:root {
  /* colour: cool off-white page, deep ink, one working blue, a sea band for offshore work */
  --bg: oklch(0.975 0.004 255);
  --bg-2: oklch(0.945 0.008 255);
  --ink: oklch(0.21 0.03 262);
  --ink-2: oklch(0.40 0.03 262);
  --ink-3: oklch(0.52 0.025 262);
  --line: oklch(0.87 0.012 258);
  --blue: oklch(0.53 0.17 262);
  --blue-ink: oklch(0.42 0.16 262);
  --blue-wash: oklch(0.93 0.035 262);
  --live: oklch(0.55 0.13 155);
  --live-wash: oklch(0.94 0.04 155);
  --sea: oklch(0.25 0.055 250);
  --sea-2: oklch(0.31 0.06 250);
  --sea-ink: oklch(0.96 0.01 250);
  --sea-ink-2: oklch(0.80 0.03 250);
  --sea-line: oklch(0.40 0.05 250);

  --font: "Archivo", system-ui, sans-serif;
  --mono: "Martian Mono", ui-monospace, monospace;

  --step--1: clamp(0.82rem, 0.8rem + 0.1vw, 0.88rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.09rem);
  --step-1: clamp(1.25rem, 1.15rem + 0.45vw, 1.5rem);
  --step-2: clamp(1.6rem, 1.4rem + 0.9vw, 2.2rem);
  --step-3: clamp(2.1rem, 1.7rem + 1.8vw, 3.4rem);
  --step-4: clamp(2.6rem, 1.9rem + 3.2vw, 5rem);

  --gutter: clamp(16px, 4vw, 48px);
  --max: 1240px;
  --radius: 6px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  /* z-index scale */
  --z-sticky: 10;
  --z-nav: 20;
  --z-popover: 30;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.6;
  font-variation-settings: "wdth" 100;
  text-rendering: optimizeLegibility;
}
img, video, svg { display: block; max-width: 100%; }
img, video { height: auto; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.08; text-wrap: balance; font-weight: 700; }
p { margin: 0; text-wrap: pretty; }
ul { margin: 0; padding: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 2px; }

.wrap { width: min(100% - 2 * var(--gutter), var(--max)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* wide display cut of Archivo: the "lettering on a drawing" voice */
.display { font-variation-settings: "wdth" 125; font-weight: 800; letter-spacing: -0.01em; }
.mono { font-family: var(--mono); font-size: 0.78em; letter-spacing: 0; font-variation-settings: "wdth" 90; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: var(--z-nav);
  background: color-mix(in oklch, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav__in { display: flex; align-items: center; gap: 24px; min-height: 60px; }
.nav__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-weight: 700; text-decoration: none; font-variation-settings: "wdth" 112; letter-spacing: -0.005em; margin-right: auto; white-space: nowrap; }
.nav__links { display: flex; gap: 4px; list-style: none; }
.nav__links a { text-decoration: none; padding: 6px 10px; border-radius: var(--radius); color: var(--ink-2); font-size: 0.95rem; }
.nav__links a:hover { color: var(--ink); background: var(--bg-2); }
.nav__links a[aria-current="page"] { color: var(--ink); background: var(--blue-wash); }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: var(--radius);
  border: 1px solid var(--ink); background: var(--ink); color: var(--bg);
  text-decoration: none; font-weight: 600; font-size: 0.95rem; line-height: 1.1; white-space: nowrap;
  transition: background .2s var(--ease-out), color .2s var(--ease-out);
}
.btn:hover { background: var(--blue-ink); border-color: var(--blue-ink); }
/* the button that should be pressed: the portfolio */
.btn--accent { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn--accent:hover { background: var(--blue-ink); border-color: var(--blue-ink); color: #fff; }
.btn--lg { padding: 13px 22px; font-size: 1.02rem; }
/* outline buttons on the dark banner */
.btn--line { background: transparent; color: #fff; border-color: oklch(0.45 0.01 262); }
.btn--line:hover { background: oklch(0.26 0.01 262); border-color: #fff; color: #fff; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--bg-2); color: var(--ink); border-color: var(--ink-3); }
.btn svg { width: 16px; height: 16px; }

.nav__toggle { display: none; background: none; border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 10px; cursor: pointer; }
.nav__name .short { display: none; }
@media (max-width: 860px) {
  .nav__name .short { display: inline; }
  .nav__in { gap: 10px; }
  .nav__toggle { display: inline-flex; }
  .nav__name .full { display: none; }
  .nav__links { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; padding: 8px var(--gutter) 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
  .nav[data-open] .nav__links { display: flex; }
  .nav__links a { padding: 10px 0; font-size: 1.05rem; }
  .nav .btn--cv span { display: none; }
}

/* ---------- reusable bits ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 0.72rem; font-variation-settings: "wdth" 90;
  padding: 5px 9px; border-radius: 100px; border: 1px solid var(--line); color: var(--ink-2); background: var(--bg);
  white-space: nowrap;
}
.chip--live { color: oklch(0.38 0.1 155); background: var(--live-wash); border-color: transparent; }
.chip--live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 var(--live); animation: live 2.4s var(--ease-out) infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--live) 60%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }

/* paper card: a citation you can open */
.paper {
  display: grid; gap: 10px; padding: 20px 22px; text-decoration: none;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg);
  transition: border-color .25s var(--ease-out), transform .25s var(--ease-out);
}
.paper:hover { border-color: var(--blue); transform: translateY(-2px); }
.paper__meta { font-family: var(--mono); font-size: 0.72rem; color: var(--ink-3); font-variation-settings: "wdth" 90; }
.paper__title { font-weight: 700; font-size: 1.08rem; line-height: 1.3; }
.paper__abs { color: var(--ink-2); font-size: 0.93rem; max-height: 4.8em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 45%, transparent); mask-image: linear-gradient(#000 45%, transparent); }
.paper__role { font-size: 0.85rem; color: var(--ink-2); }
.paper__go { font-weight: 600; color: var(--blue-ink); font-size: 0.92rem; }

/* YouTube: thumbnail first, player only after a click */
.yt { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; }
.yt img { width: 100%; height: 100%; object-fit: cover; opacity: .85; transition: opacity .3s; }
.yt button { position: absolute; inset: 0; z-index: 1; width: 100%; border: 0; background: none; cursor: pointer; display: grid; place-items: center; }
.yt button span { display: inline-flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 100px; background: color-mix(in oklch, var(--ink) 80%, transparent); color: #fff; font-weight: 600; font-size: 0.95rem; transition: background .2s; }
.yt button:hover span { background: var(--blue); }
.yt:hover img { opacity: 1; }
.yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

figure { margin: 0; }
figcaption { font-size: 0.85rem; color: var(--ink-3); margin-top: 10px; line-height: 1.45; }

/* ---------- footer ---------- */
/* closing band: same tinted area as the home globe, so the closing line always lives there */
.foot { margin-top: clamp(80px, 12vw, 160px); background: oklch(0.16 0.01 262); color: #fff; padding: clamp(48px, 7vw, 88px) 0 40px; }
.foot--joined { margin-top: 0; }
.foot__big { font-size: clamp(1.4rem, 1.1rem + 1.3vw, 2.2rem); max-width: 34ch; line-height: 1.2; color: #fff; }
.foot__row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.foot__small { margin-top: 56px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; color: oklch(0.72 0.01 262); font-size: 0.85rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- carousel: crossfading slides with arrows and dots ---------- */
.carousel { position: relative; }
.carousel__track { display: grid; touch-action: pan-y; }
.carousel__slide { grid-area: 1 / 1; opacity: 0; visibility: hidden; transition: opacity .55s var(--ease-out), visibility 0s .55s; }
.carousel__slide.is-on { opacity: 1; visibility: visible; transition-delay: 0s; }
.carousel:not(.is-ready) .carousel__slide:first-child { opacity: 1; visibility: visible; }
.carousel__slide img { width: 100%; border-radius: var(--radius); }
.carousel__nav { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.carousel__nav:empty { display: none; }
.carousel__btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); cursor: pointer; display: grid; place-items: center; transition: border-color .2s, background .2s; }
.carousel__btn:hover { border-color: var(--ink); }
.carousel__btn svg { width: 14px; height: 14px; }
.carousel__dots { display: flex; gap: 6px; }
.carousel__dot { width: 22px; height: 4px; border-radius: 2px; border: 0; padding: 0; background: var(--line); cursor: pointer; transition: background .3s, width .3s var(--ease-out); }
.carousel__dot[aria-current="true"] { background: var(--ink); width: 34px; }
.carousel__count { font-family: var(--mono); font-size: 0.7rem; color: var(--ink-3); margin-left: auto; font-variation-settings: "wdth" 90; }

.toggle { font: inherit; font-size: 0.82rem; padding: 6px 10px; border-radius: 100px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; white-space: nowrap; }
.toggle:hover { border-color: var(--ink-3); }
