/* ============================================================
   Mohammad Fazli — Portfolio
   Light theme · Violet accent · Bilingual FA(RTL)/EN
   Typography: Poppins (latin) · IRANSans (persian)
   ============================================================ */

/* ---------- Fonts ----------
   Self-hosted (no third-party font CDN → strict CSP stays intact).
   The shared stack puts Poppins first, so every Latin glyph (EN mode,
   emails, tech names inside Persian sentences) renders Poppins, while
   Arabic-script glyphs fall through to IRANSans. Vazirmatn stays as a
   fallback in case the IRANSans files ever go missing. */
@font-face {
  font-family: "Poppins";
  src: url("../fonts/Poppins-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("../fonts/Poppins-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("../fonts/Poppins-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Poppins";
  src: url("../fonts/Poppins-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IranSans";
  src: url("../fonts/IRANSansWeb.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IranSans";
  src: url("../fonts/IRANSansWeb_Medium.woff2") format("woff2");
  font-weight: 500 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IranSans";
  src: url("../fonts/IRANSansWeb_Bold.woff2") format("woff2");
  font-weight: 700 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Dana";
  src: url("../fonts/Dana-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Dana";
  src: url("../fonts/Dana-DemiBold.woff2") format("woff2");
  font-weight: 500 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-arabic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+1EE00-1EEBB, U+1EEF0-1EEF1;
}

/* ---------- Tokens ---------- */
:root {
  --bg: #ffffff;
  --bg2: #f6f7f9;
  --bg3: #eceef2;

  --border: hsla(228, 14%, 12%, 0.08);
  --border2: hsla(228, 14%, 12%, 0.18);

  --text: #17181d;
  --text2: #4f515b;
  --text3: #6c6f78;

  /* Brand accent (from the reference): violet, single interactive colour.
     Mint is reserved for the live status; red for required/error. */
  --blue: #5b32f4;
  --blue-2: #4a26d9;
  --mint: #12b881;
  --mint-2: #087f5b;
  --red: #e03131;
  --red-2: #c92a2a;

  /* Derived surfaces & fills. Every component references these — the dark
     theme re-declares ONLY this block plus the palette above, so a raw
     color in a component rule can never drift out of a theme. */
  --ink-on-accent: #ffffff;
  --surface-raised: #ffffff;
  --scrim: rgba(255, 255, 255, 0.85);
  --scrim-strong: rgba(255, 255, 255, 0.92);
  --fill-soft: rgba(23, 24, 29, 0.03);
  --fill-hover: rgba(23, 24, 29, 0.06);
  --fill-hover-strong: #e2e5ea;
  --fill-track: rgba(23, 24, 29, 0.08);
  --fill-dot: rgba(23, 24, 29, 0.05);
  --ambient-1: var(--ambient-1);
  --ambient-2: var(--ambient-2);
  --accent-soft: rgba(91, 50, 244, 0.11);
  --accent-edge: rgba(91, 50, 244, 0.4);
  --ring: rgba(91, 50, 244, 0.12);
  --mint-fill: rgba(18, 184, 129, 0.07);
  --mint-edge: rgba(18, 184, 129, 0.32);
  --selection-bg: rgba(91, 50, 244, 0.35);
  --shadow-lift: 0 10px 20px rgba(23, 24, 29, 0.15);

  --pad: clamp(20px, 5vw, 90px);
  --nav-h: clamp(60px, 4.8vw, 78px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  /* One stack for the whole page: Poppins draws every Latin glyph,
     IranSans every Persian one — switching FA/EN never swaps the voice. */
  --font-fa: "Poppins", "IranSans", "Vazirmatn", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Persian heading face: Dana (bold, rounded) — body text stays IRANSans.
     Poppins still leads so Latin runs inside FA headings keep their voice. */
  --font-fa-head: "Poppins", "Dana", "IranSans", "Vazirmatn", sans-serif;
  --font-display: var(--font-fa);
  /* Kept as an alias so legacy rules (dates, labels, percentages) resolve
     to the brand typeface instead of a monospace. */
  --font-mono: var(--font-fa);
}

/* ============================================================
   DARK THEME — awwwards-style deep ground: near-black with a cool
   violet tint, soft-light ink (never #fff on #000), depth from a
   lighter surface step rather than glows. `color-scheme: dark`
   hands form controls and scrollbars to the OS. The accent lifts
   one step so it keeps ≥4.5:1 against the ground.
   ============================================================ */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101014;
  --bg2: #17171d;
  --bg3: #1f1f27;
  --border: hsla(0, 0%, 100%, 0.08);
  --border2: hsla(0, 0%, 100%, 0.17);
  --text: #f3f3f6;
  --text2: #b9bac5;
  --text3: #8f909c;
  --blue: #8a63ff;
  --blue-2: #a48bff;
  --mint: #2fd493;
  --mint-2: #4adda4;
  --red: #ff7070;
  --red-2: #ff8b8b;
  --ink-on-accent: #0e0d13;
  --surface-raised: #232330;
  --scrim: rgba(16, 16, 20, 0.78);
  --scrim-strong: rgba(16, 16, 20, 0.86);
  --fill-soft: rgba(255, 255, 255, 0.04);
  --fill-hover: rgba(255, 255, 255, 0.08);
  --fill-hover-strong: #262631;
  --fill-track: rgba(255, 255, 255, 0.10);
  --fill-dot: rgba(255, 255, 255, 0.06);
  --ambient-1: rgba(138, 99, 255, 0.10);
  --ambient-2: rgba(47, 212, 147, 0.07);
  --accent-soft: rgba(138, 99, 255, 0.16);
  --accent-edge: rgba(164, 139, 255, 0.45);
  --ring: rgba(138, 99, 255, 0.25);
  --mint-fill: rgba(47, 212, 147, 0.10);
  --mint-edge: rgba(47, 212, 147, 0.35);
  --selection-bg: rgba(138, 99, 255, 0.45);
  --shadow-lift: 0 14px 30px rgba(0, 0, 0, 0.55);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

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

/* ---------- No-JS fallback ----------
   boot.js adds `.js` to <html> before paint. Scoping the reveal styles to that
   class means a browser without scripting renders a complete, readable page
   instead of an almost-empty one. The counters and hero subtitle already carry
   their final values in the markup; only the skill bars need explicit widths. */
.js .reveal { opacity: 0; transform: translateY(28px); }
.js .reveal.in { opacity: 1; transform: none; }

/* Anchored sections must clear the fixed nav */
section[id] { scroll-margin-top: calc(var(--nav-h) + 16px); }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-fa);
  font-weight: 400;
  line-height: 1.75;
  font-size: clamp(16px, 1.05vw, 17px);
  overflow-x: hidden;
  position: relative;
}

/* Fixed radial background wash */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(50% 40% at 12% 0%, var(--ambient-1), transparent 70%),
    radial-gradient(45% 40% at 100% 100%, var(--ambient-2), transparent 70%);
  pointer-events: none;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
ul { list-style: none; }

/* Keyboard focus: visible outline for keyboard users only.
   Inputs keep their own focus ring (border + soft ring below). */
:focus-visible {
  outline: 2px solid var(--blue-2);
  outline-offset: 3px;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--blue); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--blue-2); }

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

/* ---------- Helpers ---------- */
.font-mono { font-family: var(--font-mono); }
.font-display { font-family: var(--font-display); letter-spacing: 0.01em; }

.section-pad { padding: clamp(60px, 7.5vw, 130px) var(--pad); }
.container { max-width: 1180px; margin: 0 auto; width: 100%; }

/* ---------- Bilingual visibility (CSS-only, CSP-safe) ----------
   The FA/EN halves are toggled by the <html lang> attribute instead of
   per-element inline `style="display:none"`. That keeps the strict
   `style-src 'self'` policy intact and removes the flash of duplicated
   copy that appeared before main.js ran. */
html[lang="fa"] [data-lang="en"],
html[lang="en"] [data-lang="fa"] { display: none !important; }

/* Latin-only runs (emails, phone numbers) inside RTL copy */
.ltr { direction: ltr; text-align: start; }
.nowrap { white-space: nowrap; }

/* One-off spacing helper (was inline margin-top) */
.btn-mt { margin-top: 18px; }

section { border-top: 1px solid var(--border); position: relative; }

/* eyebrow / title / desc */
.s-eye {
  font-family: var(--font-fa);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.s-title {
  font-weight: 700;
  font-size: clamp(1.9rem, 3.4vw, 3.1rem);
  line-height: 1.12;
  color: var(--text);
  margin-bottom: 18px;
}
.s-desc {
  color: var(--text2);
  max-width: 620px;
  font-size: 1.02rem;
}
.s-head { margin-bottom: clamp(38px, 5vw, 64px); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 28px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0;
  /* Hover micro-interaction, per ui-ux-pro-max: 200-300ms, ease-OUT for the
     arriving state, and a neutral low-opacity shadow — a saturated coloured
     glow reads as unnatural. will-change pre-creates the compositor layer so
     the first hover never re-rasterises the neighbouring hero photo. */
  will-change: transform;
  transition: transform 0.25s ease-out, background 0.25s ease-out, border-color 0.25s ease-out, color 0.25s ease-out, box-shadow 0.25s ease-out;
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
/* FA (RTL): the arrow sits AFTER the label (RTL flex already places the last
   child to the left of the text) and the glyph is mirrored so the head points
   LEFT — the conventional "forward" direction when reading right-to-left.
   EN keeps the un-mirrored → after the text. */
[dir="rtl"] .btn svg { transform: scaleX(-1); }
.btn-primary {
  background: var(--blue);
  color: var(--ink-on-accent);
}
.btn-primary:hover {
  transform: translateY(-3px);
  background: var(--blue-2);
  box-shadow: var(--shadow-lift);
}
.btn-secondary {
  border: 1px solid var(--border2);
  color: var(--text);
  background: var(--fill-soft);
}
.btn-secondary:hover { transform: translateY(-2px); border-color: var(--blue); }
.btn-mint { border: 1px solid var(--mint-edge); color: var(--mint-2); }
.btn-mint:hover { transform: translateY(-2px); border-color: var(--mint); background: var(--mint-fill); }
/* Press feedback — on touch there is no hover, so the press is the only
   acknowledgement a finger gets. */
.btn:active,
.nav-links a.nav-cta:active { transform: translateY(1px); transition-duration: 0.1s; }

/* ---------- Cards ---------- */
.card-base {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px;
  transition: border-color 0.3s, background 0.3s;
}
.card-base:hover {
  border-color: var(--accent-edge);
  background: var(--bg3);
}

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 var(--pad);
  transition: background 0.3s, border-color 0.3s, backdrop-filter 0.3s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: var(--scrim);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
}
.nav-inner {
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-width: 0;
}
.nav-logo {
  font-weight: 700;
  font-family: var(--font-display);
  /* Scales with the viewport so the wordmark stays on one line on phones
     instead of wrapping into two lines or being clipped by the burger. */
  font-size: clamp(0.85rem, 4.4vw, 1.5rem);
  letter-spacing: 0.02em;
  display: flex;
  /* Centre the 30px text line inside the 44px logo box — baseline alignment
     packed it at the top, sitting ~7px higher than the lang switch/burger. */
  align-items: center;
  gap: 4px;
  min-height: 44px;
  /* Let the wordmark shrink on narrow phones instead of pushing the burger
     off-screen; the dot must never squash. */
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-logo .dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--blue);
  /* Flex 'baseline' synthesis seats an EMPTY span by its TOP edge — the dot
     floated up like a superscript. Centre it against the logo box instead. */
  align-self: center;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
}
.nav-links a {
  font-size: 0.86rem;
  color: var(--text2);
  transition: color 0.2s;
  position: relative;
  /* Comfortable pointer/touch target without changing the nav's height */
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--text); }
/* Header contact CTA: same violet pill as the hero's "Get in Touch",
   with the same hover lift + soft shadow. */
.nav-links a.nav-cta {
  background: var(--blue);
  color: var(--ink-on-accent);
  font-weight: 600;
  padding: 10px 24px;
  border-radius: 999px;
  will-change: transform;
  transition: transform 0.25s ease-out, background 0.25s ease-out, box-shadow 0.25s ease-out;
}
.nav-links a.nav-cta:hover {
  transform: translateY(-3px);
  background: var(--blue-2);
  box-shadow: var(--shadow-lift);
}
.nav-links a.nav-cta.active { color: var(--ink-on-accent); }
.nav-right { display: flex; align-items: center; gap: 16px; }
.nav-social {
  display: flex;
  gap: 12px;
}
.nav-social a, .footer .f-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  color: var(--text2);
  transition: color 0.2s, background 0.2s, transform 0.2s;
}
.nav-social a:hover { color: var(--blue-2); background: var(--fill-hover); transform: translateY(-2px); }
.nav-social svg { width: 19px; height: 19px; }
.nav-divider { width: 1px; height: 20px; background: var(--border2); }

