/* ==========================================================
   Ke Swaab — shared design system
   ========================================================== */

:root {
  /* — color tokens (exact from Figma) — */
  --bg:         #0D0D0E;                   /* Background/black */
  --bg-blue:    linear-gradient(180deg, #0F1D2B 0%, #09121A 100%); /* Background/blue */
  --ink:        #F5EEEE;                   /* Text/white */
  --ink-dim:    rgba(245, 238, 238, 0.50); /* derived */
  --ink-faint:  rgba(245, 238, 238, 0.25); /* derived */
  --rule:       #DBE0EC33;                 /* Divider */
  --accent:     #F74A53;                   /* Text/red */
  --accent-2:   #4DC8E8;                   /* logo cyan — not in tokens */

  /* — type tokens — */
  --display: "Baskervville", Georgia, serif;          /* Header 1 / Header 2 */
  --serif:   "Source Serif Pro", "Source Serif 4", Georgia, serif; /* Paragraph */
  --mono:    "JetBrains Mono", ui-monospace, monospace; /* Nav / Caption */

  --container:   1280px;
  --gutter:      20px;
  --col-label:   295px;
  --col-body:    609px;
  --col-gap:     20px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: var(--serif);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: #0D0D0E; }

/* ----------- NAV ----------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid var(--rule);
  transition: background .3s ease, backdrop-filter .3s ease, border-color .3s ease;
}
/* On scroll, blur whatever passes behind the bar */
.nav.scrolled {
  background: rgba(13, 13, 14, 0.45);
  backdrop-filter: blur(32px) saturate(130%);
  -webkit-backdrop-filter: blur(32px) saturate(130%);
  border-bottom-color: var(--rule);
}
.nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink);
  transition: opacity .2s;
}
.nav-mark:hover { opacity: 0.65; }
.nav-mark .mark { height: 24px; width: auto; display: block; flex-shrink: 0; }
/* Nav/Regular — JetBrains Mono Regular / 14px / 140% / 15% tracking */
/* Nav/Selected — JetBrains Mono ExtraBold (800) / 14px / 140% / 15% tracking */
.nav-links {
  display: flex;
  align-items: center;
  gap: 40px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.nav-links a {
  position: relative;
  /* balance the underline's bottom padding with equal top padding so the
     link TEXT centers on the logo, not just the padded box */
  padding-top: 6px;
  padding-bottom: 6px;
  color: var(--ink-dim);
  transition: color .2s;
  /* Reserve the ExtraBold width up front so toggling .active (weight 800)
     never changes the link's box — the whole header stays put across tabs. */
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}
.nav-links a::before {
  content: attr(data-text);
  font-weight: 800;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a.active {
  color: var(--ink);
  font-weight: 800;
}
/* Underline indicator — red, fades in on hover and stays on the active tab */
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: var(--accent);
  opacity: 0;
  transition: opacity .2s ease;
}
.nav-links a:hover::after,
.nav-links a.active::after { opacity: 1; }

/* ----------- PAGE WRAPPER ----------- */
main { flex: 1; width: 100%; }
.wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ----------- TYPE (exact Figma tokens) ----------- */

/* Header 1 — Baskervville Regular / 96px / 100% / -5% tracking */
.display {
  font-family: var(--display);
  font-size: 96px;
  font-style: normal;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.05em;
  margin: 0;
}
/* Header 2 — Baskervville Italic / 96px / 100% / -5% tracking */
.display.italic { font-style: italic; }

/* Header 3 — Baskervville Italic / 48px / 120% / 0% tracking */
.heading {
  font-family: var(--display);
  font-size: 48px;
  font-style: italic;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
  margin: 0;
}

/* Paragraph/Header — Source Serif Pro Regular / 40px / 120% / 0% */
.para-header {
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
  margin: 0;
}

/* Paragraph/big — Source Serif Pro Light / 24px / 140% / 0% */
.lede {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 300;
  line-height: 1.4;
  letter-spacing: 0;
  color: var(--ink-dim);
  margin: 0;
}

/* Paragraph/mid — Source Serif Pro Light / 16px / 160% / 0% */
.prose {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 300;
  line-height: 1.6;
  letter-spacing: 0;
  color: var(--ink-dim);
  margin: 0;
}
.prose p { margin: 0 0 16px; }
.prose p:last-child { margin-bottom: 0; }

/* ----------- SECTION LABEL (caption token) ----------- */
/* caption — JetBrains Mono Medium / 11px / 140% / 15% tracking */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
}
.section-label .num { color: var(--ink-dim); }

