/* Codzyne — see design-system.md. One midnight field, white type, one sunshine pill. */
:root {
  --field: #0b1f4b;
  --white: #ffffff;
  --cta: #ffd23f;
  --cta-ink: #0b1f4b;
  --paper: #f7f5f0;

  --font: "Readex Pro", "Helvetica Neue", Arial, sans-serif;
  --fs-finale: clamp(52px, 6vw + 18px, 104px);
  --fs-h1: clamp(42px, 1.1vw + 40px, 57px);
  --fs-h2: clamp(26px, 1.2vw + 21px, 38px);
  --fs-lead: clamp(17px, .45vw + 16.5px, 23px);
  --fs-body: clamp(17px, .2vw + 16px, 19px);
  --fs-small: clamp(13px, .2vw + 12.5px, 15.5px);
  --lh-h: 1.05;
  --lh-lead: 1.3;
  --lh-body: 1.4;
  --track-h: -0.01em;

  --space-1: 8px; --space-2: 16px; --space-3: 24px; --space-4: 40px; --space-5: 80px; --space-6: 160px;
  --gutter: 40px;
  --maxw: 1200px;
  --col: 570px;
}
:lang(ar) { --lh-h: 1.25; --lh-lead: 1.5; --lh-body: 1.6; --track-h: 0; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
html, body { overflow-x: clip; }
body {
  margin: 0; background: var(--field); color: var(--white);
  font-family: var(--font); font-size: var(--fs-body); line-height: var(--lh-body); font-weight: 300;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, blockquote { margin: 0; }
strong, b { font-weight: 700; }
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--white); outline-offset: 3px; }

/* ---------- Type ---------- */
.t-finale { font-size: var(--fs-finale); font-weight: 700; line-height: .92; letter-spacing: var(--track-h); }
:lang(ar) .t-finale { line-height: 1.3; }
.t-h1 { font-size: var(--fs-h1); font-weight: 700; line-height: var(--lh-h); letter-spacing: var(--track-h); }
.t-h2 { font-size: var(--fs-h2); font-weight: 700; line-height: calc(var(--lh-h) + .05); letter-spacing: var(--track-h); }
.t-lead { font-size: var(--fs-lead); line-height: var(--lh-lead); letter-spacing: var(--track-h); }
.t-small { font-size: var(--fs-small); line-height: 1.5; }
.soft { color: inherit; }

.link { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.link:hover { text-decoration-thickness: 2px; }
.arrow { display: inline-block; transition: translate .3s ease; }
.link:hover .arrow { translate: 0 3px; }

/* ---------- Pill (the only button) ---------- */
.pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 52px; padding: 14px 28px; border: 0; border-radius: 999px;
  background: var(--cta); color: var(--cta-ink); font: 700 var(--fs-body)/1 var(--font);
  text-decoration: none; white-space: nowrap; cursor: pointer; transition: translate .2s ease;
}
.pill:hover { translate: 0 -2px; }
.pill--ghost { background: transparent; color: var(--white); box-shadow: inset 0 0 0 2px var(--white); }
.pill--ghost:hover { background: var(--white); color: var(--field); }
.pill[disabled] { opacity: .7; cursor: progress; }