.lang-switch { display: flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 700; }
.lang-switch button {
  color: var(--text3);
  padding: 6px 9px;
  border-radius: 6px;
  transition: color 0.2s;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700; /* buttons don't inherit font-weight */
}
.lang-switch button.active { color: var(--blue-2); }
.lang-switch span { color: var(--text3); }

/* Theme toggle — an icon button that pairs with the language switch.
   Both icons live stacked; which one shows is theme-dependent. The icon
   shown is the theme the click will switch TO. */
.theme-toggle {
  position: relative;
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 11px;
  color: var(--text3);
  transition: color 0.2s, background 0.2s, transform 0.2s;
}
.theme-toggle:hover { color: var(--blue-2); background: var(--fill-hover); transform: translateY(-2px); }
.theme-toggle:active { transform: translateY(0); }
.theme-toggle svg {
  position: absolute;
  width: 20px; height: 20px;
  transition: opacity 0.3s var(--ease), transform 0.4s var(--ease);
}
.theme-toggle .ico-moon { opacity: 1; transform: rotate(0deg); }
.theme-toggle .ico-sun  { opacity: 0; transform: rotate(-90deg) scale(0.6); }
:root[data-theme="dark"] .theme-toggle .ico-moon { opacity: 0; transform: rotate(90deg) scale(0.6); }
:root[data-theme="dark"] .theme-toggle .ico-sun  { opacity: 1; transform: rotate(0deg); }

