/* ==========================================================================
   devmfouad.com: design system
   Editorial, engineering-spec aesthetic: paper/ink neutrals, one signal accent,
   hairline rules, Geist + Geist Mono. Light and dark are designed as equals.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #f4f3ee;
  --bg-elev: #fbfaf6;
  --surface: #ffffff;
  --ink: #141512;
  --ink-2: #3a3c36;
  --muted: #64665e;
  --line: #dcdad1;
  --line-strong: #c4c1b5;
  --accent: #b23c0b;
  --accent-hover: #93300a;
  --accent-ink: #ffffff;
  --accent-soft: rgb(178 60 11 / 0.08);
  --invert-bg: #141512;
  --invert-ink: #ecebe5;
  --invert-muted: #9a9b93;
  --invert-line: #2c2d29;
  --invert-accent: #ff7a45;
  --shadow: 0 1px 0 rgb(20 21 18 / 0.04), 0 12px 32px -16px rgb(20 21 18 / 0.18);
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);

  --font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --step--1: clamp(0.8rem, 0.78rem + 0.1vw, 0.86rem);
  --step-0: clamp(1rem, 0.97rem + 0.15vw, 1.0625rem);
  --step-1: clamp(1.15rem, 1.08rem + 0.35vw, 1.35rem);
  --step-2: clamp(1.4rem, 1.22rem + 0.8vw, 1.9rem);
  --step-3: clamp(1.8rem, 1.45rem + 1.6vw, 2.75rem);
  --step-4: clamp(2.3rem, 1.7rem + 2.8vw, 4rem);
  --step-5: clamp(2.6rem, 1.5rem + 5vw, 5.75rem);

  --gutter: clamp(16px, 4vw, 40px);
  --max: 1240px;
  --section: clamp(88px, 11vw, 168px);
  --radius: 6px;
  --radius-lg: 14px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --header-h: 68px;

  color-scheme: light;
}

:root[data-theme='dark'] {
  --bg: #0d0e0c;
  --bg-elev: #121310;
  --surface: #171815;
  --ink: #ecebe5;
  --ink-2: #c6c5bd;
  --muted: #94958c;
  --line: #262723;
  --line-strong: #3a3b35;
  --accent: #ff7a45;
  --accent-hover: #ff936a;
  --accent-ink: #1a0a03;
  --accent-soft: rgb(255 122 69 / 0.1);
  --invert-bg: #ecebe5;
  --invert-ink: #141512;
  --invert-muted: #5d5f57;
  --invert-line: #cfcdc4;
  --invert-accent: #b23c0b;
  --shadow: 0 1px 0 rgb(0 0 0 / 0.3), 0 16px 40px -20px rgb(0 0 0 / 0.7);
  color-scheme: dark;
}

/* No-JS fallback: follow the OS until a theme is chosen. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0d0e0c;
    --bg-elev: #121310;
    --surface: #171815;
    --ink: #ecebe5;
    --ink-2: #c6c5bd;
    --muted: #94958c;
    --line: #262723;
    --line-strong: #3a3b35;
    --accent: #ff7a45;
    --accent-hover: #ff936a;
    --accent-ink: #1a0a03;
    --accent-soft: rgb(255 122 69 / 0.1);
    --invert-bg: #ecebe5;
    --invert-ink: #141512;
    --invert-muted: #5d5f57;
    --invert-line: #cfcdc4;
  --invert-accent: #b23c0b;
    color-scheme: dark;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.6;
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

.theme-ready body,
.theme-ready .site-header,
.theme-ready .card,
.theme-ready .btn {
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease), border-color 0.35s var(--ease);
}

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

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: 4px;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  inset-inline-start: 16px;
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--radius);
  font-weight: 500;
  text-decoration: none;
}

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

.container {
  width: 100%;
  max-width: calc(var(--max) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.icon {
  flex: none;
}

/* ---------- Type helpers ---------- */
.mono {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.01em;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.eyebrow .index {
  color: var(--accent);
}

.lead {
  font-size: var(--step-1);
  line-height: 1.55;
  color: var(--ink-2);
}

.muted {
  color: var(--muted);
}

/* ---------- Buttons & links ---------- */
.btn {
  --btn-bg: transparent;
  --btn-ink: var(--ink);
  --btn-line: var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid var(--btn-line);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-weight: 500;
  font-size: 0.975rem;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.btn .icon {
  transition: transform 0.3s var(--ease);
}

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

.btn:hover .icon-diag,
.btn:hover .icon[data-diag] {
  transform: translate(2px, -2px);
}

.btn-primary {
  --btn-bg: var(--ink);
  --btn-ink: var(--bg);
  --btn-line: var(--ink);
}

.btn-primary:hover {
  --btn-bg: var(--accent);
  --btn-line: var(--accent);
  --btn-ink: var(--accent-ink);
}

.btn-ghost:hover {
  --btn-line: var(--ink);
}

.btn-sm {
  min-height: 38px;
  padding: 0 16px;
  font-size: 0.9rem;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 2px;
}

.link-arrow:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid transparent;
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.brand:hover .brand-mark {
  background: var(--accent);
  color: var(--accent-ink);
}

.brand-name small {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav ul {
  display: flex;
  list-style: none;
  gap: 2px;
}

.nav-link {
  position: relative;
  display: inline-block;
  padding: 8px 12px;
  color: var(--muted);
  font-size: 0.925rem;
  text-decoration: none;
  border-radius: 999px;
}

.nav-link:hover {
  color: var(--ink);
}

.nav-link[aria-current] {
  color: var(--ink);
}

.nav-link[aria-current]::after {
  content: '';
  position: absolute;
  inset-inline-start: 50%;
  bottom: 2px;
  width: 4px;
  height: 4px;
  margin-inline-start: -2px;
  border-radius: 50%;
  background: var(--accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.icon-btn:hover {
  border-color: var(--line-strong);
  background: var(--bg-elev);
}

.theme-toggle .icon-sun,
:root[data-theme='dark'] .theme-toggle .icon-moon {
  display: none;
}

:root[data-theme='dark'] .theme-toggle .icon-sun {
  display: block;
}

.menu-toggle {
  display: none;
}

.mobile-menu {
  display: none;
}

@media (max-width: 900px) {
  .site-nav {
    display: none;
  }

  .menu-toggle {
    display: inline-grid;
  }

  .header-cta {
    display: none;
  }

  .mobile-menu {
    position: fixed;
    inset: var(--header-h) 0 0 0;
    z-index: 49;
    display: flex;
    flex-direction: column;
    padding: 24px var(--gutter) 32px;
    background: var(--bg);
    border-top: 1px solid var(--line);
    overflow-y: auto;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0s 0.25s;
  }

  .mobile-menu.is-open {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  }

  .mobile-menu ul {
    list-style: none;
  }

  .mobile-menu li + li {
    border-top: 1px solid var(--line);
  }

  .mobile-menu a.mobile-link {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 18px 0;
    font-size: var(--step-2);
    font-weight: 500;
    letter-spacing: -0.02em;
    text-decoration: none;
  }

  .mobile-menu a.mobile-link span {
    font-family: var(--font-mono);
    font-size: var(--step--1);
    color: var(--muted);
  }

  .mobile-menu .btn {
    margin-top: 28px;
  }

  .menu-open {
    overflow: hidden;
  }
}

.menu-toggle .icon-close,
.menu-toggle[aria-expanded='true'] .icon-menu {
  display: none;
}

.menu-toggle[aria-expanded='true'] .icon-close {
  display: block;
}

/* ---------- Sections ---------- */
.section {
  padding-block: var(--section);
  border-top: 1px solid var(--line);
}

.section-head {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 24px var(--gutter);
  align-items: end;
  margin-bottom: clamp(48px, 6vw, 88px);
}

.section-head .eyebrow {
  grid-column: 1 / -1;
}

.section-head h2 {
  grid-column: 1 / span 8;
  font-size: var(--step-4);
  letter-spacing: -0.035em;
}

.section-head p {
  grid-column: 9 / -1;
  color: var(--muted);
}

@media (max-width: 900px) {
  .section-head h2,
  .section-head p {
    grid-column: 1 / -1;
  }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding-block: clamp(48px, 8vw, 112px) clamp(56px, 7vw, 96px);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 88px 88px;
  background-position: center top;
  opacity: 0.45;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 70% 30%, #000 10%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 70% 30%, #000 10%, transparent 75%);
  pointer-events: none;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 340px);
  gap: clamp(40px, 6vw, 96px);
  align-items: end;
}

.hero-name {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--step-0);
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted);
  margin-bottom: 18px;
}

.hero-descriptor {
  display: block;
  margin-top: 6px;
  color: var(--ink-2);
}

.hero-headline {
  display: block;
  font-size: var(--step-5);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.045em;
  max-width: 16ch;
}

.hero-headline em {
  font-style: normal;
  color: var(--accent);
}

.hero-intro {
  max-width: 54ch;
  margin-top: 28px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 36px;
}

.hero-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 0;
  margin-top: 40px;
  list-style: none;
  color: var(--ink-2);
}

.hero-roles li {
  display: inline-flex;
  align-items: center;
}

.hero-roles li:not(:last-child)::after {
  content: '/';
  margin: 0 12px;
  color: var(--line-strong);
}

.portrait {
  margin: 0;
}

.portrait-frame {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--line);
}

