/* =========================================================
   Mohamed Amr — portfolio
   Design tokens, layout and components
   ========================================================= */
:root {
  --ink: #0e0e0f;
  --ink-2: #161618;
  --ink-3: #1f1f22;
  --paper: #f5f3ee;
  --muted: #a3a097;
  --dim: #6f6c66;
  --line: rgba(245, 243, 238, .12);
  --line-2: rgba(245, 243, 238, .22);
  --red: #ed1c24;
  --red-soft: #ed1c24; /* one brand red everywhere */
  --green: #2fcb7e;
  --text-1: #e6e3db;
  --text-2: #cfccc4;
  --text-3: #d9d6ce;
  --header-bg: rgba(14, 14, 15, .78);
  --yellow: #ffc83d;

  --f-display: "Bricolage Grotesque", "Arial Black", system-ui, sans-serif;
  --f-serif: "Instrument Serif", Georgia, serif;
  --f-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;

  --gutter: clamp(16px, 4vw, 40px);
  --max: 1320px;
  --radius: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: dark;
}

/* ---------- Light theme (toggle in the header) ---------- */
:root[data-theme="light"] {
  --ink: #f5f3ee;
  --ink-2: #ebe8e1;
  --ink-3: #dfdbd2;
  --paper: #0e0e0f;
  --muted: #5c5952;
  --dim: #85827a;
  --line: rgba(14, 14, 15, .12);
  --line-2: rgba(14, 14, 15, .22);
  --text-1: #1f1e1b;
  --text-2: #3a3833;
  --text-3: #2b2a26;
  --header-bg: rgba(245, 243, 238, .82);
  color-scheme: light;
}
/* The comp window and the viewer always stay dark, like real editing software */
.comp, .lb {
  --ink: #0e0e0f; --ink-2: #161618; --ink-3: #1f1f22; --paper: #f5f3ee;
  --muted: #a3a097; --dim: #6f6c66; --line: rgba(245, 243, 238, .12); --line-2: rgba(245, 243, 238, .22);
  --text-2: #cfccc4; color: var(--paper);
}
.logo-dark { display: none; }
:root[data-theme="light"] .logo-light { display: none; }
:root[data-theme="light"] .logo-dark { display: block; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-display);
  font-size: 17px;
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--red); color: #fff; }
:focus-visible { outline: 2px solid var(--red-soft); outline-offset: 3px; border-radius: 6px; }