/* Short-lived color crossfade during a theme switch. A permanent
   *-wide transition would fight every hover and entrance tween, so the
   class is added for ~350ms by main.js and removed again. */
html.theme-anim,
html.theme-anim *,
html.theme-anim *::before,
html.theme-anim *::after {
  transition: background-color 0.3s ease, border-color 0.3s ease,
              color 0.3s ease, fill 0.3s ease, box-shadow 0.3s ease !important;
}

.nav-burger { display: none; flex-direction: column; gap: 5px; padding: 8px; order: -1; }
.nav-burger span { width: 22px; height: 1.6px; background: var(--text); border-radius: 2px; transition: transform 0.3s, opacity 0.3s; }
/* Burger → X (half-page menu): the whole icon tips -45°, bar1 drops to the
   centre, bar2 fades, bar3 stands up — together they read as an X. */
.nav-burger.open { transform: rotate(-45deg); }
.nav-burger.open span:nth-child(1) { transform: rotate(0deg) translateY(6.6px); }
.nav-burger.open span:nth-child(2) { opacity: 0; }
.nav-burger.open span:nth-child(3) { transform: rotate(-90deg) translateX(5.5px); }

/* mobile menu */
/* Hidden with display on desktop so its links never sit in the tab order
   as invisible, focusable targets; opacity-only hiding is for <=860px,
   where the burger is the only way to open it. */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 99;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: calc(var(--nav-h) + 14px) 24px 26px;
  visibility: hidden;
  pointer-events: none;
  /* Violet edge on the side the drawer slides in from (inline-start in
     both directions: right edge in FA, left edge in EN) */
  border-inline-start: 3px solid var(--blue);
  /* FA slides in from the right edge, EN from the left edge */
  transform: translateX(-100%);
  transition: transform 0.4s ease-out, visibility 0.4s;
  overflow-y: auto;
}
.mobile-menu.open { visibility: visible; pointer-events: auto; transform: translateX(0); }
[dir="rtl"] .mobile-menu { transform: translateX(100%); }
[dir="rtl"] .mobile-menu.open { transform: translateX(0); }