.portrait-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
  filter: grayscale(1) contrast(1.05);
  transition: filter 0.6s var(--ease);
}

.portrait:hover .portrait-frame img {
  filter: grayscale(0);
}

.portrait-caption {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--muted);
}

.socials {
  display: flex;
  gap: 8px;
  margin-top: 28px;
  list-style: none;
}

.socials a {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
}

.socials a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: clamp(56px, 7vw, 96px);
  border-top: 1px solid var(--line);
  list-style: none;
}

.facts li {
  padding-block: 24px 0;
  padding-inline: 0 24px;
}

.facts li + li {
  padding-inline-start: 24px;
  border-inline-start: 1px solid var(--line);
}

.fact-value {
  display: block;
  font-size: var(--step-3);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.fact-label {
  display: block;
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 24ch;
}

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .portrait {
    display: grid;
    grid-template-columns: 112px 1fr;
    gap: 20px;
    align-items: center;
    order: -1;
  }

  .portrait-frame {
    aspect-ratio: 1;
    border-radius: 50%;
  }

  /* The small circular avatar frames the face rather than the whole portrait. */
  .portrait-frame img {
    transform: scale(1.65);
    transform-origin: 50% 22%;
  }

  .portrait-caption {
    flex-direction: column;
    gap: 2px;
    margin: 0;
  }

  .portrait .socials {
    margin-top: 10px;
  }

  .facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .facts li:nth-child(3) {
    padding-inline-start: 0;
    border-inline-start: 0;
  }

  .facts li:nth-child(n + 3) {
    margin-top: 24px;
    border-top: 1px solid var(--line);
  }
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 48px var(--gutter);
}