.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: fixed; left: 16px; top: -60px; z-index: 100;
  background: var(--paper); color: var(--ink); padding: 10px 16px; border-radius: 999px;
  font-weight: 700; text-decoration: none; transition: top .2s;
}
.skip-link:focus { top: 16px; }

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- Type helpers ---------- */
.mono { font-family: var(--f-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; font-weight: 500; }
.eyebrow { font-family: var(--f-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
.serif { font-family: var(--f-serif); font-style: italic; font-weight: 400; letter-spacing: 0; color: var(--red); }
.red { color: var(--red-soft); }
.h2 {
  font-size: clamp(40px, 7vw, 96px); line-height: .95; letter-spacing: -.035em; font-weight: 800; margin: 0;
}
.h2 .serif { font-size: 1.04em; }
.lead { font-size: clamp(17px, 1.6vw, 20px); color: var(--text-2); max-width: 46ch; margin: 18px 0 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 12px 22px; border-radius: 999px;
  font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer;
  border: 1px solid var(--line-2); background: transparent;
  transition: background .25s var(--ease), color .25s var(--ease), border-color .25s, transform .25s var(--ease);
}
.btn:hover { border-color: var(--paper); transform: translateY(-2px); }
.btn--solid { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.btn--solid:hover { opacity: .88; }
.btn--red { background: var(--red); border-color: var(--red); color: #fff; }
.btn--red:hover { background: var(--red); border-color: var(--red); filter: brightness(1.12); }
.btn svg { width: 16px; height: 16px; flex: none; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(140%) blur(14px); backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 12px; height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 700; flex: none; }
.brand img { width: 62px; height: auto; }
.brand span { font-size: 16px; letter-spacing: -.01em; }
.nav { display: flex; align-items: center; gap: 6px; }
.nav a {
  text-decoration: none; font-weight: 500; font-size: 15px; padding: 10px 14px; border-radius: 999px;
  color: var(--text-3); transition: background .2s, color .2s;
}
.nav a:hover, .nav a[aria-current="page"], .nav a.is-active { background: var(--ink-3); color: var(--paper); }
.nav .btn { margin-left: 10px; min-height: 42px; padding: 8px 18px; color: var(--ink); }
.nav .btn:hover { background: var(--paper); color: var(--ink); opacity: .88; }
.nav { margin-left: auto; }
.theme-toggle {
  flex: none; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line-2); background: transparent;
  display: inline-grid; place-items: center; cursor: pointer; color: var(--paper); padding: 0;
  transition: background .2s, border-color .2s, transform .4s var(--ease);
}
.theme-toggle:hover { border-color: var(--paper); transform: rotate(-20deg); }
.theme-toggle svg { width: 20px; height: 20px; grid-area: 1 / 1; transition: opacity .3s, transform .4s var(--ease); }
.theme-toggle .i-sun { opacity: 0; transform: scale(.5) rotate(-60deg); }
:root[data-theme="light"] .theme-toggle .i-sun { opacity: 1; transform: none; }
:root[data-theme="light"] .theme-toggle .i-moon { opacity: 0; transform: scale(.5) rotate(60deg); }
.menu-toggle {
  display: none; width: 46px; height: 46px; border-radius: 999px; border: 1px solid var(--line-2);
  background: transparent; cursor: pointer; align-items: center; justify-content: center; padding: 0;
}
.menu-toggle span, .menu-toggle span::before, .menu-toggle span::after {
  display: block; width: 18px; height: 2px; background: var(--paper); border-radius: 2px; position: relative; transition: transform .3s var(--ease), background .2s;
}
.menu-toggle span::before, .menu-toggle span::after { content: ""; position: absolute; left: 0; }
.menu-toggle span::before { top: -6px; }
.menu-toggle span::after { top: 6px; }
.menu-open .menu-toggle span { background: transparent; }
.menu-open .menu-toggle span::before { transform: translateY(6px) rotate(45deg); }
.menu-open .menu-toggle span::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 860px) {
  /* backdrop-filter would become the containing block of the fixed menu */
  .site-header { -webkit-backdrop-filter: none; backdrop-filter: none; background: var(--ink); }
  .menu-toggle { display: inline-flex; }
  .theme-toggle { margin-left: auto; }
  .nav {
    position: fixed; inset: 72px 0 auto 0; flex-direction: column; align-items: stretch; gap: 4px;
    padding: 16px var(--gutter) 28px; background: var(--ink); border-bottom: 1px solid var(--line);
    transform: translateY(-8px); opacity: 0; visibility: hidden; transition: opacity .25s, transform .25s var(--ease), visibility 0s .25s;
  }
  .menu-open .nav { opacity: 1; transform: none; visibility: visible; transition: opacity .25s, transform .25s var(--ease); }
  .nav a { font-size: 22px; padding: 14px 8px; border-radius: 10px; border-bottom: 1px solid var(--line); }
  .nav .btn { margin: 14px 0 0; justify-content: center; font-size: 17px; border-bottom: 0; }
  .brand span { display: none; }
}

/* ---------- Hero ---------- */
.hero { padding: clamp(28px, 5vw, 56px) 0 clamp(56px, 8vw, 96px); }
.hero-top { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--text-3); }
.status { display: inline-flex; align-items: center; gap: 10px; }
.status::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 0 rgba(61, 220, 132, .6); animation: pulse 2.4s infinite;
}
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(61, 220, 132, 0); } 100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0); } }

