/* =====================================================================
   Barnamenevisan-e Bartar — "Blueprint & Glow" design system
   RTL-first · light + dark · no framework
   ===================================================================== */

@font-face {
  font-family: "Vazirmatn";
  src: url("/fonts/vazirmatn-var.woff2") format("woff2-variations"), url("/fonts/vazirmatn-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* ---------- tokens ---------- */
:root {
  --navy: #1D3785;
  --azure: #007FFF;
  --cyan: #18c8ff;
  --sky: #AFDBF5;

  --bg: #f5f7fc;
  --bg-2: #eaf0fb;
  --surface: #ffffff;
  --surface-2: #f1f5fd;
  --glass: rgba(255, 255, 255, .72);
  --text: #0d1631;
  --text-2: #43507a;
  --muted: #6f7ca3;
  --line: rgba(29, 55, 133, .11);
  --line-strong: rgba(29, 55, 133, .22);
  --brand: var(--navy);
  --brand-ink: #1D3785;
  --accent: var(--azure);
  --accent-soft: rgba(0, 127, 255, .10);
  --on-accent: #fff;
  --dot: rgba(29, 55, 133, .13);
  --glow-a: rgba(0, 127, 255, .18);
  --glow-b: rgba(24, 200, 255, .16);
  --glow-c: rgba(29, 55, 133, .12);
  --shadow-sm: 0 1px 2px rgba(13, 22, 49, .05), 0 2px 8px -2px rgba(13, 22, 49, .06);
  --shadow: 0 1px 2px rgba(13, 22, 49, .04), 0 12px 32px -12px rgba(13, 22, 49, .18);
  --shadow-lg: 0 30px 80px -30px rgba(29, 55, 133, .45);
  --success: #12a46b;
  --danger: #e5484d;

  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 28px;
  --container: 1200px;
  --header-h: 76px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --font: "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #060b1b;
  --bg-2: #0a1230;
  --surface: #0d1631;
  --surface-2: #121e42;
  --glass: rgba(13, 22, 49, .66);
  --text: #e9eeff;
  --text-2: #b0bce0;
  --muted: #7e8bb3;
  --line: rgba(150, 180, 255, .12);
  --line-strong: rgba(150, 180, 255, .24);
  --brand: #7fa6ff;
  --brand-ink: #9dbbff;
  --accent: #2f95ff;
  --accent-soft: rgba(47, 149, 255, .14);
  --dot: rgba(150, 180, 255, .09);
  --glow-a: rgba(47, 149, 255, .22);
  --glow-b: rgba(24, 200, 255, .14);
  --glow-c: rgba(120, 90, 255, .14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 16px 40px -16px rgba(0, 0, 0, .6);
  --shadow-lg: 0 30px 80px -30px rgba(0, 127, 255, .35);
  color-scheme: dark;
}

/* ---------- reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 24px); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.9;
  color: var(--text);
  background: var(--bg);
  font-feature-settings: "ss01";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden; /* fallback for old browsers */
  transition: background-color .4s var(--ease), color .4s var(--ease);
}
/* safety net: mobile browsers still let users pan sideways with overflow-x:hidden; clip truly forbids it */
@supports (overflow: clip) { html, body { overflow-x: clip; } }
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.35; margin: 0 0 .6em; font-weight: 800; letter-spacing: -.01em; text-wrap: balance; }
p { margin: 0 0 1em; text-wrap: pretty; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 1rem; top: -100px; z-index: 100; background: var(--accent); color: #fff; padding: .6rem 1rem; border-radius: 10px; }
.skip:focus { top: 1rem; }
.icon { width: 1.25em; height: 1.25em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* blueprint dot grid + aurora that sit behind everything */
.backdrop { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.backdrop::before {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(var(--dot) 1.2px, transparent 1.2px);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 85%);
}
/* perf: soft radial gradients instead of filter: blur() (which re-rasterises huge layers); transform-only animation stays on the compositor */
.backdrop i { position: absolute; border-radius: 50%; animation: float 22s ease-in-out infinite; will-change: transform; }
.backdrop i:nth-child(1) { width: 46vmax; height: 46vmax; background: radial-gradient(closest-side, var(--glow-a), transparent); top: -18vmax; inset-inline-end: -10vmax; }
.backdrop i:nth-child(2) { width: 36vmax; height: 36vmax; background: radial-gradient(closest-side, var(--glow-b), transparent); top: 30vh; inset-inline-start: -14vmax; animation-delay: -7s; }
.backdrop i:nth-child(3) { width: 30vmax; height: 30vmax; background: radial-gradient(closest-side, var(--glow-c), transparent); bottom: -14vmax; inset-inline-end: 20vw; animation-delay: -14s; }
@keyframes float { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(4vw, 3vh) scale(1.08); } 66% { transform: translate(-3vw, -2vh) scale(.95); } }

/* ---------- layout ---------- */
.container { width: min(100% - 32px, var(--container)); margin-inline: auto; }
.section { padding-block: clamp(56px, 9vw, 112px); position: relative; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: clamp(28px, 4vw, 48px); flex-wrap: wrap; }
.section-head h2 { font-size: clamp(1.6rem, 3.4vw, 2.5rem); margin: 0; }
.section-head p { color: var(--text-2); margin: .4rem 0 0; max-width: 56ch; }
.eyebrow {
  display: inline-flex; align-items: center; gap: .5em; font-size: .82rem; font-weight: 700; color: var(--accent);
  letter-spacing: .02em; margin-bottom: .6rem;
}
.eyebrow::before { content: ""; width: 22px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--cyan), var(--accent)); }
.grad-text {
  background: linear-gradient(100deg, var(--accent) 0%, var(--cyan) 50%, var(--accent) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  /* perf: no infinite background-position animation — it repaints the text every frame */
}
@keyframes shine { to { background-position: -200% center; } }

/* ---------- buttons / chips ---------- */
.btn {
  --b: var(--accent);
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  height: 50px; padding-inline: 1.4em; border-radius: 999px; border: 0; cursor: pointer;
  font-weight: 700; font-size: .98rem; white-space: nowrap;
  transition: transform .25s var(--spring), box-shadow .25s var(--ease), background .25s var(--ease), color .25s;
}
.btn .icon { transition: transform .3s var(--spring); }
.btn:hover .icon-go { transform: translateX(-4px); }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #2b6cff 55%, var(--navy));
  box-shadow: 0 10px 30px -10px rgba(0, 127, 255, .7), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 40px -12px rgba(0, 127, 255, .8), inset 0 1px 0 rgba(255, 255, 255, .25); }