.about-statement {
  grid-column: 1 / span 5;
  font-size: var(--step-3);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.about-statement span {
  color: var(--muted);
}

.about-body {
  grid-column: 7 / -1;
  display: grid;
  gap: 20px;
  color: var(--ink-2);
}

.capabilities {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: clamp(24px, 4vw, 56px);
  list-style: none;
  border-top: 1px solid var(--ink);
}

.capabilities li {
  padding-block: 22px 0;
  padding-inline: 0 24px;
}

.capabilities li + li {
  padding-inline-start: 24px;
  border-inline-start: 1px solid var(--line);
}

.capabilities h3 {
  font-size: var(--step-1);
  letter-spacing: -0.02em;
  margin: 10px 0 8px;
}

.capabilities p {
  font-size: 0.95rem;
  color: var(--muted);
}

@media (max-width: 900px) {
  .about-statement,
  .about-body {
    grid-column: 1 / -1;
  }

  .capabilities {
    grid-template-columns: 1fr 1fr;
  }

  .capabilities li:nth-child(3) {
    padding-inline-start: 0;
    border-inline-start: 0;
  }

  .capabilities li:nth-child(n + 3) {
    margin-top: 28px;
  }
}

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

  .capabilities li,
  .capabilities li + li {
    padding: 20px 0 0;
    border-inline-start: 0;
  }

  .capabilities li + li {
    margin-top: 20px;
    border-top: 1px solid var(--line);
  }
}

/* ---------- Experience ---------- */
.roles {
  list-style: none;
  border-top: 1px solid var(--ink);
}

.role {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px var(--gutter);
  padding-block: clamp(32px, 4vw, 52px);
  border-bottom: 1px solid var(--line);
}

.role-when {
  grid-column: 1 / span 3;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.role-when time,
.role-period {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--ink-2);
}

.role-type {
  font-size: 0.85rem;
  color: var(--muted);
}

.role-current {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.role-what {
  grid-column: 4 / span 4;
}

.role-what h3 {
  font-size: var(--step-2);
  letter-spacing: -0.03em;
}

.role-company {
  margin-top: 6px;
  font-size: var(--step-1);
  color: var(--ink-2);
}

.role-previous {
  margin-top: 10px;
  font-size: 0.875rem;
  color: var(--muted);
}

.role-detail {
  grid-column: 8 / -1;
  display: grid;
  gap: 18px;
}

.role-detail > p {
  color: var(--ink-2);
}

.ticks {
  display: grid;
  gap: 10px;
  list-style: none;
}

.ticks li {
  position: relative;
  padding-inline-start: 22px;
  color: var(--ink-2);
  font-size: 0.975rem;
}

.ticks li::before {
  content: '';
  position: absolute;
  inset-inline-start: 2px;
  top: 0.72em;
  width: 10px;
  height: 1px;
  background: var(--accent);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
}

.tags li {
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-2);
  white-space: nowrap;
}

.role-projects {
  font-size: 0.9rem;
  color: var(--muted);
}

.role-projects a {
  color: var(--ink);
}

.role-projects a:hover {
  color: var(--accent);
}

@media (max-width: 1024px) {
  .role-when {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
  }

  .role-what {
    grid-column: 1 / span 5;
  }

  .role-detail {
    grid-column: 6 / -1;
  }
}

@media (max-width: 720px) {
  .role-what,
  .role-detail {
    grid-column: 1 / -1;
  }
}