.hero-name {
  margin: clamp(18px, 3vw, 30px) 0 0;
  font-size: clamp(46px, 9.5vw, 142px); font-weight: 800; line-height: .84; letter-spacing: -.055em;
  display: flex; flex-wrap: wrap; align-items: center; column-gap: .14em;
}
.hero-name .word { display: inline-block; }
.pill {
  position: relative; display: inline-block; width: 1.87em; height: .97em; flex: none;
  border-radius: 999px; overflow: visible; transform: rotate(-4deg) translateY(.03em);
  isolation: isolate; margin-right: .06em;
}
/* solid red pill offset behind the photo */
.pill::before {
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  background: var(--red); transform: translate(.09em, .06em) rotate(3deg);
}
.pill img { position: relative; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; border-radius: inherit; filter: grayscale(1); }
/* green ring sits on its own layer so the grayscale filter can't dull it */
.pill .ring { position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 0 clamp(2px, .025em, 4px) var(--green); pointer-events: none; }
/* decorative badge lives in CSS so it never pollutes the H1 text */
.pill::after {
  content: "hi, that\2019s me"; z-index: 2;
  position: absolute; top: -.22em; right: -.12em; left: auto; white-space: nowrap; line-height: 1.2;
  font-family: var(--f-mono); font-size: clamp(10px, 1vw, 13px); letter-spacing: .02em; font-weight: 500;
  background: #5b6cf2; color: #fff; padding: 6px 12px; border-radius: 9px; transform: rotate(-2deg);
}
.hero-role {
  font-size: clamp(22px, 3.2vw, 42px); font-weight: 700; letter-spacing: -.02em; line-height: 1.15;
  margin: clamp(18px, 2.4vw, 28px) 0 0;
}
.hero-role .serif { color: var(--red-soft); font-size: 1.12em; }
.hero-role u { text-decoration: none; background: linear-gradient(var(--green), var(--green)) 0 100% / 100% .1em no-repeat; padding-bottom: .04em; }