.btn-ghost { background: var(--glass); color: var(--text); border: 1px solid var(--line-strong); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.btn-sm { height: 40px; font-size: .9rem; padding-inline: 1.1em; }
.btn-icon { width: 44px; height: 44px; padding: 0; border-radius: 50%; }

.chip {
  display: inline-flex; align-items: center; gap: .4em; padding: .25em .85em; border-radius: 999px;
  font-size: .8rem; font-weight: 600; background: var(--accent-soft); color: var(--accent); border: 1px solid transparent;
  transition: all .2s var(--ease);
}
a.chip:hover, .chip.active { background: var(--accent); color: #fff; }
.chip-outline { background: transparent; border-color: var(--line-strong); color: var(--text-2); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50; padding-top: 14px;
  transition: padding .35s var(--ease);
}
.nav-shell {
  display: flex; align-items: center; gap: 12px; height: 64px; padding-inline: 10px 10px;
  background: var(--glass); backdrop-filter: blur(18px) saturate(1.6); -webkit-backdrop-filter: blur(18px) saturate(1.6);
  border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-sm);
  transition: box-shadow .35s var(--ease), height .35s var(--ease), border-color .35s;
}
.scrolled .site-header { padding-top: 8px; }
.scrolled .nav-shell { box-shadow: var(--shadow); height: 58px; border-color: var(--line-strong); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.02rem; padding-inline-end: 8px; flex: none; }
.brand .mascot { width: 44px; height: 44px; transition: transform .5s var(--spring); }
.brand:hover .mascot { transform: rotate(-12deg) scale(1.08); }
.brand small { display: block; font-size: .68rem; font-weight: 500; color: var(--muted); line-height: 1.2; }
.brand span { line-height: 1.3; }
.nav { display: flex; gap: 2px; margin-inline: auto; }
.nav a {
  position: relative; padding: .45em .95em; border-radius: 999px; font-weight: 600; font-size: .94rem; color: var(--text-2);
  transition: color .2s, background .2s;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.nav-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.theme-toggle {
  position: relative; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; display: grid; place-items: center; overflow: hidden; color: var(--text);
  transition: transform .3s var(--spring), border-color .2s;
}
.theme-toggle:hover { transform: rotate(-20deg) scale(1.05); border-color: var(--accent); }
.theme-toggle .icon { position: absolute; transition: transform .5s var(--spring), opacity .3s; }
.theme-toggle .i-sun { transform: translateY(0) rotate(0); }
.theme-toggle .i-moon { transform: translateY(150%) rotate(-90deg); opacity: 0; }
[data-theme="dark"] .theme-toggle .i-sun { transform: translateY(-150%) rotate(90deg); opacity: 0; }
[data-theme="dark"] .theme-toggle .i-moon { transform: translateY(0) rotate(0); opacity: 1; }
.menu-btn { display: none; }
/* very small phones (≤360px): the brand must shrink instead of pushing the header wider than the screen */
.brand { min-width: 0; }
.brand > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 360px) {
  .nav-shell { gap: 6px; padding-inline: 6px; }
  .brand { font-size: .9rem; gap: 6px; padding-inline-end: 0; }
  .brand .mascot { width: 38px; height: 38px; }
  .brand small { display: none; }
  .nav-actions { gap: 6px; }
  .nav-actions .theme-toggle { width: 40px; height: 40px; }
}
.menu-btn:hover, .adm-menu:hover { transform: none; }

@media (max-width: 1020px) {
  .nav, .nav-actions .btn-cta { display: none; }
  .menu-btn { display: grid; }
  .nav-actions { margin-inline-start: auto; }
}

/* mobile sheet */
.sheet {
  position: fixed; inset: 0; z-index: 60; display: grid; align-items: end; visibility: hidden;
}
.sheet::before { content: ""; position: absolute; inset: 0; background: rgba(4, 8, 20, .5); backdrop-filter: blur(4px); opacity: 0; transition: opacity .35s; }
.sheet-panel {
  position: relative; background: var(--surface); border-radius: 28px 28px 0 0; padding: 14px 20px calc(24px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform .45s var(--ease); max-height: 88vh; overflow: auto;
}
.sheet-panel::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 9px; background: var(--line-strong); margin: 0 auto 14px; }
.sheet.open { visibility: visible; }
.sheet.open::before { opacity: 1; }
.sheet.open .sheet-panel { transform: none; }
.sheet nav { display: grid; gap: 4px; }
.sheet nav a { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 16px; font-weight: 700; font-size: 1.08rem; }
.sheet nav a .icon { color: var(--accent); width: 22px; height: 22px; }
.sheet nav a:hover, .sheet nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.sheet .btn { width: 100%; margin-top: 12px; }

/* ---------- hero ---------- */
/* overflow: clip — the rotating badge layer is a square whose corners poke ~70px out while it turns;
   clip (unlike hidden) creates no scroll container, so nothing becomes horizontally scrollable */
.hero { padding-block: clamp(40px, 7vw, 90px) clamp(40px, 6vw, 70px); overflow: clip; }
.hero-grid { display: grid; grid-template-columns: 1.08fr .92fr; gap: clamp(24px, 4vw, 64px); align-items: center; }
.status-pill {
  display: inline-flex; align-items: center; gap: .6em; padding: .4em 1em .4em .8em; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--line); font-size: .85rem; font-weight: 600; color: var(--text-2);
}
.status-pill b { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 rgba(18, 164, 107, .6); animation: ping 2s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 10px rgba(18, 164, 107, 0); } 100% { box-shadow: 0 0 0 0 rgba(18, 164, 107, 0); } }
.hero h1 { margin: 22px 0 18px; }
.hero h1 .h1-brand { display: block; font-size: clamp(1rem, 1.6vw, 1.2rem); font-weight: 700; color: var(--brand-ink); margin-bottom: .5rem; letter-spacing: 0; }
.hero h1 .h1-main { display: block; font-size: clamp(2.2rem, 5.6vw, 4.1rem); font-weight: 900; line-height: 1.25; letter-spacing: -.02em; }
.hero .lead { font-size: clamp(1rem, 1.4vw, 1.15rem); color: var(--text-2); max-width: 54ch; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.stats { display: flex; gap: clamp(18px, 4vw, 44px); margin-top: 40px; flex-wrap: wrap; }
.stat strong { display: block; font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 900; line-height: 1.1; color: var(--text); }
.stat span { font-size: .85rem; color: var(--muted); }
.stat + .stat { padding-inline-start: clamp(18px, 4vw, 44px); border-inline-start: 1px solid var(--line); }

.hero-visual { position: relative; aspect-ratio: 1; max-width: 540px; width: 100%; margin-inline: auto; }
/* the spinning layers are circles: round them so their rotated box hugs the orbit */
.orbit-spin { border-radius: 50%; }
.orbit { position: absolute; inset: 0; border-radius: 50%; border: 1px dashed var(--line-strong); }
.orbit-2 { inset: 13%; border-style: solid; border-color: var(--line); }
.orbit-spin { position: absolute; inset: 0; animation: spin 40s linear infinite; }
.orbit-spin.rev { inset: 13%; animation-duration: 30s; animation-direction: reverse; }
.orbit-spin .tech {
  position: absolute; top: 50%; left: 50%; translate: -50% -50%;
  transform: rotate(var(--a)) translate(var(--r)) rotate(calc(-1 * var(--a)));
}
.orbit-spin .tech > span {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); font: 700 .8rem/1.4 var(--mono); direction: ltr;
  animation: spin 40s linear infinite reverse; white-space: nowrap;
}
.orbit-spin.rev .tech > span { animation-duration: 30s; animation-direction: normal; }
.tech i { width: 8px; height: 8px; border-radius: 3px; background: var(--c, var(--accent)); }
@keyframes spin { to { transform: rotate(360deg); } }
.mascot-stage {
  position: absolute; inset: 24%; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, rgba(0, 127, 255, .25), transparent 70%);
  display: grid; place-items: center;
}
.mascot-stage .mascot { width: 100%; height: 100%; filter: drop-shadow(0 30px 40px rgba(29, 55, 133, .35)); animation: bob 6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-10px) rotate(-1.5deg); } }