/* ---------- Projects ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: clamp(32px, 4vw, 48px);
}

.filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 0.925rem;
  cursor: pointer;
}

.filter:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.filter[aria-pressed='true'] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.filter-count {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  opacity: 0.6;
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(20px, 2.4vw, 32px);
  list-style: none;
}

.work-grid > li {
  grid-column: span 6;
  min-width: 0;
}

.work-grid > li.is-wide {
  grid-column: 1 / -1;
}

.work-grid > li[hidden],
.work-index > li[hidden] {
  display: none;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-elev);
  overflow: hidden;
  transition: border-color 0.3s var(--ease), transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

@media (prefers-reduced-motion: no-preference) {
  .card:hover {
    transform: translateY(-3px);
  }
}

.card:focus-within {
  border-color: var(--accent);
}

.card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.8s var(--ease);
}

@media (prefers-reduced-motion: no-preference) {
  .card:hover .card-media img.is-cover {
    transform: scale(1.025);
  }
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  padding: clamp(20px, 2.4vw, 28px);
}

.card-kicker {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.card h3 {
  font-size: var(--step-2);
  letter-spacing: -0.03em;
}

.card h3 a {
  text-decoration: none;
}

/* Whole card is clickable via the title link. */
.card h3 a::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
}

.card h3 a:focus-visible {
  box-shadow: none;
}

.card-desc {
  color: var(--ink-2);
}

.card-role {
  font-size: 0.9rem;
  color: var(--muted);
}

.card-role strong {
  font-weight: 500;
  color: var(--ink);
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: auto;
  padding-top: 8px;
}

.card-foot .tags {
  min-width: 0;
}

.card-arrow {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease), border-color 0.3s var(--ease);
}

.card:hover .card-arrow {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.card-metric {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  width: fit-content;
  padding: 6px 12px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  font-size: 0.875rem;
  color: var(--ink-2);
}

.card-metric strong {
  color: var(--accent);
  font-weight: 600;
  font-size: 1rem;
}

.card-media img.is-contain {
  object-fit: contain;
  object-position: center;
}

/* Wide feature card: media and copy side by side */
.card.is-wide {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
}

.card.is-wide .card-media {
  aspect-ratio: auto;
  min-height: 420px;
  border-bottom: 0;
  border-inline-end: 1px solid var(--line);
}

.card.is-wide .card-body {
  padding: clamp(24px, 3.4vw, 44px);
}

.card.is-wide h3 {
  font-size: var(--step-3);
}

.card.is-wide.is-mirrored {
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
}

.card.is-wide.is-mirrored .card-media {
  order: 2;
  border-inline-end: 0;
  border-inline-start: 1px solid var(--line);
}

@media (max-width: 900px) {
  .work-grid > li {
    grid-column: 1 / -1;
  }

  .card.is-wide {
    display: flex;
  }

  .card.is-wide .card-media,
  .card.is-wide.is-mirrored .card-media {
    order: 0;
    aspect-ratio: 16 / 10;
    min-height: 0;
    border-inline-end: 0;
    border-inline-start: 0;
    border-bottom: 1px solid var(--line);
  }
}

/* Brand plate: used when there is no screenshot, or behind one while loading */
.plate {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--plate, var(--surface));
  color: var(--plate-ink, var(--ink));
}

.plate::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, currentColor 1px, transparent 1px),
    linear-gradient(to bottom, currentColor 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.06;
}

.plate-logo {
  position: relative;
  width: clamp(88px, 22%, 148px);
  aspect-ratio: 1;
  border-radius: 22%;
  overflow: hidden;
  box-shadow: 0 20px 40px -18px rgb(0 0 0 / 0.45);
}

.plate-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.plate-word {
  position: relative;
  max-width: 80%;
  font-size: var(--step-3);
  font-weight: 600;
  letter-spacing: -0.04em;
  text-align: center;
  line-height: 1.05;
}

.plate-note {
  position: absolute;
  inset-inline-start: 16px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.75;
}

.card-media > img,
.cs-cover > img {
  position: relative;
}

.card-media > img[data-broken],
.cs-cover > img[data-broken] {
  visibility: hidden;
}

