/* ============================================================================
 * Ahmad Ismail Sayyam — personal profile site
 * ----------------------------------------------------------------------------
 * Deep navy and gold. Sovereign, institutional, restrained.
 *
 * Two rules govern this stylesheet:
 *   1. Logical properties only (margin-inline, inset-inline, border-inline).
 *      That is what makes the Arabic RTL switch work with no second sheet.
 *   2. Uppercase and letter-spacing are guarded with :lang(en). Arabic must
 *      never receive either, or the letterforms break apart.
 * ========================================================================== */

/* ─────────────────────────────────────────────────────── tokens ───────── */

:root {
  --ink:            #08111F;
  --surface:        #0D1A2D;
  --surface-raised: #132741;
  --hairline:       rgba(201, 162, 39, 0.16);
  --hairline-soft:  rgba(242, 237, 228, 0.09);

  --gold:           #C9A227;
  --gold-light:     #E4CB7A;
  --gold-deep:      #8C6F17;

  --text:           #F2EDE4;
  --text-muted:     #A9B4C6;
  /* Brief specified #6F7D93. Measured 4.18:1 on --surface and 3.61:1 on
   * --surface-raised, both below the 4.5:1 body minimum the brief requires.
   * Lifted to keep the same cool bias while clearing AA on all three
   * grounds: 5.68 on --ink, 5.24 on --surface, 4.52 on --surface-raised. */
  --text-dim:       #7E8EA6;

  /* 8px spacing scale */
  --s1: 0.5rem;  --s2: 1rem;   --s3: 1.5rem;  --s4: 2rem;
  --s5: 3rem;    --s6: 4rem;   --s7: 6rem;

  --gutter:  clamp(1.5rem, 5vw, 5rem);
  --section: clamp(6rem, 12vh, 10rem);
  --maxw:    1200px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

:lang(en) {
  --font-display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-body:    'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
:lang(ar) {
  --font-display: 'Amiri', 'Times New Roman', serif;
  --font-body:    'IBM Plex Sans Arabic', system-ui, 'Segoe UI', Tahoma, sans-serif;
}

/* ──────────────────────────────────────────────────────── reset ───────── */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.1vw, 1.0625rem);
  line-height: 1.75;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

/* Focus is never removed, only restyled. */
:focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 2px;
}

h1, h2, h3 { margin: 0; font-weight: 600; text-wrap: balance; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

/* ─────────────────────────────────────────────────── primitives ───────── */

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

.section {
  padding-block: var(--section);
  scroll-margin-block-start: 88px;
  position: relative;
}
.section + .section { border-block-start: 1px solid var(--hairline); }
.section--alt { background: var(--surface); }

.eyebrow {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gold);
  margin-block-end: var(--s2);
}
:lang(en) .eyebrow { text-transform: uppercase; letter-spacing: 0.18em; }

.h-sec {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.15;
}
:lang(en) .h-sec { letter-spacing: -0.01em; }

/* The one gold hairline that draws itself in under each heading. */
.rule {
  height: 1px;
  background: var(--gold);
  margin-block-start: var(--s3);
  transform: scaleX(0);
  transform-origin: inline-start;
  transition: transform 900ms var(--ease);
  max-width: 220px;
}
.rule.in { transform: scaleX(1); }

.lede {
  color: var(--text-muted);
  max-width: 68ch;
  margin-block-start: var(--s3);
}

/* Scroll reveal. Each element animates once, then is unobserved. */
.rv {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 700ms var(--ease), transform 700ms var(--ease);
  transition-delay: var(--d, 0ms);
}
.rv.in { opacity: 1; transform: none; }