.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(28px, 5vw, 72px); margin-top: clamp(28px, 4vw, 48px); align-items: start; }
.hero-copy p { font-size: clamp(17px, 1.5vw, 19px); color: var(--text-2); margin: 0; max-width: 48ch; }
.hero-copy p strong { color: var(--paper); }
.stats { display: grid; grid-template-columns: 1fr 1fr; margin: 30px 0; border-top: 1px solid var(--line-2); }
.stat { padding: 18px 0 4px; }
.stat + .stat { border-left: 1px solid var(--line-2); padding-left: 22px; }
.stat b { display: block; font-size: clamp(44px, 5vw, 64px); line-height: 1; letter-spacing: -.04em; font-weight: 800; }
.stat b sup { font-size: .42em; color: var(--red-soft); vertical-align: top; position: relative; top: .1em; margin-left: .04em; }
.stat b small { font-size: .46em; color: var(--red-soft); font-family: var(--f-serif); font-style: italic; font-weight: 400; margin: 0 .06em; vertical-align: top; position: relative; top: .12em; }
.stat span { color: var(--muted); font-size: 15px; }
.tools h3 { margin: 0 0 10px; font-family: var(--f-mono); font-size: 12px; letter-spacing: .1em; color: var(--muted); font-weight: 500; text-transform: uppercase; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0 0 18px; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 6px; border: 1px solid var(--line-2); border-radius: 999px; font-weight: 600; font-size: 14px; }
.chip i {
  font-style: normal; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 800; letter-spacing: -.02em;
}
.chip.ps i { background: #001e36; color: #31a8ff; }
.chip.ai i { background: #330000; color: #ff9a00; }
.chip.ae i { background: #00005b; color: #9999ff; }
.chip.pr i { background: #00005b; color: #e4a3ff; }
.chip.id i { background: #49021f; color: #ff3366; }
.chips--small .chip { padding: 5px 12px; font-family: var(--f-mono); font-size: 12px; font-weight: 500; color: var(--text-3); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

/* ---------- Hero device: animator timeline ---------- */
.comp {
  max-width: 500px; margin-left: auto;
  border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--ink-2);
  overflow: hidden; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8);
}
.comp-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--muted);
}
.comp-bar .dots { display: flex; gap: 6px; }
.comp-bar .dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-3); border: 1px solid var(--line-2); }
.comp-bar .dots i:first-child { background: var(--red); border-color: var(--red); }
.comp-bar .tc { color: var(--paper); font-variant-numeric: tabular-nums; }
.comp-stage {
  position: relative; aspect-ratio: 1 / 1; overflow: hidden;
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 40px 40px,
    #121214;
}
.comp-stage .frame {
  position: absolute; inset: 8%; border-radius: 10px; overflow: hidden;
  opacity: 0; transform: scale(.96) translateY(10px); transition: opacity .45s var(--ease), transform .6s var(--ease);
  box-shadow: 0 20px 50px -18px rgba(0, 0, 0, .9);
}
.comp-stage .frame.is-on { opacity: 1; transform: none; }
.comp-stage .frame img { width: 100%; height: 100%; object-fit: cover; }
.comp-stage .safe { position: absolute; inset: 8%; border: 1px dashed rgba(237, 28, 36, .55); border-radius: 10px; pointer-events: none; }
.comp-stage .handles i { position: absolute; width: 9px; height: 9px; background: var(--paper); border: 1px solid var(--red); }
.comp-stage .handles i:nth-child(1) { top: calc(8% - 4px); left: calc(8% - 4px); }
.comp-stage .handles i:nth-child(2) { top: calc(8% - 4px); right: calc(8% - 4px); }
.comp-stage .handles i:nth-child(3) { bottom: calc(8% - 4px); left: calc(8% - 4px); }
.comp-stage .handles i:nth-child(4) { bottom: calc(8% - 4px); right: calc(8% - 4px); }
.comp-stage .label {
  position: absolute; left: 8%; right: 8%; bottom: 2%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em;
}
.comp-stage .label b { color: var(--paper); font-weight: 500; }
.comp-stage .label i { font-style: normal; }
.timeline { border-top: 1px solid var(--line); padding: 10px 0 12px; position: relative; }
.track { display: grid; grid-template-columns: 92px 1fr; align-items: center; height: 26px; padding-right: 16px; }
.track > span { padding-left: 16px; font-family: var(--f-mono); font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track .lane { position: relative; height: 12px; }
.track .bar { position: absolute; top: 0; bottom: 0; border-radius: 4px; opacity: .85; }
.track .key { position: absolute; top: 50%; width: 8px; height: 8px; background: var(--paper); transform: translate(-50%, -50%) rotate(45deg); border-radius: 1px; }
.timeline .ruler { margin-left: 92px; margin-right: 16px; height: 16px; position: relative; color: var(--dim); font-family: var(--f-mono); font-size: 10px; display: flex; justify-content: space-between; }
.timeline .playhead {
  position: absolute; top: 4px; bottom: 6px; left: 92px; width: 2px; background: var(--red);
  transform: translateX(0); will-change: transform;
}
.timeline .playhead::before { content: ""; position: absolute; top: -2px; left: -5px; width: 12px; height: 9px; background: var(--red); clip-path: polygon(0 0, 100% 0, 50% 100%); }

/* ---------- Sections ---------- */
.section { padding: clamp(64px, 10vw, 128px) 0; border-top: 1px solid var(--line); }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; margin-bottom: clamp(32px, 5vw, 56px); }
.section-head .lead { margin-top: 0; }
/* Selected projects: keep the line under the heading on one line where there is room */
@media (min-width: 960px) { #projects .section-head .lead { max-width: none; white-space: nowrap; } }

/* Shelves */
.shelves { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(16px, 2.4vw, 32px); }
.shelf { position: relative; display: block; text-decoration: none; border-radius: var(--radius); padding: 10px 10px 18px; transition: background .3s; }
.shelf:hover { background: var(--ink-2); }
.stack { position: relative; aspect-ratio: 4 / 3.2; margin-bottom: 18px; }
.stack img {
  position: absolute; left: 50%; top: 50%; width: 58%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 10px;
  box-shadow: 0 18px 40px -14px rgba(0, 0, 0, .9); border: 3px solid #fff;
  transition: transform .6s var(--ease);
}
.stack img:nth-child(1) { transform: translate(-50%, -50%) rotate(-11deg) translateX(-22%); }
.stack img:nth-child(2) { transform: translate(-50%, -50%) rotate(9deg) translateX(22%); }
.stack img:nth-child(3) { transform: translate(-50%, -50%) rotate(-1deg); }
.shelf:hover .stack img:nth-child(1) { transform: translate(-50%, -50%) rotate(-16deg) translateX(-38%); }
.shelf:hover .stack img:nth-child(2) { transform: translate(-50%, -50%) rotate(14deg) translateX(38%); }
.shelf:hover .stack img:nth-child(3) { transform: translate(-50%, -54%) rotate(0deg) scale(1.04); }
.stack--wide img { aspect-ratio: 16 / 10; width: 74%; }
.shelf-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.shelf-meta h3 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.shelf-meta p { margin: 2px 0 0; color: var(--muted); }
.arrow {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-2); display: grid; place-items: center;
  transition: background .3s, color .3s, transform .3s var(--ease);
}
.arrow svg { width: 16px; height: 16px; }
.shelf:hover .arrow, .card:hover .arrow { background: var(--paper); color: var(--ink); transform: rotate(-45deg); }