/* ---------- Header ---------- */
.header {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: 32px var(--gutter); color: var(--white); background: transparent;
  transition: padding .3s ease, color .25s ease, background-color .25s ease;
}
.header.is-scrolled { padding-block: 16px; background: var(--field); }
.header.on-paper { color: var(--field); background: var(--paper); }
.header.on-paper :focus-visible { outline-color: var(--field); }
.menu-open .header { background: transparent; color: var(--white); }
.brand { display: flex; align-items: center; gap: var(--space-2); text-decoration: none; min-width: 0; }
.logo { font-weight: 700; font-size: 30px; line-height: 1; letter-spacing: -0.02em; display: inline-flex; align-items: center; direction: ltr; }
.logo svg { width: .6em; height: .6em; margin: .14em .04em 0; }
.header.is-scrolled .logo { font-size: 24px; }
/* Logo collapse: once scrolled, the letters fold into the o, nearest first; scrolling back to the top pours them out again */
.lg { display: inline-grid; grid-template-columns: minmax(0, 1fr); transition: grid-template-columns .42s cubic-bezier(.6, 0, .3, 1) calc(var(--i) * 45ms); }
.lg > span { width: max-content; transition: opacity .3s ease calc(var(--i) * 45ms), transform .42s cubic-bezier(.6, 0, .3, 1) calc(var(--i) * 45ms); }
.lg-l > span { transform-origin: 100% 55%; }
.lg-r > span { transform-origin: 0 55%; }
.header.is-scrolled .lg { grid-template-columns: minmax(0, 0fr); }
.header.is-scrolled .lg > span { opacity: 0; transform: scale(.2); }
.header.is-scrolled .lg-l > span { transform: translateX(.3em) scale(.2); }
.header.is-scrolled .lg-r > span { transform: translateX(-.3em) scale(.2); }
.logo svg { transition: width .42s cubic-bezier(.6, 0, .3, 1) .12s, height .42s cubic-bezier(.6, 0, .3, 1) .12s, margin .42s cubic-bezier(.6, 0, .3, 1) .12s; }
/* Alone, the o grows to stand in for the whole wordmark */
.header.is-scrolled .logo svg { width: .9em; height: .9em; margin: 0; animation: logo-gulp .5s cubic-bezier(.3, 0, .2, 1) .22s; }
@keyframes logo-gulp { 45% { transform: scale(1.22); } }
@media (prefers-reduced-motion: reduce) {
  .lg, .lg > span, .logo svg { transition: none; }
  .header.is-scrolled .logo svg { animation: none; }
}
.tagline { font-size: var(--fs-small); white-space: nowrap; transition: opacity .25s ease; }
.header.is-scrolled .tagline { opacity: 0; pointer-events: none; }
.header-end { display: flex; align-items: center; gap: var(--space-3); }
.header-book { font-size: var(--fs-small); font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.header.is-scrolled .header-book { opacity: 1; pointer-events: auto; }
.lang { font-size: var(--fs-small); white-space: nowrap; }
.lang a { text-decoration: none; }
.lang a:hover { text-decoration: underline; text-underline-offset: 4px; }
.lang-on { display: inline-block; line-height: 1.2; font-weight: 700; border-bottom: 2px solid currentColor; padding-bottom: 3px; }
.burger { width: 40px; height: 40px; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; display: grid; place-content: center; gap: 8px; }
.burger span { display: block; width: 38px; height: 3px; background: currentColor; transition: rotate .3s ease, translate .3s ease, opacity .2s; }
.menu-open .burger span:nth-child(1) { translate: 0 11px; rotate: 45deg; }
.menu-open .burger span:nth-child(2) { opacity: 0; }
.menu-open .burger span:nth-child(3) { translate: 0 -11px; rotate: -45deg; }

.menu {
  position: fixed; inset: 0; z-index: 15; background: var(--field);
  display: flex; flex-direction: column; justify-content: center; padding: 120px var(--gutter) 60px;
  opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility .3s;
}
.menu-open .menu { opacity: 1; visibility: visible; }
.menu ul { list-style: none; margin: 0 auto; padding: 0; width: 100%; max-width: var(--maxw); }
.menu li + li { margin-top: 6px; }
.menu a { font-size: clamp(38px, 4vw + 14px, 76px); font-weight: 700; line-height: 1.25; letter-spacing: -0.02em; text-decoration: none; }
.menu a:hover { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 8px; }
.menu .menu-book { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 8px; }
.menu-open { overflow: hidden; }

/* ---------- Sections ---------- */
.section {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: flex; align-items: center;
  padding-block: var(--space-6);
  padding-inline: max(var(--gutter), calc((100% - var(--maxw)) / 2));
}
.wrap { width: 100%; }

.hero { flex-direction: column; justify-content: center; text-align: center; padding-top: 120px; padding-bottom: 40px; }
.hero h1 { max-width: 20ch; margin-inline: auto; }
:lang(ar) .hero h1 { max-width: 16ch; }
.hero { overflow-x: clip; }
.hero-lead { margin: 32px auto 0; max-width: 56ch; }
.hero h1, .hero-lead, .t-finale, .finale .t-lead { text-wrap: balance; }
.t-h1, .t-lead, .row-label { text-wrap: pretty; }
.hero-cta { margin-top: 44px; }
/* Hero face: the O mouth draws itself once; the O-to-smile loop and the eyes are SMIL in build.mjs */
.hero-visual { margin-top: clamp(48px, 8vh, 72px); }
.hero-o { width: min(50vw, 250px); aspect-ratio: 1; margin-inline: auto; color: var(--white); pointer-events: none; }
.hero-o svg { display: block; width: 100%; height: 100%; overflow: visible; }
.hero-o-mouth { stroke-dasharray: 100; animation: hero-o-draw 1.2s cubic-bezier(.65, 0, .35, 1) .25s both; }
.hero-o-eye { fill: currentColor; }
@keyframes hero-o-draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .hero-o-mouth { animation: none; } }
/* Desktop: text at the start, the O in its own column at the end (mirrored in Arabic) */
@media (min-width: 901px) {
  .hero { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: var(--space-4); text-align: start; padding-bottom: 80px; }
  .hero h1, :lang(ar) .hero h1 { max-width: none; margin-inline: 0; }
  .hero-lead { margin-inline: 0; }
  .hero-visual { margin-top: 0; display: grid; place-items: center; }
  .hero-o { width: min(100%, 400px); }
}