/* ────────────────────────────────────────────────────── buttons ───────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s1);
  min-height: 48px;
  padding-inline: 1.75rem;
  padding-block: 0.75rem;
  border-radius: 2px;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 260ms var(--ease), color 260ms var(--ease),
              border-color 260ms var(--ease);
}
.btn--primary {
  background: var(--gold);
  color: var(--ink);
  border: 1px solid var(--gold);
}
.btn--primary:hover { background: var(--gold-light); border-color: var(--gold-light); }
.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--hairline);
}
.btn--ghost:hover { border-color: var(--gold); color: var(--gold-light); }

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-block-start: var(--s4);
}

/* ─────────────────────────────────────────────────── skip link ────────── */

.skip {
  position: absolute;
  inset-inline-start: var(--s2);
  inset-block-start: -100px;
  z-index: 200;
  background: var(--gold);
  color: var(--ink);
  padding: 0.75rem 1.25rem;
  border-radius: 2px;
  font-weight: 600;
  text-decoration: none;
  transition: inset-block-start 200ms var(--ease);
}
.skip:focus { inset-block-start: var(--s2); }

/* ───────────────────────────────────────────────────── header ─────────── */

.hdr {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  z-index: 120;
  background: transparent;
  border-block-end: 1px solid transparent;
  /* Fading in over 300ms left a window where the bar was half transparent and
   * whatever scrolled under it read straight through: the scroll cue first,
   * then the stat labels. Both were reported as separate faults; they were
   * the same one. Opaque instantly on the way in, faded only on the way back
   * to rest, where there is nothing behind it to show through. */
  transition: background-color 260ms var(--ease), border-color 260ms var(--ease);
}
.hdr.stuck {
  transition: none;
}
.hdr.stuck {
  background: var(--surface);
  border-block-end-color: var(--hairline);
}
.hdr-in {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
  height: 72px;
  display: flex;
  align-items: center;
  gap: var(--s3);
}
.mark {
  display: inline-flex;
  align-items: center;
  /* A flex container drops the whitespace text node between its children,
   * so the two halves of the name ran together. gap puts it back. */
  gap: 0.3em;
  min-height: 44px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.mark span { color: var(--gold); }

.nav { margin-inline-start: auto; }
.nav ul { display: flex; gap: var(--s4); align-items: center; }
.nav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 220ms var(--ease);
}
.nav a:hover { color: var(--text); }
.nav a::after {
  content: '';
  position: absolute;
  inset-block-end: 0;
  inset-inline-start: 0;
  width: 100%;
  height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: inline-start;
  transition: transform 260ms var(--ease);
}
.nav a[aria-current="true"] { color: var(--gold); }
.nav a[aria-current="true"]::after { transform: scaleX(1); }

.lang {
  margin-inline-start: var(--s3);
  min-height: 44px;
  min-width: 44px;
  padding-inline: var(--s2);
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 220ms var(--ease), color 220ms var(--ease);
}
.lang:hover { border-color: var(--gold); color: var(--gold-light); }

.burger {
  display: none;
  margin-inline-start: auto;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}
.burger i {
  position: absolute;
  inset-inline: 12px;
  height: 1px;
  background: var(--text);
  transition: transform 260ms var(--ease), opacity 200ms var(--ease);
}
.burger i:nth-child(1) { inset-block-start: 15px; }
.burger i:nth-child(2) { inset-block-start: 21px; }
.burger i:nth-child(3) { inset-block-start: 27px; }
.burger[aria-expanded="true"] i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger[aria-expanded="true"] i:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Full-screen menu below 768px */
.menu {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: var(--ink);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s4);
}
.menu.open { display: flex; }
.menu a {
  font-family: var(--font-display);
  font-size: 1.75rem;
  color: var(--text);
  text-decoration: none;
}
.menu a:hover { color: var(--gold); }

/* ─────────────────────────────────────────────────────── hero ─────────── */

.hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  /* 120/96 plus an 804px text column put the buttons at 779px on a 1440x800
   * laptop, below the fold on the machine most of this audience uses. */
  padding-block: 104px var(--s5);
  position: relative;
  overflow: hidden;
}
/* Gold at 4% behind the hero. The only gradient on the page. */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(900px 620px at 70% 18%,
              rgba(201, 162, 39, 0.04), transparent 62%);
  pointer-events: none;
}
.hero-grid {
  display: grid;
  /* Measured at 1440: the text column came out 541px, so the promoted
   * sentence wrapped to six lines and ate 261px on its own. Wider column,
   * narrower gutter, and it reads in four. */
  grid-template-columns: 1.35fr 1fr;
  gap: clamp(1.75rem, 3.5vw, 3.25rem);
  align-items: center;
  width: 100%;
  position: relative;
}
.hero-name {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5.6vw, 5rem);
  line-height: 1.05;
  margin-block: var(--s2) var(--s3);
}
:lang(en) .hero-name { letter-spacing: -0.02em; }
:lang(ar) .hero-name { line-height: 1.22; }

.hero-role {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--gold);
}
.hero-pos {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 1.9vw, 1.6rem);
  line-height: 1.42;
  color: var(--text);
  margin-block-start: var(--s3);
  max-width: 24ch;
}
.hero-sup {
  color: var(--text-muted);
  margin-block-start: var(--s3);
  max-width: 56ch;
}

/* The no-script fallback for the language toggle. Hidden by default and
 * revealed only inside noscript, so it never doubles up with the real button
 * and never flashes before the script runs. */
/* Both classes on purpose. A single-class rule ties with .lang, which also
 * sets a display, and loses on source order: the fallback was computing to
 * inline on the live site while the stylesheet said none. */
.lang.lang-fallback { display: none; }

/* The cue belongs to the first screen and nowhere else. It used to ride up
 * under a see-through bar and sit on the wordmark. */
.cue {
  transition: opacity 240ms var(--ease), visibility 240ms;
  margin-block-start: var(--s3) !important;
}
.scrolled .cue {
  opacity: 0;
  visibility: hidden;
}
.cue {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  gap: var(--s1);
  margin-block-start: var(--s5);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  text-decoration: none;
}
:lang(en) .cue { text-transform: uppercase; letter-spacing: 0.18em; }
.cue i {
  width: 1px;
  height: 28px;
  background: linear-gradient(var(--gold), transparent);
  animation: cue 2.2s var(--ease) infinite;
  transform-origin: top;
}
@keyframes cue {
  0%, 100% { transform: scaleY(0.4); opacity: 0.5; }
  50%      { transform: scaleY(1);   opacity: 1; }
}

/* ──────────────────────────────────────────────────── portrait ────────── */

.portrait {
  position: relative;
  aspect-ratio: 4 / 5;
  will-change: transform;
}
/* The single decorative flourish: an offset gold frame on the outer edges. */
.portrait::before {
  content: '';
  position: absolute;
  inset-block: -12px;
  inset-inline-end: -12px;
  inset-inline-start: 40%;
  border: 1px solid var(--gold);
  opacity: 0.5;
  pointer-events: none;
}
.portrait-img {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--surface-raised);
  border: 1px solid var(--hairline);
}
.portrait-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
}
/* Duotone: ink rising from the bottom third, plus a faint gold wash. */
.portrait-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, var(--ink) 0%, rgba(8, 17, 31, 0.55) 22%, transparent 46%),
    linear-gradient(140deg, rgba(201, 162, 39, 0.10), transparent 55%);
  pointer-events: none;
}
/* البديل يقف خلف الصورة دائمًا بدل أن يحل محلها.
 * المنطق السابق كان يقرر بنفسه أن الصورة فشلت ثم يخفيها، وإنذار كاذب واحد
 * يكفي لإخفاء صورة سليمة تمامًا. الآن: حمّلت الصورة فغطّته، فشلت فظهر
 * من تحتها. لا فحص، ولا سباق، ولا حالة يمكن أن تخطئ. */