.badge {
  position: absolute;
  top: 14px;
  inset-inline-start: 14px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* Store badges (App Store / Google Play) */
.store-badge {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding-block: 6px 6px;
  padding-inline: 12px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
  line-height: 1.1;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}

.store-badge small {
  display: block;
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  opacity: 0.8;
}

.store-badge:hover {
  background: var(--accent);
  color: var(--accent-ink);
}

.store-badge.is-small {
  min-height: 40px;
  padding-block: 4px 4px;
  padding-inline: 10px 12px;
  border-radius: 8px;
  font-size: 0.875rem;
  gap: 8px;
}

.store-badge.is-small small {
  font-size: 0.62rem;
}

.card-stores,
.cs-stores {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-sub {
  display: block;
  margin-top: 2px;
  font-size: 0.875rem;
  color: var(--muted);
}

/* Compact index of additional work */
.work-more {
  margin-top: clamp(56px, 7vw, 96px);
}

.work-more h3 {
  margin-bottom: 20px;
  font-size: var(--step-1);
}

.work-index {
  list-style: none;
  border-top: 1px solid var(--ink);
}

.index-row {
  position: relative;
  display: grid;
  grid-template-columns: 56px minmax(0, 3fr) minmax(0, 4fr) minmax(0, 2fr) 32px;
  align-items: center;
  gap: 20px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition: padding 0.3s var(--ease), background-color 0.3s var(--ease);
}

.index-row:hover {
  background: var(--bg-elev);
}

@media (prefers-reduced-motion: no-preference) {
  .index-row:hover {
    padding-inline: 12px;
  }
}

.index-thumb {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.index-thumb .plate-word {
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.index-thumb .plate-logo {
  width: 100%;
  border-radius: 0;
  box-shadow: none;
}

.index-name {
  font-size: var(--step-1);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.index-desc {
  color: var(--muted);
  font-size: 0.925rem;
}

.index-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.index-row .icon {
  color: var(--muted);
}

.index-row:hover .icon {
  color: var(--accent);
}

@media (max-width: 900px) {
  .index-row {
    grid-template-columns: 48px minmax(0, 1fr) 24px;
    gap: 4px 16px;
  }

  .index-thumb {
    grid-row: span 2;
    width: 48px;
    height: 48px;
  }

  .index-desc {
    grid-column: 2;
    grid-row: 2;
  }

  .index-meta {
    display: none;
  }

  .index-row .icon {
    grid-column: 3;
    grid-row: 1 / span 2;
  }
}

.empty-state {
  padding: 48px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  text-align: center;
  color: var(--muted);
}

/* ---------- Expertise ---------- */
.expertise-list {
  list-style: none;
  border-top: 1px solid var(--ink);
}

.expertise-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 4fr) minmax(0, 7fr);
  gap: 16px var(--gutter);
  padding-block: clamp(26px, 3vw, 40px);
  border-bottom: 1px solid var(--line);
}

.expertise-num {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--accent);
  padding-top: 6px;
}

.expertise-row h3 {
  font-size: var(--step-2);
  letter-spacing: -0.03em;
}

.expertise-row p {
  margin-top: 10px;
  color: var(--muted);
  max-width: 40ch;
}

.skill-list {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
  list-style: none;
  padding-top: 4px;
}

.skill-list li {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  font-size: 0.925rem;
  color: var(--ink-2);
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease);
}

.expertise-row:hover .skill-list li {
  border-color: var(--line-strong);
  color: var(--ink);
}

@media (max-width: 900px) {
  .expertise-row {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .skill-list {
    grid-column: 2;
  }
}

/* ---------- Principles (inverted band) ---------- */
.section-invert {
  background: var(--invert-bg);
  color: var(--invert-ink);
  border-top: 0;
  --line: var(--invert-line);
  --muted: var(--invert-muted);
  --accent: var(--invert-accent);
}

.section-invert .eyebrow {
  color: var(--invert-muted);
}

.principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  list-style: none;
  border-top: 1px solid var(--invert-line);
}

.principle {
  padding-block: clamp(28px, 3vw, 40px);
  padding-inline: 0 clamp(20px, 2.4vw, 36px);
  border-bottom: 1px solid var(--invert-line);
}

.principle:not(:nth-child(3n + 1)) {
  padding-inline-start: clamp(20px, 2.4vw, 36px);
  border-inline-start: 1px solid var(--invert-line);
}

.principle-num {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--accent);
}

.principle h3 {
  margin: 28px 0 12px;
  font-size: var(--step-2);
  letter-spacing: -0.03em;
}

.principle p {
  color: var(--invert-muted);
}

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

  .principle:not(:nth-child(3n + 1)) {
    padding-inline-start: 0;
    border-inline-start: 0;
  }

  .principle:nth-child(even) {
    padding-inline-start: clamp(20px, 2.4vw, 36px);
    border-inline-start: 1px solid var(--invert-line);
  }
}

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

  .principle:nth-child(even) {
    padding-inline-start: 0;
    border-inline-start: 0;
  }

  .principle h3 {
    margin-top: 16px;
  }
}

/* ---------- Contact ---------- */
.contact {
  padding-block: var(--section);
  border-top: 1px solid var(--line);
}

.contact h2 {
  font-size: var(--step-5);
  letter-spacing: -0.045em;
  line-height: 0.98;
  max-width: 15ch;
}

.contact-lead {
  max-width: 52ch;
  margin-top: 28px;
}

.contact-email {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  margin-top: clamp(40px, 5vw, 64px);
  padding-block: 28px;
  border-block: 1px solid var(--ink);
}

.contact-email > a {
  font-size: var(--step-3);
  font-weight: 500;
  letter-spacing: -0.03em;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.contact-email > a:hover {
  color: var(--accent);
}

.contact-email .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-inline-start: auto;
}

.channels {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  list-style: none;
}

.channels a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding-block: 24px 24px;
  padding-inline: 0 20px;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.channels li + li a {
  padding-inline-start: 20px;
  border-inline-start: 1px solid var(--line);
}