/* Project cards */
.cards { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(16px, 2.4vw, 28px); }
.card { grid-column: span 6; text-decoration: none; display: block; }
.card-media { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--ink-2); aspect-ratio: 16 / 9; }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 1s var(--ease); }
.card:hover .card-media img { transform: scale(1.04); }
.card-media .tag {
  position: absolute; left: 14px; top: 14px; background: rgba(14, 14, 15, .78); color: #f5f3ee;
  padding: 6px 12px; border-radius: 999px; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.card-meta { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 4px 0; }
.card-meta h3 { margin: 0; font-size: clamp(22px, 2.4vw, 30px); letter-spacing: -.025em; line-height: 1.15; }
.card-meta p { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.card--video { grid-column: 2 / span 10; }
.card-media video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
/* Services */
.services { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line-2); }
.service { padding: 26px 22px 30px 0; }
.service + .service { border-left: 1px solid var(--line); padding-left: 22px; }
.service .num { color: var(--red-soft); }
.service h3 { font-size: 24px; letter-spacing: -.02em; line-height: 1.15; margin: 18px 0 10px; }
.service p { margin: 0 0 14px; color: var(--text-2); font-size: 16px; }
.service ul { list-style: none; padding: 0; margin: 0; color: var(--muted); font-size: 14px; }
.service li { padding: 6px 0; border-top: 1px solid var(--line); }

/* About */
.about { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: clamp(32px, 6vw, 88px); align-items: start; }
.portrait { position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 5; background: var(--ink-2); }
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; filter: grayscale(1) contrast(1.05); }
.portrait figcaption { position: absolute; left: 14px; bottom: 14px; background: var(--paper); color: var(--ink); padding: 6px 12px; border-radius: 999px; }
.about-text p { font-size: clamp(19px, 2vw, 25px); line-height: 1.45; letter-spacing: -.01em; margin: 0 0 18px; color: var(--text-1); }
.about-text p .serif { color: var(--red-soft); font-size: 1.1em; }
.about-text .eyebrow { font-size: 12px; line-height: 1.5; color: var(--muted); letter-spacing: .1em; margin-bottom: 14px; }
.steps { list-style: none; padding: 0; margin: 34px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; counter-reset: step; }
.steps li { border-top: 1px solid var(--line-2); padding: 16px 0 18px; }
.steps b { display: block; font-size: 19px; letter-spacing: -.01em; }
.steps b::before { counter-increment: step; content: "0" counter(step); font-family: var(--f-mono); font-size: 12px; color: var(--red-soft); margin-right: 10px; font-weight: 500; vertical-align: middle; }
.steps span { color: var(--muted); font-size: 15px; }