.portrait-ph {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: clamp(3rem, 7vw, 5rem);
  color: var(--gold);
  background: var(--surface-raised);
}
/* القصاصة شفافة، فلا يصح أن يظهر صندوق تحتها إلا إن غابت الصورة فعلًا. */
.portrait--cut .portrait-ph { background: transparent; }
.portrait--cut.no-photo .portrait-ph {
  background: var(--surface-raised);
  border: 1px solid var(--hairline);
}
.no-photo .portrait-img img { display: none; }


/* ── Cut-out portrait ──────────────────────────────────────────────────────
 * A photo with a transparent background needs the opposite of a framed one:
 * no card behind it, no duotone wash over empty pixels. The subject stands
 * directly on the page and dissolves into it at the base, with the gold
 * offset frame reading as architecture behind him rather than a border. */
.portrait--cut { aspect-ratio: 832 / 1216; }
.portrait--cut .portrait-img { background: transparent; border: none; overflow: visible; }
/* البدلة كحلية داكنة والأرضية كحلية داكنة: التباين المقيس عند الصدر 1.41
 * وعند الأسفل 1.26، أي أن الجسد يذوب ويبقى الرأس طافيًا. هالة بيضاوية
 * أفتح قليلًا خلف الصاحب تفصل الظل الخارجي عن الصفحة بلا أن تصير صندوقًا. */
.portrait--cut .portrait-img::before {
  content: '';
  position: absolute;
  /* Raised and pulled in. Sitting low and wide it ended below the photo and
   * drew a visible edge under him; the lower quarter is now clear so the base
   * of the cut-out dissolves into the ink instead of stopping against a rim. */
  inset-block: 0 24%;
  inset-inline: 13%;
  z-index: 0;
  border-radius: 50% 50% 44% 44% / 38% 38% 12% 12%;
  /* Gold, not a cool grey. A neutral glow behind him read as a washed-out
   * patch; the accent hue ties the portrait to the rest of the page and
   * still lifts the dark suit off the dark ground. */
  background:
    radial-gradient(60% 52% at 50% 26%, rgba(201, 162, 39, 0.22), transparent 70%),
    radial-gradient(74% 58% at 50% 46%, rgba(140, 111, 23, 0.13), transparent 74%);
  filter: blur(6px);
  pointer-events: none;
}
.portrait--cut .portrait-img img { position: relative; z-index: 1; }
.portrait--cut .portrait-img::after { z-index: 2; }
.portrait--cut .portrait-img img {
  object-fit: contain;
  object-position: bottom center;
}
.portrait--cut .portrait-img::after {
  background: linear-gradient(to top,
    var(--ink) 0%, rgba(8, 17, 31, 0.55) 9%, transparent 26%);
}
.portrait--cut::before {
  inset-block: 4% -12px;
  inset-inline-start: 34%;
}

/* ────────────────────────────────────────────────── proof strip ───────── */

.proof {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
.proof-cell {
  padding: var(--s4) var(--s3);
  border-inline-start: 1px solid var(--hairline);
  text-align: center;
}
.proof-cell:first-child { border-inline-start: none; }
.proof-n {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 600;
  color: var(--gold);
  line-height: 1;
  /* Cormorant defaults to old-style figures, so 19 rendered with a short 1 and
   * a descending 9, and 30+ read as 3o+. Lining figures put every numeral on
   * the cap line where a statistic belongs. */
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: 'lnum' 1, 'tnum' 1;
}
.proof-l {
  margin-block-start: var(--s2);
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ─────────────────────────────────────────────────── prose block ──────── */

/* 686px of text inside a 1200px container left 442px of dead space on one
 * side. A second column would either duplicate Credentials or invent copy,
 * so the measure is centred instead and the emptiness reads as margin. */
.prose { max-width: 68ch; margin-block-start: var(--s5); margin-inline: auto; }
#profile .wrap { max-width: 900px; }
.prose p + p { margin-block-start: var(--s3); }
.prose p { color: var(--text-muted); }

/* ─────────────────────────────────────────────── capability cards ─────── */

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s3);
  margin-block-start: var(--s5);
}
.card {
  position: relative;
  padding: var(--s4);
  background: var(--surface-raised);
  border: 1px solid var(--hairline);
  border-radius: 2px;
  transition: transform 300ms var(--ease), border-color 300ms var(--ease);
}
.card:hover {
  transform: translateY(-2px);
  border-color: rgba(201, 162, 39, 0.4);
}
.card-n {
  position: absolute;
  inset-block-start: var(--s3);
  inset-inline-end: var(--s3);
  font-family: var(--font-display);
  font-size: 0.9375rem;
  color: var(--gold);
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}
.card h3 {
  font-family: var(--font-body);
  font-size: 1.25rem;
  padding-inline-end: var(--s4);
  margin-block-end: var(--s2);
}
.card p { color: var(--text-muted); font-size: 0.9375rem; line-height: 1.7; }

