:root {
  color-scheme: light;
  --page: #f4f2ec;
  --surface: #fbfaf6;
  --text: #20231f;
  --muted: #62645d;
  --line: #d9d7ce;
  --accent: #385842;
  --copy: #53564f;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

/* System preference is the default; data-theme is only set for a saved choice. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #10110f;
  --surface: #171814;
  --text: #eeefe9;
  --muted: #a2a49b;
  --line: #30322d;
  --accent: #c4f26a;
  --copy: #c5c7bf;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --page: #10110f;
    --surface: #171814;
    --text: #eeefe9;
    --muted: #a2a49b;
    --line: #30322d;
    --accent: #c4f26a;
    --copy: #c5c7bf;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 24px; }

body {
  min-width: 320px;
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-thickness: .06em; text-underline-offset: .22em; }
a:hover { color: var(--accent); }
a:focus-visible,
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.skip-link {
  position: absolute;
  z-index: 2;
  inset: 12px auto auto 12px;
  padding: 10px 14px;
  transform: translateY(-160%);
  background: var(--accent);
  color: var(--page);
  font: 12px var(--mono);
}
.skip-link:focus { transform: translateY(0); }

.page { width: min(100% - 48px, 1040px); min-height: 100svh; margin-inline: auto; }
.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  font: 12px var(--mono);
}
.brand { display: inline-flex; width: 28px; height: 28px; flex: 0 0 auto; color: var(--accent); }
.brand svg { width: 100%; height: 100%; }
.site-nav { display: flex; align-items: center; gap: clamp(16px, 4vw, 32px); margin-left: auto; }
.site-nav a { padding-block: 10px; color: var(--muted); text-decoration: none; }
.site-nav a:hover { color: var(--text); }
.theme-toggle {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.theme-toggle { visibility: hidden; }
:root.js-ready .theme-toggle { visibility: visible; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .sun { display: none; }
  :root:not([data-theme]) .theme-toggle .moon { display: block; }
}

main { display: block; }
.hero { padding: clamp(76px, 13svh, 138px) 0 clamp(64px, 11svh, 112px); }
.eyebrow,
.section-index,
.case-kicker {
  color: var(--muted);
  font: 11px/1.5 var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.eyebrow { margin: 0 0 24px; }
h1 { max-width: 850px; margin: 0; font-size: clamp(52px, 10vw, 112px); line-height: .96; letter-spacing: -.075em; font-weight: 500; }
h1 span { display: block; margin-top: 12px; color: var(--accent); font-size: .48em; line-height: 1.15; letter-spacing: -.055em; }
.intro { max-width: 640px; margin: 32px 0 0; color: var(--copy); font: clamp(16px, 1.7vw, 18px)/1.7 var(--sans); }
.hero-links { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 28px; font: 12px var(--mono); }
.hero-links a { text-decoration: none; }
.hero-links a::before { content: "↗ "; color: var(--accent); }

.section { padding: 26px 0 34px; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.section-heading h2 { margin: 0; font-size: clamp(20px, 3vw, 28px); line-height: 1.15; font-weight: 500; letter-spacing: -.045em; }
.section-index { margin: 0; }

.work-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.case-file {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  background: var(--surface);
}
/* The featured case uses a restrained golden split: about 38% context, 62% evidence. */
.case-file--feature { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.618fr); align-items: end; gap: 32px; border-top: 2px solid var(--accent); padding: 24px; }
.case-kicker { margin: 0 0 20px; font-size: 10px; }
.case-file h3 { margin: 0; font-size: clamp(22px, 3vw, 34px); line-height: 1.08; letter-spacing: -.045em; font-weight: 500; }
.case-file h3 [lang="ar"] { display: inline-block; margin-inline-start: 8px; color: var(--accent); font-size: .72em; letter-spacing: 0; }
.identity-artifact { margin: 0 0 20px; }
.identity-artifact img { display: block; width: 100%; max-height: 156px; padding: 18px; border: 1px solid var(--line); background: #fff; object-fit: contain; }
.identity-artifact figcaption { margin-top: 8px; color: var(--muted); font: 10px/1.5 var(--mono); }
.case-lead { margin: 11px 0 0; color: var(--muted); font: 14px/1.65 var(--sans); }
.case-detail { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 18px; }
.case-detail > p { max-width: 510px; margin: 0; color: var(--copy); font: 15px/1.7 var(--sans); }
.case-links { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0; padding: 0; list-style: none; }
.case-links a { padding-block: 4px; color: var(--accent); font: 11px/1.6 var(--mono); }
.case-image { display: block; width: calc(100% + 40px); height: auto; aspect-ratio: 16 / 9; margin: -20px -20px 18px; border-bottom: 1px solid var(--line); object-fit: cover; background: var(--page); }
.contribution-list { width: 100%; margin: 18px 0 0; padding: 0; list-style: none; }
.contribution-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); color: var(--copy); font: 13px/1.6 var(--sans); }
.contribution-list li span { color: var(--muted); }
.contribution-list li a { display: inline-block; padding-block: 4px; }