.code-card {
  position: absolute; inset-inline-start: -6%; bottom: 2%; width: min(320px, 70%); direction: ltr; text-align: left;
  background: #0b1430; color: #d6e2ff; border-radius: 16px; border: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 0 30px 60px -20px rgba(4, 10, 30, .6); font: 500 .78rem/1.75 var(--mono); overflow: hidden;
  animation: bob 7s ease-in-out infinite reverse;
}
.code-card .bar { display: flex; gap: 6px; padding: 10px 12px; background: rgba(255, 255, 255, .04); border-bottom: 1px solid rgba(255, 255, 255, .06); }
.code-card .bar i { width: 10px; height: 10px; border-radius: 50%; background: #ff5f57; }
.code-card .bar i:nth-child(2) { background: #febc2e; }
.code-card .bar i:nth-child(3) { background: #28c840; }
.code-card .bar span { margin-left: auto; font-size: .7rem; color: #7d8ab0; }
.code-card pre { margin: 0; padding: 12px 14px 14px; min-height: 9.5em; white-space: pre-wrap; }
.code-card .k { color: #7fb4ff; } .code-card .s { color: #8ef0b0; } .code-card .n { color: #ffcf6b; } .code-card .c { color: #6b7aa6; } .code-card .f { color: #5ee0ff; }
.caret { display: inline-block; width: 7px; height: 1.1em; background: var(--cyan); vertical-align: -2px; animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.float-badge {
  position: absolute; inset-inline-end: -4%; top: 2%; display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); font-size: .82rem; font-weight: 700;
  animation: bob 5s ease-in-out infinite;
}
.float-badge .score { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font: 800 .85rem var(--mono); color: var(--success); background: conic-gradient(var(--success) 100%, transparent 0); position: relative; }
.float-badge .score::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--surface); }
.float-badge .score span { position: relative; }
.float-badge small { display: block; font-weight: 500; color: var(--muted); font-size: .72rem; }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-visual { max-width: 420px; order: -1; margin-bottom: -10px; }
  .code-card { inset-inline-start: 0; width: 62%; font-size: .68rem; }
  .float-badge { inset-inline-end: 0; }
}
@media (max-width: 480px) {
  .hero-visual { max-width: 340px; }
  .code-card { display: none; }
  .stat + .stat { padding-inline-start: 18px; }
  /* compact score badge tucked into the empty top corner, so it no longer covers the orbit badges */
  .float-badge { top: -3%; inset-inline-end: -3%; padding: 5px 10px 5px 6px; gap: 6px; font-size: .72rem; border-radius: 14px; z-index: 2; }
  .float-badge small { display: none; }
  .float-badge .score { width: 32px; height: 32px; font-size: .72rem; }
}

/* ---------- marquee ---------- */
.marquee { position: relative; overflow: hidden; padding-block: 18px; border-block: 1px solid var(--line); background: var(--glass); mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); }
.marquee-track { display: flex; gap: 14px; width: max-content; animation: marquee 38s linear infinite; direction: ltr; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font: 700 .88rem var(--mono); color: var(--text-2); white-space: nowrap; }
.marquee-track span i { width: 8px; height: 8px; border-radius: 3px; background: var(--c, var(--accent)); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- cards: shared ---------- */
.card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); overflow: hidden; isolation: isolate;
  transition: transform .45s var(--ease), box-shadow .45s var(--ease), border-color .3s;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow); border-color: var(--line-strong); }