.channel-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 500;
}

.channel-handle {
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--muted);
  overflow-wrap: anywhere;
}

.channels a:hover .channel-label {
  color: var(--accent);
}

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

  .channels li:nth-child(odd) a {
    padding-inline-start: 0;
    border-inline-start: 0;
  }

  .contact-email .actions {
    margin-inline-start: 0;
  }
}

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

  .channels li a,
  .channels li + li a {
    padding-inline-start: 0;
    border-inline-start: 0;
  }
}

/* ---------- Footer ---------- */
.site-footer {
  padding-block: 40px;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  list-style: none;
}

.footer-links a {
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--ink);
}

/* ---------- Case study ---------- */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--muted);
}

.crumbs li + li::before {
  content: '/';
  margin-inline-end: 8px;
  color: var(--line-strong);
}

.crumbs a {
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--ink);
}

.cs-head {
  padding-block: clamp(40px, 6vw, 80px) clamp(40px, 5vw, 64px);
}

.cs-title {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 28px var(--gutter);
  margin-top: clamp(32px, 4vw, 56px);
}

.cs-title > div {
  grid-column: 1 / span 8;
}

.cs-title h1 {
  margin-top: 16px;
  font-size: var(--step-5);
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.cs-title .lead {
  margin-top: 28px;
  max-width: 60ch;
}

.cs-links {
  grid-column: 9 / -1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 10px;
}

.cs-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: clamp(40px, 5vw, 64px);
  border-top: 1px solid var(--ink);
}

.cs-meta > div {
  padding-block: 20px 0;
  padding-inline: 0 20px;
}

.cs-meta > div + div {
  padding-inline-start: 20px;
  border-inline-start: 1px solid var(--line);
}

.cs-meta dt {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.cs-meta dd {
  margin: 8px 0 0;
  color: var(--ink);
}

@media (max-width: 900px) {
  .cs-title > div,
  .cs-links {
    grid-column: 1 / -1;
  }

  .cs-links {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .cs-meta {
    grid-template-columns: 1fr 1fr;
  }

  .cs-meta > div:nth-child(3) {
    padding-inline-start: 0;
    border-inline-start: 0;
  }

  .cs-meta > div:nth-child(n + 3) {
    margin-top: 20px;
  }
}

.cs-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.cs-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.cs-cover .plate-logo {
  width: clamp(110px, 16%, 180px);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-top: clamp(40px, 5vw, 64px);
  list-style: none;
  border-top: 1px solid var(--line);
}

.metrics li {
  padding-block: 24px 0;
  padding-inline: 0 24px;
}

.metrics li + li {
  padding-inline-start: 24px;
  border-inline-start: 1px solid var(--line);
}

.metric-value {
  display: block;
  font-size: var(--step-4);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1;
}

.metric-label {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.925rem;
  max-width: 28ch;
}

.metric-source {
  display: block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
}

@media (max-width: 720px) {
  .metrics li,
  .metrics li + li {
    padding: 20px 0 0;
    border-inline-start: 0;
  }
}

.cs-body {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 48px var(--gutter);
  padding-block: clamp(64px, 8vw, 120px);
}

.cs-toc {
  grid-column: 1 / span 3;
}

.cs-toc nav {
  position: sticky;
  top: calc(var(--header-h) + 32px);
}

.cs-toc ol {
  display: grid;
  gap: 2px;
  list-style: none;
  border-inline-start: 1px solid var(--line);
}

.cs-toc a {
  display: block;
  margin-inline-start: -1px;
  padding-block: 6px 6px;
  padding-inline: 16px 0;
  border-inline-start: 1px solid transparent;
  color: var(--muted);
  font-size: 0.925rem;
  text-decoration: none;
}

.cs-toc a:hover,
.cs-toc a[aria-current] {
  color: var(--ink);
  border-inline-start-color: var(--accent);
}

.cs-content {
  grid-column: 4 / -1;
  display: grid;
  gap: clamp(56px, 7vw, 96px);
  min-width: 0;
}

.cs-section {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 20px var(--gutter);
}

.cs-section > h2 {
  grid-column: 1 / span 3;
  font-size: var(--step-1);
  letter-spacing: -0.02em;
}

.cs-section > h2 span {
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-mono);
  font-size: var(--step--1);
  font-weight: 400;
  color: var(--accent);
  letter-spacing: 0;
}

.cs-section > .cs-section-body {
  grid-column: 4 / -1;
  display: grid;
  gap: 20px;
  color: var(--ink-2);
  font-size: var(--step-1);
  line-height: 1.6;
}

.cs-section .ticks li {
  font-size: var(--step-0);
}

.cs-section.is-full > .cs-section-body {
  grid-column: 1 / -1;
}

.callout {
  padding: 16px 20px;
  border-inline-start: 2px solid var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius);
  border-start-start-radius: 0;
  border-end-start-radius: 0;
  font-size: var(--step-0);
  color: var(--ink-2);
}

