/* ==========================================================
   Zaher Chehayeb — portfolio
   Colour system: process inks (C/M/Y/K) and dieline crease/cut lines.
   ========================================================== */

:root {
  --paper: #FFFFFF;
  --stock: #F4F3EF;
  --ink: #121212;
  --ink-2: #5E5C57;
  --ink-3: #8C8983;
  --rule: #E3E1DB;
  --yellow: #F2BF1F;
  --cyan: #0096D6;
  --magenta: #D6187A;
  --crease: #E0301E;
  --key: #121212;
  --on-yellow: #121212;
  --void: #111110;
  --void-2: #1C1C1A;
  --on-void: #F1F0EB;
  --on-void-2: #A6A39C;

  --display: "Archivo", "Arial Narrow", Arial, sans-serif;
  --body: "Archivo", -apple-system, "Segoe UI", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --max: 1240px;
  --gutter: 44px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #111110;
    --stock: #1A1A18;
    --ink: #F1F0EB;
    --ink-2: #A6A39C;
    --ink-3: #75726C;
    --rule: #2F2E2A;
    --cyan: #33B1E8;
    --magenta: #EC4C9C;
    --crease: #F0553F;
    --key: #F1F0EB;
  }
}
:root[data-theme="dark"] {
  --paper: #111110;
  --stock: #1A1A18;
  --ink: #F1F0EB;
  --ink-2: #A6A39C;
  --ink-3: #75726C;
  --rule: #2F2E2A;
  --cyan: #33B1E8;
  --magenta: #EC4C9C;
  --crease: #F0553F;
  --key: #F1F0EB;
}

/* ---------- base ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
ul, ol { list-style: none; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.08; text-wrap: balance; }
p { text-wrap: pretty; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.mono { font-family: var(--mono); }
.label {
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2);
}
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--cyan); outline-offset: 3px;
}

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.site-header .wrap { height: 68px; display: flex; align-items: center; justify-content: space-between; }
.logo {
  display: flex; align-items: center; gap: 12px; text-decoration: none;
  font-family: var(--display); font-weight: 800; font-size: 15px;
  font-stretch: 112%; letter-spacing: 0.01em;
}
.logo .mark { position: relative; width: 16px; height: 16px; background: var(--ink); }
.logo .mark::after {
  content: ""; position: absolute; left: 6px; top: 6px;
  width: 16px; height: 16px; background: var(--yellow);
}
.nav { display: flex; gap: 34px; }
.nav a {
  font-size: 14px; font-weight: 500; text-decoration: none; color: var(--ink-2);
  padding: 4px 0; border-bottom: 1.5px solid transparent; transition: color .2s, border-color .2s;
}
.nav a:hover { color: var(--ink); border-bottom-color: var(--yellow); }
.nav-toggle {
  display: none; width: 32px; height: 32px; padding: 0; border: 0; background: none; cursor: pointer;
  flex-direction: column; justify-content: center; gap: 6px;
}
.nav-toggle span { display: block; height: 2px; background: var(--ink); transition: transform .25s, opacity .25s; }
.nav-toggle.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ---------- hero ---------- */
.hero { padding: 104px 0 96px; border-bottom: 1px solid var(--rule); }
.hero h1 {
  font-size: clamp(38px, 5.4vw, 72px);
  font-weight: 800; font-stretch: 112%;
  letter-spacing: -0.025em; line-height: 1.02; text-wrap: pretty;
}
.hero h1 .quiet { color: var(--ink-3); }
.hero .lede { margin-top: 30px; font-size: clamp(17px, 1.6vw, 21px); line-height: 1.55; color: var(--ink-2); }
.hero .actions { margin-top: 36px; display: flex; gap: 14px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 600; text-decoration: none;
  padding: 13px 22px; border: 1.5px solid var(--ink); transition: background .2s, color .2s;
}
.btn.dark { background: var(--ink); color: var(--paper); }
.btn.dark:hover { background: var(--yellow); border-color: var(--yellow); color: var(--on-yellow); }

/* ---------- ink swatches (diagrams and keys) ---------- */
.sw { display: inline-block; width: 22px; height: 22px; border-radius: 3px; }
.sw.cyan { background: var(--cyan); }
.sw.magenta { background: var(--magenta); }
.sw.yellow { background: var(--yellow); }
.sw.key { background: var(--key); }
.sw.cut { background: var(--key); height: 2px; }
.sw.crease { background: repeating-linear-gradient(90deg, var(--crease) 0 5px, transparent 5px 8px); height: 2px; }

/* ---------- section shell ---------- */
.section { padding: 112px 0; }
.section + .section { border-top: 1px solid var(--rule); }
.section-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; margin-bottom: 64px; }
.section-head .label { margin-bottom: 16px; }
.section-head h2 { font-size: clamp(34px, 5.4vw, 72px); font-weight: 800; font-stretch: 112%; letter-spacing: -0.025em; line-height: 1.02; text-wrap: pretty; }
.section-head p { color: var(--ink-2); font-size: clamp(17px, 1.6vw, 21px); line-height: 1.55; }