/* ----------- CTA LINK LIST (Nav/Regular token) ----------- */
/* Nav/Regular — JetBrains Mono Regular / 14px / 140% / 15% tracking */
.link-list {
  display: flex;
  gap: 28px;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.link-list a {
  color: var(--ink-dim);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--rule);
  transition: color .25s, border-color .25s;
}
.link-list a:hover { color: var(--ink); border-bottom-color: var(--accent); }

/* ----------- MEDIA: VIDEO & GIF ----------- */
figure.media {
  margin: 0;
  padding: 0;
}
figure.media video,
figure.media img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 3px;
}
figure.media.contained video,
figure.media.contained img {
  border: 1px solid var(--rule);
}
/* caption token */
figure.media figcaption {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 12px;
}

/* ----------- PREV / NEXT PAGER ----------- */
.pager {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 64px var(--gutter) 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  border-top: 1px solid var(--rule);
}
.pager-item.prev { align-items: flex-start; text-align: left; }
.pager-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  transition: opacity .2s;
}
.pager-item.next { align-items: flex-end; text-align: right; }
.pager-item .pager-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 1.65px;
  text-transform: uppercase;
  color: var(--ink-dim);
  transition: color .2s;
}
.pager-item .pager-title {
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: 28px;
  line-height: 1.1;
  color: var(--ink);
  transition: color .2s;
}
a.pager-item:hover .pager-label { color: var(--accent); }
a.pager-item:hover .pager-title { color: var(--accent); }
/* coming-soon item — greyed, not clickable */
.pager-item.disabled { cursor: default; pointer-events: none; }
.pager-item.disabled .pager-label,
.pager-item.disabled .pager-title { color: var(--ink-faint); }
.pager-item.disabled .pager-soon {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--ink-faint);
}
@media (max-width: 600px) {
  .pager-item .pager-title { font-size: 22px; }
}

/* ----------- FOOTER ----------- */
.foot {
  width: 100%;
  padding: 48px 0;
}
.foot-meta {
  max-width: var(--container);
  margin: 0 auto;
  padding: 24px var(--gutter) 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.foot-meta a {
  color: var(--ink-faint);
  transition: color .2s;
}
.foot-meta a:hover { color: var(--ink); }

/* ----------- RESPONSIVE ----------- */
@media (max-width: 960px) {
  :root {
    --col-label: 0px;
    --col-gap:   0px;
  }
  .nav-links { gap: 24px; font-size: 13px; letter-spacing: 1.8px; }
  .display { font-size: clamp(52px, 13vw, 96px); letter-spacing: -2.4px; }
  .heading { font-size: clamp(32px, 8vw, 48px); }
  .lede { font-size: 20px; }
}

@media (max-width: 600px) {
  .nav-links { gap: 16px; font-size: 12px; letter-spacing: 1.4px; }
  .display { font-size: clamp(44px, 15vw, 72px); letter-spacing: -1.8px; }
}

/* ----------- MOBILE MEDIA FIX -----------
   On narrow screens, article images carry inline max-widths (e.g. 664/814px)
   set for desktop. Those override the responsive cap and overflow the viewport,
   clipping the image on both edges. Force them to stay within the container. */
@media (max-width: 960px) {
  .band-center img,
  .band-figure img,
  .band-row img,
  .fig img,
  .fig video { max-width: 100% !important; }

  /* Multi-image composition bands (fixed wide aspect-ratio + %-positioned
     children) collapse to a tiny height on narrow screens. Let them use the
     full viewport width for maximum size; tap any layer to view it full-res. */
  .band[style*="aspect-ratio"] {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
  }
}

/* ----------- LIGHTBOX (tap image to view at full size) ----------- */
.zoomable { cursor: zoom-in; }
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  background: rgba(6, 6, 8, 0.94);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.lightbox.open { display: block; }
/* scroll container — lets an image larger than the screen be panned */
.lightbox-scroll {
  position: absolute;
  inset: 0;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.lightbox-media {
  display: block;
  margin: auto;
  max-width: 100%;
  max-height: calc(100dvh - 48px);
  width: auto;
  height: auto;
  border-radius: 4px;
  cursor: zoom-in;
}
/* "actual size" state — image renders at native resolution and the container scrolls */
.lightbox.actual .lightbox-scroll { justify-content: flex-start; align-items: flex-start; }
.lightbox.actual .lightbox-media {
  max-width: none;
  max-height: none;
  cursor: zoom-out;
}
.lightbox-close {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 1001;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(245, 238, 238, 0.10);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background .2s;
}
.lightbox-close:hover { background: rgba(245, 238, 238, 0.22); }
.lightbox-hint {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1001;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 1.65px;
  text-transform: uppercase;
  color: var(--ink-dim);
  pointer-events: none;
}