.spec {
  list-style: none;
  border-top: 1px solid var(--line);
  counter-reset: spec;
}

.spec li {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-size: var(--step-0);
  counter-increment: spec;
}

.spec li::before {
  content: counter(spec, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  color: var(--muted);
  padding-top: 2px;
}

.challenges {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  list-style: none;
}

.challenges li {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-elev);
}

.challenges h3 {
  font-size: var(--step-1);
  letter-spacing: -0.02em;
  color: var(--ink);
}

.challenges p {
  margin-top: 10px;
  font-size: 0.975rem;
  color: var(--muted);
}

.gallery {
  display: grid;
  gap: 20px;
  list-style: none;
}

.gallery.is-phone {
  grid-auto-flow: column;
  grid-auto-columns: clamp(170px, 22vw, 230px);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  padding-bottom: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.gallery.is-phone > li {
  scroll-snap-align: start;
}

.gallery.is-desktop {
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
}

.gallery figure {
  margin: 0;
}

.shot {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.gallery.is-phone .shot {
  border-radius: 20px;
}

.gallery.is-phone .shot.has-bezel {
  padding: 6px;
  border-radius: 26px;
  background: var(--ink);
  border-color: var(--ink);
}

.gallery.is-phone .shot.has-bezel img {
  border-radius: 20px;
}

.gallery.is-desktop .shot {
  padding-top: 26px;
  position: relative;
}

.gallery.is-desktop .shot::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--line-strong);
  box-shadow: 12px 0 0 var(--line-strong), 24px 0 0 var(--line-strong);
}

.gallery figcaption {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.cs-cta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 24px 48px;
  padding: clamp(32px, 5vw, 64px);
  border-radius: var(--radius-lg);
  background: var(--invert-bg);
  color: var(--invert-ink);
}

.cs-cta h2 {
  font-size: var(--step-3);
  letter-spacing: -0.035em;
  max-width: 20ch;
}

.cs-cta p {
  margin-top: 14px;
  color: var(--invert-muted);
  max-width: 50ch;
}

.cs-cta .btn-primary {
  --btn-bg: var(--invert-ink);
  --btn-ink: var(--invert-bg);
  --btn-line: var(--invert-ink);
}

.cs-cta .btn-primary:hover {
  --btn-bg: var(--accent);
  --btn-line: var(--accent);
  --btn-ink: var(--accent-ink);
}