/* cursor spotlight (JS sets --mx/--my) */
.spot::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), var(--accent-soft), transparent 45%);
}
.spot:hover::after { opacity: 1; }
.stretched::before { content: ""; position: absolute; inset: 0; z-index: 2; }

/* ---------- services bento ---------- */
.bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: 18px; }
.bento .svc { grid-column: span 2; }
.svc { display: flex; flex-direction: column; padding: 28px; min-height: 270px; }
.bento .svc:nth-child(1) { grid-column: span 4; grid-row: span 2; }
/* balance the last row for 4 or 5 services */
.bento .svc:nth-child(4):last-child { grid-column: span 6; min-height: 0; display: grid; grid-template-columns: auto 1fr auto; column-gap: 22px; align-items: center; }
.bento .svc:nth-child(4):last-child .svc-icon { grid-row: span 2; }
.bento .svc:nth-child(4):last-child .more { grid-row: 1 / span 2; grid-column: 3; }
.bento .svc:nth-child(4):last-child .svc-icon { margin: 0; }
.bento .svc:nth-child(4):last-child .more { margin: 0 auto 0 0; padding: 0; }
.bento .svc:nth-child(4):nth-last-child(2), .bento .svc:nth-child(5):last-child { grid-column: span 3; }
.bento .svc:nth-child(1) .svc-art { flex: 1; min-height: 200px; margin: 18px -28px -28px; }
.svc-icon {
  width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; color: #fff; margin-bottom: 18px;
  background: linear-gradient(135deg, var(--cyan), var(--accent) 50%, var(--navy));
  box-shadow: 0 12px 24px -10px rgba(0, 127, 255, .7); transition: transform .5s var(--spring);
}
.svc-icon .icon { width: 26px; height: 26px; }
.svc:hover .svc-icon { transform: rotate(-8deg) scale(1.08); }
.svc h3 { font-size: 1.25rem; margin-bottom: .3em; }
.svc p { color: var(--text-2); font-size: .93rem; margin: 0; }
.svc .more { margin-top: auto; padding-top: 18px; display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 700; font-size: .9rem; }
.svc .more .icon { transition: transform .3s var(--spring); }
.svc:hover .more .icon { transform: translateX(-5px); }
.svc-art { position: relative; overflow: hidden; border-top: 1px solid var(--line); background: var(--surface-2); }
.svc-art img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.svc:hover .svc-art img { transform: scale(1.05); }
@media (max-width: 900px) {
  .bento { grid-template-columns: repeat(2, 1fr); }
  .svc, .bento .svc:nth-child(1) { grid-column: span 2; grid-row: auto; }
}
/* mobile: one column; doubled pseudo-classes outrank the desktop last-row rules */
@media (max-width: 900px) { .bento .svc:nth-child(n):nth-child(n):nth-child(n) { grid-column: 1 / -1; display: flex; flex-direction: column; min-height: 0; } .bento .svc:nth-child(n):nth-child(n) .svc-icon { margin: 0 0 18px; } .bento .svc:nth-child(n):nth-child(n) .more { margin-top: auto; padding-top: 18px; } }

