/* ==========================================================================
   Akram Rahali — portfolio
   Base: neutral ink. Each featured project re-themes whatever carries its
   theme class (section, hero card, index row, case study page) through the
   same set of custom properties, using the palette its app ships with.
   ========================================================================== */

:root {
  --bg: #0A0B0E;
  --surface: #111318;
  --surface-2: #0E1014;
  --border: #1F222A;
  --border-strong: #2E323C;
  --text: #EDEBE6;
  --text-strong: #F4F2EC;
  --muted: #B5B9C2;
  --subtle: #9AA0AB;
  --faint: #8A8F9A;
  --headline-muted: #7E8491;

  /* One signal colour per featured project: palette bar, index dots, hero graph. */
  --c-agri: #4ADE80;
  --c-swarm: #6FDCCB;
  --c-wood: #E3A65F;
  --c-flower: #F2C230;

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", monospace;
  --font-serif: "Cormorant Garamond", Georgia, serif;

  --gutter: clamp(16px, 4vw, 40px);
  --max: 1200px;
  --radius: 18px;
  --header-h: 72px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 8px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, video, svg { display: block; max-width: 100%; }
h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid #8AB4FF; outline-offset: 3px; border-radius: 6px; }
::selection { background: #2B3A55; color: #fff; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; left: 16px; top: -60px; z-index: 100;
  padding: 10px 16px; border-radius: 10px; background: var(--text); color: var(--bg);
  font-weight: 600; text-decoration: none; transition: top .2s;
}
.skip-link:focus { top: 16px; }

.container { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.muted { color: var(--subtle); }

/* ---------- project themes ---------- */
/* .project defaults to AgriGraph so a bare .project section still reads well. */
.project, .theme-agri {
  --p-bg: #0D1422; --p-surface: #131D30; --p-border: #22304A; --p-line: #1A2436; --p-hover: #2F5A45;
  --p-text: #E6EDF5; --p-muted: #B3C0D1; --p-meta: #93A1B5;
  --accent: #4ADE80; --on-accent: #08130D; --link: #A7F3C4; --tag: #4ADE80; --signal: var(--c-agri);
  --hi-bg: #122A22; --hi-border: #1F5A3F; --hi-text: #A7F3C4;
  --chip-border: #2A3852; --chip-text: #C9D4E2; --frame-bg: #0A101C;
}
.theme-swarm {
  --p-bg: #06080D; --p-surface: #0D121C; --p-border: #232A3A; --p-line: #161B26; --p-hover: #3A4A60;
  --p-text: #E4E8F0; --p-muted: #AEB6C6; --p-meta: #98A2B6;
  --accent: #6FDCCB; --on-accent: #04110F; --link: #6FDCCB; --tag: #6FDCCB; --signal: var(--c-swarm);
  --chip-border: #2A3245; --chip-text: #C6CDDB; --frame-bg: #0B0F17;
}
.theme-wood {
  --p-bg: #16100B; --p-surface: #221A13; --p-border: #3A2B1D; --p-line: #2A1F15; --p-hover: #6A4C2E;
  --p-text: #F3E6D6; --p-muted: #CDBBA4; --p-meta: #BFA98F;
  --accent: #E3A65F; --on-accent: #1A1008; --link: #E3A65F; --tag: #E3A65F; --signal: var(--c-wood);
  --chip-border: #4A3826; --chip-text: #E8D6C0; --frame-bg: #000;
}
.theme-flower {
  --p-bg: #F5F8F1; --p-surface: #FFFFFF; --p-border: #D3E2CC; --p-line: #E3ECDD; --p-hover: #9CC79A;
  --p-text: #17261B; --p-muted: #46594B; --p-meta: #256B36;
  --accent: #2E8A45; --on-accent: #FFFFFF; --link: #1F6B35; --tag: #256B36; --signal: var(--c-flower);
  --hi-bg: #E6F3E3; --hi-border: #B9D9B4; --hi-text: #1C5A2C;
  --chip-border: #C4D8BD; --chip-text: #2B4633; --frame-bg: #FFFFFF;
}

/* ---------- header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 11, 14, .72);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .3s;
}
.site-header.is-scrolled { border-bottom-color: #1C1F26; background: rgba(10, 11, 14, .86); }
.nav { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-height: 44px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid #2A2E37; background: var(--surface);
  display: grid; place-items: center; font: 600 14px var(--font-display); letter-spacing: .02em;
}
.brand-name { font: 600 17px var(--font-display); }
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px;
  border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 14.5px;
  transition: color .2s, background .2s;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.is-active { color: var(--text); background: #171A20; }
.nav-links .nav-cta { margin-left: 6px; padding: 0 18px; background: var(--text); color: var(--bg); font-weight: 500; }
.nav-links .nav-cta:hover, .nav-links .nav-cta.is-active { background: #fff; color: var(--bg); }
.nav-toggle {
  display: none; width: 44px; height: 44px; border-radius: 12px;
  border: 1px solid #2A2E37; background: transparent; place-items: center;
}
.nav-toggle .i-close { display: none; }
.nav-toggle[aria-expanded="true"] .i-open { display: none; }
.nav-toggle[aria-expanded="true"] .i-close { display: inline; }

@media (max-width: 760px) {
  .nav-toggle { display: grid; }
  .nav-links {
    position: absolute; left: 0; right: 0; top: var(--header-h);
    flex-direction: column; align-items: stretch; gap: 2px;
    padding: 12px var(--gutter) 20px;
    background: rgba(10, 11, 14, .97); border-bottom: 1px solid #1C1F26;
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity .2s, transform .2s, visibility .2s;
  }
  .nav-links.is-open { opacity: 1; visibility: visible; transform: none; }
  .nav-links a { display: flex; font-size: 17px; padding: 0 12px; border-radius: 12px; }
  .nav-links .nav-cta { margin: 8px 0 0; justify-content: center; }
}

/* ---------- buttons & links ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 22px;
  border-radius: 999px; text-decoration: none; font-weight: 500;
  transition: transform .2s var(--ease), background .2s, border-color .2s, filter .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: #fff; }
.btn-ghost { border: 1px solid var(--border-strong); }
.btn-ghost:hover { border-color: #4A505C; }
.btn-accent { min-height: 46px; padding: 0 20px; background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 15px; }
.btn-accent:hover { filter: brightness(1.08); }
.text-link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
  color: var(--link, var(--accent)); font-weight: 500; text-decoration: none;
}
.text-link:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- typography ---------- */
.eyebrow, .project-meta, .card-meta, .step-label, .detail-label, .contact-label, .case-kicker {
  font: 500 12.5px/1.4 var(--font-mono); letter-spacing: .07em; text-transform: uppercase;
}
.eyebrow { color: var(--subtle); }
.section-title { font: 600 clamp(32px, 4vw, 48px)/1.1 var(--font-display); letter-spacing: -.02em; color: var(--text-strong); }
.section-sub { max-width: 460px; color: var(--subtle); }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px 40px; margin-bottom: 40px; }
.section-head-text { display: flex; flex-direction: column; gap: 14px; }
.block { padding-top: clamp(80px, 10vw, 128px); }

/* Four project colours as one segmented rule: the site's signature mark. */
.palette-bar {
  flex: none; display: inline-block; width: 44px; height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--c-agri) 0 25%, var(--c-swarm) 25% 50%, var(--c-wood) 50% 75%, var(--c-flower) 75% 100%);
}
.hero .eyebrow, .contact .eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }

/* ---------- hero ---------- */
.hero { position: relative; isolation: isolate; overflow: hidden; border-bottom: 1px solid #16181E; }
.hero-graph {
  position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%;
  -webkit-mask-image: radial-gradient(110% 80% at 75% 25%, #000 30%, transparent 72%);
          mask-image: radial-gradient(110% 80% at 75% 25%, #000 30%, transparent 72%);
}
.hero-inner {
  display: flex; flex-direction: column; gap: 28px;
  padding-top: clamp(56px, 8vw, 104px); padding-bottom: clamp(56px, 6vw, 80px);
}
.hero-title {
  max-width: 1100px; margin-bottom: 8px;
  font: 600 clamp(42px, 6.8vw, 100px)/.98 var(--font-display);
  letter-spacing: -.04em; color: var(--text-strong); text-wrap: balance;
}
.hero-title span { color: var(--headline-muted); }
.hero-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 28px 64px; }
.hero-lede { flex: 1 1 440px; max-width: 600px; font-size: clamp(17px, 1.4vw, 19px); color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-cards { margin-top: 28px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.hero-cards > li { display: flex; min-width: 0; }
@media (max-width: 1020px) { .hero-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  /* Swipeable row on phones instead of four tall stacked cards. */
  .hero-cards {
    display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
    margin: 12px calc(var(--gutter) * -1) 0; padding: 4px var(--gutter) 8px; scroll-padding-inline: var(--gutter);
  }
  .hero-cards::-webkit-scrollbar { display: none; }
  .hero-cards > li { flex: 0 0 78%; scroll-snap-align: start; }
}
.sys-card {
  flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden;
  border-radius: var(--radius); border: 1px solid var(--p-border); background: var(--p-bg); color: var(--p-text);
  text-decoration: none; transition: transform .3s var(--ease), border-color .3s;
}
.sys-card:hover { transform: translateY(-3px); border-color: var(--p-hover); }
.sys-card-media { display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--frame-bg); border-bottom: 1px solid var(--p-border); }
.sys-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.sys-card:hover .sys-card-media img { transform: scale(1.04); }
.sys-card-body { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.sys-card-tag { font: 500 12px var(--font-mono); color: var(--tag); }
.sys-card-name { font: 600 21px/1.15 var(--font-display); }
.sys-card.theme-flower .sys-card-name { font: 600 26px/1.05 var(--font-serif); }
.sys-card-desc { font-size: 14px; line-height: 1.45; color: var(--p-muted); }

/* ---------- approach ---------- */
.approach { padding-bottom: clamp(72px, 8vw, 104px); }
.stages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) { .stages { grid-template-columns: 1fr; } }
.stage {
  padding: 28px; border-radius: 20px; background: var(--surface-2); border: 1px solid #1C1F26;
  display: flex; flex-direction: column; gap: 12px;
}
.stage-progress { display: flex; gap: 4px; margin-bottom: 8px; }
.stage-progress i { flex: 1; height: 3px; border-radius: 2px; background: #23262E; }
.stage-progress i.on { background: var(--text); }
.stage-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); }
.stage-top .step-label { color: var(--subtle); }
.stage h3 { font: 600 23px/1.2 var(--font-display); color: var(--text-strong); }
.stage p { font-size: 15px; color: var(--muted); }
.stage .stage-tools { margin-top: auto; padding-top: 8px; font: 400 12.5px/1.6 var(--font-mono); color: var(--faint); }

/* ---------- work index ---------- */
.work { padding-bottom: clamp(72px, 8vw, 104px); }
.work-index { border-bottom: 1px solid var(--border); }
.work-row {
  display: grid; grid-template-columns: 40px minmax(0, 1.25fr) minmax(0, 1fr) 180px 20px;
  align-items: center; gap: 6px 24px; padding: 22px 8px;
  border-top: 1px solid var(--border); color: var(--text); text-decoration: none;
  transition: background .25s;
}
.work-row:hover { background: var(--surface-2); }
.work-n { font: 500 13px var(--font-mono); color: var(--faint); }
.work-name {
  display: flex; align-items: center; gap: 14px; min-width: 0;
  font: 600 clamp(22px, 2.4vw, 30px)/1.2 var(--font-display); letter-spacing: -.01em; color: var(--text-strong);
}
.work-name::before {
  content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%;
  background: var(--signal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--signal) 16%, transparent);
}
.work-domain { font-size: 15px; color: var(--muted); }
.work-meta { font: 400 13px var(--font-mono); color: var(--subtle); }
.work-arrow { color: var(--subtle); transition: transform .25s var(--ease), color .25s; }
.work-row:hover .work-arrow { transform: translateX(4px); color: var(--text); }
@media (max-width: 760px) {
  .work-row { grid-template-columns: 28px minmax(0, 1fr) 18px; gap: 4px 16px; }
  .work-n, .work-name, .work-arrow { grid-row: 1; }
  .work-name { grid-column: 2; }
  .work-arrow { grid-column: 3; }
  .work-domain, .work-meta { grid-column: 2; }
}

/* ==========================================================================
   Featured projects
   ========================================================================== */
.project { background: var(--p-bg); color: var(--p-text); border-top: 1px solid var(--p-line); }
.project-inner { padding-block: clamp(72px, 9vw, 120px); display: flex; flex-direction: column; gap: 44px; }
.project-head { display: flex; flex-wrap: wrap; gap: 24px 64px; align-items: flex-end; justify-content: space-between; }
.project-id { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.project-summary { flex: 1 1 400px; min-width: 0; display: flex; flex-direction: column; gap: 18px; color: var(--p-muted); }
.project-links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; }
.project-meta { color: var(--p-meta); }
.project-title { font: 600 clamp(44px, 6vw, 80px)/1 var(--font-display); letter-spacing: -.02em; }
.project-title .accent { color: var(--accent); }
.project-tagline { font-size: clamp(18px, 1.6vw, 21px); color: var(--p-text); }

/* facts: label first in the DOM (dt), value shown first */
.facts {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 32px;
  border-top: 1px solid var(--p-border);
}
@media (max-width: 860px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; } }
.fact { min-width: 0; padding-top: 22px; display: flex; flex-direction: column; gap: 4px; }
.fact dt { order: 2; font-size: 14px; line-height: 1.45; color: var(--p-meta); }
.fact dd { order: 1; font: 600 clamp(28px, 3vw, 40px)/1.1 var(--font-display); letter-spacing: -.01em; color: var(--p-text); }
.fact dd.hl { color: var(--accent); }
.facts-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 24px; }
.facts-3 .fact { padding-top: 16px; gap: 2px; }
.facts-3 .fact dt { font-size: 13.5px; color: var(--p-muted); }
@media (max-width: 420px) { .facts-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* media */
.media-frame {
  border: 1px solid var(--p-border); border-radius: var(--radius); overflow: hidden; background: var(--frame-bg);
  box-shadow: 0 40px 80px -48px rgba(0, 0, 0, .8);
}
.browser-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--p-line); }
.browser-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--chip-border); }
.browser-bar span { margin-left: 10px; font: 400 12px var(--font-mono); color: var(--p-meta); }
.video-wrap { position: relative; aspect-ratio: 2.08 / 1; background: var(--frame-bg); }
.video-wrap video { width: 100%; height: 100%; object-fit: cover; }
.video-toggle {
  position: absolute; right: 14px; bottom: 14px; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(8, 10, 14, .62); color: #fff;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .25s, background .2s;
}
.video-wrap:hover .video-toggle, .video-toggle:focus-visible, .video-toggle.is-paused { opacity: 1; }
.video-toggle:hover { background: rgba(8, 10, 14, .85); }
.video-toggle .i-play { display: none; }
.video-toggle.is-paused .i-pause { display: none; }
.video-toggle.is-paused .i-play { display: inline; }
@media (hover: none) { .video-toggle { opacity: 1; } }