/* FAQ */
.faq { border-top: 1px solid var(--line-2); max-width: 920px; }
.faq details { border-bottom: 1px solid var(--line-2); }
.faq summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 20px;
  padding: 22px 0; font-size: clamp(19px, 2vw, 24px); font-weight: 700; letter-spacing: -.015em;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--f-mono); font-weight: 500; font-size: 24px; color: var(--red-soft); transition: transform .3s var(--ease); flex: none; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: -6px 0 24px; color: var(--text-2); max-width: 70ch; }

/* Contact */
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 88px); }
.contact-big { font-size: clamp(44px, 8vw, 116px); line-height: .92; letter-spacing: -.045em; font-weight: 800; margin: 0 0 28px; }
.links { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line-2); }
.links li { border-bottom: 1px solid var(--line-2); }
.links a, .links button {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 2px;
  text-decoration: none; background: none; border: 0; cursor: pointer; text-align: left;
}
.links .k { color: var(--muted); }
.links .v { font-weight: 700; font-size: clamp(16px, 1.8vw, 20px); word-break: break-word; }
.links a:hover .v, .links button:hover .v { color: var(--red-soft); }
.copy-note { min-height: 22px; color: var(--green); font-size: 14px; margin: 10px 0 0; }

.form { background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 3vw, 32px); }
.form h3 { margin: 0 0 4px; font-size: 26px; letter-spacing: -.02em; }
.form > p { margin: 0 0 22px; color: var(--muted); font-size: 15px; }
.field { display: grid; gap: 8px; margin-bottom: 16px; }
.field label { font-family: var(--f-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.field input, .field select, .field textarea {
  width: 100%; background: var(--ink); border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  padding: 14px 16px; font-size: 16px; transition: border-color .2s, box-shadow .2s;
}
.field textarea { min-height: 130px; resize: vertical; }
.field select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--paper) 50%), linear-gradient(135deg, var(--paper) 50%, transparent 50%); background-position: calc(100% - 22px) 52%, calc(100% - 16px) 52%; background-size: 6px 6px; background-repeat: no-repeat; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--paper); box-shadow: 0 0 0 3px rgba(245, 243, 238, .12); }
.field [aria-invalid="true"] { border-color: var(--red-soft); }
.field .err { color: var(--red-soft); font-size: 14px; min-height: 0; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.form-actions .btn { flex: 1 1 200px; justify-content: center; }
.form-note { color: var(--dim); font-size: 13px; margin: 14px 0 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0 36px; color: var(--muted); }
.site-footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 16px 28px; flex-wrap: wrap; }
.site-footer nav { display: flex; gap: 6px 20px; flex-wrap: wrap; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--paper); }

