/* =========================================================
   Doaa Alghamdi — portfolio
   Theme: "vision lab" — detection boxes, scan lines, black + sage green
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark;
  --bg: #111111;
  --bg-2: #0a0a0a;
  --surface: #191919;
  --surface-2: #232323;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #e5e4e2;
  --muted: #e5e4e2;
  --faint: #e5e4e2;
  --brand: #e5e4e2;
  --brand-strong: #e5e4e2;
  --brand-soft: rgba(255, 255, 255, 0.1);
  --on-brand: #000000;
  --box: #8fbc8b;
  --on-box: #0e1a0d;
  --box-soft: rgba(143, 188, 139, 0.12);
  --coral: #ff8a65;
  --grid-line: rgba(255, 255, 255, 0.035);
  --smoke-opacity: 0.95;
  --smoke-filter: none;
  --smoke-image: url("smoke.svg?v=9");
  --grain-opacity: 0;
  --glow: transparent;
  --vignette: transparent;
  --grain-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1.4 -0.2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.75);
  --header-bg: rgba(17, 17, 17, 0.78);
  --radius: 22px;
  --radius-sm: 12px;
  --font: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --arabic: 'Markazi Text', 'Space Grotesk', serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f9f6ee;
  --bg-2: #f0ebdf;
  --surface: #fdfbf6;
  --surface-2: #f4f0e5;
  --line: rgba(23, 20, 31, 0.09);
  --line-strong: rgba(23, 20, 31, 0.18);
  --text: #4a4a4a;
  --muted: #4a4a4a;
  --faint: #4a4a4a;
  --brand: #4a4a4a;
  --brand-strong: #4a4a4a;
  --brand-soft: rgba(0, 0, 0, 0.07);
  --on-brand: #ffffff;
  --box: #87a96b;
  --on-box: #0e1a0d;
  --box-soft: rgba(135, 169, 107, 0.1);
  --coral: #d9532e;
  --grid-line: rgba(23, 20, 31, 0.045);
  --smoke-opacity: 0.7;
  --smoke-filter: none;
  --smoke-image: url("smoke-light.svg?v=1");
  --grain-opacity: 0;
  --grain-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='512' height='512'%3E%3Cdefs%3E%3Cpattern id='d' width='4' height='4' patternUnits='userSpaceOnUse'%3E%3Ccircle cx='1' cy='1' r='0.95' fill='rgb(150,130,95)' fill-opacity='0.32'/%3E%3Ccircle cx='3' cy='3' r='0.95' fill='rgb(150,130,95)' fill-opacity='0.32'/%3E%3C/pattern%3E%3C/defs%3E%3Cfilter id='t' x='0' y='0' width='1' height='1'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45  0 0 0 0 0.38  0 0 0 0 0.26  1.2 0 0 0 -0.5'/%3E%3C/filter%3E%3Cfilter id='m' x='0' y='0' width='1' height='1'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.0078' numOctaves='3' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.6  0 0 0 0 0.52  0 0 0 0 0.36  0.9 0 0 0 -0.32'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' fill='url(%23d)'/%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3Crect width='100%25' height='100%25' filter='url(%23t)'/%3E%3C/svg%3E");
  --glow: transparent;
  --vignette: transparent;
  --shadow: 0 24px 50px -30px rgba(0, 0, 0, 0.3);
  --header-bg: rgba(249, 246, 238, 0.85);
}

/* No-JS fallback: follow the OS setting */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #f9f6ee;
    --bg-2: #f0ebdf;
    --surface: #fdfbf6;
    --surface-2: #f4f0e5;
    --line: rgba(23, 20, 31, 0.09);
    --line-strong: rgba(23, 20, 31, 0.18);
    --text: #4a4a4a;
    --muted: #4a4a4a;
    --faint: #4a4a4a;
    --brand: #4a4a4a;
    --brand-strong: #4a4a4a;
    --brand-soft: rgba(0, 0, 0, 0.07);
    --on-brand: #ffffff;
    --box: #87a96b;
    --on-box: #0e1a0d;
    --box-soft: rgba(135, 169, 107, 0.1);
    --coral: #d9532e;
    --grid-line: rgba(23, 20, 31, 0.045);
    --smoke-opacity: 0.7;
    --smoke-filter: none;
    --smoke-image: url("smoke-light.svg?v=1");
    --grain-opacity: 0;
    --grain-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='512' height='512'%3E%3Cdefs%3E%3Cpattern id='d' width='4' height='4' patternUnits='userSpaceOnUse'%3E%3Ccircle cx='1' cy='1' r='0.95' fill='rgb(150,130,95)' fill-opacity='0.32'/%3E%3Ccircle cx='3' cy='3' r='0.95' fill='rgb(150,130,95)' fill-opacity='0.32'/%3E%3C/pattern%3E%3C/defs%3E%3Cfilter id='t' x='0' y='0' width='1' height='1'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45  0 0 0 0 0.38  0 0 0 0 0.26  1.2 0 0 0 -0.5'/%3E%3C/filter%3E%3Cfilter id='m' x='0' y='0' width='1' height='1'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.0078' numOctaves='3' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.6  0 0 0 0 0.52  0 0 0 0 0.36  0.9 0 0 0 -0.32'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' fill='url(%23d)'/%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3Crect width='100%25' height='100%25' filter='url(%23t)'/%3E%3C/svg%3E");
    --glow: transparent;
    --vignette: transparent;
    --shadow: 0 24px 50px -30px rgba(0, 0, 0, 0.3);
    --header-bg: rgba(249, 246, 238, 0.85);
  }
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 60% at 55% 30%, var(--glow), transparent 70%),
    radial-gradient(ellipse 120% 90% at 50% 50%, transparent 55%, var(--vignette) 100%);
  background-attachment: fixed;
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Film-grain texture over the page background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: var(--grain-image);
}

/* Drifting smoke behind everything (smoke.svg) */
body::after {
  content: "";
  position: fixed;
  inset: -6%;
  z-index: -2;
  pointer-events: none;
  background: var(--smoke-image) center 20% / cover no-repeat;
  opacity: var(--smoke-opacity);
  filter: var(--smoke-filter);
  animation: smoke-drift 38s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes smoke-drift {
  0%   { transform: translate3d(-2%, 0, 0) scale(1); }
  50%  { transform: translate3d(1.5%, -1.5%, 0) scale(1.04); }
  100% { transform: translate3d(3%, 1%, 0) scale(1.02); }
}

@media (prefers-reduced-motion: reduce) {
  body::after { animation: none; }
}

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

a {
  color: inherit;
}

::selection {
  background: var(--box);
  color: var(--on-box);
}

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

.container {
  width: min(1160px, 100% - 32px);
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 1000;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 600;
  text-decoration: none;
}

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

.mono {
  font-family: var(--mono);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 168px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-right: auto;
}

.brand img {
  width: 160px;
  height: 160px;
  object-fit: contain;
}

.brand span {
  font-size: 1.02rem;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.site-nav a {
  position: relative;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s ease, background 0.2s ease;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.site-nav a[aria-current="page"] {
  color: var(--text);
  background: var(--brand-soft);
}

.site-nav a[aria-current="page"]::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: var(--box);
  vertical-align: middle;
  transform: translateY(-1px);
}

/* Desktop: centered pill-shaped menu */
@media (min-width: 761px) {
  .site-nav {
    padding: 0.3rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }
}

@media (min-width: 900px) {
  .nav-wrap {
    position: relative;
  }

  .site-nav {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
  }
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.icon-btn:hover {
  transform: translateY(-1px);
  border-color: var(--brand);
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.theme-btn .icon-sun {
  display: none;
}

:root[data-theme="light"] .theme-btn .icon-sun {
  display: block;
}

:root[data-theme="light"] .theme-btn .icon-moon {
  display: none;
}

.nav-toggle {
  display: none;
}

@media (max-width: 760px) {
  .nav-toggle {
    display: inline-grid;
  }

  .brand span {
    display: none;
  }

  .site-nav {
    position: absolute;
    top: 168px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0.75rem 16px 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    display: none;
  }

  .site-nav.open {
    display: flex;
  }

  .site-nav a {
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-size: 1.05rem;
  }
}

/* ---------- Buttons & small parts ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.85rem 1.35rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font: 600 0.98rem/1 var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn svg {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}

.btn:hover svg {
  transform: translateX(3px);
}

.btn-primary {
  background: var(--brand);
  color: var(--on-brand);
  box-shadow: 0 10px 30px -10px var(--brand);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px -12px var(--brand);
}

.btn-ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line-strong);
}

.btn-ghost:hover {
  transform: translateY(-2px);
  border-color: var(--brand);
}

.btn-sm {
  padding: 0.6rem 1rem;
  font-size: 0.88rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font: 500 0.78rem/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--box);
  box-shadow: 0 0 12px var(--box);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.38rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  font: 500 0.82rem/1.2 var(--font);
  white-space: nowrap;
}

.pill-sm {
  padding: 0.28rem 0.6rem;
  font-size: 0.76rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font: 600 0.7rem/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--box);
}

.tag::before {
  content: "[";
}

.tag::after {
  content: "]";
}

/* ---------- Detection box (signature motif) ---------- */
.det {
  position: relative;
}

.det::before {
  --c: var(--box);
  --l: 22px;
  --w: 2px;
  content: "";
  position: absolute;
  inset: -10px;
  pointer-events: none;
  background:
    linear-gradient(var(--c), var(--c)) top left / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) top left / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) top right / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) top right / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) bottom left / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) bottom left / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) bottom right / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) bottom right / var(--w) var(--l);
  background-repeat: no-repeat;
  transition: inset 0.3s ease, opacity 0.3s ease;
}