/* Menu rows: full-width pill rows with a directional chevron that appears
   on hover/active — no plain bare text links. */
.mobile-menu a {
  font-family: var(--font-fa-head);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(320px, 100%);
  min-height: 56px;
  padding: 10px 18px;
  border-radius: 14px;
  /* Permanent pill row: reads as a tappable button on touch, no hover needed */
  background: var(--bg2);
  border: 1px solid var(--border);
  transition: color 0.2s, background 0.2s, border-color 0.2s, opacity 0.4s var(--ease), transform 0.45s var(--ease);
}
/* staggered entrance, one row at a time (fa/en pairs) */
.mobile-menu a { opacity: 0; transform: translateY(14px); }
.mobile-menu.open a { opacity: 1; transform: translateY(0); }
.mobile-menu.open a:nth-child(1), .mobile-menu.open a:nth-child(2) { transition-delay: 0.10s, 0.10s; }
.mobile-menu.open a:nth-child(3), .mobile-menu.open a:nth-child(4) { transition-delay: 0.16s, 0.16s; }
.mobile-menu.open a:nth-child(5), .mobile-menu.open a:nth-child(6) { transition-delay: 0.22s, 0.22s; }
.mobile-menu.open a:nth-child(7), .mobile-menu.open a:nth-child(8) { transition-delay: 0.28s, 0.28s; }
.mobile-menu.open a:nth-child(9), .mobile-menu.open a:nth-child(10) { transition-delay: 0.34s, 0.34s; }
.mobile-menu.open a:nth-child(11), .mobile-menu.open a:nth-child(12) { transition-delay: 0.40s, 0.40s; }

/* directional chevron at the row end — always visible on touch */
.mobile-menu a::after {
  content: "";
  width: 8px; height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.55;
  transition: opacity 0.2s, transform 0.2s;
}
[dir="rtl"] .mobile-menu a::after {
  border-top: none;
  border-right: none;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
}
@media (hover: hover) {
  .mobile-menu a:hover {
    color: var(--blue);
    background: var(--surface-raised);
    border-color: var(--accent-edge);
  }
  .mobile-menu a:hover::after { opacity: 1; transform: rotate(45deg) translateX(3px); }
}
.mobile-menu a:active { color: var(--blue); background: var(--surface-raised); border-color: var(--accent-edge); }
.mobile-menu a:focus-visible { color: var(--blue); background: var(--surface-raised); border-color: var(--accent-edge); }

/* drawer footer: live status + direct contact shortcuts */
.mm-foot {
  margin-top: auto;
  padding-top: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: min(320px, 100%);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s var(--ease) 0.45s, transform 0.5s var(--ease) 0.45s;
}
.mobile-menu.open .mm-foot { opacity: 1; transform: translateY(0); }
.mm-status {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--mint-2);
  font-size: 0.95rem;
  font-weight: 600;
}
.mm-social { display: flex; gap: 10px; }
.mm-social a {
  /* Must beat the pill-row's min-height:56px — these are square icon cards */
  width: 46px; height: 46px;
  min-height: 46px; min-width: 46px;
  padding: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  /* The pill row's justify-content: space-between leaks into this grid —
     with a single track that pins the icon to the inline edge. Re-centre. */
  place-content: center;
  color: var(--blue-2);
  background: var(--bg2);
  border: 1px solid var(--border);
  opacity: 1;
  transform: none;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.mm-social a::after { display: none; }
.mm-social svg { width: 20px; height: 20px; }
@media (hover: hover) {
  .mm-social a:hover { color: var(--blue); background: var(--surface-raised); border-color: var(--accent-edge); }
}
@media (min-width: 861px) { .mobile-menu { display: none; } }

/* While the drawer is open, clear the fixed bar so it reads on the panel */
@media (max-width: 860px) {
  body.menu-open .nav { background: transparent; border-bottom-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
  body.menu-open .nav-logo, body.menu-open .lang-switch { opacity: 0.35; }
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--nav-h) + 30px) var(--pad) 60px;
  position: relative;
  overflow: hidden;
  border-top: none;
}
.hero-grid {
  max-width: 1180px;
  margin: 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 42%;
  gap: 40px;
  align-items: center;
  min-width: 0;
}
.hero-grid > * { min-width: 0; }