/* ---------- process steps ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; counter-reset: step; position: relative; }
.step { padding: 26px; border-radius: var(--radius); background: var(--glass); border: 1px solid var(--line); position: relative; }
.step::before {
  counter-increment: step; content: "۰" counter(step, persian);
  font: 900 2.6rem/1 var(--font); display: block; margin-bottom: 14px;
  background: linear-gradient(180deg, var(--accent), transparent 120%); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.step h3 { font-size: 1.08rem; margin-bottom: .3em; }
.step p { color: var(--text-2); font-size: .9rem; margin: 0; }
.steps::before {
  content: ""; position: absolute; top: 52px; inset-inline: 8%; height: 2px; z-index: -1;
  background: linear-gradient(90deg, transparent, var(--accent), var(--cyan), transparent); opacity: .4;
}
@media (max-width: 900px) { .steps { grid-template-columns: 1fr 1fr; } .steps::before { display: none; } }
@media (max-width: 520px) { .steps { grid-template-columns: 1fr; } }

/* ---------- portfolio ---------- */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
@media (max-width: 1000px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.project { padding: 12px; border-radius: var(--radius-lg); }
.browser { border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.browser .chrome { display: flex; align-items: center; gap: 6px; height: 30px; padding-inline: 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); direction: ltr; }
.browser .chrome i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); }
.browser .chrome i:nth-child(1) { background: #ff5f57; } .browser .chrome i:nth-child(2) { background: #febc2e; } .browser .chrome i:nth-child(3) { background: #28c840; }
.browser .chrome span { flex: 1; margin-left: 8px; height: 16px; border-radius: 6px; background: var(--surface); font: 500 .66rem/16px var(--mono); color: var(--muted); padding-inline: 8px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.browser .viewport { aspect-ratio: 4 / 3; overflow: hidden; }
.browser .viewport img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: object-position 3s var(--ease), transform .8s var(--ease); }
.project:hover .viewport img { object-position: bottom; }
.project .meta { padding: 16px 8px 8px; }
.project h3 { font-size: 1.12rem; margin: 0 0 .15em; }
.project p { margin: 0; color: var(--muted); font-size: .88rem; }

/* ---------- books ---------- */
.book { text-align: center; padding: 26px 22px 22px; background: linear-gradient(180deg, var(--surface-2), var(--surface)); }
.book .cover {
  position: relative; width: 78%; margin: 0 auto 20px; perspective: 900px;
}
.book .cover img {
  border-radius: 6px 14px 14px 6px; box-shadow: -14px 18px 30px -12px rgba(13, 22, 49, .45), inset 4px 0 0 rgba(255, 255, 255, .25);
  transform: rotateY(-14deg) rotateX(4deg); transition: transform .7s var(--spring);
}
.book:hover .cover img { transform: rotateY(0) rotateX(0) scale(1.03); }
.book h3 { font-size: 1.02rem; margin-bottom: .2em; }
.book p { margin: 0; font-size: .85rem; color: var(--muted); }

/* ---------- team ---------- */
.member { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; padding: 26px; }
.avatar {
  --s: 92px; width: var(--s); height: var(--s); border-radius: 30% 70% 62% 38% / 42% 38% 62% 58%;
  display: grid; place-items: center; font-size: calc(var(--s) * .34); font-weight: 900; color: #fff;
  background: linear-gradient(135deg, var(--cyan), var(--accent) 45%, var(--navy));
  box-shadow: 0 16px 30px -12px rgba(0, 127, 255, .6); overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.member:hover .avatar, .page-hero .avatar { animation: morph 10s ease-in-out infinite; }
@keyframes morph { 50% { border-radius: 58% 42% 35% 65% / 55% 62% 38% 45%; } }
.member h3 { font-size: 1.2rem; margin-bottom: .2em; }
.member p { margin: 0; color: var(--text-2); font-size: .9rem; }
@media (max-width: 520px) { .member { grid-template-columns: 1fr; text-align: center; justify-items: center; } }

/* ---------- posts ---------- */
.post { display: flex; flex-direction: column; }
.post .thumb { aspect-ratio: 16 / 10; overflow: hidden; background: var(--surface-2); }
.post .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.post:hover .thumb img { transform: scale(1.06); }
.post .body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.post h3 { font-size: 1.08rem; line-height: 1.6; margin: .6em 0 .5em; }
.post h3 a { background: linear-gradient(var(--accent), var(--accent)) no-repeat 100% 100% / 0 2px; transition: background-size .4s var(--ease); }
.post:hover h3 a { background-size: 100% 2px; }
.post p { color: var(--text-2); font-size: .9rem; margin: 0 0 1em; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: auto; font-size: .8rem; color: var(--muted); }
.post-meta span { display: inline-flex; align-items: center; gap: 5px; }
.post-meta .icon { width: 15px; height: 15px; }
.post.featured { grid-column: span 2; flex-direction: row; }
.post.featured .thumb { flex: 1.1; aspect-ratio: auto; min-height: 320px; }
.post.featured .body { flex: 1; padding: 32px; justify-content: center; }
.post.featured h3 { font-size: 1.5rem; }
@media (max-width: 1000px) { .post.featured { grid-column: span 2; } }
@media (max-width: 700px) { .post.featured { grid-column: auto; flex-direction: column; } .post.featured .thumb { min-height: 0; aspect-ratio: 16/10; } .post.featured .body { padding: 20px 22px 22px; } }

/* ---------- CTA band ---------- */
.cta-band {
  position: relative; overflow: hidden; border-radius: 36px; padding: clamp(36px, 6vw, 72px);
  background: radial-gradient(120% 140% at 0% 0%, #18c8ff 0%, transparent 45%), linear-gradient(135deg, #007FFF, #1D3785 70%);
  color: #fff; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 32px;
  box-shadow: var(--shadow-lg);
}
.cta-band::before {
  content: ""; position: absolute; inset: 0; opacity: .25;
  background-image: radial-gradient(rgba(255, 255, 255, .6) 1px, transparent 1px); background-size: 22px 22px;
  mask-image: linear-gradient(90deg, #000, transparent 70%);
}
.cta-band h2 { font-size: clamp(1.6rem, 3.6vw, 2.6rem); margin-bottom: .3em; position: relative; }
.cta-band p { opacity: .85; max-width: 52ch; margin: 0; position: relative; }
.cta-band .actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; position: relative; }
.cta-band .btn-light { background: #fff; color: var(--navy); }
.cta-band .btn-light:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -12px rgba(0, 0, 0, .5); }
.cta-band .btn-line { color: #fff; border: 1px solid rgba(255, 255, 255, .45); background: rgba(255, 255, 255, .08); }
.cta-band .btn-line:hover { background: rgba(255, 255, 255, .18); }
.cta-band .mascot { width: clamp(140px, 18vw, 230px); height: auto; position: relative; transform: rotate(8deg); filter: drop-shadow(0 30px 30px rgba(0, 0, 0, .35)); }
@media (max-width: 720px) { .cta-band { grid-template-columns: 1fr; } .cta-band .mascot { position: absolute; inset-inline-end: -40px; bottom: -40px; opacity: .25; } }

/* ---------- footer ---------- */
.site-footer { margin-top: clamp(60px, 8vw, 100px); border-top: 1px solid var(--line); background: var(--glass); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.3fr; gap: 36px; padding-block: 56px 36px; }
.footer-grid h3 { font-size: .95rem; margin-bottom: 1em; color: var(--text); }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.footer-grid a { color: var(--text-2); font-size: .92rem; transition: color .2s; }
.footer-grid a:hover { color: var(--accent); }
.footer-about p { color: var(--text-2); font-size: .9rem; margin-top: 14px; }
.contact-line { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); font-size: .9rem; margin-bottom: 12px; }
.contact-line .icon { color: var(--accent); margin-top: 5px; }
.socials { display: flex; gap: 8px; margin-top: 16px; }
.socials a { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); transition: all .25s var(--spring); }
.socials a:hover { color: #fff; background: var(--accent); border-color: var(--accent); transform: translateY(-3px); }
.footer-bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-block: 20px; border-top: 1px solid var(--line); font-size: .82rem; color: var(--muted); }
.footer-bottom { align-items: center; }
.footer-bottom a:not(.credit):hover { color: var(--accent); }

/* izisys credit: gradient-border pill (padding-box/border-box trick, no extra wrapper) */
.credit {
  --g: linear-gradient(110deg, var(--cyan), var(--accent) 45%, #7b5cff);
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 14px 5px 6px; border-radius: 999px;
  border: 1.5px solid transparent; color: var(--text-2); font-weight: 600; white-space: nowrap;
  background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--g) border-box;
  transition: transform .3s var(--spring), box-shadow .3s var(--ease), color .2s;
}
.credit-ic {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--g); flex: none;
}
.credit-ic .icon { width: 14px; height: 14px; stroke-width: 2.2; }
.credit-domain {
  font: 700 .8rem var(--mono); unicode-bidi: isolate;
  background: var(--g); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.credit-go { width: 14px; height: 14px; color: var(--accent); transition: transform .3s var(--spring); }
.credit:hover { color: var(--text); transform: translateY(-2px); box-shadow: 0 10px 24px -10px rgba(0, 127, 255, .55); }
.credit:hover .credit-go { transform: translateX(-4px); }
@media (max-width: 520px) {
  .footer-bottom { justify-content: center; text-align: center; }
  .credit { font-size: .72rem; gap: 6px; padding-inline-end: 12px; }
  .credit-domain { font-size: .72rem; }
  .credit-go { display: none; }
  .credit { max-width: 100%; }
}
@media (max-width: 340px) { .credit { white-space: normal; text-align: start; } }
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- inner page header ---------- */
.page-hero { padding-block: clamp(36px, 6vw, 72px) clamp(24px, 4vw, 40px); }
.page-hero h1 { font-size: clamp(1.9rem, 4.4vw, 3.1rem); font-weight: 900; margin: .3em 0 .35em; }
.page-hero .lead { color: var(--text-2); font-size: 1.08rem; max-width: 64ch; margin: 0; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .84rem; color: var(--muted); list-style: none; padding: 0; margin: 0; }
.crumbs li { display: inline-flex; align-items: center; gap: 6px; }
.crumbs li + li::before { content: ""; width: 6px; height: 6px; border-inline-start: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(45deg); opacity: .6; margin-inline-end: 4px; }
.crumbs a:hover { color: var(--accent); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 24px; }
.search-box { display: flex; align-items: center; gap: 8px; height: 46px; padding-inline: 16px 6px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-strong); min-width: min(100%, 320px); transition: border-color .2s, box-shadow .2s; }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search-box input { flex: 1; border: 0; background: transparent; outline: none; min-width: 0; }
.search-box button { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; cursor: pointer; }

/* ---------- article ---------- */
.reading-progress { position: fixed; top: 0; inset-inline: 0; height: 3px; z-index: 70; background: linear-gradient(90deg, var(--cyan), var(--accent)); transform-origin: 100% 50%; transform: scaleX(0); }
.article-head { max-width: 860px; }
.article-head .post-meta { font-size: .88rem; margin-top: 18px; gap: 10px 22px; }
.cover-figure { margin: 8px 0 0; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--surface-2); }
.cover-figure img { width: 100%; max-height: 560px; object-fit: contain; background: var(--surface-2); }
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 48px; align-items: start; margin-top: 40px; }
.article-layout.no-aside { grid-template-columns: minmax(0, 820px); justify-content: center; }
@media (max-width: 1000px) { .article-layout { grid-template-columns: 1fr; } .aside { order: -1; } }
.aside { position: sticky; top: calc(var(--header-h) + 20px); display: grid; gap: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel h2, .panel h3 { font-size: .95rem; margin-bottom: .8em; display: flex; align-items: center; gap: 8px; }
.toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 50vh; overflow: auto; }
.toc a { display: block; padding: 6px 12px; border-radius: 10px; font-size: .86rem; line-height: 1.7; color: var(--text-2); border-inline-start: 2px solid var(--line); transition: all .2s; }
.toc a.l3 { padding-inline-start: 24px; font-size: .82rem; }
.toc a:hover { color: var(--text); background: var(--surface-2); }
.toc a.active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
@media (max-width: 1000px) { .toc { display: none; } }
.share { display: flex; gap: 8px; flex-wrap: wrap; }
.share a, .share button { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); display: grid; place-items: center; cursor: pointer; color: var(--text-2); transition: all .25s var(--spring); }
.share a:hover, .share button:hover { color: #fff; background: var(--accent); border-color: var(--accent); transform: translateY(-2px); }

.prose { font-size: 1.07rem; line-height: 2.05; color: var(--text); overflow-wrap: anywhere; }
.prose > *:first-child { margin-top: 0; }
.prose h2 { font-size: 1.55rem; margin: 2em 0 .7em; padding-top: .2em; position: relative; }
.prose h2::before { content: ""; position: absolute; inset-inline-start: -18px; top: .55em; width: 6px; height: 1.1em; border-radius: 4px; background: linear-gradient(var(--cyan), var(--accent)); }
.prose h3 { font-size: 1.25rem; margin: 1.6em 0 .6em; }
.prose h4 { font-size: 1.08rem; margin: 1.4em 0 .5em; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.2em; }
.prose ul, .prose ol { padding-inline-start: 1.4em; }
.prose li { margin-bottom: .4em; }
.prose li::marker { color: var(--accent); }
.prose a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.prose a:hover { text-decoration-thickness: 2px; }
.prose strong { font-weight: 800; color: var(--text); }
.prose img { border-radius: var(--radius); margin: 1.6em auto; border: 1px solid var(--line); }
.prose figure { margin: 2em 0; }
.prose figcaption { text-align: center; font-size: .85rem; color: var(--muted); margin-top: .6em; }
.prose blockquote { margin: 1.8em 0; padding: 1.2em 1.4em; border-radius: var(--radius); background: var(--accent-soft); border-inline-start: 4px solid var(--accent); color: var(--text); }
.prose blockquote p:last-child { margin: 0; }
.prose hr { border: 0; height: 1px; background: var(--line-strong); margin: 2.5em 0; }
.prose code { font: .9em var(--mono); padding: .15em .45em; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); direction: ltr; unicode-bidi: isolate; }
.prose pre { direction: ltr; text-align: left; background: #0b1430; color: #d6e2ff; padding: 1.2em 1.4em; border-radius: var(--radius); overflow: auto; font: .88rem/1.8 var(--mono); border: 1px solid rgba(255, 255, 255, .06); margin: 1.6em 0; position: relative; }
.prose pre code { background: none; border: 0; padding: 0; color: inherit; font-size: inherit; }
.prose .table-wrap { overflow-x: auto; margin: 1.6em 0; border: 1px solid var(--line); border-radius: var(--radius); }
.prose table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.prose th, .prose td { padding: .7em 1em; border-bottom: 1px solid var(--line); text-align: start; }
.prose th { background: var(--surface-2); font-weight: 700; }
.prose iframe { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: var(--radius); }
.copy-code { position: absolute; top: 8px; right: 8px; font: 600 .72rem var(--font); padding: 4px 10px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .15); background: rgba(255, 255, 255, .06); color: #d6e2ff; cursor: pointer; }

.facts { display: grid; gap: 10px; margin: 0; }
.facts div { display: flex; justify-content: space-between; gap: 12px; font-size: .88rem; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.facts div:last-child { border: 0; padding: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 700; text-align: end; }

.pager { display: flex; justify-content: center; gap: 8px; margin-top: 48px; flex-wrap: wrap; }
.pager a, .pager span { min-width: 44px; height: 44px; padding-inline: 14px; border-radius: 14px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); font-weight: 700; }
.pager a:hover { border-color: var(--accent); color: var(--accent); }
.pager .current { background: var(--accent); color: #fff; border-color: var(--accent); }

.prev-next { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 48px; }
.prev-next a { padding: 18px 20px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); transition: all .3s var(--ease); }
.prev-next a:hover { border-color: var(--accent); transform: translateY(-3px); }
.prev-next small { color: var(--muted); display: block; font-size: .8rem; }
.prev-next strong { font-size: .95rem; line-height: 1.6; display: block; margin-top: 4px; }
.prev-next .next { text-align: end; }
@media (max-width: 600px) { .prev-next { grid-template-columns: 1fr; } }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-size: .88rem; font-weight: 700; color: var(--text-2); }
.input, .field input, .field textarea, .field select {
  width: 100%; padding: .85em 1.05em; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface);
  transition: border-color .2s, box-shadow .2s; outline: none;
}
.field textarea { min-height: 150px; resize: vertical; line-height: 1.9; }
.input:focus, .field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field .err, .field-validation-error { color: var(--danger); font-size: .82rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }
/* honeypot: visually hidden in place (not pushed 9999px off-page, which can widen the page in RTL) */
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; opacity: 0; pointer-events: none; }
.alert { padding: 14px 18px; border-radius: 14px; margin-bottom: 18px; font-weight: 600; display: flex; gap: 10px; align-items: center; }
.alert-ok { background: rgba(18, 164, 107, .12); color: var(--success); }
.alert-err { background: rgba(229, 72, 77, .12); color: var(--danger); }