.det-label {
  position: absolute;
  top: -10px;
  left: -10px;
  transform: translateY(-100%);
  padding: 0.32rem 0.55rem;
  border-radius: 5px 5px 5px 0;
  background: var(--box);
  color: var(--on-box);
  font: 600 0.7rem/1 var(--mono);
  white-space: nowrap;
  z-index: 2;
}

/* Only show corners on hover (cards) */
.det-hover::before {
  opacity: 0;
  inset: 0;
}

.det-hover:hover::before,
.det-hover:focus-within::before {
  opacity: 1;
  inset: -8px;
}

/* Inline highlighted word, boxed like a detected object */
.hl-box {
  position: relative;
  display: inline-block;
  padding: 0 0.12em;
  color: var(--box);
  border: 2px solid var(--box);
  border-radius: 4px;
  line-height: 1.05;
}

.hl-box::after {
  content: attr(data-label);
  position: absolute;
  left: -2px;
  bottom: 100%;
  padding: 0.22rem 0.4rem;
  border-radius: 4px 4px 0 0;
  background: var(--box);
  color: var(--on-box);
  font: 600 0.72rem/1 var(--mono);
  letter-spacing: 0;
  white-space: nowrap;
}

/* ---------- Sections ---------- */
main {
  display: block;
}

.section {
  padding: clamp(2.5rem, 5vw, 4rem) 0;
}

.section-tight {
  padding-top: 0;
}

.section-head {
  max-width: 720px;
  margin-bottom: clamp(1.4rem, 2.5vw, 2rem);
}

.section-head.center {
  margin-inline: auto;
  text-align: center;
}

.section-head h2 {
  margin: 0.7rem 0 0.5rem;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
}

.section-head p {
  color: var(--muted);
  font-size: 1rem;
}

.page-hero {
  padding: clamp(2rem, 5vw, 3.5rem) 0 clamp(1.2rem, 3vw, 2rem);
}

.page-hero h1 {
  margin: 0.8rem 0 0.7rem;
  font-size: clamp(2.1rem, 4.6vw, 3.4rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
  max-width: 14ch;
}

.page-hero p.lead {
  max-width: 620px;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
}

/* ---------- Home: hero ---------- */
.hero {
  padding: clamp(1.5rem, 4vh, 3rem) 0 clamp(1.5rem, 3vh, 2.5rem);
  /* the canvas bleeds past its box; don't let that widen the page */
  overflow-x: clip;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: clamp(1.5rem, 3vw, 3rem);
  align-items: center;
  min-height: min(calc(100svh - 168px - 9rem), 560px);
}

.hero h1 {
  margin: 0.9rem 0 0.9rem;
  font-size: clamp(2.2rem, 4.2vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.045em;
  font-weight: 700;
}

.hero h1 .hl-box {
  margin-top: 0.4em;
}

.hero-sub {
  max-width: 480px;
  color: var(--muted);
  font-size: 1.02rem;
}

.hero .hero-actions {
  margin-top: 1.4rem;
}

/* the quote gets its own centred row across the top of the hero:
   fading hairlines either side */
.hero .hero-quote {
  grid-column: 1 / -1;
  justify-self: stretch;
  display: flex;
  align-items: center;
  gap: clamp(0.8rem, 2.5vw, 1.6rem);
  margin: 0;
  font-family: var(--arabic);
  font-size: clamp(1.25rem, 2.2vw, 1.6rem);
  font-weight: 500;
  line-height: 1.3;
  color: var(--text);
  text-align: center;
}

.hero .hero-quote::before,
.hero .hero-quote::after {
  content: "";
  flex: 1 1 0;
  min-width: 1.5rem;
  max-width: 220px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--line-strong));
}

/* fade each line out toward the outer edge (::before is on the right in RTL) */
.hero .hero-quote::before {
  margin-inline-start: auto;
  background: linear-gradient(to left, transparent, var(--line-strong));
}

.hero .hero-quote::after {
  margin-inline-end: auto;
}

.hero .hero-quote span {
  white-space: nowrap;
}

@media (max-width: 420px) {
  .hero .hero-quote span {
    white-space: normal;
    text-wrap: balance;
  }
}

.hero-visual {
  position: relative;
  height: clamp(280px, 36vw, 440px);
}