.hero-eye {
  font-family: var(--font-fa);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--mint-2);
  margin-bottom: 22px;
}
[dir="rtl"] .hero-eye { letter-spacing: 0; }
.hero-eye .pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 0 rgba(18, 184, 129, 0.6);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(18, 184, 129, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(18, 184, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(18, 184, 129, 0); }
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 5.5vw, 5.5rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
  margin-bottom: 20px;
  color: var(--text);
  /* Wrap rather than clip: on narrow phones the title scales down with the
     viewport and may break to a second line instead of overflowing. */
  white-space: normal;
  overflow-wrap: break-word;
  text-wrap: balance;
}
[dir="rtl"] .hero h1 {
  font-family: var(--font-fa-head);
  font-weight: 700;
  font-size: clamp(2.4rem, 5.5vw, 4.6rem);
  line-height: 1.15;
}
/* Persian headings & eyebrow labels use Dana; body copy stays IRANSans. */
[dir="rtl"] :is(.s-title, .tl-role, .deg, .s-eye) { font-family: var(--font-fa-head); }
.hero h1 .accent {
  color: var(--blue);
}

.hero-sub {
  font-family: var(--font-mono);
  font-size: clamp(1rem, 1.8vw, 1.4rem);
  color: var(--blue-2);
  margin-bottom: 22px;
  min-height: 1.5em;
}
[dir="rtl"] .hero-sub { font-family: var(--font-fa); font-weight: 500; }

.hero-p {
  color: var(--text2);
  max-width: 520px;
  margin-bottom: 34px;
  font-size: 1.02rem;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; }

/* photo — organic blob mask, as the reference layout.
   .hero-media wraps photo + badge; the badge lives outside the blob's
   overflow clip so it floats on the bottom edge uncut. */
.hero-media { position: relative; }
.hero-photo {
  position: relative;
  /* Blob shape requested by the owner — exact values, do not "improve". */
  aspect-ratio: 1 / 1;
  /* Never grow taller than the viewport allows: keeps the hero (and the
     scroll cue after it) inside the first screen on desktop. */
  max-height: min(66svh, 560px);
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  overflow: hidden;
}
.hero-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  filter: saturate(0.96) contrast(1.02);
  /* Own compositor layer: hovering nearby buttons never re-rasterises the
     filtered image, so the photo can't flash or "transition". */
  transform: translateZ(0);
}
.hero-photo picture {
  display: block;
  width: 100%;
  height: 100%;
}
.hero-badge {
  position: absolute;
  /* Floats over the blob's bottom edge, centred; outside the clip. */
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  background: var(--scrim-strong);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 15px;
  display: flex;
  align-items: center;
  gap: 9px;
  /* Cap to the photo column; the label wraps instead of spilling out. */
  max-width: calc(100% - 16px);
}
.hero-badge .num {
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1;
  color: var(--mint-2);
}
.hero-badge .lbl { font-size: 0.8125rem; color: var(--text2); line-height: 1.3; }

.hero-dots {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(var(--fill-dot) 1px, transparent 1px);
  background-size: 40px 40px;
  -webkit-mask-image: radial-gradient(60% 60% at 30% 40%, #000, transparent 75%);
  mask-image: radial-gradient(60% 60% at 30% 40%, #000, transparent 75%);
}

.scroll-cue {
  /* Sits in the hero's own flow (not absolutely positioned) so it can never
     collide with the CTA buttons when the content grows. */
  /* relative (still in normal flow) so the ::before glow ring can anchor
     to the pill without taking it out of the hero's layout. */
  position: relative;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 9px 18px 9px 15px;
  border-radius: 999px;
  background: var(--bg3);
  border: 0;
  color: inherit;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease), transform 0.25s var(--ease);
  animation: cue-float 2.6s ease-in-out infinite;
  margin: clamp(20px, 3vh, 34px) auto 0;
  align-self: center;
  flex: 0 0 auto;
  white-space: nowrap;
}
.scroll-cue:hover {
  background: var(--fill-hover-strong);
}

.scroll-cue .cue-label {
  font-size: 0.875rem;
  color: var(--text2);
}
[dir="rtl"] .scroll-cue .cue-label { letter-spacing: 0.06em; }

/* Mouse / wheel glyph that houses the animated dot */
.scroll-cue .cue-mouse {
  position: relative;
  width: 20px;
  height: 30px;
  border: 1.6px solid var(--text2);
  border-radius: 11px;
  display: block;
  flex-shrink: 0;
}
.scroll-cue .cue-mouse::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 6px;
  width: 3px;
  height: 6px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--blue);
  animation: cue-wheel 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes cue-wheel {
  0%   { opacity: 0; transform: translateY(-2px); }
  35%  { opacity: 1; }
  70%  { opacity: 1; transform: translateY(9px); }
  100% { opacity: 0; transform: translateY(11px); }
}

/* Gentle vertical breathing; the pill is centred by margin, not translateX. */
@keyframes cue-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(5px); }
}

/* ============================================================
   ABOUT
   ============================================================ */
/* Single column: the old side contact card was removed as redundant
   (contact details live in #contact); keep the bio at a readable measure. */
.about-grid { display: grid; grid-template-columns: 1fr; gap: 0; }
.about-text { max-width: 660px; }
.about-text p { color: var(--text2); margin-bottom: 16px; }
.about-text p:first-child { margin-top: 0; }
.about-text .chips { margin-top: 26px; padding-top: 0; }
.about-text p strong { color: var(--text); font-weight: 600; }

.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 0 rgba(18, 184, 129, 0.6); animation: live-pulse 2s ease-out infinite; }
@keyframes live-pulse { 70%, 100% { box-shadow: 0 0 0 10px rgba(18, 184, 129, 0); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }

.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-top: 26px; }
.chip {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  color: var(--text2);
  background: var(--fill-soft);
  text-align: center;
}