/* screenshots */
.shots { display: grid; gap: 16px; }
.shots-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 960px) { .shots-3 { grid-template-columns: 1fr; } }
.shot { display: flex; flex-direction: column; gap: 10px; }
.shot figcaption { font-size: 14px; color: var(--p-meta); }
.zoom {
  display: block; width: 100%; padding: 0; border: 1px solid var(--p-border); border-radius: 12px;
  overflow: hidden; background: var(--frame-bg); cursor: zoom-in;
}
.zoom img { width: 100%; height: auto; transition: transform .5s var(--ease); }
.zoom:hover img { transform: scale(1.025); }

/* pipeline + chips */
.project-detail { display: flex; flex-wrap: wrap; gap: 32px 64px; }
.detail-main { flex: 2 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.detail-side { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.detail-label { color: var(--p-meta); }
.detail-note { color: var(--p-muted); font-size: 15px; }
/* Pills joined by arrows; the arrow is a masked pseudo-element in the gap,
   tinted with the section accent, so it wraps cleanly with its pill. */
.pipeline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 0; }
.pipeline li {
  position: relative; padding: 8px 12px; border-radius: 9px; font-size: 14px; line-height: 1.3;
  background: var(--p-surface); border: 1px solid var(--p-border); color: var(--p-text);
}
.pipeline li + li { margin-left: 30px; }
.pipeline li + li::before {
  content: ""; position: absolute; left: -26px; top: 50%; width: 22px; height: 14px; margin-top: -7px;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 14' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7h15M14 3l4 4-4 4'/%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 22 14' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7h15M14 3l4 4-4 4'/%3E%3C/svg%3E") center / contain no-repeat;
}
.pipeline li.hi { background: var(--hi-bg); border-color: var(--hi-border); color: var(--hi-text); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; font: 400 12.5px var(--font-mono); }
.chips li { padding: 6px 11px; border-radius: 999px; border: 1px solid var(--chip-border); color: var(--chip-text); }
.chips-sm { font-size: 12px; gap: 6px; }
.chips-sm li { padding: 5px 10px; }

/* ---------- 01 AgriGraph ---------- */
/* Wide uppercase wordmark: one size step down so it stays on one line beside the summary. */
.agri-title { font-weight: 700; font-size: clamp(40px, 5.4vw, 72px); letter-spacing: .03em; color: var(--accent); }

/* ---------- 02 Drone swarms ---------- */
.theme-swarm .project-title { color: #F2F4F8; }
.cards-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 860px) { .cards-3 { grid-template-columns: 1fr; } }
.mini-card {
  padding: 24px; border-radius: 16px; background: var(--p-surface); border: 1px solid #1E2534;
  display: flex; flex-direction: column; gap: 8px;
}
.mini-card .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--dot); box-shadow: 0 0 0 4px color-mix(in srgb, var(--dot) 18%, transparent); }
.mini-card h3 { margin-top: 6px; font: 600 19px/1.3 var(--font-display); }
.mini-card p { font-size: 15px; color: var(--p-muted); }