.hero-canvas {
  position: absolute;
  /* bleed past the box so pushed dots aren't clipped at a hard edge */
  inset: -48px;
  width: calc(100% + 96px);
  height: calc(100% + 96px);
  display: block;
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at center, #000 70%, transparent 100%);
  mask-image: radial-gradient(ellipse 50% 50% at center, #000 70%, transparent 100%);
}

/* ParticleHero's cursor is white by default; follow the theme instead */
.hero-canvas .ph-cursor-ring {
  border-color: var(--text);
}

.hero-canvas .ph-cursor-dot {
  background: var(--text);
}

.hero-canvas .ph-cursor-text {
  color: var(--text);
  font-family: var(--mono);
}

@media (hover: none) {
  .hero-canvas .ph-cursor {
    display: none;
  }
}

/* English: hands on the left, text on the right (Arabic already mirrors this) */
@media (min-width: 861px) {
  html:not([dir="rtl"]) .hero-grid { grid-template-columns: 1.05fr 1fr; }
  html:not([dir="rtl"]) .hero-visual { grid-column: 1; grid-row: 2; }
  html:not([dir="rtl"]) .hero-text { grid-column: 2; grid-row: 2; }
}

@media (max-width: 860px) {
  .hero-grid {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .hero-visual {
    height: min(66vw, 320px);
  }
}

.scroll-cue {
  position: absolute;
  left: 50%;
  top: calc(max(100svh - 168px, 640px) - 92px);
  z-index: 2;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  text-decoration: none;
  font: 500 0.72rem/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mouse {
  position: relative;
  width: 24px;
  height: 36px;
  border: 2px solid currentColor;
  border-radius: 12px;
}

.mouse i {
  position: absolute;
  left: 50%;
  top: 7px;
  width: 4px;
  height: 7px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--box);
  animation: wheel 1.6s ease-in-out infinite;
}

@keyframes wheel {
  0% { opacity: 0; transform: translateY(-3px); }
  40% { opacity: 1; }
  100% { opacity: 0; transform: translateY(10px); }
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.stat {
  padding: 1.1rem 1.2rem;
  border-inline-end: 1px solid var(--line);
}

.stat:last-child {
  border-inline-end: 0;
}

.stat b {
  display: block;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--text);
}

.stat b em {
  font-style: normal;
  color: var(--box);
}

.stat span {
  display: block;
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

@media (max-width: 760px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat:nth-child(2) {
    border-inline-end: 0;
  }

  .stat:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

.about-text p {
  font-size: 1.15rem;
  color: var(--muted);
  margin-bottom: 1.1rem;
}

.about-text p strong {
  color: var(--text);
  font-weight: 600;
}

.steps {
  display: grid;
  gap: 0.9rem;
  list-style: none;
}

.step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.1rem;
  align-items: start;
  padding: 1.3rem 1.4rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
}

.step-num {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font: 700 0.95rem/1 var(--mono);
}

:root[data-theme="light"] .step-num {
  color: var(--brand);
}

.step h3 {
  font-size: 1.08rem;
  margin-bottom: 0.2rem;
}

.step p {
  color: var(--muted);
  font-size: 0.96rem;
}

@media (max-width: 860px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Interest cards ---------- */
.journey {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1rem, 4vw, 3.5rem);
  margin: 0 0 clamp(2rem, 4vw, 3.25rem);
  padding: 1.4rem clamp(1rem, 4vw, 3rem);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(110deg, var(--surface), color-mix(in srgb, var(--brand-soft) 40%, var(--surface)));
}

.journey-track {
  position: absolute;
  top: 1.95rem;
  left: 16.67%;
  right: 16.67%;
  height: 2px;
  background: linear-gradient(270deg, var(--brand), var(--box));
  opacity: 0.8;
}

.journey-track::before,
.journey-track::after {
  position: absolute;
  top: 50%;
  width: 9px;
  height: 9px;
  content: "";
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--brand-strong);
  box-shadow: 0 0 0 3px var(--brand-soft), 0 0 16px var(--brand);
  transform: translateY(-50%);
}

.journey-track::before { right: 0; }
.journey-track::after { left: 0; background: var(--box); box-shadow: 0 0 0 3px var(--box-soft), 0 0 16px var(--box); }

.journey-track span {
  position: absolute;
  top: 50%;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 12px var(--text);
  transform: translateY(-50%);
  animation: journey-scan 3.2s ease-in-out infinite alternate;
}

@keyframes journey-scan { to { left: calc(100% - 5px); } }

.journey-stop {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  min-width: 0;
  padding-top: 2.35rem;
}

.journey-index {
  position: absolute;
  top: 0;
  left: 0;
  color: var(--brand);
  font: 600 0.68rem/1 var(--mono);
  letter-spacing: 0.08em;
}

.journey-copy { min-width: 0; width: 100%; }
.journey-kicker { color: var(--faint); font: 500 0.62rem/1.4 var(--mono); letter-spacing: 0.14em; }
.journey-copy h3 { margin: 0.2rem 0 0.1rem; font-size: clamp(1rem, 1.8vw, 1.25rem); line-height: 1.2; }
.journey-copy p { color: var(--muted); font-size: 0.9rem; }

.journey-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.6rem;
}

.journey-title img {
  flex: 0 0 auto;
  width: 2.4rem;
  height: 3rem;
  object-fit: contain;
  background: transparent;
}

.journey-title img.journey-sdaia-logo {
  width: 3rem;
  height: 3rem;
  background: transparent;
  object-fit: cover;
  object-position: left center;
}

.journey-title h3 { margin-top: 0; }
.journey-stop-current .journey-index { color: var(--box); }
.journey-stop-open .journey-index { color: var(--coral); }
.journey-open-icon { color: var(--coral); font-size: 1.5rem; line-height: 1; }

@media (max-width: 760px) {
  /* newest stop on top, so the line runs from the bottom up */
  .journey { grid-template-columns: 1fr; gap: 0.8rem; padding: 1rem 1.1rem; }
  .journey-track { top: 2rem; bottom: 2rem; left: 1.35rem; right: auto; width: 2px; height: auto; background: linear-gradient(to top, var(--brand), var(--box), var(--coral)); }
  .journey-track::before { top: 100%; right: auto; left: 50%; transform: translate(-50%, -50%); }
  .journey-track::after { top: 0; right: auto; left: 50%; transform: translate(-50%, -50%); }
  .journey-track span { top: auto; bottom: 0; left: 50%; transform: translateX(-50%); animation-name: journey-scan-vertical; }
  @keyframes journey-scan-vertical { to { bottom: calc(100% - 5px); left: 50%; } }
  .journey-stop { padding: 0.3rem 0 0.5rem 1.4rem; }
  .journey-index { left: 1.4rem; top: 0; }
  .journey-title img { width: 2.4rem; height: 3rem; }
}

/* Timeline + category footer share one card */
.journey-card {
  margin: 0 0 clamp(2rem, 4vw, 3.25rem);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.journey-card > .journey {
  margin: 0;
  border: 0;
  border-radius: 0;
}

.journey-cats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 96%, #000);
}

.journey-cat {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem 1.75rem;
  text-decoration: none;
  transition: background-color 150ms ease;
}

.journey-cat + .journey-cat { border-inline-start: 1px solid var(--line); }

.journey-cat-bar {
  width: 24px;
  height: 3px;
  border-radius: 3px;
  background: var(--cat);
  transition: width 150ms ease;
}

.journey-cat-name {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
}

.journey-cat-arrow {
  margin-inline-start: auto;
  color: var(--faint);
  font-weight: 500;
  transition: color 150ms ease, transform 150ms ease;
}

.journey-cat:hover,
.journey-cat:focus-visible { background: color-mix(in srgb, var(--surface) 94%, #fff); }
.journey-cat:hover .journey-cat-bar,
.journey-cat:focus-visible .journey-cat-bar { width: 40px; }
.journey-cat:hover .journey-cat-arrow,
.journey-cat:focus-visible .journey-cat-arrow { color: var(--cat); transform: translate(2px, -2px); }

/* inset so the card's overflow: hidden doesn't clip the ring */
.journey-cat:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -4px;
  border-radius: 0;
}

@media (max-width: 899px) {
  .journey-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .journey-cat + .journey-cat { border-inline-start: 0; }
  .journey-cat:nth-child(even) { border-inline-start: 1px solid var(--line); }
  .journey-cat:nth-child(n + 3) { border-top: 1px solid var(--line); }
}

@media (max-width: 559px) {
  .journey-cats { grid-template-columns: 1fr; }
  .journey-cat:nth-child(even) { border-inline-start: 0; }
  .journey-cat + .journey-cat { border-top: 1px solid var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  .journey-cat,
  .journey-cat-bar,
  .journey-cat-arrow { transition: none; }
}

[dir="rtl"] .journey-cat:hover .journey-cat-arrow,
[dir="rtl"] .journey-cat:focus-visible .journey-cat-arrow { transform: translate(-2px, -2px); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 1.2rem;
}

.card-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 900px) {
  .card-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.interest {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  padding: 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: transform 0.25s ease, border-color 0.25s ease;
}

a.interest:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
}

.interest-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  margin-bottom: 0.8rem;
}

.interest-icon svg {
  width: 26px;
  height: 26px;
}

.interest h3 {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
}

.interest p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.interest .example {
  margin-top: auto;
  padding-top: 1.2rem;
  font-size: 0.88rem;
  color: var(--faint);
}

.interest .example a {
  color: var(--box);
  font-weight: 600;
  text-decoration: none;
}

.interest .example a:hover {
  text-decoration: underline;
}

/* ---------- Toolbox ---------- */
.toolbox {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr));
  gap: 1.2rem;
}

.tool-group {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}

.tool-group h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.tool-group h3 small {
  font: 500 0.72rem/1 var(--mono);
  color: var(--faint);
}

.tool-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
}