/* counters */
.counters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: clamp(40px, 5vw, 64px);
}
.counter {
  text-align: center;
  padding: 22px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg2);
}
.counter .num {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  line-height: 1;
  color: var(--blue-2);
}
.counter .lbl { font-size: 0.8125rem; color: var(--text2); margin-top: 8px; }

/* ============================================================
   SKILLS
   ============================================================ */
.skills-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.skill-group h3 {
  font-size: 1.02rem;
  font-weight: 600;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.skill-group h3 .ic {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--blue-2);
}
.skill-group h3 .ic svg { width: 18px; height: 18px; }
.skill-row { margin-bottom: 15px; }
.skill-row:last-child { margin-bottom: 0; }
.skill-row .top { display: flex; justify-content: space-between; margin-bottom: 7px; font-size: 0.86rem; }
.skill-row .top .pct { font-family: var(--font-mono); color: var(--text2); font-size: 0.8125rem; }
.skill-track { height: 4px; background: var(--fill-track); border-radius: 4px; overflow: hidden; }
.skill-fill {
  height: 100%;
  width: 0;
  border-radius: 4px;
  background: var(--blue);
  transition: width 1.4s var(--ease);
}

/* ============================================================
   EXPERIENCE (timeline)
   ============================================================ */
.timeline { position: relative; max-width: 860px; margin: 0 auto; }
.timeline::before {
  content: "";
  position: absolute;
  inset-inline-start: 7px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border2);
}
.tl-item { position: relative; padding-inline-start: 40px; padding-bottom: 42px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--blue);
  box-shadow: 0 0 0 4px var(--ring);
}
.tl-item.mint::before { border-color: var(--blue); box-shadow: 0 0 0 4px var(--ring); }
.tl-date { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--text2); letter-spacing: 0.06em; margin-bottom: 6px; }
.tl-role { font-size: 1.15rem; font-weight: 700; margin-bottom: 2px; }
.tl-company { color: var(--blue-2); font-size: 0.9rem; margin-bottom: 14px; }
.tl-list li {
  color: var(--text2);
  font-size: 0.92rem;
  padding-inline-start: 20px;
  position: relative;
  margin-bottom: 8px;
}
.tl-list li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 11px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--blue);
}

/* ============================================================
   CERTIFICATIONS
   ============================================================ */
.certs-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.cert-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 132px;
  padding: 20px 22px;
  border-radius: 16px;
  background: var(--bg2);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: opacity 0.7s var(--ease) var(--d, 0s), transform 0.7s var(--ease) var(--d, 0s), border-color 0.35s, background 0.35s;
}
.cert-card:nth-child(3n+2) { --d: 0.08s; }
.cert-card:nth-child(3n) { --d: 0.16s; }
.cert-card:hover { border-color: var(--accent-edge); background: var(--bg3); }
.cert-card .cert-year {
  order: -1;
  align-self: flex-start;
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  color: var(--text2);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.cert-card .cert-year::before {
  content: "";
  width: 18px; height: 1px;
  background: var(--border2);
  transition: width 0.4s var(--ease);
}
.cert-card:hover .cert-year::before { width: 34px; background: var(--blue); }
.cert-card .cert-name { font-weight: 600; font-size: 1.08rem; line-height: 1.35; color: var(--text); }
.cert-card .cert-org { color: var(--text3); font-size: 0.88rem; }

/* ============================================================
   EDUCATION
   ============================================================ */
.edu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.edu-card { display: flex; gap: 18px; align-items: flex-start; }
.edu-icon {
  flex-shrink: 0;
  width: 48px; height: 48px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--blue-2);
}
.edu-icon svg { width: 24px; height: 24px; }
.edu-card .deg { font-weight: 700; font-size: 1.05rem; margin-bottom: 4px; }
.edu-card .field { color: var(--text2); font-size: 0.9rem; margin-bottom: 8px; }
.edu-card .uni { color: var(--blue-2); font-size: 0.86rem; }
.edu-card .yr { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--text2); margin-top: 6px; }

/* ============================================================
   CONTACT
   ============================================================ */
.contact-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(30px, 5vw, 64px); }
.contact-info .ci-item { display: flex; gap: 16px; align-items: center; margin-bottom: 24px; }
.contact-info .ci-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--blue-2);
  flex-shrink: 0;
}
.contact-info .ci-icon svg { width: 20px; height: 20px; }
/* Live status row: mint context for the pulsing dot + status text */
.contact-info .ci-live { color: var(--mint); background: var(--mint-fill); border-color: var(--mint-edge); }
.contact-info .ci-v.mint { color: var(--mint-2); }
.contact-info .ci-k { font-size: 0.8125rem; color: var(--text2); font-family: var(--font-mono); letter-spacing: 0.08em; }
.contact-info .ci-v { font-size: 0.98rem; font-weight: 500; direction: ltr; }
[dir="rtl"] .contact-info .ci-v { text-align: start; }