/* ---------- case study ---------- */
.case { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 64px; padding: 72px 0; border-top: 1px solid var(--rule); }
.case:first-of-type { border-top: 0; padding-top: 0; }
.case-meta .kind { margin-bottom: 14px; }
.case-meta h3 { font-size: clamp(26px, 2.6vw, 34px); font-weight: 800; font-stretch: 106%; letter-spacing: -0.015em; }
.case-meta .summary { margin-top: 16px; font-size: 16.5px; color: var(--ink-2); max-width: 46ch; }
.facts { margin-top: 28px; display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 28px; }
.fact .n { font-family: var(--display); font-size: 30px; font-weight: 800; font-stretch: 112%; font-variant-numeric: tabular-nums; line-height: 1; }
.fact .t { margin-top: 6px; font-size: 12.5px; color: var(--ink-2); max-width: 15ch; line-height: 1.35; }
.stack { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 6px; }
.stack li { font-family: var(--mono); font-size: 11.5px; padding: 4px 9px; border: 1px solid var(--rule); color: var(--ink-2); border-radius: 3px; }
.case-link { display: inline-flex; gap: 8px; margin-top: 24px; font-size: 14.5px; font-weight: 600; text-decoration: none; border-bottom: 1.5px solid var(--yellow); padding-bottom: 2px; }
.case-link:hover { border-bottom-color: var(--ink); }

.case-body { min-width: 0; }
.case-body > * + * { margin-top: 28px; }
.notes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; }
.notes li { padding: 14px 0; border-top: 1px solid var(--rule); font-size: 14.5px; color: var(--ink-2); line-height: 1.5; }
.notes li b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 2px; }
.notes-title { margin-bottom: 4px; }

/* ---------- pipeline diagram ---------- */
.sheet {
  position: relative; background: var(--stock); padding: 34px 30px 26px;
  --m: 14px; --c: var(--ink-3);
  background-image:
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c)),
    linear-gradient(var(--c), var(--c)), linear-gradient(var(--c), var(--c));
  background-size: var(--m) 1px, 1px var(--m), var(--m) 1px, 1px var(--m), var(--m) 1px, 1px var(--m), var(--m) 1px, 1px var(--m);
  background-position: 0 0, 0 0, 100% 0, 100% 0, 0 100%, 0 100%, 100% 100%, 100% 100%;
  background-repeat: no-repeat;
  background-color: var(--stock);
}
.sheet-title { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
/* Lanes are a strict 3-column grid: nodes align across every lane,
   and arrows only ever sit between two nodes on the same row. */
.lane { --gap: 30px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px var(--gap); }
.lane-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); margin: 22px 0 10px; }
.node {
  position: relative; display: flex; align-items: center; gap: 9px; min-height: 42px;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 6px;
  padding: 8px 12px 8px 10px; font-family: var(--mono); font-size: 12.5px; line-height: 1.25; color: var(--ink);
}
.node .sw { width: 11px; height: 11px; border-radius: 2px; flex-shrink: 0; }
.lane.alt .node { border-style: dashed; border-color: color-mix(in srgb, var(--crease) 55%, var(--rule)); }
@media (min-width: 521px) {
  .lane .node:not(:last-child):not(:nth-child(3n))::after {
    content: ""; position: absolute; top: calc(50% - 1px); left: calc(100% + 5px);
    width: calc(var(--gap) - 12px); height: 2px; background: var(--key);
  }
  .lane .node:not(:last-child):not(:nth-child(3n))::before {
    content: ""; position: absolute; top: calc(50% - 4px); left: calc(100% + var(--gap) - 8px);
    border-left: 6px solid var(--key); border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  }
  .lane.alt .node:not(:last-child):not(:nth-child(3n))::after { background: none; height: 0; border-top: 2px dashed var(--crease); }
  .lane.alt .node:not(:last-child):not(:nth-child(3n))::before { border-left-color: var(--crease); }
}
.sheet-key { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--rule); display: flex; flex-wrap: wrap; gap: 8px 20px; }
.sheet-key span { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 11px; color: var(--ink-2); }
.sheet-key .sw { width: 10px; height: 10px; }
.sheet-key .sw.cut { width: 18px; height: 2px; }
.sheet-key .sw.crease { width: 18px; height: 2px; }