/* ---------- contact ---------- */
.contact-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 24px; align-items: start; }
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; } }
.info-cards { display: grid; gap: 14px; }
.info-card { display: flex; gap: 16px; align-items: center; padding: 18px 20px; }
.info-card .ic { width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.info-card small { display: block; color: var(--muted); font-size: .8rem; }
.info-card strong { font-size: 1rem; }
.map-card { position: relative; overflow: hidden; padding: 0; }
.map-art { height: 240px; position: relative; background: var(--surface-2); }
.map-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-pin { position: absolute; left: 50%; top: 46%; translate: -50% -100%; color: var(--accent); filter: drop-shadow(0 8px 10px rgba(0, 127, 255, .45)); animation: pin 2.4s var(--spring) infinite; }
.map-pin .icon { width: 48px; height: 48px; fill: var(--accent); stroke: #fff; }
.map-pin::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 18px; height: 6px; translate: -50% 0; border-radius: 50%; background: rgba(0, 127, 255, .35); }
@keyframes pin { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.directions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 16px; }
.directions a { display: grid; justify-items: center; gap: 6px; padding: 12px 6px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-size: .78rem; font-weight: 700; transition: all .25s var(--spring); }
.directions a:hover { border-color: var(--accent); transform: translateY(-3px); }
.directions img { width: 36px; height: 36px; object-fit: contain; }

/* ---------- 404 ---------- */
.not-found { text-align: center; padding-block: 60px 20px; }
.not-found .mascot { width: 200px; margin: 0 auto 10px; animation: tilt 3s ease-in-out infinite; }
@keyframes tilt { 50% { transform: rotate(-10deg); } }
.not-found .code { font: 900 clamp(4rem, 14vw, 9rem)/1 var(--font); background: linear-gradient(180deg, var(--accent), transparent); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: 24px; } .mt-4 { margin-top: 48px; }
.to-top { position: fixed; inset-inline-start: 18px; bottom: 18px; z-index: 40; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(10px); display: grid; place-items: center; cursor: pointer; color: var(--text); opacity: 0; transform: translateY(20px) scale(.8); transition: all .4s var(--spring); }
.scrolled-far .to-top { opacity: 1; transform: none; }
.to-top:hover { background: var(--accent); color: #fff; }
.toast { position: fixed; bottom: 24px; left: 50%; translate: -50% 0; z-index: 90; background: var(--text); color: var(--bg); padding: 10px 20px; border-radius: 999px; font-weight: 700; font-size: .9rem; box-shadow: var(--shadow); transform: translateY(100px); transition: transform .4s var(--spring); }
.toast.show { transform: none; }
.tag-cloud { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- reveal on scroll ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(28px); transition: opacity .8s var(--ease), transform .8s var(--ease); transition-delay: calc(var(--i, 0) * 80ms); }
.js [data-reveal].in { opacity: 1; transform: none; }

/* ---------- view transitions (cross-document) ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .35s; }
.site-header { view-transition-name: header; }

/* theme switch circular reveal */
::view-transition-old(root.theme), ::view-transition-new(root.theme) { animation: none; mix-blend-mode: normal; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
}

@media print {
  .site-header, .site-footer, .aside, .backdrop, .to-top, .share, .cta-band, .reading-progress { display: none !important; }
  body { background: #fff; color: #000; }
}

@media (max-width: 480px) {
  .orbit-spin .tech > span { font-size: .66rem; padding: 4px 8px; gap: 4px; }
  /* on phones both rings end up at nearly the same radius and their badges collide: keep only the outer ring */
  .orbit-spin.rev, .orbit-2 { display: none; }
  /* a slightly wider ring keeps badges clear of the mascot (overrides the inline radius) */
  .orbit-spin .tech { --r: min(150px, 50vw - 52px) !important; }
}

/* perf: browsers skip layout/paint of off-screen sections until needed (faster first render, less main-thread work) */
.section, .site-footer { content-visibility: auto; contain-intrinsic-size: auto 900px; }
.site-footer { contain-intrinsic-size: auto 420px; }