/* ────────────────────────────────────────────────── signature work ────── */

.works { margin-block-start: var(--s5); }
.work {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  padding-block: var(--s6);
  border-block-start: 1px solid var(--hairline);
}
.work:first-child { border-block-start: none; padding-block-start: 0; }
.work--flip .work-main { order: 2; }
.work-kicker {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gold);
  margin-block-end: var(--s2);
}
:lang(en) .work-kicker { text-transform: uppercase; letter-spacing: 0.18em; }
.work h3 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.6vw, 2.125rem);
  line-height: 1.25;
  margin-block-end: var(--s3);
}
.work-main p { color: var(--text-muted); max-width: 54ch; }
.work-meta { display: flex; flex-direction: column; gap: var(--s3); }
.work-row { border-inline-start: 1px solid var(--hairline); padding-inline-start: var(--s3); }
.work-row dt {
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--gold);
  margin-block-end: 0.35rem;
}
:lang(en) .work-row dt { text-transform: uppercase; letter-spacing: 0.18em; }
.work-row dd {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text-muted);
}

/* ───────────────────────────────────────────────────── timeline ───────── */

.tl {
  position: relative;
  margin-block-start: var(--s5);
  padding-inline-start: var(--s5);
}
/* Rail plus the gold fill that grows with scroll. */
.tl::before {
  content: '';
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 1px;
  background: var(--hairline-soft);
}
.tl-fill {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  width: 1px;
  height: 0;
  background: var(--gold);
  transition: height 120ms linear;
}
.tl-item { position: relative; padding-block-end: var(--s6); }
.tl-item:last-child { padding-block-end: 0; }
.tl-item::before {
  content: '';
  position: absolute;
  inset-block-start: 0.6rem;
  inset-inline-start: calc(var(--s5) * -1 - 3.5px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
}
.tl-date {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
:lang(en) .tl-date { text-transform: uppercase; letter-spacing: 0.14em; }
.tl-role {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2.3vw, 1.75rem);
  margin-block: 0.35rem 0.25rem;
}
.tl-org { color: var(--text-dim); font-size: 0.9375rem; }
.tl-item ul { margin-block-start: var(--s3); display: flex; flex-direction: column; gap: var(--s2); }
.tl-item li {
  position: relative;
  padding-inline-start: var(--s3);
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.7;
}
.tl-item li::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: 0.72em;
  width: 6px;
  height: 1px;
  background: var(--gold);
}

/* ──────────────────────────────────────────────────── credentials ─────── */

.creds {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: clamp(2rem, 6vw, 5rem);
  margin-block-start: var(--s5);
}
.creds h3 {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gold);
  margin-block-end: var(--s3);
}
:lang(en) .creds h3 { text-transform: uppercase; letter-spacing: 0.18em; }
.cert {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: var(--s2) 0 var(--s2) 0;
  padding-inline-start: var(--s3);
  border-inline-start: 1px solid var(--hairline);
  transition: border-color 260ms var(--ease);
}
.cert:hover { border-inline-start-color: var(--gold); }
.cert b { font-weight: 600; font-size: 0.9375rem; }
.cert span { color: var(--text-dim); font-size: 0.8125rem; }
.edu p { color: var(--text-muted); font-size: 0.9375rem; }
.edu p + p { margin-block-start: var(--s2); }