.tool-list button {
  font: 500 0.86rem/1.2 var(--font);
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.tool-list button:hover,
.tool-list button[aria-pressed="true"] {
  background: var(--box);
  border-color: var(--box);
  color: var(--on-box);
  transform: translateY(-1px);
}

.tool-explain {
  margin-top: auto;
  padding-top: 1.1rem;
  min-height: 4.6rem;
  font-size: 0.93rem;
  color: var(--muted);
  border-top: 1px dashed var(--line-strong);
  margin-top: 1.2rem;
}

.tool-explain b {
  color: var(--text);
}

.hint {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.4rem;
  font: 500 0.8rem/1 var(--mono);
  color: var(--faint);
}

/* Tabbed toolbox — folder tabs sitting on top of the open panel */
.tabs {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  gap: 0.3rem;
  margin-bottom: -1px;
  padding-top: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tabs [role="tab"] {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.05rem 0.65rem;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  background: var(--surface-2);
  box-shadow: inset 0 -1px 0 var(--line-strong);
  color: var(--muted);
  font: 500 0.92rem/1 var(--font);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, padding 0.2s ease;
}

.tabs [role="tab"]::before {
  content: "";
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M3 6.5A1.5 1.5 0 0 1 4.5 5h4.6l2 2.5h8.4A1.5 1.5 0 0 1 21 9v9.5a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 18.5z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M3 6.5A1.5 1.5 0 0 1 4.5 5h4.6l2 2.5h8.4A1.5 1.5 0 0 1 21 9v9.5a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 18.5z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.tabs [role="tab"]:hover {
  color: var(--text);
}

/* Open folder: same color as the panel, taller, no line underneath */
.tabs [role="tab"][aria-selected="true"] {
  padding-top: 0.85rem;
  border-color: var(--line-strong);
  background: var(--surface);
  box-shadow: none;
  color: var(--text);
}

.tabs [role="tab"][aria-selected="true"]::before {
  background: var(--brand);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M3 6.5A1.5 1.5 0 0 1 4.5 5h4.6l2 2.5h7.4A1.5 1.5 0 0 1 20 9v1.5M3 18.5V6.5M3 18.5l2.6-7A1.5 1.5 0 0 1 7 10.5h13.6a1 1 0 0 1 .95 1.3l-2.2 7.2a1.5 1.5 0 0 1-1.43 1H4.5A1.5 1.5 0 0 1 3 18.5z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M3 6.5A1.5 1.5 0 0 1 4.5 5h4.6l2 2.5h7.4A1.5 1.5 0 0 1 20 9v1.5M3 18.5V6.5M3 18.5l2.6-7A1.5 1.5 0 0 1 7 10.5h13.6a1 1 0 0 1 .95 1.3l-2.2 7.2a1.5 1.5 0 0 1-1.43 1H4.5A1.5 1.5 0 0 1 3 18.5z'/%3E%3C/svg%3E");
}

.toolbox-tabs .tool-group[hidden] {
  display: none;
}

/* The folder body: square top-left corner so the first tab joins it */
.toolbox-tabs .tool-group {
  border: 1px solid var(--line-strong);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  padding: 1.3rem 1.3rem 1.3rem;
  box-shadow: var(--shadow);
}

.toolbox-tabs .tool-explain {
  min-height: 0;
  margin-top: 1rem;
  padding-top: 0.9rem;
}

/* ---------- CTA band ---------- */
.cta {
  position: relative;
  overflow: hidden;
  padding: clamp(1.6rem, 4vw, 2.6rem);
  border-radius: 24px;
  background: var(--box);
  color: var(--on-box);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  align-items: center;
}

.cta::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(90deg, transparent 30%, #000);
  -webkit-mask-image: linear-gradient(90deg, transparent 30%, #000);
  pointer-events: none;
}

.cta h2 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  max-width: 20ch;
}

.cta p {
  margin-top: 0.8rem;
  opacity: 0.85;
  max-width: 460px;
}

.cta .btn {
  position: relative;
  z-index: 1;
  background: var(--on-box);
  color: var(--box);
}

.cta .btn:hover {
  transform: translateY(-2px);
}

@media (max-width: 700px) {
  .cta {
    grid-template-columns: 1fr;
  }
}

/* ---------- Filters ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.filters button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  font: 500 0.92rem/1 var(--font);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filters button:hover {
  color: var(--text);
  border-color: var(--brand);
}

.filters button[aria-pressed="true"] {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.filters button small {
  font: 600 0.72rem/1 var(--mono);
  opacity: 0.7;
}

/* ---------- Project cards ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 1.5rem;
  align-items: start;
}

.project {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.project:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.project[hidden] {
  display: none;
}

.gallery {
  position: relative;
  display: flex;
  gap: 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  background: var(--bg-2);
}

.gallery::-webkit-scrollbar {
  display: none;
}

.gallery img {
  flex: 0 0 100%;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  scroll-snap-align: start;
  cursor: zoom-in;
}

.media {
  position: relative;
}

.media-count {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  background: rgba(35, 35, 35, 0.78);
  color: #fff;
  font: 600 0.7rem/1 var(--mono);
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.media-placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  background:
    radial-gradient(circle at 30% 30%, var(--brand-soft), transparent 60%),
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--bg-2);
  color: var(--brand);
}

.media-placeholder svg {
  width: 64px;
  height: 64px;
}

.project-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.4rem 1.4rem 1.5rem;
}

.project h3 {
  margin: 0.6rem 0 0.8rem;
  font-size: 1.35rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.simple {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--box-soft);
  border-inline-start: 3px solid var(--box);
  font-size: 0.98rem;
  line-height: 1.5;
}

.simple span {
  display: block;
  margin-bottom: 0.25rem;
  font: 600 0.68rem/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--box);
}

.how-title {
  margin: 1.1rem 0 0.5rem;
  font: 600 0.72rem/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.how {
  list-style: none;
  display: grid;
  gap: 0.45rem;
}

.how li {
  position: relative;
  padding-left: 1.3rem;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.5;
}

.how li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 7px;
  height: 7px;
  border: 1.5px solid var(--brand);
  border-radius: 2px;
}

.project-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1.2rem 0 0;
  list-style: none;
}

.project-foot {
  margin-top: auto;
  padding-top: 1.3rem;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--box);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.95rem;
}

.link-arrow svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.link-arrow:hover svg {
  transform: translate(2px, -2px);
}

.empty-note {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--muted);
}

/* ---------- Project cards (compact) ---------- */
.projects-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 1.1rem;
  counter-reset: proj;
}

.project {
  counter-increment: proj;
}

.project .gallery img,
.project .media-placeholder {
  aspect-ratio: 16 / 9;
}

.project .media-placeholder svg {
  width: 46px;
  height: 46px;
}

.project .project-body {
  position: relative;
  padding: 1rem 1.15rem 1.15rem;
}

.project .project-body::before {
  content: counter(proj, decimal-leading-zero);
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  font: 700 1.6rem/1 var(--font);
  letter-spacing: -0.04em;
  color: transparent;
  -webkit-text-stroke: 1px var(--line-strong);
}

.project h3 {
  margin: 0.45rem 0 0.6rem;
  padding-right: 2.5rem;
  font-size: 1.15rem;
}

.project .simple {
  padding: 0.65rem 0.8rem;
  font-size: 0.92rem;
}

.project details.more {
  margin-top: 0.8rem;
  padding-top: 0.7rem;
}

.project details.more .how {
  margin-top: 0.7rem;
}

.project .how li {
  font-size: 0.88rem;
}

.project .project-tools {
  margin-top: 0.8rem;
}

.project .project-foot {
  padding-top: 0.9rem;
}

/* Featured projects reuse the original card design in a static row. */
.featured-projects {
  margin-bottom: 1.25rem;
}

.featured-projects-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.1rem;
  max-width: 980px;
  margin-inline: auto;
}

.featured-projects-grid .pcard {
  position: relative;
  inset: auto;
  width: 100%;
  height: auto;
  min-height: 450px;
  margin: 0;
  padding: 1.1rem;
  will-change: auto;
}

.featured-projects-grid .pcard-img {
  height: 190px;
}

.featured-projects-grid .pcard-img + .pcard-label {
  margin-top: 95px;
}

.featured-projects-grid .pcard-title {
  font-size: 1.4rem;
}

.featured-projects-grid .pcard-simple {
  font-size: 0.85rem;
}

.featured-projects-grid .pcard-list {
  gap: 0.25rem;
  padding-top: 0.6rem;
}

.featured-projects-grid .pcard-list li {
  font-size: 0.7rem;
}

.featured-projects-grid .pcard-foot {
  gap: 0.45rem 0.7rem;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
}

.featured-projects-grid .pcard-tools {
  font-size: 0.6rem;
}

.featured-projects-grid .link-arrow {
  font-size: 0.78rem;
}

@media (max-width: 800px) {
  .featured-projects {
    --card-w: min(340px, 78vw);
    --card-h: 590px;
  }

  .featured-projects-grid {
    display: block;
    position: relative;
    max-width: none;
    height: calc(var(--card-h) + 60px);
    perspective: 1500px;
    touch-action: pan-y;
    user-select: none;
    cursor: grab;
  }

  .featured-projects-grid .pcard {
    position: absolute;
    inset: 50% auto auto 50%;
    width: var(--card-w);
    height: var(--card-h);
    min-height: 0;
    margin: calc(var(--card-h) / -2) 0 0 calc(var(--card-w) / -2);
    padding: 1.4rem 1.4rem 1.2rem;
    will-change: transform;
  }

  .featured-projects-grid .pcard-img { height: 220px; }
  .featured-projects-grid .pcard-img + .pcard-label { margin-top: 115px; }
  .featured-projects-grid .pcard-title { font-size: 1.5rem; }
  .featured-projects-grid .pcard-simple { font-size: 0.95rem; }
  .featured-projects-grid .pcard-list { gap: 0.35rem; }
  .featured-projects-grid .pcard-list li { font-size: 0.76rem; }
  .featured-projects-grid .pcard-tools { font-size: 0.66rem; }
  .featured-projects-grid .link-arrow { font-size: 0.88rem; }

  .pcard .pcard-list {
    margin-top: 0.5rem;
    padding-top: 0;
  }
}

/* ---------- Project carousel (3D coverflow) ---------- */
.pc {
  position: relative;
  margin-bottom: 2.5rem;
  --card-w: min(340px, 78vw);
  --card-h: 560px;
}

.pc-glow {
  position: absolute;
  left: 50%;
  top: 44%;
  width: min(900px, 120vw);
  height: 520px;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(closest-side, rgba(140, 140, 140, 0.22), transparent),
    radial-gradient(closest-side at 65% 60%, rgba(143, 188, 139, 0.18), transparent);
  filter: blur(30px);
  pointer-events: none;
}

.pc-stage {
  position: relative;
  height: calc(var(--card-h) + 60px);
  perspective: 1500px;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}

.pc-stage.dragging {
  cursor: grabbing;
}

.pc-stage:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 6px;
  border-radius: 20px;
}