@media (max-width: 1024px) {
  .cs-toc {
    display: none;
  }

  .cs-content {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .cs-section > h2,
  .cs-section > .cs-section-body {
    grid-column: 1 / -1;
  }

  .cs-cta {
    grid-template-columns: 1fr;
  }
}

.related {
  padding-block: var(--section);
  border-top: 1px solid var(--line);
}

.related .work-grid > li {
  grid-column: span 4;
}

@media (max-width: 900px) {
  .related .work-grid > li {
    grid-column: 1 / -1;
  }
}

/* ---------- Page header (projects index, 404) ---------- */
.page-head {
  padding-block: clamp(48px, 7vw, 104px) clamp(40px, 5vw, 64px);
}

.page-head h1 {
  margin-top: 20px;
  font-size: var(--step-5);
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.page-head .lead {
  margin-top: 24px;
  max-width: 56ch;
}

.not-found {
  min-height: 60vh;
  display: grid;
  align-content: center;
}

.not-found .hero-actions {
  margin-top: 32px;
}

/* ---------- Language switcher ---------- */
.lang-switch {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
}

.lang-switch > * {
  display: inline-grid;
  place-items: center;
  min-width: 40px;
  height: 100%;
  padding-inline: 10px;
  border-radius: 999px;
  text-decoration: none;
  line-height: 1;
}

.lang-switch [aria-current] {
  background: var(--ink);
  color: var(--bg);
}

.lang-switch a {
  color: var(--muted);
}

.lang-switch a:hover {
  color: var(--ink);
  background: var(--bg-elev);
}

/* "عربي" renders in the Arabic face even on English pages, where Plex Arabic is not loaded. */
.lang-switch [lang='ar'] {
  font-family: 'IBM Plex Sans Arabic', 'Geeza Pro', 'Segoe UI', Tahoma, sans-serif;
  font-size: 0.9rem;
}

.lang-switch.is-block {
  align-self: flex-start;
  height: 48px;
  margin-top: 28px;
  font-size: 0.95rem;
}

.lang-switch.is-block > * {
  min-width: 72px;
}

@media (max-width: 900px) {
  .header-actions .lang-switch:not(.is-block) {
    display: none;
  }
}

/* ---------- Expertise pages ---------- */
.expertise-link {
  margin-top: 16px;
  font-size: 0.925rem;
  color: var(--accent);
  border-bottom-color: currentColor;
}

.expertise-link:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.expertise-link .icon {
  transition: transform 0.2s var(--ease);
}

.expertise-link:hover .icon {
  transform: translateX(3px);
}

[dir='rtl'] .expertise-link:hover .icon-dir {
  transform: scaleX(-1) translateX(3px);
}

.tech-title {
  margin: clamp(48px, 6vw, 72px) 0 18px;
  font-size: var(--step-1);
}

.faq {
  border-top: 1px solid var(--ink);
}

.faq details {
  border-bottom: 1px solid var(--line);
}

.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 24px;
  cursor: pointer;
  list-style: none;
}

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

.faq summary h3 {
  font-size: var(--step-1);
  letter-spacing: -0.02em;
}

.faq summary .icon {
  flex: none;
  color: var(--muted);
  transition: transform 0.3s var(--ease);
}

.faq details[open] summary .icon {
  transform: rotate(45deg);
  color: var(--accent);
}

.faq details p {
  max-width: 72ch;
  padding-bottom: 24px;
  color: var(--ink-2);
}

.channel-name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

/* ---------- Articles (Engineering Insights) ---------- */
.article-list {
  list-style: none;
  border-top: 1px solid var(--ink);
}

.article-row {
  grid-template-columns: minmax(0, 2fr) minmax(0, 6fr) minmax(0, 3fr) 32px;
}

.prose {
  max-width: 72ch;
  padding-bottom: var(--section);
  color: var(--ink-2);
  font-size: var(--step-1);
}

.prose > * + * {
  margin-top: 1.1em;
}

.prose h2,
.prose h3 {
  margin-top: 2em;
  color: var(--ink);
}

.prose ul,
.prose ol {
  padding-inline-start: 1.4em;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.prose pre {
  overflow-x: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  font-size: 0.9rem;
  direction: ltr;
  text-align: left;
}

/* ---------- Right-to-left & Arabic ---------- */
/* Directional arrows point the other way in RTL; the hover nudge follows. */
[dir='rtl'] .icon-dir {
  transform: scaleX(-1);
}

[dir='rtl'] .btn:hover .icon-dir {
  transform: scaleX(-1) translateX(3px);
}

[dir='rtl'] .hero::before {
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 30% 30%, #000 10%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 30% 30%, #000 10%, transparent 75%);
}

/* Mixed Arabic/English lists: each item takes the direction of its own text (e.g. "C#", ".NET"). */
.tags li,
.skill-list li {
  unicode-bidi: plaintext;
}

:root[lang='ar'] {
  /* Latin glyphs keep the Geist brand faces; Arabic glyphs fall through to IBM Plex Sans Arabic. */
  --font-sans: 'Geist', 'IBM Plex Sans Arabic', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'Geist Mono', 'IBM Plex Sans Arabic', ui-monospace, monospace;
}

:root[lang='ar'] body {
  line-height: 1.8;
}

/* Arabic is cursive: tracking breaks letter joining, and uppercase does not apply. */
:root[lang='ar'] body * {
  letter-spacing: 0 !important;
}

:root[lang='ar'] .eyebrow,
:root[lang='ar'] .card-kicker,
:root[lang='ar'] .index-meta,
:root[lang='ar'] .role-current,
:root[lang='ar'] .cs-meta dt,
:root[lang='ar'] .badge,
:root[lang='ar'] .plate-note {
  text-transform: none;
  font-family: var(--font-sans);
}

:root[lang='ar'] :is(h1, h2, h3, h4) {
  line-height: 1.4;
}

:root[lang='ar'] .hero-headline {
  max-width: 18ch;
  font-size: clamp(2.3rem, 1.3rem + 4.4vw, 4.9rem);
  line-height: 1.3;
}

:root[lang='ar'] :is(.contact h2, .cs-title h1, .page-head h1) {
  line-height: 1.3;
}

:root[lang='ar'] .about-statement {
  font-size: var(--step-2);
  line-height: 1.6;
}

:root[lang='ar'] .fact-value,
:root[lang='ar'] .metric-value {
  line-height: 1.35;
}

:root[lang='ar'] .hero-name,
:root[lang='ar'] .hero-roles,
:root[lang='ar'] .portrait-caption {
  font-family: var(--font-sans);
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
    transition-delay: calc(var(--reveal-delay, 0) * 70ms);
  }

  .js [data-reveal].is-visible {
    opacity: 1;
    transform: none;
  }

  .hero-headline,
  .hero-name,
  .hero-intro,
  .hero-actions,
  .hero-roles {
    animation: rise 0.9s var(--ease) both;
  }

  .hero-name {
    animation-delay: 0.05s;
  }

  .hero-headline {
    animation-delay: 0.12s;
  }

  .hero-intro {
    animation-delay: 0.24s;
  }

  .hero-actions {
    animation-delay: 0.32s;
  }

  .hero-roles {
    animation-delay: 0.4s;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

@media print {
  .site-header,
  .mobile-menu,
  .filters,
  .theme-toggle {
    display: none !important;
  }

  .section-invert,
  .cs-cta {
    background: none;
    color: inherit;
  }
}