.visual-work { margin-top: 36px; }
.visual-work-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.visual-work-heading h3 { margin: 0; font-size: 14px; font-weight: 500; letter-spacing: -.02em; }
.visual-work-heading p { margin: 0; color: var(--muted); font: 11px/1.5 var(--mono); }
.visual-work-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.visual-work-item { min-width: 0; margin: 0; }
.visual-work-image { overflow: hidden; aspect-ratio: 1.36; border: 1px solid var(--line); background: #fff; }
.visual-work-image img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.visual-work-item--identity img { object-position: center; }
.visual-work-item figcaption { display: flex; flex-direction: column; gap: 4px; padding-top: 10px; }
.visual-work-item figcaption span { color: var(--muted); font: 10px var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.visual-work-item figcaption strong { font: 13px/1.4 var(--sans); font-weight: 500; }

.about-copy { max-width: 680px; margin: 0; color: var(--copy); font: 16px/1.75 var(--sans); }
.about-copy + .about-copy { margin-top: 12px; }
.about-copy strong { color: var(--text); font-weight: 400; }
.socials { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 18px; font: 13px var(--sans); }
.socials a { padding-block: 6px; color: var(--muted); text-decoration: none; }
.socials a:hover { color: var(--accent); }
.contact-trigger { margin-top: 14px; padding: 8px 0; border: 0; background: transparent; color: var(--accent); font: 12px var(--mono); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; }
.contact-trigger:hover { color: var(--text); }
.contact-dialog { width: min(100% - 32px, 520px); max-width: none; max-height: min(90svh, 760px); overflow-y: auto; margin: auto; padding: clamp(22px, 5vw, 34px); border: 1px solid var(--line); background: var(--surface); color: var(--text); box-shadow: 0 24px 80px rgb(0 0 0 / .24); }
.contact-dialog::backdrop { background: rgb(8 9 7 / .68); backdrop-filter: blur(3px); }
.contact-dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 24px; }
.contact-dialog-heading .case-kicker { margin-bottom: 8px; }
.contact-dialog-heading h3 { margin: 0; font-size: 24px; font-weight: 500; letter-spacing: -.04em; }
.contact-close { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--text); font: 24px/1 var(--sans); cursor: pointer; }
.contact-form { display: grid; gap: 9px; }
.contact-form[hidden],
.contact-success[hidden] { display: none; }
.contact-form label { margin-top: 6px; color: var(--muted); font: 11px var(--mono); }
.contact-form input,
.contact-form textarea { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 0; background: var(--page); color: var(--text); font: 14px/1.5 var(--sans); }
.contact-form textarea { min-height: 120px; resize: vertical; }
.contact-form input:focus-visible,
.contact-form textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cf-turnstile { margin-top: 12px; }
.contact-status { margin: 4px 0; color: var(--copy); font: 13px/1.6 var(--sans); }
.contact-success { display: grid; justify-items: start; gap: 18px; padding-top: 4px; }
.contact-success p { margin: 0; color: var(--copy); font: 15px/1.7 var(--sans); }
.contact-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 8px; }
.contact-cancel,
.contact-submit { min-height: 44px; padding: 0 16px; border: 1px solid var(--line); background: transparent; color: var(--text); font: 11px var(--mono); cursor: pointer; }
.contact-submit { border-color: var(--accent); background: var(--accent); color: var(--page); }
.contact-submit:disabled { opacity: .65; cursor: wait; }
.contact-submit:hover { filter: brightness(.94); }
.site-footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 26px; padding: 16px 0 22px; border-top: 1px solid var(--line); color: var(--muted); font: 11px var(--mono); }

body,
.topbar,
.case-file,
.theme-toggle,
.site-footer { transition: color .3s ease, background-color .3s ease, border-color .3s ease; }

@keyframes theme-reveal {
  from { clip-path: circle(0 at var(--theme-x, 50vw) var(--theme-y, 50vh)); }
  to { clip-path: circle(150vmax at var(--theme-x, 50vw) var(--theme-y, 50vh)); }
}
/* The JS feature-detects this API; unsupported browsers switch themes without a reveal. */
::view-transition-old(root) { animation: none; z-index: 1; }
::view-transition-new(root) { animation: theme-reveal .62s cubic-bezier(.2, .75, .25, 1) both; }

@media (max-width: 680px) {
  .page { width: min(100% - 36px, 1040px); }
  .topbar { min-height: 64px; }
  .hero { padding: 72px 0 64px; }
  h1 { font-size: clamp(48px, 13vw, 78px); }
  h1 span { max-width: 520px; font-size: .54em; }
  .work-grid { grid-template-columns: 1fr; }
  .case-file--feature { grid-column: auto; grid-template-columns: 1fr; gap: 18px; padding: 20px; }
  .visual-work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .visual-work-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
}

@media (max-width: 420px) {
  .page { width: min(100% - 28px, 1040px); }
  .site-nav { gap: 12px; font-size: 12px; }
  .brand { width: 24px; height: 24px; }
  .case-file { padding: 16px; }
  .case-file--feature { padding: 18px; }
  .case-image { width: calc(100% + 32px); margin: -16px -16px 16px; }
  .visual-work-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
  ::view-transition-new(root) { animation-duration: .01ms !important; }
}