/* ---------- Inner pages ---------- */
.page-head { padding: clamp(28px, 5vw, 56px) 0 clamp(28px, 4vw, 44px); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: clamp(20px, 3vw, 32px); }
.crumbs a { white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); border-radius: 999px; padding: 8px 14px; color: var(--text-3); }
.crumbs a:hover { border-color: var(--paper); color: var(--paper); }
.crumbs span { color: var(--dim); }
.page-title { font-size: clamp(40px, 7vw, 96px); font-weight: 800; letter-spacing: -.05em; line-height: .88; margin: 0; }
.page-intro { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 72px); margin-top: clamp(24px, 3vw, 40px); align-items: start; }
.page-intro p { margin: 0 0 14px; color: var(--text-2); font-size: clamp(17px, 1.6vw, 20px); max-width: 60ch; }
.facts { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-2); }
.facts li { display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.facts li > span:first-child { color: var(--muted); }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.tabs a { text-decoration: none; padding: 9px 16px; border: 1px solid var(--line-2); border-radius: 999px; color: var(--text-3); }
.tabs a:hover { border-color: var(--paper); }
.tabs a[aria-current="page"] { background: var(--paper); color: var(--ink); border-color: var(--paper); }

.gallery { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: clamp(12px, 1.8vw, 22px); padding-bottom: clamp(56px, 8vw, 96px); }
.g-item { grid-column: span 12; margin: 0; }
.g-item.half { grid-column: span 6; }
.g-item.third { grid-column: span 4; }
.g-btn {
  display: block; width: 100%; padding: 0; border: 0; background: var(--ink-2); border-radius: var(--radius); overflow: hidden;
  cursor: zoom-in; position: relative;
}
.g-btn img, .g-btn video { width: 100%; height: auto; transition: transform .8s var(--ease); }
.g-btn:hover img { transform: scale(1.015); }
.g-item figcaption { display: flex; justify-content: space-between; gap: 12px; padding: 10px 4px 0; color: var(--muted); font-size: 14px; }
.g-item figcaption b { color: var(--paper); font-weight: 600; }
.g-item figcaption { justify-content: flex-end; }
/* social media: every post shown as a 1:1 square */
.client .g-btn { aspect-ratio: 1 / 1; }
.client .g-btn img, .client .g-btn video { height: 100%; object-fit: cover; }
/* animated loops: the two-up clips share one 16:9 frame so they line up */
.g-item.half .g-btn { aspect-ratio: 16 / 9; }
.g-item.half .g-btn video, .g-item.half .g-btn img { height: 100%; object-fit: cover; }
.badge-motion { position: absolute; right: 12px; top: 12px; background: var(--red); color: #fff; padding: 5px 10px; border-radius: 999px; pointer-events: none; }

.client { padding: clamp(40px, 6vw, 72px) 0 0; border-top: 1px solid var(--line); scroll-margin-top: 90px; }
.client:first-of-type { border-top: 0; padding-top: 0; }
.client-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.client-head h2 { margin: 0; font-size: clamp(32px, 4.6vw, 60px); letter-spacing: -.035em; line-height: 1; }
.client-head p { margin: 6px 0 0; color: var(--muted); }
.client .gallery { padding-bottom: 0; }

.films { display: grid; gap: clamp(28px, 4vw, 48px); padding-bottom: clamp(56px, 8vw, 96px); }
.film { margin: 0; }
.film video { width: 100%; border-radius: var(--radius); background: #000; aspect-ratio: 16 / 9; }
.film figcaption { display: flex; justify-content: flex-end; gap: 16px; padding: 14px 4px 0; flex-wrap: wrap; }
.film figcaption h2 { margin: 0; font-size: clamp(22px, 2.6vw, 32px); letter-spacing: -.02em; }
.film figcaption a { color: var(--muted); }

.next {
  display: flex; justify-content: space-between; align-items: center; gap: 20px; text-decoration: none;
  border-top: 1px solid var(--line-2); padding: clamp(28px, 4vw, 44px) 0;
}
.next .k { color: var(--muted); }
.next b { display: block; font-size: clamp(34px, 6vw, 80px); letter-spacing: -.04em; line-height: 1; margin-top: 8px; }
.next:hover b { color: var(--red-soft); }
.next:hover .arrow { background: var(--paper); color: var(--ink); transform: rotate(-45deg); }
/* "See more on Behance" line, with clear space above and below so it never sits on a divider */
.more-be { margin: clamp(28px, 4vw, 44px) 0 clamp(48px, 7vw, 88px); text-align: center; font-size: clamp(17px, 1.6vw, 20px); color: var(--text-2); }
.section .more-be { margin-bottom: 0; }
.more-be a { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--paper); text-decoration: none; border-bottom: 2px solid var(--green); padding-bottom: 2px; }
.more-be a svg { width: 15px; height: 15px; transition: transform .3s var(--ease); }
.more-be a:hover svg { transform: translateX(4px) rotate(-45deg); }
/* Floating WhatsApp button (phones only), shown once the visitor scrolls past the hero */
.fab { display: none; }
@media (max-width: 760px) {
  .fab {
    position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 40;
    display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px 0 14px; border-radius: 999px;
    background: #25d366; color: #0b2e17; font-weight: 700; font-size: 15px; text-decoration: none;
    box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .55);
    opacity: 0; transform: translateY(16px); pointer-events: none; transition: opacity .3s, transform .3s var(--ease);
  }
  .fab svg { width: 22px; height: 22px; }
  .fab.is-on { opacity: 1; transform: none; pointer-events: auto; }
  .menu-open .fab { opacity: 0; pointer-events: none; }
}
@media print { .fab { display: none !important; } }
/* two "Back to" choices side by side */
.next-pair { display: grid; grid-template-columns: 1fr 1fr; column-gap: clamp(20px, 4vw, 56px); }
.next-pair b { font-size: clamp(26px, 4vw, 52px); }
@media (max-width: 760px) { .next-pair { grid-template-columns: 1fr; } }

/* 404 */
.nf { min-height: 70vh; display: grid; align-content: center; padding: 60px 0; }
.nf h1 { font-size: clamp(90px, 22vw, 280px); line-height: .8; letter-spacing: -.06em; margin: 0; }
.nf p { color: var(--text-2); font-size: 20px; max-width: 40ch; }

/* ---------- Lightbox ---------- */
.lb {
  width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgba(8, 8, 9, .96); color: var(--paper);
}
.lb::backdrop { background: rgba(0, 0, 0, .7); }
.lb[open] { display: grid; grid-template-rows: auto 1fr auto; }
.lb-top, .lb-bottom { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px var(--gutter); }
.lb-stage { position: relative; display: grid; place-items: center; padding: 0 clamp(8px, 6vw, 88px); min-height: 0; touch-action: pan-y; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 8px; }
.lb-btn {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(14, 14, 15, .7);
  display: grid; place-items: center; cursor: pointer; flex: none;
}
.lb-btn:hover { background: var(--paper); color: var(--ink); }
.lb-btn svg { width: 18px; height: 18px; }
.lb-prev, .lb-next { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; }
.lb-prev { left: clamp(8px, 2vw, 24px); }
.lb-next { right: clamp(8px, 2vw, 24px); }
.lb-cap { color: var(--text-2); font-size: 15px; }

/* ---------- Reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .services { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .service:nth-child(3) { border-left: 0; padding-left: 0; }
  .service:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 960px) {
  .hero-grid, .about, .contact-grid, .page-intro { grid-template-columns: minmax(0, 1fr); }
  .hero-device { order: -1; }
  .comp { margin-inline: auto; }
  .about .portrait { max-width: 440px; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .shelves { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .shelf { padding: 6px 0 22px; }
  .stack { aspect-ratio: 16 / 10; }
  .stack img { width: 44%; }
  .stack--wide img { width: 64%; }
  .card, .card:first-child { grid-column: span 12; }
  .card-media { aspect-ratio: 4 / 3; }
  .card--video .card-media { aspect-ratio: 16 / 9; }
  .services, .steps { grid-template-columns: minmax(0, 1fr); }
  .service, .service + .service { border-left: 0; padding-left: 0; padding-right: 0; }
  .service + .service { border-top: 1px solid var(--line); }
  .g-item.half, .g-item.third { grid-column: span 12; }
  .client .g-item.third { grid-column: span 6; }
  .track { grid-template-columns: 70px 1fr; }
  .timeline .ruler { margin-left: 70px; }
  .timeline .playhead { left: 70px; }
  .lb-prev, .lb-next { top: auto; bottom: 8px; transform: none; }
  .lb-stage { padding-bottom: 64px; }
  .facts li { grid-template-columns: 100px 1fr; }
}
@media (max-width: 420px) {
  .client .g-item.third { grid-column: span 12; }
  .stat + .stat { padding-left: 14px; }
}
/* Phones: the photo gets its own space next to "Amr" so it reads at a real size, badge included */
@media (max-width: 600px) {
  .hero-name { row-gap: .1em; }
  .pill { width: min(50vw, 210px); height: auto; aspect-ratio: 1.93; margin-right: .1em; }
  .pill .ring { box-shadow: 0 0 0 3px var(--green); }
  .pill::after { display: block; font-size: 11px; padding: 5px 10px; top: -10px; right: -6px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .js .reveal { opacity: 1; transform: none; }
}
@media print {
  .site-header, .lb, .form, .hero-device { display: none !important; }
  body { background: #fff; color: #000; }
}