/* ─────────────────────────────────────────────────────── sectors ──────── */

.chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin-block-start: var(--s4); }
.chip {
  padding: 0.625rem 1.25rem;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ─────────────────────────────────────────────────────── contact ──────── */

.close { text-align: center; }
.close .lede { margin-inline: auto; }
.close .cta-row { justify-content: center; }
.contacts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s2) var(--s5);
  margin-block-start: var(--s5);
  padding-block-start: var(--s4);
  border-block-start: 1px solid var(--hairline);
}
.contacts a, .contacts span {
  color: var(--text-muted);
  font-size: 0.9375rem;
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.contacts a:hover { color: var(--gold-light); }

.foot {
  border-block-start: 1px solid var(--hairline);
  padding-block: var(--s4);
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8125rem;
}
.foot p + p { margin-block-start: 0.35rem; }

/* Language swap cross-fade. 200ms out, render, 200ms back. */
#main { transition: opacity 200ms var(--ease); }
#main.fading { opacity: 0; }

/* ────────────────────────────────────────────────────── responsive ────── */

@media (max-width: 1024px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .work { grid-template-columns: 1fr; gap: var(--s4); }
  .work--flip .work-main { order: 0; }
  .creds { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .nav { display: none; }
  .lang { display: none; }
  .burger { display: block; }
  .hero { min-height: auto; padding-block: 110px var(--s6); }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-text { order: 2; }
  .portrait { order: 1; aspect-ratio: 1 / 1; max-width: 380px; margin-inline: auto; }
  .portrait::before { inset-inline-start: 30%; }
  .proof { grid-template-columns: repeat(2, 1fr); }
  .proof-cell:nth-child(odd) { border-inline-start: none; }
  .proof-cell:nth-child(n + 3) { border-block-start: 1px solid var(--hairline); }
  /* Five cells over two columns leaves the last one orphaned beside a gap.
   * Spanning it reads as a closing line rather than as a layout accident. */
  .proof-cell:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
  .cta-row .btn { flex: 1 1 100%; }
}

/* ───────────────────────────────────────────────── reduced motion ─────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .rv { opacity: 1; transform: none; }
  .rule { transform: scaleX(1); }
}

/* ─────────────────────────────────────────────────────────── print ────── */

@media print {
  .hdr, .menu, .cue, .skip { display: none !important; }
  body { background: #fff; color: #000; }
}

/* ── Cut-out geometry, last word ──────────────────────────────────────────
 * These live at the end on purpose. The responsive block above squares the
 * portrait for phones, which is right for a framed photo and wrong for a
 * cut-out: a square container letterboxes a 0.684 image, leaving a gap under
 * the subject that the gold frame then aligns to instead of to him.
 * Measured alpha bounds of the supplied file: 5.5% left, 6.1% right,
 * 5.7% top, 0% bottom. The frame is set to hug those, not the box. */
.portrait.portrait--cut {
  aspect-ratio: 832 / 1216;
}
/* No frame on the cut-out. A rectangle drawn around a subject with no
 * edges reads as a mistake, not as structure. The halo carries the
 * separation on its own. */
.portrait.portrait--cut::before { display: none; }
@media (max-width: 768px) {
  .portrait.portrait--cut { max-width: 320px; }
  .portrait.portrait--cut::before { inset-inline-start: 24%; }
}

/* ── Section-specific reveals ─────────────────────────────────────────────
 * The shared .rv fade-and-rise is deliberately quiet, and in three sections
 * it was too quiet to register: prose, capability cards and the work blocks
 * all arrived without anyone noticing they had arrived. Each now gets motion
 * that suits its own shape, on the same easing and the same 700ms clock. */

/* Profile: each paragraph wipes in behind a moving edge, the way a document
 * is read rather than assembled. */
#profile-prose p {
  clip-path: inset(0 0 0 0);
  transform: translateY(18px);
}
#profile-prose p.in {
  animation: proseIn 900ms var(--ease) both;
  animation-delay: var(--d, 0ms);
}
@keyframes proseIn {
  from { opacity: 0; transform: translateY(18px); clip-path: inset(0 100% 0 0); }
  to   { opacity: 1; transform: none;             clip-path: inset(0 0 0 0); }
}
[dir="rtl"] #profile-prose p.in { animation-name: proseInRtl; }
@keyframes proseInRtl {
  from { opacity: 0; transform: translateY(18px); clip-path: inset(0 0 0 100%); }
  to   { opacity: 1; transform: none;             clip-path: inset(0 0 0 0); }
}

/* What I build: the cards settle rather than slide, and the gold numeral
 * arrives a beat later so the eye lands on the heading first. */
.card { transform: translateY(28px) scale(0.985); }
.card.in {
  transform: none;
  transition: opacity 700ms var(--ease), transform 700ms var(--ease),
              border-color 300ms var(--ease);
  transition-delay: var(--d, 0ms);
}
.card-n { opacity: 0; transition: opacity 600ms var(--ease); }
.card.in .card-n { opacity: 0.7; transition-delay: calc(var(--d, 0ms) + 260ms); }

/* Signature work: the block enters from the inline start, and the three
 * labelled rows fall in one after another against their hairline. */
.work { transform: translateY(22px); }
.work.in { transform: none; }
.work-row {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 600ms var(--ease), transform 600ms var(--ease);
}
.work.in .work-row { opacity: 1; transform: none; }
.work.in .work-row:nth-child(1) { transition-delay: 220ms; }
.work.in .work-row:nth-child(2) { transition-delay: 340ms; }
.work.in .work-row:nth-child(3) { transition-delay: 460ms; }
/* The existing hairline warms from neutral to gold as the row lands. Drawing
 * a second line would just double the one already there. */
.work-row { transition: opacity 600ms var(--ease), transform 600ms var(--ease),
            border-color 700ms var(--ease); }
.work.in .work-row { border-inline-start-color: rgba(201, 162, 39, 0.45); }

@media (prefers-reduced-motion: reduce) {
  #profile-prose p, #profile-prose p.in { animation: none !important; clip-path: none; transform: none; }
  .card, .work { transform: none !important; }
  .card-n, .work-row { opacity: 1 !important; transform: none !important; }
  .work-row { background-size: 1px 100% !important; }
}

/* ── Icons ────────────────────────────────────────────────────────────────
 * One family, one weight, sized to the text they sit beside. They mark the
 * three things a visitor scans for (email, LinkedIn, location) and the two
 * actions. Nowhere else: an icon on every heading is decoration, and the
 * capability cards already carry numerals that an icon would fight.
 * All are aria-hidden; the adjacent text is the accessible name. */
.ico {
  width: 1.05em;
  height: 1.05em;
  flex: none;
  display: inline-block;
  vertical-align: -0.16em;
}
.contacts a, .contacts > span {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.contacts .ico { color: var(--gold); transition: color 220ms var(--ease); }
.contacts a:hover .ico { color: var(--gold-light); }
/* The download arrow nudges down on hover: the only motion on a control. */
.btn .ico { transition: transform 260ms var(--ease); }
.btn--primary:hover .ico { transform: translateY(2px); }
@media (prefers-reduced-motion: reduce) {
  .btn--primary:hover .ico { transform: none; }
}

/* The one phrase in the closing line that earns the accent. */
.hl { color: var(--gold); font-weight: 600; }

/* ══════════════════════════════════════════════════════════ tools ═══════
 * Evidence, not a portfolio. Rows separated by a hairline rather than cards,
 * the image side alternating so the page keeps a rhythm, and the same gold
 * offset frame the portrait already uses. Nothing new is invented here. */

.tools-reach {
  margin-block-start: var(--s3);
  color: var(--gold);
  font-size: 0.9375rem;
}

.tools { margin-block-start: var(--s6); }

/* Screenshot full width, text in two columns beneath it.
 *
 * The brief asked for image and text side by side with the side alternating.
 * Built that way it did not work and the arithmetic says it cannot: these
 * screenshots are close to 2:1, so beside a 500 to 600px column of text they
 * left roughly 300px of dead space, and narrowing the text to close the gap
 * only makes the text taller. Full width also shows a dense dashboard at
 * 1200px instead of 555, which is the difference between reading it and
 * guessing at it. The alternation goes with it; the hairlines carry the
 * rhythm instead. */
.tool {
  padding-block: var(--s6);
  border-block-start: 1px solid var(--hairline-soft);
}
.tool:first-child { border-block-start: none; padding-block-start: 0; }

.tool-text {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(1.75rem, 3.5vw, 3.5rem);
  align-items: start;
  margin-block-start: var(--s5);
}

.tool-num {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--gold);
  line-height: 1;
  margin-block-end: var(--s2);
  font-variant-numeric: lining-nums tabular-nums;
}
.tool-name { font-family: var(--font-display); font-size: clamp(1.5rem, 2.6vw, 2rem);
  line-height: 1.25; margin: 0; }
.tool-tag { color: var(--text-muted); margin-block-start: var(--s2); font-size: 1rem; }
.tool-body { color: var(--text-muted); margin-block-start: var(--s3); max-width: 62ch; }

.tool-feats { margin-block-start: var(--s3); display: flex; flex-direction: column; gap: var(--s1); }
.tool-feats li {
  position: relative;
  padding-inline-start: var(--s3);
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.7;
}
/* The same 6px gold rule the timeline bullets already use. */
.tool-feats li::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: 0.72em;
  width: 6px;
  height: 1px;
  background: var(--gold);
}