.contact-form { display: flex; flex-direction: column; gap: 16px; }
.field label { display: block; font-size: 0.8125rem; color: var(--text2); margin-bottom: 7px; }
.field label .req { color: var(--red); }
.field input,
.field textarea {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 13px 15px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--ring);
}
.field textarea { resize: vertical; min-height: 120px; }
.form-submit { align-self: flex-start; }
.form-submit:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; box-shadow: none; }
.form-note { font-size: 0.8125rem; color: var(--text3); }
.form-note.ok { color: var(--mint-2); }
.form-note.err { color: var(--red-2); }
/* Empty notes must not eat a flex gap row */
.form-note:empty { display: none; }
/* Honeypot: hidden from humans, visible to naive bots.
   Uses clip rather than a negative offset so an RTL page never gains
   horizontal scroll from it. */
.contact-form .hp {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  pointer-events: none;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px var(--pad);
  text-align: center;
  color: var(--text3);
  font-size: 0.84rem;
}
.footer .f-name { color: var(--text2); font-weight: 500; }
.footer .f-social { display: flex; justify-content: center; gap: 10px; margin: 18px 0; }
.footer .f-social svg { width: 20px; height: 20px; }

/* ============================================================
   REVEAL ANIMATION
   ============================================================ */
.reveal { transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }

/* Skill bars render at their real width when scripting is off; with JS the
   .in observer animates width from 0 using data-width. Scoped to `:not(.js)`
   so it never wins over the inline width the animation sets. */
html:not(.js) .skill-fill.w90 { width: 90%; }
html:not(.js) .skill-fill.w85 { width: 85%; }
html:not(.js) .skill-fill.w80 { width: 80%; }
html:not(.js) .skill-fill.w75 { width: 75%; }
html:not(.js) .skill-fill.w70 { width: 70%; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; }
  /* Single column: cap the portrait height so the stack (photo + copy + CTA +
     scroll cue) still fits the first viewport on tablets and landscape phones. */
  .hero-media { max-width: 268px; margin-inline: auto; order: -1; }
  .hero-photo { max-height: min(34svh, 260px); aspect-ratio: 1 / 1; }
  .hero-badge { display: none; }

  .hero-grid { gap: 24px; }
  .hero { padding: calc(var(--nav-h) + 22px) var(--pad) 30px; }
  .hero h1 { margin-bottom: 14px; }
  .hero-p { margin-bottom: 22px; }
}
@media (max-width: 860px) {
  .nav-links, .nav-social, .nav-divider { display: none; }
  .nav-burger { display: flex; }
  /* Burger sits on the drawer's opening edge (FA: right / EN: left), the
     logo right next to it, the language switch at the far edge */
  .nav-inner { justify-content: flex-start; }
  .nav-right { margin-inline-start: auto; }
  .skills-grid { grid-template-columns: 1fr; }
  .certs-grid { grid-template-columns: 1fr 1fr; }
  .edu-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .counters { grid-template-columns: 1fr 1fr; }
  /* CTAs stack in both languages so FA and EN match on switch. Phones keep
     the full-width pills with centered labels; the tablet range reverts to
     word width below — stretched pills look broken on tablet columns. */
  .hero-cta { flex-direction: column; align-items: stretch; gap: 12px; }
}

/* Tablet range (641–860): the single-column hero gets a wide text column,
   so full-width pills look oversized — keep them at word width, aligned
   with the text edge (flex-start follows the language direction). */
@media (min-width: 641px) and (max-width: 860px) {
  .hero-cta { align-items: flex-start; }
}

@media (max-width: 640px) {
  /* Portrait: cap the height so the hero (and its scroll cue) still fits a phone. */
  .hero-media {
    max-width: 210px;
  }
  .hero-photo {
    aspect-ratio: 1 / 1;
    margin-inline: auto;
  }
  .hero-grid { gap: 24px; }
  .hero { padding: calc(var(--nav-h) + 14px) var(--pad) 44px; }
  /* Keep scaling below ~360px instead of pinning at 2rem, so the title
     shrinks with the viewport and never out-grows its column. */
  .hero h1, [dir="rtl"] .hero h1 { font-size: clamp(1.55rem, 8.4vw, 2.7rem); }
  .hero-eye { margin-bottom: 14px; }
  .hero h1, [dir="rtl"] .hero h1 { margin-bottom: 14px; }
  .hero-sub { font-size: 0.96rem; min-height: 1.6em; margin-bottom: 14px; }
  .hero-p { font-size: 0.94rem; margin-bottom: 18px; }
  .hero-cta { gap: 12px; }

  /* Tighten the top bar so the wordmark + language switch + burger all fit
     on a 320px phone without clipping the name. */
  .nav-inner { gap: 8px; }
  .nav-logo { gap: 7px; }
  .s-title { font-size: clamp(1.6rem, 6.6vw, 2.2rem); }
  .s-desc, .about-text p, .tl-list li { font-size: 0.94rem; }

  /* Bump the smallest labels so they stay legible on a phone */
  .s-eye, .hero-eye { font-size: 0.8125rem; }
  .chips { grid-template-columns: repeat(2, 1fr); }
  .chip { font-size: 0.82rem; padding: 8px 10px; }
  .ci-k { font-size: 0.8125rem; }
  .counter .lbl { font-size: 0.82rem; }
  .field label { font-size: 0.86rem; }
  .tl-date, .edu-card .yr { font-size: 0.8125rem; }
  .cert-year { font-size: 0.8125rem; }
  .skill-row .top .pct { font-size: 0.8125rem; }
  .hero-badge .lbl { font-size: 0.8125rem; }
  .nav-links a, .footer p, .form-note { font-size: 0.9rem; }
  .scroll-cue .cue-label { font-size: 0.875rem; }
  .scroll-cue { padding: 8px 16px 8px 13px; }

  .certs-grid { grid-template-columns: 1fr; }
    .hero-cta { width: 100%; }
  .hero-cta .btn { flex: 1 1 auto; justify-content: center; }
  .scroll-cue { margin-top: 18px; }
}