.split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); align-items: center; }
.split > .split-visual { order: 0; }
.split--rev > .split-visual { order: 2; }
.split-text { max-width: var(--col); }
.split--rev .split-text { justify-self: start; }
.split:not(.split--rev) .split-text { justify-self: end; width: 100%; }
.split-text > .t-lead { margin-top: var(--space-3); }
.split-visual { display: grid; place-items: center; width: 100%; }
/* Desktop: figures and the FAQ heading stay in view while their longer text column scrolls. */
@media (min-width: 901px) {
  .split > .split-visual, .faq-head { align-self: start; position: sticky; top: 15vh; }
  .split { align-items: start; }
}
.section-link { display: inline-block; margin-top: var(--space-4); font-weight: 700; }

/* ---------- Rows (hairline accordions) ---------- */
.rows { margin-top: var(--space-3); border-bottom: 1px solid currentColor; }
.rows-label { margin-top: var(--space-5); margin-bottom: calc(-1 * var(--space-2)); }
.row { border-top: 1px solid currentColor; }
.row summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--space-2);
  padding: 12px 0; font-size: var(--fs-body);
}
.row summary::-webkit-details-marker { display: none; }
.row-label { flex: 1; }
.row .n { flex: none; width: 36px; font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.plus { flex: none; position: relative; width: 22px; height: 22px; transition: rotate .3s ease; }
.plus::before, .plus::after { content: ""; position: absolute; inset: 50% 0 auto 0; height: 1.5px; margin-top: -.75px; background: currentColor; }
.plus::after { rotate: 90deg; }
.row[open] .plus { rotate: 45deg; }
.row-body { padding: 0 0 var(--space-3); max-width: 52ch; }
.steps { list-style: none; margin: var(--space-3) 0 0; padding: 0; border-bottom: 1px solid currentColor; }
.steps li { border-top: 1px solid currentColor; padding: 12px 0 14px; }
.steps strong { display: block; }
.steps p { margin-top: 4px; max-width: 46ch; }
.row summary:hover .row-label { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }

/* ---------- Work ---------- */
.case + .case { margin-top: var(--space-6); }
/* Client screenshots: true colour so the work is readable; no frame, desktop + overlapping phone. */
.case.split { grid-template-columns: 1.15fr 1fr; gap: var(--space-5); }
.case-built .rows-label { margin-top: var(--space-5); }
.shot { position: relative; display: block; width: 100%; padding-bottom: 16%; text-decoration: none; transition: translate .3s ease; }
.shot:hover { translate: 0 -4px; }
.shot-desk { width: 88%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; }
.shot-phone { position: absolute; inset-inline-end: 0; bottom: 0; width: 24%; aspect-ratio: 390 / 844; object-fit: cover; object-position: top; outline: 6px solid var(--field); }
.case-name { margin-top: var(--space-3); }
.case-summary { margin-top: var(--space-3); }
.case-quote { margin-top: var(--space-4); }
.case-quote footer { margin-top: var(--space-1); }
.case-result { margin-top: var(--space-3); }
.work-more { margin-top: var(--space-3); }

/* ---------- Offer ---------- */

/* ---------- Compositions of primitives ---------- */
.comp { position: relative; width: min(100%, 520px); color: var(--white); }
.comp--square { aspect-ratio: 1; width: min(100%, 440px); }
.comp--figure { width: min(100%, 520px); }
.comp--tall { aspect-ratio: 4 / 5; width: min(100%, 400px); }
.comp--small { aspect-ratio: 1; width: min(60%, 260px); margin-top: 64px; }
.prim { position: absolute; display: block; height: auto; overflow: visible; will-change: translate, rotate; }

/* ---------- Finale (paper) ---------- */
.finale { background: var(--paper); color: var(--field); flex-direction: column; justify-content: center; text-align: center; padding-top: 140px; padding-bottom: var(--space-4); }
.finale :focus-visible { outline-color: var(--field); }
.finale .t-lead { margin: var(--space-3) auto 0; max-width: 40ch; }
:lang(ar) .finale .t-lead { margin-top: var(--space-4); }
.pill-face { direction: ltr; display: flex; align-items: center; justify-content: center; gap: 28px; }
.eye { width: 56px; height: 56px; color: var(--field); flex: none; }
.smile { width: 96px; height: 48px; rotate: 180deg; color: var(--field); margin-top: 20px; }
.deal { font-size: var(--fs-small); margin-bottom: var(--space-2); text-align: center; }
.deal span { white-space: nowrap; }
.deal span:not(:last-child)::after { content: "  ·  "; white-space: pre; }
.contact { margin: var(--space-5) auto 0; display: flex; flex-direction: column; align-items: center; gap: var(--space-1); }
.contact-label { margin-top: var(--space-4); }
.contact-email { font-size: var(--fs-lead); font-weight: 700; overflow-wrap: anywhere; }
.footer { margin-top: var(--space-5); font-size: var(--fs-small); }
.footer p + p { margin-top: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  :root { --fs-finale: 60px; }
}
@media (max-width: 900px) {
  :root { --gutter: 20px; --space-6: 96px; --space-5: 56px; }
  .header { padding: 20px var(--gutter); gap: var(--space-2); }
  .header.is-scrolled { padding-block: 12px; }
  .logo, .header.is-scrolled .logo { font-size: 22px; }
  .brand { gap: 10px; }
  .header-end { gap: var(--space-2); }
  .header.is-scrolled .tagline { display: none; }
  .split { grid-template-columns: 1fr; gap: var(--space-4); }
  .split > .split-visual, .split--rev > .split-visual { order: 0; }
  .split .split-text, .split:not(.split--rev) .split-text { justify-self: stretch; max-width: none; }
  .comp--square, .comp--figure { width: min(72vw, 340px); }
  .comp--tall { width: min(50vw, 220px); }
  .hero-o { width: min(52vw, 210px); }
  .split.section { min-height: auto; padding-block: 72px; }
  .case.split { grid-template-columns: 1fr; gap: var(--space-4); }
  .shot { padding-bottom: 0; }
  .shot-desk { width: 100%; }
  .shot-phone { position: static; display: block; width: 70vw; margin: var(--space-4) auto 0; outline: none; }
  .deal { text-wrap: balance; }
  .pill-face { gap: 8px; }
  .pill-face .pill { padding-inline: 20px; }
  .eye { width: 30px; height: 30px; }
  .smile { width: 52px; height: 26px; margin-top: 12px; }
  .faq-head { display: flex; flex-direction: column; }
  .faq-head .comp { order: -1; width: min(56vw, 260px); margin: 0 auto var(--space-4); }
  .hero { padding-top: 120px; }
}
@media (max-width: 600px) {
  .burger { width: 32px; }
  .burger span { width: 30px; }
  .finale { padding-top: 110px; }
}