.tool-privacy {
  margin-block-start: var(--s4);
  color: var(--text-dim);
  font-size: 0.8125rem;
  line-height: 1.7;
}

.tool-cta { margin-block-start: var(--s4); }

/* Media, framed exactly like the portrait: a hairline offset behind it. */
.tool-media { position: relative; }
.tool-media::before {
  content: '';
  position: absolute;
  inset-block: -10px;
  inset-inline: -10px;
  border: 1px solid var(--gold);
  opacity: 0.4;
  pointer-events: none;
  border-radius: 2px;
}
.tool-shot {
  display: block;
  width: 100%;
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  background: var(--surface-raised);
  padding: 0;
  cursor: zoom-in;
}
/* No fixed ratio and no cover. Each screenshot keeps its own proportions, so
 * nothing is cropped away; the width and height attributes reserve the space
 * before it loads. */
.tool-shot img { width: 100%; height: auto; display: block; }

/* Shown when a screenshot has not been added yet. Deliberate, not broken. */
.tool-ph {
  width: 100%;
  aspect-ratio: 1.94;
  border-radius: 2px;
  border: 1px solid var(--hairline);
  background: var(--surface-raised);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 2.5rem;
  color: var(--gold);
  opacity: 0.55;
}

@media (max-width: 900px) {
  .tool-text { grid-template-columns: 1fr; gap: var(--s4); }
}

/* ── lightbox ─────────────────────────────────────────────────────────── */
.lb {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(4, 9, 17, 0.92);
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  animation: lbIn 180ms var(--ease);
}
.lb[hidden] { display: none; }
@keyframes lbIn { from { opacity: 0; } }
.lb-img { max-width: 95vw; max-height: 90vh; width: auto; height: auto;
  border: 1px solid var(--hairline); border-radius: 2px; }
.lb-x {
  position: absolute;
  inset-block-start: clamp(0.75rem, 2vw, 1.5rem);
  inset-inline-end: clamp(0.75rem, 2vw, 1.5rem);
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.lb-x:hover { border-color: var(--gold); }

@media (prefers-reduced-motion: reduce) {
  .lb { animation: none; }
}