/* Touch targets: keep interactive chrome at >=44px on touch-sized viewports */
@media (max-width: 1024px) {
  .nav-burger { min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }
  .nav-social a, .footer .f-social a {
    min-width: 44px; min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
  }
}

/* Phones (≤460px): the theme toggle joined the bar, so the row must give
   the wordmark its width back — "Mohammad Fazli" ran under the sun icon
   in EN. Compact the toggle + language switch and scale the wordmark down
   a step; FA (shorter name) benefits from the same slack. */
@media (max-width: 460px) {
  .nav-right { gap: 8px; }
  .theme-toggle { width: 40px; height: 40px; }
  .lang-switch button { min-width: 36px; padding: 6px 5px; }
  .nav-logo { font-size: clamp(0.9rem, 3.6vw, 1.25rem); }
}

/* Very narrow phones (<380px): give the wordmark room by tightening the
   language switch so the burger never crowds the name off the bar. */
@media (max-width: 380px) {
  .nav-inner { gap: 6px; }
  .nav-right { gap: 6px; }
  .theme-toggle { width: 36px; height: 36px; }
  .nav-burger { min-width: 40px; padding: 6px; }
  .nav-logo { font-size: clamp(0.62rem, 3.2vw, 0.95rem); }
  /* Narrow the switch but keep its text at the legible 13px size. */
  .lang-switch { gap: 2px; }
  .lang-switch button { min-width: 30px; padding: 4px 3px; }
  /* Grid cells here are ~133px: tighten chips so even "Python Automation"
     stays on one line and every row keeps the same height. */
  .chips { gap: 6px; }
  .chip { font-size: 0.75rem; padding: 8px 7px; }

  /* Small phone: shrink the portrait and last gaps so the scroll cue still
     lands inside the first viewport instead of just below the fold. */
  .hero-media { max-width: 168px; }
  .hero-grid { gap: 18px; }
  .hero-p { margin-bottom: 14px; }
  .scroll-cue { margin-top: 14px; }
}

/* Short viewports (small phones in portrait, most in landscape): compress the
   hero so the title, CTAs and the scroll cue all fit above the fold. */
@media (max-height: 720px) {
  .hero { padding-top: calc(var(--nav-h) + 10px); padding-bottom: 20px; }
  /* The photo scales with viewport height so a short DESKTOP window keeps a
     proportional portrait; the fixed 168px cap is only for phone widths. */
  .hero-media { max-width: clamp(200px, 38svh, 268px); }
  .hero-eye { margin-bottom: 10px; }
  .hero h1, [dir="rtl"] .hero h1 { margin-bottom: 10px; }
  .hero-sub { margin-bottom: 10px; }
  .hero-p { margin-bottom: 8px; }
  .scroll-cue { margin-top: 12px; }
}
/* Phone widths keep the aggressive cap so the fold still holds there. */
@media (max-height: 720px) and (max-width: 860px) {
  .hero-media { max-width: 168px; }
}

/* reduce motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
  .scroll-cue { transform: none; }
  .scroll-cue .cue-mouse::after { opacity: 0.75; transform: translateY(5px); }
  /* Drawer without the slide/stagger: rows appear in place */
  .mobile-menu, [dir="rtl"] .mobile-menu { transform: none; transition: opacity 0.2s, visibility 0.2s; }
  .mobile-menu a, .mm-foot { opacity: 1; transform: none; transition: none; }
  .mobile-menu.open a, [dir="rtl"] .mobile-menu.open a { transition-delay: 0s; }
}

.js.motion-pending .hero-grid > * > *,
.js.motion-pending .hero-photo,
.js.motion-pending .scroll-cue { visibility: hidden; }
@media (prefers-reduced-motion: reduce) {
  .js.motion-pending .hero-grid > * > *,
  .js.motion-pending .hero-photo,
  .js.motion-pending .scroll-cue { visibility: visible; }
}

@media (min-width: 1025px) {
  :root:not([dir="rtl"]) .hero h1 {
    font-size: clamp(2.2rem, 4.4vw, 4.6rem);
    white-space: nowrap;
  }
}

[dir="rtl"] .s-eye,
[dir="rtl"] .hero-eye,
[dir="rtl"] .tl-date,
[dir="rtl"] .contact-info .ci-k,
[dir="rtl"] .scroll-cue .cue-label,
[dir="rtl"] .chip,
[dir="rtl"] .lang-switch,
[dir="rtl"] .counter .lbl {
  font-family: var(--font-fa);
  letter-spacing: 0;
  text-transform: none;
}
[dir="rtl"] .s-eye { font-size: 0.95rem; font-weight: 600; }
[dir="rtl"] .hero-eye { font-size: 0.95rem; font-weight: 500; }
[dir="rtl"] .tl-date, [dir="rtl"] .contact-info .ci-k { font-size: 0.88rem; }
[dir="rtl"] .cert-card .cert-year { font-family: var(--font-mono); }