/* ---------- 03 ARWood ---------- */
.theme-wood .project-title { font-weight: 700; }
.theme-wood .mini-card { border-color: var(--p-border); }
.steps .mini-card h3 { margin-top: 0; }
.step-n { font: 500 12px var(--font-mono); color: var(--accent); }
.phones {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start;
  gap: clamp(12px, 2.4vw, 32px); padding: 0 clamp(0px, 4vw, 56px) 36px;
}
.phone { display: flex; flex-direction: column; gap: 12px; }
.phone:nth-child(even) { margin-top: 36px; }
@media (max-width: 640px) {
  .phones { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 0 24px; }
  .phone:nth-child(even) { margin-top: 24px; }
}
.phone .zoom { border-radius: 26px; box-shadow: 0 30px 60px -36px rgba(0, 0, 0, .9); }
.phone img { aspect-ratio: 9 / 20; object-fit: cover; object-position: top; }
.phone figcaption { text-align: center; font-size: 13px; color: var(--p-meta); }

/* ---------- 04 Algerian Flower ---------- */
.theme-flower :focus-visible { outline-color: #1F6B35; }
.split { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 48px 64px; }
.split-copy { flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.split-copy > p:not([class]) { color: var(--p-muted); }
.split-reverse .split-copy { order: 2; }
.flower-frame {
  flex: 1.5 1 560px; min-width: 0; border-radius: 22px; border-color: #DCE7D5;
  box-shadow: 0 30px 60px -34px rgba(31, 90, 46, .45);
}
.flower-title { display: flex; align-items: center; gap: 14px; font: 600 clamp(44px, 4.6vw, 64px)/1 var(--font-serif); letter-spacing: 0; white-space: nowrap; }
@media (max-width: 420px) { .flower-title { white-space: normal; } }
.flower-title svg { flex: none; width: clamp(38px, 4vw, 52px); height: auto; }
.theme-flower .facts-3 dd { font: 600 30px/1.1 var(--font-serif); letter-spacing: 0; }
.theme-flower .video-toggle { border-color: rgba(23, 38, 27, .15); background: rgba(255, 255, 255, .75); color: #17261B; }
.theme-flower .video-toggle:hover { background: #fff; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; padding: 3px 10px; vertical-align: 1px;
  border-radius: 999px; background: var(--hi-bg); border: 1px solid var(--hi-border); color: var(--hi-text); letter-spacing: .04em;
}
.status-pill span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* ---------- more projects ---------- */
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 960px) { .cards { grid-template-columns: 1fr; } }
.card {
  --chip-border: #2A2E37; --chip-text: #C3C7CF;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); overflow: hidden;
  display: flex; flex-direction: column; transition: border-color .3s, transform .3s var(--ease);
}
.card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.card-art { height: 132px; display: grid; place-items: center; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.card-art svg { width: 260px; max-width: 80%; height: auto; }
.card-body { flex: 1; padding: 26px 28px 28px; display: flex; flex-direction: column; gap: 14px; }
.card-meta { color: var(--subtle); font-size: 12px; }
.card h3 { font: 600 24px/1.2 var(--font-display); color: var(--text-strong); }
.card-body > p:not([class]) { color: var(--muted); font-size: 15px; }
.card-flow { font: 400 13px/1.5 var(--font-mono); color: var(--faint); }
.card .chips { margin-top: auto; padding-top: 4px; }

.experience {
  --chip-border: #2A2E37; --chip-text: #C3C7CF;
  margin-top: 16px; padding: 28px; border-radius: var(--radius); border: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: 16px 48px;
}
.exp-id { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.exp-id h3 { font: 600 22px/1.25 var(--font-display); color: var(--text-strong); }
.exp-body { flex: 2 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.exp-body p { color: var(--muted); font-size: 15px; }

/* ---------- about ---------- */
.about { display: flex; flex-wrap: wrap; gap: 48px 72px; }
.about-copy { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.about-title { font: 600 clamp(28px, 3.2vw, 40px)/1.15 var(--font-display); letter-spacing: -.02em; color: var(--text-strong); text-wrap: balance; }
.about-lede { font-size: 17px; color: #C9CCD3; }
.timeline { margin-top: 8px; border-top: 1px solid var(--border); }
.timeline > div {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 24px;
  padding: 18px 0; border-bottom: 1px solid var(--border);
}
.timeline dt { font-weight: 600; display: flex; flex-direction: column; }
.timeline dt span { font-weight: 400; color: var(--subtle); font-size: 15px; }
.timeline dd { font: 400 13px/1.9 var(--font-mono); color: var(--subtle); }
.toolkit { flex: 1 1 420px; min-width: 0; align-self: flex-start; display: flex; flex-direction: column; gap: 14px; }
.skills { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.skills > div { padding: 20px 24px; display: flex; flex-direction: column; gap: 10px; }
.skills > div + div { border-top: 1px solid var(--border); }
.skills dt { font: 500 12px var(--font-mono); letter-spacing: .07em; text-transform: uppercase; color: var(--subtle); }
.skills dd { display: flex; flex-wrap: wrap; gap: 6px; font-size: 14px; }
.skills dd span { padding: 4px 10px; border-radius: 8px; background: #171A20; color: #D3D6DC; }

/* ---------- contact ---------- */
.contact { padding-top: clamp(96px, 12vw, 160px); padding-bottom: 72px; display: flex; flex-direction: column; gap: 32px; }
.contact-title {
  max-width: 940px; font: 600 clamp(36px, 5.6vw, 76px)/1.02 var(--font-display);
  letter-spacing: -.03em; color: var(--text-strong); text-wrap: balance;
}
.contact-title span { color: var(--headline-muted); }
.contact-email-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 20px; }
.contact-email {
  font: 600 clamp(24px, 3.4vw, 42px)/1.2 var(--font-display); letter-spacing: -.01em; color: var(--text-strong);
  text-decoration: underline; text-decoration-color: #3A3F4A; text-decoration-thickness: 2px; text-underline-offset: 10px;
  overflow-wrap: anywhere; transition: text-decoration-color .2s;
}
.contact-email:hover { text-decoration-color: var(--text); }
.copy-btn {
  min-height: 44px; padding: 0 16px; display: inline-flex; align-items: center; gap: 8px;
  border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted);
  font-size: 14px; font-weight: 500; transition: color .2s, border-color .2s;
}
.copy-btn:hover { color: var(--text); border-color: #4A505C; }
.copy-btn.is-copied { color: #4ADE80; border-color: #1F5A3F; }
.contact-grid { margin-top: 8px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }
.contact-grid > li { display: flex; min-width: 0; }
.contact-card {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 16px; padding: 20px 22px;
  border-radius: 16px; background: var(--surface); border: 1px solid var(--border); text-decoration: none;
  transition: border-color .3s, transform .3s var(--ease), background .3s;
}
.contact-card:hover { border-color: #3A3F4A; transform: translateY(-2px); }
.contact-card svg { flex: none; color: var(--muted); }
.contact-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.contact-label { color: var(--subtle); font-size: 12px; }
.contact-value { font-weight: 500; overflow-wrap: anywhere; }
.contact-card.is-primary { background: var(--text); border-color: var(--text); color: var(--bg); }
.contact-card.is-primary:hover { background: #fff; border-color: #fff; }
.contact-card.is-primary svg { color: var(--bg); }
.contact-card.is-primary .contact-label { color: #4A4D55; }
.contact-card.is-primary .contact-value { font-weight: 600; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid #1C1F26; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-block: 24px; font-size: 14px; color: var(--faint); }
.footer-inner a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; color: var(--muted); }
.footer-inner a:hover { color: var(--text); }

/* ==========================================================================
   Case study page (agrigraph.html): the whole page wears one project theme.
   ========================================================================== */
.page-case { background: var(--p-bg); color: var(--p-text); }
.page-case .site-header { background: rgba(13, 20, 34, .78); }
.page-case .site-header.is-scrolled { background: rgba(13, 20, 34, .92); border-bottom-color: var(--p-line); }
.page-case .brand-mark { border-color: var(--p-border); background: var(--p-surface); }
.page-case .nav-toggle { border-color: var(--p-border); }
.page-case .nav-links a { color: var(--p-muted); }
.page-case .nav-links a:hover { color: var(--p-text); }
.page-case .nav-links .nav-cta { background: var(--p-text); color: var(--p-bg); }
@media (max-width: 760px) { .page-case .nav-links { background: rgba(13, 20, 34, .97); border-bottom-color: var(--p-line); } }
.page-case .eyebrow { color: var(--p-meta); }
.page-case .site-footer { border-top-color: var(--p-line); }
.page-case .footer-inner { color: var(--p-meta); }
.page-case .footer-inner a { color: var(--p-muted); }
.page-case .footer-inner a:hover { color: var(--p-text); }

.case-hero { padding-top: clamp(40px, 6vw, 80px); padding-bottom: 48px; display: flex; flex-direction: column; gap: 24px; }
.back-link {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-bottom: 4px;
  color: var(--p-muted); text-decoration: none; font-size: 15px;
}
.back-link:hover { color: var(--p-text); }
.back-link svg { transition: transform .25s var(--ease); }
.back-link:hover svg { transform: translateX(-3px); }
.case-title { font: 700 clamp(48px, 8vw, 112px)/.95 var(--font-display); letter-spacing: .02em; color: var(--accent); }
.case-lede {
  max-width: 820px; font: 500 clamp(21px, 2.2vw, 30px)/1.3 var(--font-display);
  letter-spacing: -.01em; color: var(--p-text); text-wrap: balance;
}
.case-meta { margin-top: 12px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 32px; border-top: 1px solid var(--p-border); }
@media (max-width: 860px) { .case-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; } }
.case-meta > div { min-width: 0; padding-top: 18px; display: flex; flex-direction: column; gap: 4px; }
.case-meta dt { font: 500 12px var(--font-mono); letter-spacing: .07em; text-transform: uppercase; color: var(--p-meta); }
.case-meta a { color: var(--link); text-underline-offset: 4px; }

.case-section { padding-top: clamp(72px, 9vw, 120px); }
.case-kicker { color: var(--accent); }
.case-h2 { font: 600 clamp(28px, 3vw, 38px)/1.15 var(--font-display); letter-spacing: -.02em; }
.case-split { display: flex; flex-wrap: wrap; gap: 24px 64px; }
.case-split-head { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.case-split-head > p:not([class]) { color: var(--p-muted); }
.case-split-body { flex: 2 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 16px; font-size: 17px; color: var(--p-muted); }
.case-split-body em { color: var(--p-text); }
.case-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 32px; }

.case-steps { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1100px) { .case-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .case-steps { grid-template-columns: 1fr; } }
.case-step {
  min-width: 0; padding: 20px; border-radius: 16px; background: var(--p-surface); border: 1px solid var(--p-border);
  display: flex; flex-direction: column; gap: 10px;
}
.case-step-top { display: flex; align-items: center; justify-content: space-between; font: 500 12px var(--font-mono); color: var(--p-meta); }
.case-step-top svg { color: var(--accent); }
.case-step h3 { font: 600 17px/1.3 var(--font-display); }
.case-step p { font-size: 14px; line-height: 1.5; color: var(--p-muted); }
.case-step.hi { background: var(--hi-bg); border-color: var(--hi-border); }
.case-step.hi h3, .case-step.hi .case-step-top { color: var(--hi-text); }
.case-step.hi p { color: #C6EBD4; }

.pillars { flex: 2 1 520px; min-width: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .pillars { grid-template-columns: 1fr; } }
.pillar { padding: 22px; border-radius: 16px; border: 1px solid var(--p-border); display: flex; align-items: center; gap: 16px; font: 600 18px/1.3 var(--font-display); }
.pillar-n {
  flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: var(--hi-bg); border: 1px solid var(--hi-border); font: 600 15px var(--font-display); color: var(--accent);
}

.case-rows { display: flex; flex-direction: column; gap: 56px; }
.case-row { display: flex; flex-wrap: wrap; align-items: center; gap: 24px 56px; }
.case-row.reverse { flex-wrap: wrap-reverse; }
.case-row-media { flex: 1.7 1 560px; min-width: 0; }
.case-row-media .zoom { border-radius: 16px; }
.case-row-text { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.case-row-text .detail-label { font-size: 12px; }
.case-row-text h3 { font: 600 24px/1.25 var(--font-display); }
.case-row-text p:not([class]) { color: var(--p-muted); }

.case-stack { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 24px; }
@media (max-width: 860px) { .case-stack { grid-template-columns: 1fr; } }
.case-stack > div { padding: 22px; border-radius: 16px; background: var(--p-surface); border: 1px solid var(--p-border); display: flex; flex-direction: column; gap: 12px; }
.case-stack dt { font: 500 12px var(--font-mono); letter-spacing: .07em; text-transform: uppercase; color: var(--p-meta); }

.case-next { padding-top: clamp(72px, 9vw, 120px); padding-bottom: 80px; }
.next-card {
  display: flex; flex-wrap: wrap; border-radius: 20px; overflow: hidden; text-decoration: none;
  background: var(--p-bg); border: 1px solid var(--p-border); color: var(--p-text);
  transition: border-color .3s;
}
.next-card:hover { border-color: var(--p-hover); }
.next-card-text { flex: 1 1 360px; min-width: 0; padding: clamp(24px, 4vw, 44px); display: flex; flex-direction: column; justify-content: space-between; gap: 32px; }
.next-card-text .eyebrow { color: var(--p-meta); }
.next-card-title { display: flex; flex-direction: column; gap: 10px; }
.next-card-title strong { font: 600 clamp(32px, 4vw, 52px)/1.02 var(--font-display); letter-spacing: -.02em; color: #F2F4F8; }
.next-card-title strong span { color: var(--accent); }
.next-card-title > span { color: var(--p-muted); }
.next-card-cta { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; color: var(--accent); }
.next-card-cta svg { transition: transform .25s var(--ease); }
.next-card:hover .next-card-cta svg { transform: translateX(4px); }
.next-card-media { flex: 1.2 1 420px; min-width: 0; min-height: 260px; overflow: hidden; background: var(--frame-bg); border-left: 1px solid var(--p-line); }
.next-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.next-card:hover .next-card-media img { transform: scale(1.03); }

/* ---------- lightbox ---------- */
.lightbox {
  max-width: min(1400px, 94vw); max-height: 92vh; padding: 0; border: 0; border-radius: 14px;
  background: transparent; overflow: visible;
}
.lightbox::backdrop { background: rgba(5, 6, 8, .86); backdrop-filter: blur(6px); }
.lightbox img { max-width: min(1400px, 94vw); max-height: 92vh; width: auto; height: auto; border-radius: 14px; }
.lightbox-close {
  position: absolute; top: -14px; right: -14px; width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; border: 1px solid #2E323C; background: #111318; color: #EDEBE6;
}
@media (max-width: 640px) { .lightbox-close { top: 8px; right: 8px; } }
.lightbox[open] { animation: lb-in .25s var(--ease); }
@keyframes lb-in { from { opacity: 0; transform: scale(.97); } }

/* ---------- hero entrance (transform only, so the headline paints at once) ---------- */
.rise { animation: rise 1s var(--ease) both; }
.hero-title.rise { animation-delay: 60ms; }
.hero-row.rise { animation-delay: 140ms; }
.hero-cards.rise { animation-delay: 220ms; }
@keyframes rise { from { transform: translateY(16px); } }

/* ---------- reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}