.pcard {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--card-w);
  height: var(--card-h);
  margin: calc(var(--card-h) / -2) 0 0 calc(var(--card-w) / -2);
  display: flex;
  flex-direction: column;
  padding: 1.4rem 1.4rem 1.2rem;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(160deg, #262626, #121212);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  overflow: hidden;
  will-change: transform;
  transform-style: preserve-3d;
}

.pcard[hidden] {
  display: none;
}

.pcard.is-active {
  border-color: rgba(255, 255, 255, 0.2);
}

.pcard:not(.is-active) {
  cursor: pointer;
}

.pcard:not(.is-active) * {
  pointer-events: none;
}

.pcard-img {
  position: absolute;
  inset: 0 0 auto 0;
  height: 270px;
  background: var(--img) center / cover no-repeat;
  /* photo is clear at the top and melts into the card behind the text */
  -webkit-mask-image: linear-gradient(180deg, #000 40%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 40%, transparent 100%);
  pointer-events: none;
}

/* small icon logos: keep them crisp and centred instead of stretched */
.pcard-img--icon {
  background-size: 96px auto;
  background-position: center 60px;
  image-rendering: auto;
}

.pcard-img + .pcard-label {
  margin-top: 150px;
}

.pcard-img ~ .pcard-label,
.pcard-img ~ .pcard-title,
.pcard-img ~ .pcard-simple {
  text-shadow: 0 1px 12px rgba(10, 8, 16, 0.9);
}

:root[data-theme="light"] .pcard-img ~ .pcard-label,
:root[data-theme="light"] .pcard-img ~ .pcard-title,
:root[data-theme="light"] .pcard-img ~ .pcard-simple {
  text-shadow: 0 1px 12px rgba(255, 255, 255, 0.95);
}

.pcard > *:not(.pcard-img) {
  position: relative;
}

.pcard-label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font: 600 0.68rem/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(229, 228, 226, 0.75);
}

.pcard-title {
  margin: 0.7rem 0 0.6rem;
  font-size: clamp(1.5rem, 2.6vw, 1.85rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--text);
}

.pcard-simple {
  color: rgba(229, 228, 226, 0.86);
  font-size: 0.95rem;
  line-height: 1.5;
}

.pcard-list {
  list-style: none;
  display: grid;
  gap: 0.35rem;
  margin-top: auto;
  padding-top: 0.8rem;
}

.pcard-list li {
  position: relative;
  padding-left: 1rem;
  font: 400 0.76rem/1.45 var(--mono);
  color: rgba(229, 228, 226, 0.68);
}

.pcard-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #8fbc8b;
}

.pcard-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.pcard-tools {
  flex: 1 1 60%;
  font: 500 0.66rem/1.5 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(229, 228, 226, 0.55);
}

.pcard .link-arrow {
  color: #8fbc8b;
  font-size: 0.88rem;
  white-space: nowrap;
}

.pc-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.4rem;
}

/* Arrows sit above the cards, one on the left and one on the right */
.pc {
  padding-top: 56px;
}

.pc-prev,
.pc-next {
  position: absolute;
  top: 0;
  z-index: 50;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.pc-prev {
  left: 0;
}

.pc-next {
  right: 0;
}

.pc-prev svg,
.pc-next svg {
  width: 24px;
  height: 24px;
}

.pc-prev:hover,
.pc-next:hover {
  transform: scale(1.08);
}


.pc-count {
  min-width: 5.5ch;
  text-align: center;
  font: 600 0.85rem/1 var(--mono);
  color: var(--muted);
}

.pc-hint {
  margin-top: 0.7rem;
  text-align: center;
  font: 500 0.72rem/1 var(--mono);
  color: var(--faint);
}

/* Light theme: frosted white cards */
:root[data-theme="light"] .pcard {
  border-color: rgba(23, 20, 31, 0.1);
  background: linear-gradient(160deg, #ffffff, #f1eee8);
  box-shadow: 0 30px 50px -30px rgba(0, 0, 0, 0.3);
}

:root[data-theme="light"] .pcard-label,
:root[data-theme="light"] .pcard-simple,
:root[data-theme="light"] .pcard-list li,
:root[data-theme="light"] .pcard-tools {
  color: var(--muted);
}

:root[data-theme="light"] .pcard-title {
  color: var(--text);
}

:root[data-theme="light"] .pcard-foot {
  border-top-color: var(--line);
}

:root[data-theme="light"] .pcard .link-arrow {
  color: var(--box);
}

:root[data-theme="light"] .pcard-list li::before {
  background: var(--box);
}

:root[data-theme="light"] .pc-glow {
  opacity: 0.6;
}

@media (max-width: 600px) {
  .pc {
    --card-h: 590px;
  }

  .pcard-img {
    height: 220px;
  }

  .pcard-img + .pcard-label {
    margin-top: 115px;
  }
}

/* ---------- Volunteer ---------- */
.jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 2rem;
}

.jump a {
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
  color: var(--muted);
  transition: all 0.2s ease;
}

.jump a:hover {
  color: var(--text);
  border-color: var(--brand);
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 1.1rem;
  /* opening one card's "+" shouldn't stretch its neighbours */
  align-items: start;
}

.story {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
}

.story-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1.05rem 1.15rem 1.15rem;
}

.story-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  font: 500 0.78rem/1.2 var(--mono);
  color: var(--faint);
}