/* ---------- screenshot + video slots ---------- */
.shot-frame, .video-frame { position: relative; background: var(--stock); border: 1px solid var(--rule); overflow: hidden; }
.shot .shot-frame { background: #FAFAFA; }
.shot-frame img { display: block; width: 100%; height: auto; }
.video-frame { aspect-ratio: 16 / 9; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.shot .shot-frame a { display: block; cursor: zoom-in; }
figcaption a { color: var(--ink); text-decoration-color: var(--yellow); text-underline-offset: 3px; }
figcaption { margin-top: 10px; font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }

/* ---------- more automations strip ---------- */
.more-auto { padding: 36px 0 72px; }
.more-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.more-head .case-link { margin-top: 0; }
.more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.more-card {
  display: flex; flex-direction: column; gap: 8px; padding: 22px 24px; text-decoration: none;
  background: var(--stock); border: 1px solid var(--rule); transition: border-color .2s, transform .2s;
}
.more-card strong { font-family: var(--display); font-size: 20px; font-weight: 800; font-stretch: 106%; }
.more-card span:last-child { font-size: 14.5px; color: var(--ink-2); }
.more-card:hover { border-color: var(--ink); transform: translateY(-2px); }

/* ---------- page hero (sub pages) ---------- */
.page-hero { padding: 88px 0 24px; }
.page-hero .crumb { font-family: var(--mono); font-size: 12px; color: var(--ink-2); text-decoration: none; }
.page-hero .crumb:hover { color: var(--ink); }
.page-hero h1 { margin-top: 22px; font-size: clamp(36px, 5vw, 64px); font-weight: 800; font-stretch: 112%; letter-spacing: -0.025em; }
.page-hero p { margin-top: 18px; max-width: 60ch; font-size: 17px; color: var(--ink-2); }
.pending { padding: 22px 24px; border: 1.5px dashed var(--ink-3); border-radius: 4px; font-size: 14.5px; color: var(--ink-2); }
.pending .label { display: block; margin-bottom: 6px; }

/* ---------- about + contact ---------- */
.about { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 64px; align-items: start; }
.about img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: center 30%; }
.about h2 { font-size: clamp(28px, 3vw, 40px); font-weight: 800; font-stretch: 108%; letter-spacing: -0.02em; }
.about p { margin-top: 18px; color: var(--ink-2); max-width: 640px; }
.about p:first-of-type { margin-top: 22px; color: var(--ink); font-size: 18px; }

.contact { background: var(--void); color: var(--on-void); padding: 104px 0 36px; border-top: 1px solid var(--rule); }
.contact .label { color: var(--on-void-2); }
.contact h2 { margin-top: 0; font-size: clamp(30px, 3.9vw, 54px); font-weight: 800; font-stretch: 112%; letter-spacing: -0.025em; line-height: 1.06; max-width: 26ch; }
.contact .lines { margin-top: 44px; display: flex; flex-wrap: wrap; gap: 14px; }
.icon-btn {
  display: grid; place-items: center; width: 56px; height: 56px; border-radius: 6px;
  background: color-mix(in srgb, var(--on-void) 10%, var(--void)); color: var(--on-void);
  transition: background .2s, color .2s;
}
.icon-btn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; shape-rendering: geometricPrecision; }
.icon-btn:hover { background: var(--yellow); color: var(--on-yellow); }
.foot { margin-top: 96px; padding-top: 22px; border-top: 1px solid var(--void-2); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--on-void-2); }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; transition-delay: 0s !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
  .case { grid-template-columns: 1fr; gap: 40px; }
}
@media (max-width: 820px) {
  :root { --gutter: 22px; }
  .nav-toggle { display: flex; }
  .nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0; background: var(--paper); border-bottom: 1px solid var(--rule);
  }
  .nav.open { display: flex; }
  .nav a { padding: 15px var(--gutter); border-bottom: 1px solid var(--rule); }
  .hero { padding: 72px 0 64px; }
  .section { padding: 76px 0; }
  .section-head { gap: 16px; margin-bottom: 44px; }
  .case { padding: 56px 0; }
  .notes { grid-template-columns: 1fr; }
  .more-grid { grid-template-columns: 1fr; }
  .page-hero { padding: 64px 0 8px; }
  .about { grid-template-columns: 1fr; gap: 32px; }
  .about img { max-width: 260px; }
  .sheet { padding: 28px 18px 20px; }
}
@media (max-width: 520px) {
  .facts { grid-template-columns: repeat(2, auto); }
  .lane { grid-template-columns: 1fr; row-gap: 18px; }
  .lane .node:not(:last-child)::after {
    content: ""; position: absolute; left: 15px; top: calc(100% + 2px);
    width: 2px; height: 8px; background: var(--key);
  }
  .lane .node:not(:last-child)::before {
    content: ""; position: absolute; left: 12px; top: calc(100% + 9px);
    border-top: 6px solid var(--key); border-left: 4px solid transparent; border-right: 4px solid transparent;
  }
  .lane.alt .node:not(:last-child)::after { background: none; width: 0; border-left: 2px dashed var(--crease); }
  .lane.alt .node:not(:last-child)::before { border-top-color: var(--crease); }
}

.page-hero + .section { padding-top: 56px; }
.case > .shot-wide { grid-column: 1 / -1; margin-top: -8px; }