.role {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font: 600 0.72rem/1 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

:root[data-theme="light"] .role {
  color: var(--brand);
}

.story h3 {
  margin: 0.55rem 0 0.4rem;
  font-size: 1.12rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.story p {
  color: var(--muted);
  font-size: 0.92rem;
}

.story p + p {
  margin-top: 0.7rem;
}

.badge-win {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.9rem;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  background: var(--box-soft);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
}

details.more {
  margin-top: 1rem;
  border-top: 1px dashed var(--line-strong);
  padding-top: 0.9rem;
}

details.more summary {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  list-style: none;
  cursor: pointer;
  color: var(--brand);
  font-weight: 600;
  font-size: 0.92rem;
}

details.more summary::-webkit-details-marker {
  display: none;
}

details.more summary::after {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--brand-soft);
  font: 700 0.9rem/1 var(--mono);
  transition: transform 0.2s ease;
}

details.more[open] summary::after {
  content: "–";
}

details.more[open] > *:not(summary) {
  animation: fadeIn 0.3s ease;
}

details.more > p:first-of-type {
  margin-top: 0.8rem;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

.points {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.9rem;
  list-style: none;
}

.points li {
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.points li strong {
  display: block;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 0.1rem;
}

.points a,
.story a:not(.btn) {
  color: var(--brand);
  font-weight: 600;
}

/* Club cards: the open card is wide, the others shrink and go gray.
   Hovering a card opens it; clicking keeps it open. */
.club-accordion {
  display: flex;
  gap: 0.7rem;
  height: clamp(480px, 64vh, 620px);
}

.club-card {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  filter: grayscale(1);
  opacity: 0.72;
  transition: flex-grow 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s ease, filter 0.4s ease,
    border-color 0.3s ease;
}

.club-card.is-open {
  flex-grow: 6;
  cursor: default;
  filter: none;
  opacity: 1;
  border-color: var(--line-strong);
}

.cc-tab {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
  padding: 1.3rem 0.4rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: opacity 0.25s ease;
}

.cc-label {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
  font-weight: 600;
  font-size: 1.05rem;
}

.cc-role {
  font: 600 0.62rem/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.cc-body {
  position: absolute;
  inset: 0;
  min-width: 620px;
  overflow-y: auto;
  padding: clamp(1.1rem, 2.2vw, 1.6rem);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  scrollbar-width: thin;
}

.club-card .story {
  background: var(--bg-2);
}

:root[data-theme="light"] .club-card .story {
  background: var(--surface-2);
}

.club-card .story-grid {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.9rem;
}

.club-card .club-head {
  padding-bottom: 0.9rem;
  margin-bottom: 1rem;
}

/* which card shows its content */
.club-card.is-open .cc-body {
  opacity: 1;
  pointer-events: auto;
  transition-delay: 0.2s;
}

.club-card.is-open .cc-tab {
  opacity: 0;
  pointer-events: none;
}

@media (hover: hover) and (min-width: 761px) {
  .club-accordion:hover .club-card {
    flex-grow: 1;
    filter: grayscale(1);
    opacity: 0.72;
  }

  .club-accordion:hover .club-card:hover {
    flex-grow: 6;
    filter: none;
    opacity: 1;
  }

  .club-accordion:hover .club-card:hover .cc-body {
    opacity: 1;
    pointer-events: auto;
    transition-delay: 0.2s;
  }

  .club-accordion:hover .club-card:hover .cc-tab {
    opacity: 0;
    pointer-events: none;
  }

  .club-accordion:hover .club-card.is-open:not(:hover) .cc-body {
    opacity: 0;
    pointer-events: none;
    transition-delay: 0s;
  }

  .club-accordion:hover .club-card.is-open:not(:hover) .cc-tab {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (max-width: 760px) {
  .club-accordion {
    flex-direction: column;
    height: auto;
  }

  .club-card {
    flex: none;
    height: 64px;
  }

  .club-card.is-open {
    height: auto;
  }

  .cc-tab {
    flex-direction: row;
    justify-content: space-between;
    padding: 0 1.2rem;
  }

  .cc-label,
  .cc-role {
    writing-mode: horizontal-tb;
    transform: none;
  }

  .club-card.is-open .cc-tab {
    display: none;
  }

  .cc-body {
    position: static;
    min-width: 0;
    display: none;
  }

  .club-card.is-open .cc-body {
    display: block;
  }
}

/* Club panel */
.club {
  border-radius: 28px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: clamp(1.1rem, 2.5vw, 1.6rem);
  margin-bottom: 1.2rem;
}

.club-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem 2rem;
  align-items: end;
  padding-bottom: 1rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--line);
}

.club-head h3 {
  margin: 0.5rem 0 0.25rem;
  font-size: clamp(1.3rem, 2.4vw, 1.6rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.club-head p {
  color: var(--muted);
  max-width: 620px;
}

.club-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
}

.club-logo img {
  display: block;
  height: 72px;
  width: auto;
}

.club-logo .logo-light {
  display: none;
}

:root[data-theme="light"] .club-logo .logo-light {
  display: block;
}

:root[data-theme="light"] .club-logo .logo-dark {
  display: none;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .club-logo .logo-light {
    display: block;
  }
  :root:not([data-theme]) .club-logo .logo-dark {
    display: none;
  }
}

.club-dates {
  font: 500 0.85rem/1.2 var(--mono);
  color: var(--faint);
  white-space: nowrap;
}

.club .story {
  background: var(--bg-2);
  border-color: var(--line);
}

:root[data-theme="light"] .club .story {
  background: var(--surface-2);
}

@media (max-width: 640px) {
  .club-head {
    grid-template-columns: 1fr;
  }
  .club-aside {
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: center;
  }
  .club-logo img {
    height: 56px;
  }
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 1.5rem;
  align-items: start;
}

.channels {
  display: grid;
  gap: 0.8rem;
}

.channel {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.2rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

a.channel:hover,
.channel:has(button:hover) {
  transform: translateY(-2px);
  border-color: var(--brand);
}

.channel-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
}

.channel-icon svg {
  width: 22px;
  height: 22px;
}

.channel b {
  display: block;
  font-size: 1rem;
}

.channel div span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  overflow-wrap: break-word;
}

.channel .go {
  color: var(--faint);
  width: 18px;
  height: 18px;
}

.form-card {
  padding: clamp(1.4rem, 3.5vw, 2.2rem);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
}

.form-card h2 {
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.3rem;
}

.form-card > p {
  color: var(--muted);
  margin-bottom: 1.4rem;
}

.field {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.field label {
  font: 600 0.75rem/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.5 var(--font);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field textarea {
  resize: vertical;
  min-height: 130px;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.form-note {
  margin-top: 0.9rem;
  font-size: 0.85rem;
  color: var(--faint);
}

.reply-time {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.8rem;
  padding: 1rem 1.2rem;
  border-radius: 16px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  font-size: 0.93rem;
}

.pulse {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--box);
  box-shadow: 0 0 0 0 var(--box);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(143, 188, 139, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(143, 188, 139, 0); }
  100% { box-shadow: 0 0 0 0 rgba(143, 188, 139, 0); }
}

@media (max-width: 860px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

/* Simple centered contact: big email + a row of links */
.say-hi {
  padding: clamp(3rem, 10vh, 6rem) 0 clamp(2rem, 6vh, 4rem);
  text-align: center;
}

.say-hi h2 {
  margin: 0.9rem 0 0.6rem;
  font-size: clamp(3rem, 9vw, 6rem);
  line-height: 1;
  letter-spacing: -0.05em;
}

.say-hi-lead {
  max-width: 460px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 1.08rem;
}

.say-hi-email {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 2.2rem;
}

.say-hi-email a {
  font-size: clamp(1.3rem, 4vw, 2.2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--box);
  text-decoration-thickness: 3px;
  text-underline-offset: 8px;
  overflow-wrap: anywhere;
  transition: color 0.2s ease;
}

.say-hi-email a:hover {
  color: var(--box);
}

.say-hi-or {
  margin-top: 2.6rem;
  font: 500 0.75rem/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.say-hi-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 1rem;
}

.say-hi-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.7rem 1.15rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.say-hi-links a:hover {
  transform: translateY(-2px);
  border-color: var(--box);
  color: var(--box);
}

.say-hi-links span {
  display: flex;
}

.say-hi-links svg {
  width: 18px;
  height: 18px;
}

.say-hi-note {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 2.4rem;
  color: var(--muted);
  font-size: 0.92rem;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 300;
  transform: translate(-50%, 140%);
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: var(--shadow);
  transition: transform 0.3s ease;
}

.toast.show {
  transform: translate(-50%, 0);
}

/* ---------- Lightbox ---------- */
.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(1100px, 94vw);
  max-height: 90vh;
  margin: auto;
}

.lightbox::backdrop {
  background: rgba(8, 6, 12, 0.88);
  backdrop-filter: blur(6px);
}

.lightbox img {
  max-width: 100%;
  max-height: 84vh;
  border-radius: 14px;
  margin: 0 auto;
}

.lightbox figcaption {
  margin-top: 0.7rem;
  text-align: center;
  color: #dddddd;
  font-size: 0.9rem;
}

.lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

/* ---------- iPhone notice ---------- */
.device-note {
  width: min(340px, 88vw);
  margin: auto;
  padding: 1.6rem 1.4rem 1.4rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: center;
  box-shadow: var(--shadow);
}

.device-note::backdrop {
  background: rgba(8, 6, 12, 0.7);
  backdrop-filter: blur(6px);
}

.device-note-tag {
  display: inline-block;
  font: 500 0.78rem/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  text-decoration: line-through;
  text-decoration-color: var(--coral);
  text-decoration-thickness: 2px;
}

:root[lang="ar"] .device-note-tag {
  font-family: var(--arabic);
  font-size: 1rem;
  letter-spacing: 0;
}

.device-note h2 {
  margin: 0.7rem 0 0.4rem;
  font-size: 1.35rem;
}

.device-note p {
  margin: 0 0 1.2rem;
  color: var(--muted);
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: clamp(2rem, 5vw, 3.5rem);
  border-top: 1px solid var(--line);
  padding: 2.5rem 0 2rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.footer-brand img {
  width: 84px;
  height: 84px;
  object-fit: contain;
}

.footer-brand p {
  color: var(--muted);
  font-size: 0.93rem;
  max-width: 300px;
  line-height: 1.45;
}

.socials {
  display: flex;
  gap: 0.6rem;
}

.socials a {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  transition: all 0.2s ease;
}

.socials a:hover {
  color: var(--on-box);
  background: var(--box);
  border-color: var(--box);
  transform: translateY(-2px);
}

.socials svg {
  width: 19px;
  height: 19px;
}

.copyright {
  margin-top: 2rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--faint);
  font-size: 0.85rem;
}

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

.copyright a:hover {
  color: var(--box);
}

/* ---------- Compact story grid (Volunteer events) ---------- */
.story-grid.compact {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  max-width: 920px;
  gap: 0.9rem;
}

.story-grid.compact .gallery img {
  aspect-ratio: 2 / 1;
}

.story-grid.compact .story-body {
  padding: 0.8rem 0.9rem 0.9rem;
}

.story-grid.compact .story-meta {
  font-size: 0.7rem;
}

.story-grid.compact .story h3 {
  font-size: 1rem;
}

.story-grid.compact .story p {
  font-size: 0.84rem;
}

/* ---------- Highlights orbit carousel (Volunteer) ---------- */
.orbit {
  --orbit-bg: #8FBC8B;
  --orbit-fg: #e5e4e2;
  --orbit-ease: cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--radius);
  background-color: var(--orbit-bg);
  color: var(--orbit-fg);
  padding-bottom: clamp(1.25rem, 3vw, 2.25rem);
}

:root[data-theme="light"] .orbit {
  --orbit-fg: #fff;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .orbit {
    --orbit-fg: #fff;
  }
}


/* Cards sit on the theme surface, so they shouldn't inherit the box's white */
.orbit .story {
  color: var(--text);
}

.orbit,
.js .orbit.reveal {
  transition: background-color 650ms var(--orbit-ease), opacity 0.7s ease, transform 0.7s ease;
}

.orbit-grain {
  position: absolute;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}

.orbit-tag {
  position: absolute;
  top: 1.1rem;
  left: clamp(1rem, 3vw, 2rem);
  z-index: 60;
  font: 600 0.72rem/1 var(--font);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.9;
}

.orbit-ghost {
  position: absolute;
  inset-inline: 0;
  top: 2.2rem;
  z-index: 1;
  text-align: center;
  font: 400 clamp(56px, 14vw, 190px)/1 'Anton', sans-serif;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  transition: opacity 325ms var(--orbit-ease), transform 325ms var(--orbit-ease);
}

.orbit-ghost.swap {
  opacity: 0;
  transform: translateY(12px);
}

.orbit-stage {
  position: relative;
  z-index: 3;
  display: grid;
  gap: 1.1rem;
  padding: 3.25rem 1rem 1rem;
}

.js .orbit-stage {
  display: block;
  padding: 0;
  height: var(--stage-h, 640px);
  transition: height 300ms var(--orbit-ease);
}

.js .orbit-item {
  position: absolute;
  top: clamp(4.5rem, 9vw, 7rem);
  left: 50%;
  width: min(330px, 74vw);
  transform-origin: 50% 0;
  box-shadow: 0 30px 60px -28px rgba(0, 0, 0, 0.5);
  transition:
    transform 650ms var(--orbit-ease),
    filter 650ms var(--orbit-ease),
    opacity 650ms var(--orbit-ease),
    left 650ms var(--orbit-ease);
  will-change: transform, filter, opacity;
}

.js .orbit-item[data-role="center"] {
  z-index: 20;
  transform: translateX(-50%) scale(1);
}

.js .orbit-item[data-role="left"],
.js .orbit-item[data-role="right"] {
  z-index: 10;
  left: 26%;
  transform: translateX(-50%) translateY(28px) scale(0.72);
  filter: blur(2px);
  opacity: 0.85;
  cursor: pointer;
}

.js .orbit-item[data-role="right"] {
  left: 74%;
}

.js .orbit-item[data-role="back"] {
  z-index: 5;
  transform: translateX(-50%) translateY(20px) scale(0.55);
  filter: blur(4px);
  opacity: 0.9;
  cursor: pointer;
}

.orbit-ui {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 clamp(1rem, 3vw, 2rem);
}

.orbit-count {
  margin-bottom: 0.3rem;
  font: 600 0.75rem/1 var(--mono);
  letter-spacing: 0.08em;
  opacity: 0.85;
}

.orbit-name {
  margin-bottom: 0.9rem;
  font-weight: 700;
  font-size: clamp(1rem, 2.2vw, 1.35rem);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.95;
}

.orbit-info {
  position: relative;
  z-index: 60;
}

/* Arrows pinned to the middle of the box's left and right edges */
.orbit-btn {
  position: absolute;
  top: 50%;
  z-index: 60;
  transform: translateY(-50%);
}

.orbit-prev {
  left: clamp(1rem, 3vw, 2rem);
}

.orbit-next {
  right: clamp(1rem, 3vw, 2rem);
}

.orbit-btn {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border: 2px solid var(--orbit-fg);
  border-radius: 50%;
  background: transparent;
  color: var(--orbit-fg);
  cursor: pointer;
  transition: transform 150ms, background-color 150ms;
}

.orbit-btn svg {
  width: 26px;
  height: 26px;
}

.orbit-btn:hover {
  transform: translateY(-50%) scale(1.08);
  background-color: rgba(255, 255, 255, 0.12);
}

.orbit-btn:focus-visible {
  outline: 2px solid var(--orbit-fg);
  outline-offset: 3px;
}

@media (min-width: 900px) {
  .js .orbit {
    padding-bottom: 0;
  }

  .js .orbit-info {
    position: absolute;
    left: clamp(1rem, 3vw, 2rem);
    bottom: clamp(1.25rem, 3vw, 2rem);
  }
}

@media (max-width: 640px) {
  .js .orbit-item[data-role="left"],
  .js .orbit-item[data-role="right"] {
    left: 12%;
    transform: translateX(-50%) translateY(50px) scale(0.6);
    opacity: 0.7;
  }

  .js .orbit-item[data-role="right"] {
    left: 88%;
  }

  .orbit-btn {
    width: 3rem;
    height: 3rem;
  }
}

/* ---------- Reveal on scroll ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.js .reveal.in {
  opacity: 1;
  transform: none;
}

@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;
  }

  .js .reveal {
    opacity: 1;
    transform: none;
  }
}

/* ===================== Language switch + Arabic (RTL) ===================== */
.lang-btn {
  font: 600 0.95rem/1 var(--font);
  text-decoration: none;
}

.lang-btn[lang="ar"] {
  font-family: var(--arabic);
  font-size: 1.1rem;
}

/* Latin glyphs keep Space Grotesk / JetBrains Mono; Arabic glyphs fall back to Markazi Text */
:root[lang="ar"] {
  --font: 'Space Grotesk', 'Markazi Text', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Markazi Text', ui-monospace, monospace;
}

/* Negative tracking breaks Arabic letter joining */
[dir="rtl"] :is(h1, h2, h3, h4, p, span, li, a, button, .eyebrow) {
  letter-spacing: 0;
}

[dir="rtl"] body {
  line-height: 1.75;
}

[dir="rtl"] .skip-link { left: auto; right: 16px; }
[dir="rtl"] .brand { margin-right: 0; margin-left: auto; }
[dir="rtl"] .site-nav a[aria-current="page"]::before { margin-right: 0; margin-left: 0.45rem; }

/* Arrow icons point "forward" = left in RTL */
[dir="rtl"] .btn svg,
[dir="rtl"] .link-arrow svg {
  transform: scaleX(-1);
}
[dir="rtl"] .btn:hover svg {
  transform: scaleX(-1) translateX(3px);
}

/* Journey timeline runs right-to-left */
[dir="rtl"] .journey-track { background: linear-gradient(90deg, var(--brand), var(--box)); }
[dir="rtl"] .journey-track::before { right: auto; left: 0; }
[dir="rtl"] .journey-track::after { left: auto; right: 0; }
[dir="rtl"] .journey-index { left: auto; right: 0; }

@media (max-width: 760px) {
  [dir="rtl"] .journey-track { left: auto; right: 1.35rem; background: linear-gradient(to top, var(--brand), var(--box), var(--coral)); }
  [dir="rtl"] .journey-track::before,
  [dir="rtl"] .journey-track::after { left: 50%; right: auto; }
  [dir="rtl"] .journey-stop { padding: 0.3rem 1.4rem 0.5rem 0; }
  [dir="rtl"] .journey-index { right: 1.4rem; }
}

[dir="rtl"] .how li,
[dir="rtl"] .pcard-list li { padding-left: 0; }
[dir="rtl"] .how li { padding-right: 1.3rem; }
[dir="rtl"] .pcard-list li { padding-right: 1rem; }
[dir="rtl"] .how li::before,
[dir="rtl"] .pcard-list li::before { left: auto; right: 0; }

[dir="rtl"] .project .project-body::before { right: auto; left: 1rem; }
[dir="rtl"] .project h3 { padding-right: 0; padding-left: 2.5rem; }
[dir="rtl"] .media-count { right: auto; left: 12px; }
[dir="rtl"] .link-arrow:hover svg {
  transform: scaleX(-1) translate(2px, -2px);
}

/* ---------- Theme-aware site logo ---------- */
.theme-logo.logo-light { display: none; }
:root[data-theme="light"] .theme-logo.logo-light { display: block; }
:root[data-theme="light"] .theme-logo.logo-dark { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .theme-logo.logo-light { display: block; }
  :root:not([data-theme]) .theme-logo.logo-dark { display: none; }
}

/* Project permalinks retain the card title styling. */
.pcard[id] {
  scroll-margin-top: 100px;
}

.pcard-title a {
  color: inherit;
  text-decoration: none;
}

.pcard-title a:hover {
  text-decoration: none;
}

.volunteer-permalink,
.volunteer-permalink:hover {
  color: inherit;
  text-decoration: none;
}

.story[id],
.club-card[id] {
  scroll-margin-top: 100px;
}

/* Custom scrollbar with a percentage; 100% once the footer shows. */
html { scrollbar-width: none; }
html::-webkit-scrollbar { display: none; }
.scroll-progress {
  position: fixed;
  inset-inline-end: 0;
  top: 0;
  bottom: 0;
  z-index: 150;
  width: 14px;
  touch-action: none;
  cursor: pointer;
}
.scroll-progress::before {
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-end: 4px;
  width: 4px;
  border-radius: 2px;
  background: var(--line-strong);
}
.scroll-progress-thumb {
  position: absolute;
  top: 0;
  inset-inline-end: 2px;
  width: 8px;
  height: 64px;
  border-radius: 4px;
  background: var(--box);
  will-change: transform;
  transition: width 0.15s ease;
}
.scroll-progress:hover .scroll-progress-thumb,
.scroll-progress.is-dragging .scroll-progress-thumb { width: 10px; }
.scroll-progress-label {
  position: absolute;
  top: 50%;
  inset-inline-end: calc(100% + 8px);
  transform: translateY(-50%);
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: var(--box);
  color: var(--on-box);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
}

/* ---------- Say hi: wave button + optional note ---------- */
.wave {
  display: grid;
  justify-items: center;
  gap: 1rem;
  max-width: 460px;
  margin: 2rem auto 0;
}

.wave-lead {
  color: var(--muted);
  font-size: 1.08rem;
}

.wave-more {
  width: 100%;
}

.wave-more summary {
  width: max-content;
  margin: 0 auto;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px dashed var(--line-strong);
  font: 500 0.78rem/1 var(--mono);
  letter-spacing: 0.04em;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.wave-more summary::-webkit-details-marker { display: none; }

.wave-more summary:hover,
.wave-more[open] summary {
  border-color: var(--box);
  color: var(--box);
}

.wave-fields {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.9rem;
}

.wave-fields textarea,
.wave-fields input {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font: 400 1rem/1.5 var(--font);
  resize: vertical;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

:lang(ar) .wave-fields textarea,
:lang(ar) .wave-fields input {
  font-family: var(--arabic);
  font-size: 1.15rem;
}

.wave-fields textarea:focus,
.wave-fields input:focus {
  outline: none;
  border-color: var(--box);
  box-shadow: 0 0 0 4px var(--box-soft);
}

.wave-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.wave-btn:hover {
  transform: translateY(-3px) scale(1.04);
  border-color: var(--box);
  background: var(--box-soft);
}

.wave-btn:focus-visible {
  outline: 3px solid var(--box);
  outline-offset: 4px;
}

.wave-btn:disabled {
  cursor: default;
  transform: none;
}

.wave-hand {
  display: block;
  width: 92px;
  transform-origin: 55% 85%;
}

.wave-img {
  display: block;
  width: 100%;
  height: auto;
}

/* white doodle on dark theme, black doodle on light theme */
.wave-img-light { display: none; }
:root[data-theme="light"] .wave-img-light { display: block; }
:root[data-theme="light"] .wave-img-dark { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .wave-img-light { display: block; }
  :root:not([data-theme]) .wave-img-dark { display: none; }
}

.wave-btn:hover .wave-hand,
.wave.is-sending .wave-hand {
  animation: wave-hand 0.9s ease-in-out infinite;
}

.wave.is-sent .wave-hand {
  animation: wave-hand 0.5s ease-in-out 3;
}

.wave.is-sent .wave-btn {
  border-color: var(--box);
  background: var(--box-soft);
}

@keyframes wave-hand {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(18deg); }
  40% { transform: rotate(-10deg); }
  60% { transform: rotate(14deg); }
  80% { transform: rotate(-4deg); }
}

/* little "hi" bubbles that float up after sending */
.wave-pop {
  position: absolute;
  left: 50%;
  top: 10%;
  font: 600 0.85rem/1 var(--mono);
  color: var(--box);
  pointer-events: none;
  animation: wave-pop 1.2s ease-out forwards;
}

@keyframes wave-pop {
  from { opacity: 1; transform: translate(-50%, 0) scale(0.8); }
  to { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), -70px) scale(1.15); }
}

.wave-hint {
  min-height: 1.5em;
  font: 500 0.8rem/1.5 var(--mono);
  letter-spacing: 0.04em;
  color: var(--faint);
}

.wave.is-sent .wave-hint { color: var(--box); }
.wave.is-error .wave-hint { color: var(--coral); }

.wave-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .wave-btn:hover .wave-hand,
  .wave.is-sending .wave-hand,
  .wave.is-sent .wave-hand,
  .wave-pop {
    animation: none;
  }
  .wave-pop { display: none; }
}

/* Arabic letters must stay joined: no mono font or letter-spacing */
:lang(ar) .wave-hint,
:lang(ar) .wave-more summary,
:lang(ar) .say-hi-or {
  font-family: var(--arabic);
  font-size: 1.05rem;
  letter-spacing: 0;
  text-transform: none;
}
