/* ============================================================
   Hamrood — main stylesheet (public pages)
   Bilingual (RTL/LTR) via CSS logical properties.
   Light: white + Hamrood blue |   Dark: night sky + bright blue
   ============================================================ */

/* ---------- fonts (loaded in <head>, stacks defined here) ---------- */
:root {
  --font-fa: 'Vazirmatn', 'Inter', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  --font-en: 'Inter', 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* light theme (default) — Hamrood blue */
  --bg: #f4f8fe;
  --bg-soft: #e9f1fc;
  --surface: #ffffff;
  --surface-2: #eef4fd;
  --text: #0c1e3d;
  --text-soft: #41587d;
  --muted: #7d92b6;
  --primary: #1d4ed8;
  --primary-strong: #173db3;
  --primary-soft: #dbeafe;
  --accent: #3b82f6;
  --gold: #f59e0b;
  --border: #d4e2f5;
  --shadow: 0 10px 30px rgba(29, 78, 216, .09);
  --shadow-lg: 0 18px 45px rgba(29, 78, 216, .17);
  --ok: #16a34a;
  --danger: #dc2626;
  --nav-bg: rgba(255, 255, 255, .84);
  --hero-grad: linear-gradient(165deg, #e8f1fe 0%, #f7fbff 52%, #d8e8fd 100%);
  --sky: #d4e6fc;
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 68px;
  --container: 1180px;
}

[data-theme="dark"] {
  --bg: #060c18;
  --bg-soft: #0a1424;
  --surface: #0d1729;
  --surface-2: #122038;
  --text: #e4eefc;
  --text-soft: #a6bad9;
  --muted: #64809f;
  --primary: #5b9cf8;
  --primary-strong: #8dbdfb;
  --primary-soft: #14294d;
  --accent: #4f8ef6;
  --gold: #fbbf24;
  --border: #1b2d4d;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 45px rgba(0, 0, 0, .5);
  --nav-bg: rgba(7, 13, 25, .84);
  --hero-grad: linear-gradient(165deg, #071224 0%, #0a1830 55%, #0d2140 100%);
  --sky: #0b1a33;
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 14px); }

body {
  margin: 0;
  font-family: var(--font-fa);
  font-size: 16px;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg);
  transition: background .35s ease, color .35s ease;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

html[lang="en"] body { font-family: var(--font-en); line-height: 1.7; }

img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-strong); }

h1, h2, h3, h4 { line-height: 1.4; margin: 0 0 .6em; font-weight: 800; }
p { margin: 0 0 1em; }

.container { width: min(100% - 40px, var(--container)); margin-inline: auto; }

::selection { background: var(--primary); color: #fff; }

/* scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-soft); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: 12px; border: 1px solid transparent;
  font: inherit; font-weight: 700; font-size: .95rem; cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s;
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 18px rgba(29, 78, 216, .35); }
.btn-primary:hover { background: var(--primary-strong); color: #fff; transform: translateY(-2px); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-2px); }
.btn-sm { padding: 7px 14px; font-size: .85rem; border-radius: 9px; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ---------- header / nav ---------- */
/* sticky (in-flow) so an optional top banner can live above it:
   the banner scrolls away, then the navbar sticks to the top. */
.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: var(--nav-bg);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, box-shadow .3s;
}
.site-header.scrolled { border-bottom-color: var(--border); box-shadow: 0 4px 24px rgba(0,0,0,.06); }

.nav { display: flex; align-items: center; gap: 18px; height: var(--nav-h); }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 1.25rem; color: var(--text); }
.brand:hover { color: var(--text); }
.brand .logo { width: 36px; height: 36px; flex: none; }
.brand b { color: var(--primary); }

/* v0.5: official logo assets — blue tile in the light theme, black tile in the dark */
[data-theme="light"] img.only-dark { display: none; }
[data-theme="dark"] img.only-light { display: none; }

.nav-links { display: flex; align-items: center; gap: 4px; margin-inline-start: 12px; list-style: none; padding: 0; margin-block: 0; }
.nav-links a {
  display: block; padding: 8px 13px; border-radius: 10px;
  color: var(--text-soft); font-weight: 600; font-size: .95rem;
}
.nav-links a:hover, .nav-links a.active { color: var(--primary); background: var(--primary-soft); }

.nav-actions { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 11px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  transition: transform .2s, color .2s, border-color .2s, background .2s;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.icon-btn svg { width: 19px; height: 19px; }

.lang-btn { width: auto; padding-inline: 12px; font: inherit; font-weight: 700; font-size: .85rem; gap: 6px; }
.lang-btn svg { width: 16px; height: 16px; }

/* theme icons: show only the active one */
.theme-btn .icon-sun { display: none; }
.theme-btn .icon-moon { display: block; }
[data-theme="dark"] .theme-btn .icon-sun { display: block; }
[data-theme="dark"] .theme-btn .icon-moon { display: none; }

.burger { display: none; }

/* mobile nav (top follows the header, which may sit below the banner) */
.mobile-menu {
  position: fixed; top: var(--hdr-bottom, var(--nav-h)); inset-inline: 0; z-index: 99;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 10px 20px 18px; display: none; box-shadow: var(--shadow-lg);
}
.mobile-menu.open { display: block; }
.mobile-menu a { display: block; padding: 12px 10px; border-radius: 10px; color: var(--text); font-weight: 700; border-bottom: 1px dashed var(--border); }
.mobile-menu a:last-child { border-bottom: 0; }
.mobile-menu a:hover { background: var(--primary-soft); color: var(--primary); }

/* ---------- hero ---------- */
/* header is in normal flow now -> no extra top padding needed */
.hero {
  position: relative; overflow: hidden;
  padding: 52px 0 78px;
  background: var(--hero-grad);
}
/* v0.4.1: v0.3.1 grid back — and the scene now floats CENTERED in its
   own wide column, with even breathing room between it and the text */
.hero-inner { display: grid; grid-template-columns: minmax(0, .88fr) minmax(0, 1.32fr); gap: 34px; align-items: center; }

/* light entrance animation (opacity/transform only -> GPU friendly) */
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.hero-inner > div:first-child > * { animation: fadeUp .65s ease both; }
.hero-inner > div:first-child > *:nth-child(1) { animation-delay: .05s; }
.hero-inner > div:first-child > *:nth-child(2) { animation-delay: .14s; }
.hero-inner > div:first-child > *:nth-child(3) { animation-delay: .23s; }
.hero-inner > div:first-child > *:nth-child(4) { animation-delay: .32s; }
.hero-inner > div:first-child > *:nth-child(5) { animation-delay: .41s; }
/* art enters FROM THE LEFT (bigger scene, gently centered) */
@keyframes fadeFromLeft { from { opacity: 0; transform: translateX(-56px); } to { opacity: 1; transform: none; } }
.hero-art { animation: fadeFromLeft .95s cubic-bezier(.18, .74, .26, 1) .18s both; }

/* keep the scene on the visual LEFT in English (LTR) too — and keep it
   in the WIDE track: the order swap must swap the grid template as well,
   otherwise the scene shrinks to the narrow .88fr column in English */
[dir="ltr"] .hero-inner .hero-art { order: -1; }
@media (min-width: 1025px) {
  [dir="ltr"] .hero-inner { grid-template-columns: minmax(0, 1.32fr) minmax(0, .88fr); }
}

/* v0.4.1: no more edge-hugging — the old wide-screen translate that
   pulled the scene toward the viewport edge is gone; it sits centered. */

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--primary-soft); color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
  padding: 7px 16px; border-radius: 999px; font-size: .85rem; font-weight: 700;
  margin-bottom: 22px;
}
.hero-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 1.6s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(22,163,74,.45);} 55% { box-shadow: 0 0 0 7px rgba(22,163,74,0);} }

.hero h1 { font-size: clamp(1.9rem, 4.2vw, 3rem); margin-bottom: 18px; letter-spacing: -.5px; text-wrap: balance; }
.hero h1 .hl { color: var(--primary); position: relative; }
.hero .lead { font-size: 1.08rem; color: var(--text-soft); max-width: 58ch; margin-bottom: 30px; text-wrap: pretty; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-tags { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 34px; }
.hero-tags span {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-soft); font-size: .82rem; font-weight: 700;
  padding: 6px 13px; border-radius: 999px; box-shadow: var(--shadow);
  transition: transform .2s, color .2s, border-color .2s;
}
.hero-tags span:hover { transform: translateY(-3px); color: var(--primary); border-color: var(--primary); }
.hero-tags svg { width: 14px; height: 14px; color: var(--primary); }

/* v0.4.1: the scene floats CENTERED in its column (RTL and LTR alike),
   with an even gap to the text instead of sticking to the viewport edge */
.hero-art { display: flex; justify-content: center; position: relative; }
/* v0.3.2: a soft halo in the page's own blue — the scene grows out of
   the hero background instead of sitting on it like a video player */
.hero-art::before {
  content: ""; position: absolute; inset: -7% -5%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--primary) 9%, transparent), transparent 74%);
  border-radius: 50%;
  pointer-events: none;
}

/* ============================================================
   HERO — flat 2D CI/CD river (v0.4.3)
   A side-view illustration: sun, clouds, birds, hills and a
   three-layer parallax river carrying container barges through
   the git -> build -> test -> deploy gates. One inline SVG,
   animated with CSS transform/opacity only -> GPU composited,
   no 3D layer explosion, tiny CPU/GPU cost. Frameless: the
   edges melt into the hero gradient through a static SVG mask.
   Gate pulses fire exactly when a barge crosses (timings are
   computed from the shared 34s journey — see README table).
   ============================================================ */
.scn2d {
  /* ---- palette ---- */
  --w-top:#8ec1f8; --w-mid:#4b8fe9; --w-deep:#1d4ed8;
  --wave-far:#aacdf8; --wave-mid:#7bb0f5; --wave-near:#3a7fe8;
  --hill-far:#c4dcf9; --hill-near:#aed0f6;
  --mtn-far:#cfe4fc; --mtn-far-f:#bcd6f9; --mtn-near:#a8ccf7; --mtn-near-f:#8fb9f1;
  --mtn-wall:#8db4ee; --mtn-wall-f:#7aa5ea; --mtn-snow:#ffffff;
  --cloud-c:#ffffff; --sun-c:#ffd98e; --hull-c:#2b4a77;
  --bird-c:rgba(30,58,95,.5);
  --hz-bot:#edf4fd;
  /* ---- tunables (see README) ---- */
  --b-sail:34s;      /* one full downstream journey per barge */
  --wave-k:1;        /* global wave speed multiplier          */
  --glow-k:1;        /* green glow intensity after TEST       */
  position: relative;
  width: min(100%, 880px);
}
[data-theme="dark"] .scn2d {
  --w-top:#16386a; --w-mid:#102c58; --w-deep:#0a2044;
  --wave-far:#1c4178; --wave-mid:#17396c; --wave-near:#102c5c;
  --hill-far:#0d2039; --hill-near:#112b50;
  --mtn-far:#0d2140; --mtn-far-f:#0a1b35; --mtn-near:#132c52; --mtn-near-f:#0f2547;
  --mtn-wall:#1a3a68; --mtn-wall-f:#163159; --mtn-snow:#cfe2ff;
  --cloud-c:#152845; --sun-c:#f2c36a; --hull-c:#0f2038;
  --bird-c:rgba(150,185,230,.45);
  --hz-bot:#0b1c36;
}
/* frameless: sides dissolve via ONE css mask layer (the proven v0.3.2
   pattern — never stack masks), bottom melts via the fadebot gradient */
.scn2d svg {
  display: block; width: 100%; height: auto; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 11%, #000 89%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 11%, #000 89%, transparent 100%);
}

/* gradient stops (theme-aware) */
.scn2d .hg2-w1 { stop-color: var(--w-top); }
.scn2d .hg2-w2 { stop-color: var(--w-mid); }
.scn2d .hg2-w3 { stop-color: var(--w-deep); }
.scn2d .hg2-hz2 { stop-color: var(--hz-bot); }
.scn2d .hg2-su1 { stop-color: rgba(255,206,112,.9); }
.scn2d .hg2-su2 { stop-color: rgba(255,206,112,.32); }
.scn2d .hg2-su3 { stop-color: rgba(255,206,112,0); }
[data-theme="dark"] .scn2d .hg2-su1 { stop-color: rgba(150,188,255,.55); }
[data-theme="dark"] .scn2d .hg2-su2 { stop-color: rgba(150,188,255,.16); }
[data-theme="dark"] .scn2d .hg2-su3 { stop-color: rgba(150,188,255,0); }
.scn2d .hg2-sh1 { stop-color: rgba(9,24,58,.30); }
.scn2d .hg2-sh2 { stop-color: rgba(9,24,58,0); }
.scn2d .hg2-gl1 { stop-color: rgba(34,197,110,.5); }
.scn2d .hg2-gl2 { stop-color: rgba(34,197,110,0); }

/* ---- sky ---- */
.scn-sun { opacity:.85; transform-box: fill-box; transform-origin: center; animation: sunBreathe 7.5s ease-in-out infinite; }
[data-theme="dark"] .scn-sun { opacity:.42; }
.scn-sun-core { fill: var(--sun-c); }
@keyframes sunBreathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }

.scn-star { fill:#cfe2ff; animation: twinkle 3s ease-in-out infinite; }
[data-theme="light"] .scn-star { display: none; }
@keyframes twinkle { 0%,100% { opacity:.25; } 50% { opacity:1; } }

.scn-cloud { fill: var(--cloud-c); opacity:.9; transform-box: fill-box; will-change: transform;
  animation: cloudDrift var(--cd,110s) linear infinite; animation-delay: var(--co,0s); }
@keyframes cloudDrift { from { transform: translateX(-170px); } to { transform: translateX(1070px); } }

.scn-bird path { fill:none; stroke: var(--bird-c); stroke-width:2; stroke-linecap:round; }
.scn-bird { will-change: transform; animation: birdFly var(--bf,34s) linear infinite; animation-delay: var(--bo,0s); }
@keyframes birdFly { from { transform: translateX(-60px); } to { transform: translateX(1020px); } }

/* ---- horizon ---- */
.scn-hill.far  { fill: var(--hill-far); }
.scn-hill.near { fill: var(--hill-near); }

/* ---- v0.5: faceted mountains around the river (the logo's landscape) ----
   Static silhouette layers: far = hazy, near = mid, wall = closest flank.
   Bases run under the water rect; no animation, zero runtime cost; the
   scene's single side mask dissolves them at the edges like everything else. */
.scn-mtn.far  { fill: var(--mtn-far); }
.scn-mtn.near { fill: var(--mtn-near); }
.scn-mtn.wall { fill: var(--mtn-wall); }
.scn-mtn.far  .facet { fill: var(--mtn-far-f); }
.scn-mtn.near .facet { fill: var(--mtn-near-f); }
.scn-mtn.wall .facet { fill: var(--mtn-wall-f); }
.scn-mtn .snow { fill: var(--mtn-snow); opacity:.95; }
[data-theme="dark"] .scn-mtn .snow { opacity:.28; }

/* ---- water: three parallax layers, near = fast (depth cue) ----
   Each layer slides EXACTLY one wavelength (--wl) per cycle, so the
   loop is seamless; the small vertical offsets inside the keyframes
   keep the surface from looking mechanically flat. */
.scn-wave { transform-box: fill-box; will-change: transform;
  animation: waveDrift calc(var(--wd, 11s) / var(--wave-k, 1)) linear infinite; }
.scn-wave.w1 { --wl:260px; fill: var(--wave-far); opacity:.85; }
.scn-wave.w2 { --wl:220px; fill: var(--wave-mid); opacity:.95; }
.scn-wave.w3 { --wl:180px; fill: var(--wave-near); fill-opacity:.92; }
@keyframes waveDrift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(calc(var(--wl) * .25), -2.4px); }
  50%  { transform: translate(calc(var(--wl) * .5), .8px); }
  75%  { transform: translate(calc(var(--wl) * .75), -2px); }
  100% { transform: translate(var(--wl), 0); }
}

/* sun glints drifting on the surface */
.scn-shine { fill:#fff; opacity:0; transform-box: fill-box; transform-origin: center;
  animation: shine var(--sd, 5s) ease-in-out infinite; animation-delay: var(--so, 0s); }
@keyframes shine {
  0%,100% { opacity:0; transform: translateX(0) scaleX(.7); }
  50%     { opacity:.5; transform: translateX(9px) scaleX(1.15); }
}

/* ---- gates ---- */
.scn-gate { color: var(--gc); }
.g-git    { --gc:#6478f2; }
.g-build  { --gc:#f59e0b; }
.g-test   { --gc:#0ea5c9; }
.g-deploy { --gc:#22a55b; }
[data-theme="dark"] .g-git    { --gc:#8b98fa; }
[data-theme="dark"] .g-build  { --gc:#fbbf24; }
[data-theme="dark"] .g-test   { --gc:#38c2e8; }
[data-theme="dark"] .g-deploy { --gc:#3ec97b; }

.gate-amb { fill: currentColor; opacity:.10; }
.gate-amb.big { opacity:.06; }
.gate-ambwrap { transform-box: fill-box; transform-origin: center; animation: gateBreathe 4.8s ease-in-out infinite; }
.g-build .gate-ambwrap { animation-duration: 5.6s; animation-delay: -1.3s; }
.g-test  .gate-ambwrap { animation-duration: 5.1s; animation-delay: -2.4s; }
.g-deploy .gate-ambwrap { animation-duration: 6s; animation-delay: -.8s; }
@keyframes gateBreathe { 0%,100% { transform: scale(.94); opacity:.75; } 50% { transform: scale(1.08); opacity:1; } }

.gate-post, .gate-beam { fill: currentColor; }
.beam-light { fill:#fff; opacity:.3; }

.gate-foam { fill:#fff; opacity:.38; transform-box: fill-box; transform-origin: center;
  animation: gateFoam2 3.4s ease-in-out infinite; }
.g-build .gate-foam { animation-delay: -1.2s; }
.g-test  .gate-foam { animation-delay: -2.3s; }
.g-deploy .gate-foam { animation-delay: -.7s; }
@keyframes gateFoam2 { 0%,100% { transform: scale(.9); opacity:.28; } 50% { transform: scale(1.08); opacity:.55; } }

.gate-refl { fill:none; stroke: currentColor; stroke-width:5; stroke-linecap:round; opacity:.14;
  transform-box: fill-box; transform-origin: center top; animation: reflWob 6.4s ease-in-out infinite; }
.g-build .gate-refl { animation-duration: 7.2s; }
.g-test  .gate-refl { animation-duration: 5.7s; }
.g-deploy .gate-refl { animation-duration: 6.9s; }
@keyframes reflWob { 0%,100% { transform: skewX(0deg) scaleY(1); opacity:.13; } 50% { transform: skewX(2.4deg) scaleY(1.06); opacity:.2; } }

/* pass pulse: fires 4x per journey cycle — once per barge */
.gate-ring { fill:none; stroke: currentColor; stroke-width:3; opacity:0;
  transform-box: fill-box; transform-origin: center;
  animation: ringGit var(--b-sail) linear infinite; }
.g-build .gate-ring { animation-name: ringBuild; }
.g-test  .gate-ring { animation-name: ringTest; }
.g-deploy .gate-ring { animation-name: ringDeploy; }

.gate-chip { transform-box: fill-box; transform-origin: center;
  animation: popGit var(--b-sail) linear infinite; }
.g-build .gate-chip { animation-name: popBuild; }
.g-test  .gate-chip { animation-name: popTest; }
.g-deploy .gate-chip { animation-name: popDeploy; }

.gate-chip rect { fill: currentColor; }
.gate-chip .numc { fill: rgba(255,255,255,.28); }
.gate-chip text { fill:#fff; font-family: var(--font-en); text-anchor: middle; dominant-baseline: central; }
.gate-chip .num { font-size:10px; font-weight:800; }
.gate-chip .lbl { font-size:12.5px; font-weight:800; letter-spacing:1.1px; }
.g-git    .gate-chip rect { x:-30px; width:60px; }
.g-build  .gate-chip rect { x:-36px; width:72px; }
.g-test   .gate-chip rect { x:-30px; width:60px; }
.g-deploy .gate-chip rect { x:-38px; width:76px; }

/* ring spikes at 1.03 / 27.5 / 51.03 / 73.09 % of the journey */
@keyframes ringGit {
  0%, 0.9% { opacity:0; transform: scale(.45); }
  1.03%    { opacity:.9; transform: scale(1); }
  3.1%     { opacity:0; transform: scale(1.6); }
  26.4%    { opacity:0; transform: scale(.45); }
  27.5%    { opacity:.9; transform: scale(1); }
  29.6%    { opacity:0; transform: scale(1.6); }
  49.9%    { opacity:0; transform: scale(.45); }
  51.03%   { opacity:.9; transform: scale(1); }
  53.1%    { opacity:0; transform: scale(1.6); }
  72%      { opacity:0; transform: scale(.45); }
  73.09%   { opacity:.9; transform: scale(1); }
  75.2%    { opacity:0; transform: scale(1.6); }
  100%     { opacity:0; transform: scale(.45); }
}
@keyframes popGit {
  0%, 0.5% { transform: scale(1); }
  1.03%    { transform: scale(1.17); }
  2.7%     { transform: scale(1); }
  26.9%    { transform: scale(1); }
  27.5%    { transform: scale(1.17); }
  29.1%    { transform: scale(1); }
  50.4%    { transform: scale(1); }
  51.03%   { transform: scale(1.17); }
  52.7%    { transform: scale(1); }
  72.5%    { transform: scale(1); }
  73.09%   { transform: scale(1.17); }
  74.7%    { transform: scale(1); }
  100%     { transform: scale(1); }
}
/* ring spikes at 16.03 / 42.5 / 66.03 / 88.09 % */
@keyframes ringBuild {
  0%, 14.9% { opacity:0; transform: scale(.45); }
  16.03%    { opacity:.9; transform: scale(1); }
  18.1%     { opacity:0; transform: scale(1.6); }
  41.4%     { opacity:0; transform: scale(.45); }
  42.5%     { opacity:.9; transform: scale(1); }
  44.6%     { opacity:0; transform: scale(1.6); }
  64.9%     { opacity:0; transform: scale(.45); }
  66.03%    { opacity:.9; transform: scale(1); }
  68.1%     { opacity:0; transform: scale(1.6); }
  87%       { opacity:0; transform: scale(.45); }
  88.09%    { opacity:.9; transform: scale(1); }
  90.2%     { opacity:0; transform: scale(1.6); }
  100%      { opacity:0; transform: scale(.45); }
}
@keyframes popBuild {
  0%, 15.5% { transform: scale(1); }
  16.03%    { transform: scale(1.17); }
  17.7%     { transform: scale(1); }
  41.9%     { transform: scale(1); }
  42.5%     { transform: scale(1.17); }
  44.1%     { transform: scale(1); }
  65.4%     { transform: scale(1); }
  66.03%    { transform: scale(1.17); }
  67.7%     { transform: scale(1); }
  87.5%     { transform: scale(1); }
  88.09%    { transform: scale(1.17); }
  89.7%     { transform: scale(1); }
  100%      { transform: scale(1); }
}
/* ring spikes at 3.09 / 31.03 / 57.5 / 81.03 % */
@keyframes ringTest {
  0%, 2%   { opacity:0; transform: scale(.45); }
  3.09%    { opacity:.9; transform: scale(1); }
  5.2%     { opacity:0; transform: scale(1.6); }
  29.9%    { opacity:0; transform: scale(.45); }
  31.03%   { opacity:.9; transform: scale(1); }
  33.1%    { opacity:0; transform: scale(1.6); }
  56.4%    { opacity:0; transform: scale(.45); }
  57.5%    { opacity:.9; transform: scale(1); }
  59.6%    { opacity:0; transform: scale(1.6); }
  79.9%    { opacity:0; transform: scale(.45); }
  81.03%   { opacity:.9; transform: scale(1); }
  83.1%    { opacity:0; transform: scale(1.6); }
  100%     { opacity:0; transform: scale(.45); }
}
@keyframes popTest {
  0%, 2.5% { transform: scale(1); }
  3.09%    { transform: scale(1.17); }
  4.7%     { transform: scale(1); }
  30.4%    { transform: scale(1); }
  31.03%   { transform: scale(1.17); }
  32.7%    { transform: scale(1); }
  56.9%    { transform: scale(1); }
  57.5%    { transform: scale(1.17); }
  59.1%    { transform: scale(1); }
  80.4%    { transform: scale(1); }
  81.03%   { transform: scale(1.17); }
  82.7%    { transform: scale(1); }
  100%     { transform: scale(1); }
}
/* ring spikes at 18.09 / 46.03 / 72.5 / 96.03 % */
@keyframes ringDeploy {
  0%, 17%  { opacity:0; transform: scale(.45); }
  18.09%   { opacity:.9; transform: scale(1); }
  20.2%    { opacity:0; transform: scale(1.6); }
  44.9%    { opacity:0; transform: scale(.45); }
  46.03%   { opacity:.9; transform: scale(1); }
  48.1%    { opacity:0; transform: scale(1.6); }
  71.4%    { opacity:0; transform: scale(.45); }
  72.5%    { opacity:.9; transform: scale(1); }
  74.6%    { opacity:0; transform: scale(1.6); }
  94.9%    { opacity:0; transform: scale(.45); }
  96.03%   { opacity:.9; transform: scale(1); }
  98.1%    { opacity:0; transform: scale(1.6); }
  100%     { opacity:0; transform: scale(.45); }
}
@keyframes popDeploy {
  0%, 17.5% { transform: scale(1); }
  18.09%    { transform: scale(1.17); }
  19.7%     { transform: scale(1); }
  45.4%     { transform: scale(1); }
  46.03%    { transform: scale(1.17); }
  47.7%     { transform: scale(1); }
  71.9%     { transform: scale(1); }
  72.5%     { transform: scale(1.17); }
  74.1%     { transform: scale(1); }
  95.4%     { transform: scale(1); }
  96.03%    { transform: scale(1.17); }
  97.7%     { transform: scale(1); }
  100%      { transform: scale(1); }
}

/* ---- container barges ----
   All four share one journey duration (same river current);
   irregular negative delays spread them naturally. Each has its
   own bob period / amplitude / roll and a reduced-motion parking
   spot (--rms-x). */
.scn-boat { transform-box: fill-box; transform-origin: center; will-change: transform;
  animation: boatSail var(--b-sail) linear infinite; animation-delay: var(--dl, 0s); }
@keyframes boatSail { from { transform: translateX(-170px); } to { transform: translateX(1040px); } }

.boat-bob { transform-box: fill-box; transform-origin: center;
  animation: boatBob var(--bd, 4s) ease-in-out infinite; animation-delay: var(--bo, 0s); }
@keyframes boatBob {
  0%,100% { transform: translateY(calc(var(--ba, 3px) * -1)) rotate(calc(var(--br, 1.2deg) * -1)); }
  50%     { transform: translateY(var(--ba, 3px)) rotate(var(--br, 1.2deg)); }
}
.boat-body { transform-box: fill-box; transform-origin: 50% 100%; transform: scale(var(--sc, 1)); }

.c-blue { --bc1:#2f6fe4; }
.c-sky  { --bc1:#5ea0f5; }
.c-gold { --bc1:#f0a63a; }
.c-deep { --bc1:#1e4fb3; }
.boat-body .box    { fill: var(--bc1); }
.boat-body .ridges { stroke: rgba(255,255,255,.32); stroke-width: 2.5; fill: none; }
.boat-body .box-top { fill:#fff; opacity:.22; }
.boat-body .hull   { fill: var(--hull-c); }

.boat-shadow { fill: url(#hg2-shadow); transform-box: fill-box; transform-origin: center;
  animation: shadowBeat var(--bd, 4s) ease-in-out infinite; animation-delay: var(--bo, 0s); }
@keyframes shadowBeat { 0%,100% { transform: scale(.94); opacity:.8; } 50% { transform: scale(1.07); opacity:1; } }

.boat-wake .wk { fill:#fff; opacity:.4; transform-box: fill-box; transform-origin: right center;
  animation: wakePuff 2.2s ease-in-out infinite; }
.boat-wake .wk2 { animation-duration: 2.9s; animation-delay: -1.1s; }
@keyframes wakePuff { 0%,100% { opacity:.16; transform: scaleX(.7); } 50% { opacity:.6; transform: scaleX(1.05); } }

/* soft green halo once the barge has passed TEST */
.boat-glow { fill: url(#hg2-glow); opacity:0;
  animation: cntGlow var(--b-sail) linear infinite; animation-delay: var(--dl, 0s); }
@keyframes cntGlow {
  0%, 56% { opacity:0; }
  62%     { opacity: calc(.55 * var(--glow-k, 1)); }
  80%     { opacity: calc(.45 * var(--glow-k, 1)); }
  92%,100% { opacity:0; }
}

/* ---------- sections ---------- */
/* v0.4 perf: below-the-fold sections skip rendering while off-screen
   (contain-intrinsic-size keeps the scrollbar honest) */
.section { padding: 84px 0; content-visibility: auto; contain-intrinsic-size: auto 720px; }
.section-alt { background: var(--bg-soft); }
.section-head { max-width: 640px; margin: 0 auto 46px; text-align: center; }
.section-head .kicker {
  display: inline-block; color: var(--primary); background: var(--primary-soft);
  font-size: .8rem; font-weight: 800; letter-spacing: 1px;
  padding: 5px 14px; border-radius: 999px; margin-bottom: 14px;
}
.section-head h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); text-wrap: balance; }
.section-head p { color: var(--text-soft); margin: 0; }

/* ---------- cards ---------- */
.grid { display: grid; gap: 22px; }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s;
  position: relative; overflow: hidden;
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }

.card .icon-wrap {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary); margin-bottom: 18px;
}
.card .icon-wrap svg { width: 26px; height: 26px; }
.card h3 { font-size: 1.12rem; margin-bottom: 8px; }
.card p { color: var(--text-soft); font-size: .95rem; margin: 0; }

/* project card */
.project-card .stack { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.project-card .stack span {
  font-size: .74rem; font-weight: 700; color: var(--primary);
  background: var(--primary-soft); padding: 3px 11px; border-radius: 999px;
}
.project-card .p-head { display: flex; align-items: flex-start; gap: 14px; }
.project-card .p-head .icon-wrap { margin-bottom: 0; flex: none; }
.project-card .p-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 16px; font-weight: 700; font-size: .9rem; }
.project-card .p-link svg { width: 15px; height: 15px; }

/* article card */
.article-card { padding: 0; display: flex; flex-direction: column; }
.article-card .cover {
  height: 170px; position: relative; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(120px 80px at 80% 10%, color-mix(in srgb, var(--accent) 30%, transparent), transparent),
    linear-gradient(135deg, var(--primary-soft), var(--surface-2));
  border-bottom: 1px solid var(--border);
}
.article-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.article-card .cover .ph-icon { display: block; width: 56px; height: 56px; color: var(--primary); opacity: .75; }
.article-card .cover .ph-icon svg { width: 100%; height: 100%; }
.article-card .cover .badge-cover {
  position: absolute; top: 12px; inset-inline-start: 12px;
  background: var(--primary); color: #fff; font-size: .72rem; font-weight: 800;
  padding: 4px 12px; border-radius: 999px;
}
.article-card .body { padding: 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.article-card .meta { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: .8rem; }
.article-card .meta span { display: inline-flex; align-items: center; gap: 5px; }
.article-card .meta svg { width: 13px; height: 13px; }
.article-card h3 { font-size: 1.08rem; margin: 0; }
.article-card h3 a { color: var(--text); }
.article-card h3 a:hover { color: var(--primary); }
.article-card p { font-size: .92rem; color: var(--text-soft); margin: 0; flex: 1; }
.article-card .tags { display: flex; flex-wrap: wrap; gap: 6px; }
.article-card .tags a { font-size: .72rem; font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 3px 10px; border-radius: 999px; }
.article-card .read-more { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: .88rem; color: var(--primary); }
.article-card .read-more svg { width: 15px; height: 15px; transition: transform .2s; }
.article-card:hover .read-more svg { transform: translateX(3px); }
[dir="rtl"] .article-card:hover .read-more svg { transform: translateX(-3px) ; }

/* ---------- about ---------- */
.about-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.about-wrap h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
.about-wrap .txt p { color: var(--text-soft); }
.about-points { display: grid; gap: 14px; margin-top: 26px; }
.about-points .pt { display: flex; gap: 13px; align-items: flex-start; }
.about-points .pt-ic {
  width: 40px; height: 40px; flex: none; border-radius: 11px;
  background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
}
.about-points .pt-ic svg { width: 20px; height: 20px; }
.about-points b { display: block; margin-bottom: 2px; }
.about-points p { margin: 0; font-size: .9rem; color: var(--text-soft); }

/* ============================================================
   ABOUT — flat 2D harbor (v0.4.3)
   The Hamrood logo floats over its island while five skill chips
   ride a slowly turning dashed orbit; below, a rounded river
   strip carries two mini barges. Same visual language as the
   hero: inline SVG + HTML, transform/opacity animations only.
   ============================================================ */
.ascene2d {
  --aw1:#6ba6f2; --aw2:#1d4ed8; --w-line:#8ec1f8;
  --hill-near:#aed0f6; --hill-far:#c4dcf9;
  --a2-mtn-far:#d8e7fc; --a2-mtn-far-f:#c6dafa; --a2-mtn-near:#bdd9fa; --a2-mtn-near-f:#a7c9f5;
  --a2-snow:#ffffff;
  --cloud-c:#ffffff; --hull-c:#2b4a77;
  --ring-c:rgba(29,78,216,.22);
  position: relative;
  width: min(100%, 470px);
  aspect-ratio: 470 / 430;
  margin-inline: auto;
  overflow: hidden;
}
[data-theme="dark"] .ascene2d {
  --aw1:#153565; --aw2:#0a2044; --w-line:#1c4178;
  --hill-near:#112b50; --hill-far:#0d2039;
  --a2-mtn-far:#0a1a34; --a2-mtn-far-f:#081528; --a2-mtn-near:#0e2445; --a2-mtn-near-f:#0b1e3a;
  --a2-snow:#cfe2ff;
  --cloud-c:#152845; --hull-c:#0f2038;
  --ring-c:rgba(91,156,248,.26);
}

/* dashed orbit, slowly turning */
.a2-deco { position:absolute; inset:0; width:100%; height:100%;
  transform-box: fill-box; transform-origin: center; animation: a2Ring 80s linear infinite; }
@keyframes a2Ring { to { transform: rotate(360deg); } }
.a2-ring { fill:none; stroke: var(--ring-c); stroke-width:2; stroke-dasharray:2 9; stroke-linecap:round; }

/* v0.5: faceted mountains behind the harbor — static, one mask layer of its own,
   positioned between the orbit ring (behind) and chips/island (in front) */
.a2-mtns { position:absolute; left:-2%; width:104%; bottom:25%; height:44%; display:block;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12%, #000 88%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 12%, #000 88%, transparent 100%); }
.a2-mtns .far  { fill: var(--a2-mtn-far); }
.a2-mtns .near { fill: var(--a2-mtn-near); }
.a2-mtns .far .facet  { fill: var(--a2-mtn-far-f); }
.a2-mtns .near .facet { fill: var(--a2-mtn-near-f); }
.a2-mtns .snow { fill: var(--a2-snow); opacity:.95; }
[data-theme="dark"] .a2-mtns .snow { opacity:.28; }

.a2-star { position:absolute; width:3px; height:3px; border-radius:50%;
  background:#cfe2ff; box-shadow:0 0 6px rgba(207,226,255,.9); animation: twinkle 3s ease-in-out infinite; }
[data-theme="light"] .a2-star { display:none; }

/* clouds gently drift back and forth — always inside the safe area,
   so their rounded shape never gets clipped into a square sliver.
   Both sides use LOGICAL insets -> they mirror with RTL and spread. */
.a2-cloud { position:absolute; width:60px; height:18px; border-radius:999px;
  background: var(--cloud-c); opacity:.85; animation: a2Cloud 34s ease-in-out infinite alternate; }
.a2-cloud::before, .a2-cloud::after { content:""; position:absolute; bottom:55%;
  background: inherit; border-radius:50%; }
.a2-cloud::before { left:16%; width:26px; height:26px; }
.a2-cloud::after  { right:14%; width:19px; height:19px; }
.a2-cloud.c1 { top:9%; inset-inline-start:18%; }
.a2-cloud.c2 { top:20%; inset-inline-end:10%; transform:scale(.68);
  animation-duration:44s; animation-delay:-20s; opacity:.7; }
@keyframes a2Cloud { from { translate:-46px 0; } to { translate:64px 0; } }

/* island + mounds under the floating logo */
.a2-island { position:absolute; left:50%; top:57%; width:46%; height:15%;
  transform:translateX(-50%);
  background: var(--hill-near);
  border-radius: 46% 54% 10px 10px / 100% 100% 0 0; }
.a2-island::before, .a2-island::after { content:""; position:absolute; bottom:100%;
  background: var(--hill-far); border-radius:50% 50% 0 0; }
.a2-island::before { left:12%; width:34%; height:16px; }
.a2-island::after  { right:14%; width:24%; height:11px; }

.a2-logo { position:absolute; left:50%; top:39%; width:88px; height:88px; border-radius:22px;
  transform: translate(-50%,-50%);
  background: var(--surface); border:1px solid var(--border); box-shadow: var(--shadow-lg);
  display:flex; align-items:center; justify-content:center;
  animation: a2LogoFloat 5s ease-in-out infinite; }
.a2-logo svg { width:54px; height:54px; }
.a2-logo .a2-logo-img { width:60px; height:60px; }
.a2-logo::after { content:""; position:absolute; inset:-9px; border-radius:27px;
  border:2px solid color-mix(in srgb, var(--primary) 38%, transparent);
  animation: haloPulse 3s ease-in-out infinite; }
@keyframes a2LogoFloat {
  0%,100% { transform: translate(-50%,-50%) translateY(-4px); }
  50%     { transform: translate(-50%,-50%) translateY(4px); }
}
@keyframes haloPulse { 0%,100% { transform:scale(1); opacity:.85; } 50% { transform:scale(1.13); opacity:.2; } }

/* rounded river strip (self-contained shape — no cut edges) */
.a2-water { position:absolute; left:5%; right:5%; bottom:4%; height:23%;
  border-radius:16px;
  background: linear-gradient(180deg, var(--aw1), var(--aw2));
  box-shadow: inset 0 3px 0 rgba(255,255,255,.25), 0 14px 30px rgba(29,78,216,.16);
  overflow:hidden; }
.a2-wline { position:absolute; top:-1px; left:0; width:100%; height:24px; display:block; }
.a2-wline path { fill: var(--w-line); opacity:.9; }

.a2-shine { position:absolute; width:26px; height:3px; border-radius:2px; background:#fff; }
.a2-shine.s1 { left:16%; bottom:55%; animation: a2Shine 4.6s ease-in-out infinite; }
.a2-shine.s2 { left:52%; bottom:36%; width:32px; animation: a2Shine 5.7s ease-in-out infinite; animation-delay:-2.1s; }
.a2-shine.s3 { left:74%; bottom:60%; width:22px; animation: a2Shine 5.1s ease-in-out infinite; animation-delay:-3.4s; }
@keyframes a2Shine { 0%,100% { opacity:.1; transform:scaleX(.7); } 50% { opacity:.55; transform:scaleX(1.1); } }

.a2-barge { position:absolute; bottom:9px; left:0; will-change:transform;
  animation: a2Sail var(--sd, 26s) linear infinite; animation-delay: var(--so, 0s); }
@keyframes a2Sail {
  0%   { transform: translateX(-90px); opacity:0; }
  9%   { opacity:1; }
  87%  { opacity:1; }
  100% { transform: translateX(560px); opacity:0; }
}
.ab-inner { display:flex; flex-direction:column; align-items:center;
  animation: a2Bob 3.1s ease-in-out infinite; }
.a2-barge:last-child .ab-inner { animation-delay: -1.4s; }
@keyframes a2Bob {
  0%,100% { transform: translateY(-1.6px) rotate(-1.2deg); }
  50%     { transform: translateY(1.6px) rotate(1.2deg); }
}
.ab-box { width:42px; height:16px; border-radius:3px; }
.ab-inner.gold .ab-box {
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.25) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #f0a63a, #d98324); }
.ab-inner.blue .ab-box {
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.25) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #5ea0f5, #3b7de0); }
.ab-hull { width:54px; height:9px; border-radius:2px 2px 8px 8px; background: var(--hull-c); margin-top:1px; }

/* skill chips (inline-start/end -> they mirror with RTL) */
.a2-chip { position:absolute; top:var(--top, 20%);
  inset-inline-start: var(--x, auto); inset-inline-end: var(--e, auto);
  display:inline-flex; align-items:center; gap:7px; padding:7px 14px; border-radius:999px;
  background: var(--surface); border:1px solid color-mix(in srgb, var(--primary) 28%, var(--border));
  color: var(--primary); font-family: var(--font-en); font-size:.8rem; font-weight:800; white-space:nowrap;
  box-shadow: 0 8px 20px rgba(2,8,20,.10);
  animation: a2Float var(--fd, 4s) ease-in-out infinite; animation-delay: var(--fo, 0s); }
.a2-chip svg { width:15px; height:15px; flex:none; }
@keyframes a2Float { 0%,100% { transform: translateY(-3px); } 50% { transform: translateY(3.5px); } }

/* about kicker (no more inline style in the HTML) */
.about-wrap .kicker {
  display:inline-block; color: var(--primary); background: var(--primary-soft);
  font-size:.8rem; font-weight:800; letter-spacing:1px;
  padding:5px 14px; border-radius:999px; margin-bottom:14px;
}

/* ---------- contact (v0.4.5: form removed — centered cards grid) ---------- */
.contact-list {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px; margin-top: 34px;
}
.contact-list a {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 24px 16px 20px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-weight: 600; text-align: center;
  transition: transform .2s, border-color .2s, color .2s, box-shadow .2s;
}
.contact-list a:hover { border-color: var(--primary); transform: translateY(-3px); color: var(--primary); box-shadow: var(--shadow); }
.contact-list .c-ic { width: 46px; height: 46px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; flex: none; margin-bottom: 8px; }
.contact-list .c-ic svg { width: 21px; height: 21px; }
.contact-list b { font-size: .95rem; line-height: 1.5; word-break: break-word; }
.contact-list small { display: block; color: var(--muted); font-weight: 400; font-size: .82rem; }

.form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: grid; gap: 7px; }
.field-full { grid-column: 1 / -1; }
.field label { font-size: .88rem; font-weight: 700; }
.field input, .field textarea, .field select {
  font: inherit; color: var(--text); background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 10px; padding: 11px 14px;
  transition: border-color .2s, box-shadow .2s; width: 100%;
}
.field textarea { resize: vertical; min-height: 110px; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}

/* ---------- footer ---------- */
.site-footer { background: var(--bg-soft); border-top: 1px solid var(--border); padding: 54px 0 0; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 38px; padding-bottom: 38px; }
.site-footer h4 { font-size: 1rem; margin-bottom: 16px; }
.site-footer .f-about { color: var(--text-soft); font-size: .92rem; max-width: 40ch; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.site-footer ul a { color: var(--text-soft); font-size: .93rem; }
.site-footer ul a:hover { color: var(--primary); }
.footer-bottom { border-top: 1px solid var(--border); padding: 18px 0; text-align: center; color: var(--muted); font-size: .85rem; }

/* ---------- articles page ---------- */
.page-head { padding: 48px 0 34px; background: var(--hero-grad); }
.page-head h1 { font-size: clamp(1.6rem, 3.4vw, 2.4rem); margin-bottom: 8px; }
.page-head p { color: var(--text-soft); margin: 0; max-width: 62ch; }

.toolbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-bottom: 30px; }
.search-box { position: relative; flex: 1; min-width: 230px; }
.search-box svg { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.search-box input {
  width: 100%; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 44px; transition: border-color .2s, box-shadow .2s;
}
.search-box input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.tag-filter { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-filter button {
  font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer;
  color: var(--text-soft); background: var(--surface); border: 1px solid var(--border);
  padding: 6px 14px; border-radius: 999px; transition: color .18s, border-color .18s, background .18s;
}
.tag-filter button:hover { color: var(--primary); border-color: var(--primary); }
.tag-filter button.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* v0.4.2: clear-search button + result count + rss link */
.search-clear {
  position: absolute; inset-inline-end: 10px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; cursor: pointer; color: var(--muted); background: transparent;
  transition: color .18s, background .18s;
}
.search-clear:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.search-clear[hidden] { display: none; }   /* the hidden attr must win over display */
.search-clear svg { width: 14px; height: 14px; }
.search-meta { flex-basis: 100%; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .85rem; margin: -14px 0 0; }
.search-meta b { color: var(--text-soft); }
.search-meta .rss-link {
  display: inline-flex; align-items: center; gap: 5px; margin-inline-start: auto;
  color: var(--muted); font-size: .78rem; font-weight: 700; text-decoration: none;
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 11px;
  transition: color .18s, border-color .18s;
}
.search-meta .rss-link:hover { color: var(--gold); border-color: var(--gold); }
.search-meta .rss-link svg { width: 12px; height: 12px; }

.empty-state { text-align: center; padding: 70px 20px; color: var(--muted); }
.empty-state svg { width: 64px; height: 64px; margin: 0 auto 18px; color: var(--border); }
.empty-state h3 { color: var(--text-soft); }

/* ---------- single article ---------- */
.article-page { max-width: 800px; margin-inline: auto; }
.article-header { padding: 48px 0 30px; background: var(--hero-grad); }
.article-header .back-link { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: .9rem; margin-bottom: 22px; }
.article-header .back-link svg { width: 16px; height: 16px; }
.article-header h1 { font-size: clamp(1.5rem, 3.4vw, 2.3rem); }
.article-header .meta { display: flex; flex-wrap: wrap; gap: 16px; color: var(--text-soft); font-size: .88rem; }
.article-header .meta span { display: inline-flex; align-items: center; gap: 6px; }
.article-header .meta svg { width: 15px; height: 15px; color: var(--primary); }
.article-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.article-tags a { font-size: .76rem; font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 4px 12px; border-radius: 999px; }

/* ---------- v0.4.4: reading progress (thin top bar) ---------- */
.read-progress {
  position: fixed; top: 0; inset-inline: 0; height: 3px; z-index: 120;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--primary));
  transform: scaleX(0); transform-origin: 0 50%;
  will-change: transform; pointer-events: none;
}
[dir="rtl"] .read-progress { transform-origin: 100% 50%; }

/* ---------- v0.4.4: share bar ---------- */
.share-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 18px;
  padding-top: 14px; border-top: 1px dashed var(--border);
}
.share-label {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); font-size: .8rem; font-weight: 700;
}
.share-label svg { width: 15px; height: 15px; }
.share-btns { display: inline-flex; align-items: center; gap: 8px; }
.share-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-soft);
  transition: color .18s, border-color .18s, background-color .18s, transform .18s;
}
.share-btn svg { width: 15px; height: 15px; }
.share-btn:hover { transform: translateY(-2px); color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.share-btn.is-tg:hover { color: #229ed9; border-color: #229ed9; background: color-mix(in srgb, #229ed9 12%, transparent); }
.share-btn.is-wa:hover { color: #1fa855; border-color: #1fa855; background: color-mix(in srgb, #25d366 14%, transparent); }
.share-btn.is-x:hover { color: var(--text); border-color: var(--text-soft); }
.share-btn.is-native:hover { color: var(--gold); border-color: var(--gold); }
.share-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- v0.4.4: table of contents ---------- */
.toc {
  margin: 0 0 22px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.toc summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 9px;
  padding: 14px 20px; font-weight: 800; font-size: .95rem; color: var(--text);
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary svg { width: 17px; height: 17px; color: var(--primary); flex: none; }
.toc summary::after {
  content: ''; margin-inline-start: auto; width: 8px; height: 8px; flex: none;
  border-inline-end: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .2s;
}
[dir="rtl"] .toc summary::after { transform: rotate(-135deg); }
.toc details[open] > summary::after, .toc[open] summary::after { transform: rotate(225deg); }
[dir="rtl"] .toc[open] summary::after { transform: rotate(-315deg); }
.toc ul { list-style: none; margin: 0; padding: 2px 20px 16px; }
.toc li { margin: 0; }
.toc a {
  display: block; padding: 6px 12px; border-radius: 8px;
  color: var(--text-soft); font-size: .9rem; font-weight: 600;
  border-inline-start: 2px solid transparent;
  transition: color .15s, background-color .15s, border-color .15s;
}
.toc a:hover { color: var(--primary); background: var(--primary-soft); }
.toc a.active { color: var(--primary); background: var(--primary-soft); border-inline-start-color: var(--primary); font-weight: 800; }
.toc .toc-sub { padding: 0; }
.toc .toc-sub a { font-size: .84rem; font-weight: 500; padding-inline-start: 26px; }

.draft-banner {
  display: flex; align-items: center; gap: 9px;
  background: color-mix(in srgb, var(--gold) 16%, transparent);
  color: var(--gold); border: 1px dashed var(--gold);
  padding: 11px 16px; border-radius: 10px; font-weight: 700; font-size: .9rem; margin-top: 20px;
}
.draft-banner svg { width: 17px; height: 17px; flex: none; }

.article-cover { border-radius: var(--radius); overflow: hidden; margin: 30px 0; border: 1px solid var(--border); }

.prose {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: clamp(22px, 4vw, 44px); box-shadow: var(--shadow);
  font-size: 1.02rem;
}
.prose h2 { font-size: 1.45rem; margin: 1.7em 0 .6em; padding-inline-start: 14px; border-inline-start: 4px solid var(--primary); }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 1.18rem; margin: 1.5em 0 .5em; }
.prose p { color: var(--text-soft); }
.prose strong { color: var(--text); }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose ul, .prose ol { color: var(--text-soft); padding-inline-start: 1.4em; margin: 0 0 1em; }
.prose li { margin-bottom: .4em; }
.prose blockquote {
  margin: 1.4em 0; padding: 14px 20px; border-inline-start: 4px solid var(--gold);
  background: color-mix(in srgb, var(--gold) 10%, transparent);
  border-radius: 0 12px 12px 0; color: var(--text-soft);
}
[dir="rtl"] .prose blockquote { border-radius: 12px 0 0 12px; }
.prose code {
  font-family: ui-monospace, 'Cascadia Code', 'Fira Code', Consolas, monospace;
  font-size: .86em; background: var(--primary-soft); color: var(--primary-strong);
  padding: 2px 7px; border-radius: 6px; direction: ltr; unicode-bidi: embed;
}
[data-theme="dark"] .prose code { color: var(--accent); }
.prose hr { border: 0; border-top: 1px dashed var(--border); margin: 2em 0; }

.code-block { margin: 1.4em 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); direction: ltr; }
.code-head {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface-2); padding: 8px 14px;
  font-size: .75rem; color: var(--muted); font-family: ui-monospace, Consolas, monospace;
}
.code-copy {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  background: none; border: 1px solid var(--border); border-radius: 7px;
  color: var(--muted); font: inherit; font-size: .72rem; padding: 3px 10px; transition: color .18s, border-color .18s;
}
.code-copy:hover { color: var(--primary); border-color: var(--primary); }
.code-copy svg { width: 12px; height: 12px; }
.code-block pre { margin: 0; padding: 18px; overflow-x: auto; background: var(--bg-soft); }
.code-block code { background: none; padding: 0; color: var(--text); font-size: .87rem; line-height: 1.75; }

/* ---------- v0.4.2: syntax highlighting tokens ----------
   Calm, blue-family palette that follows the site theme:
   comments = muted, strings = green, keywords = blue,
   yaml/json keys = teal, variables = warm, numbers = gold. */
.code-block .tk-cm  { color: var(--muted); font-style: italic; }
.code-block .tk-str { color: #15803d; }
.code-block .tk-kw  { color: var(--primary); font-weight: 600; }
.code-block .tk-key { color: #0e7490; font-weight: 600; }
.code-block .tk-var { color: #b45309; }
.code-block .tk-num { color: #b45309; }
.code-block .tk-fn  { color: #7c3aed; }
.code-block .tk-op  { color: var(--text-soft); }
[data-theme="dark"] .code-block .tk-cm  { color: var(--muted); }
[data-theme="dark"] .code-block .tk-str { color: #6ee7a0; }
[data-theme="dark"] .code-block .tk-kw  { color: #7db1fb; }
[data-theme="dark"] .code-block .tk-key { color: #67e8f9; }
[data-theme="dark"] .code-block .tk-var { color: #fdba74; }
[data-theme="dark"] .code-block .tk-num { color: #fbbf24; }
[data-theme="dark"] .code-block .tk-fn  { color: #c4b5fd; }
[data-theme="dark"] .code-block .tk-op  { color: var(--text-soft); }

/* ---------- v0.4.2: comments (Giscus) ---------- */
.comments { margin-top: 52px; padding-top: 30px; border-top: 1px dashed var(--border); }
.comments h3 { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.comments h3 svg { width: 19px; height: 19px; color: var(--primary); }
.comments .comments-hint { color: var(--muted); font-size: .84rem; margin: 0 0 18px; }
.comments .giscus { margin-top: 6px; }

.related { margin-top: 44px; }
.related h3 { margin-bottom: 20px; }

/* ---------- login ---------- */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--hero-grad); position: relative; overflow: hidden; }
.auth-card {
  width: min(100%, 420px); background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 38px 34px; box-shadow: var(--shadow-lg); position: relative; z-index: 2;
}
.auth-card .auth-logo { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 26px; text-align: center; }
.auth-card .auth-logo .auth-img { width:132px; height:132px; }
.auth-card .auth-logo h1 { font-size: 1.35rem; margin: 0; }
.auth-card .auth-logo p { color: var(--muted); font-size: .88rem; margin: 0; }
.auth-form { display: grid; gap: 16px; }
.pass-wrap { position: relative; }
.pass-toggle {
  position: absolute; inset-inline-end: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; cursor: pointer; color: var(--muted); padding: 6px; display: flex;
}
.pass-toggle:hover { color: var(--primary); }
.pass-toggle svg { width: 18px; height: 18px; }
.form-error {
  display: none; align-items: center; gap: 8px;
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent);
  color: var(--danger); padding: 11px 14px; border-radius: 10px; font-size: .87rem; font-weight: 600;
}
.form-error.show { display: flex; }
.form-error svg { width: 16px; height: 16px; flex: none; }
.auth-note { display: flex; gap: 8px; align-items: flex-start; font-size: .78rem; color: var(--muted); background: var(--bg-soft); border-radius: 10px; padding: 11px 13px; }
.auth-note svg { width: 15px; height: 15px; flex: none; margin-top: 2px; color: var(--primary); }
.auth-back { text-align: center; margin-top: 20px; font-size: .88rem; }

/* ---------- top banner (ticker / slideshow) ---------- */
.site-banner {
  position: relative; overflow: hidden;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

/* scrolling text ticker */
.site-banner.ticker { height: 44px; display: flex; align-items: center; }
.ticker-clip { overflow: hidden; width: 100%; }
.ticker-track {
  display: flex; width: max-content; direction: ltr;
  animation: tickerMove var(--ticker-dur, 32s) linear infinite;
  will-change: transform;
}
.ticker-track span {
  white-space: nowrap; padding-inline: 44px;
  font-weight: 700; font-size: .9rem; color: var(--primary);
  animation: tickerFade 1s ease both;
}
@keyframes tickerMove { to { transform: translateX(-50%); } }
@keyframes tickerFade { from { opacity: 0; } to { opacity: 1; } }
.site-banner.ticker:hover .ticker-track { animation-play-state: paused; }

/* image slideshow */
.carousel-slides { position: relative; height: var(--banner-h, 150px); }
.carousel-slide {
  position: absolute; inset: 0; opacity: 0;
  transition: opacity .9s ease; display: block;
}
.carousel-slide.on { opacity: 1; }
.carousel-slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
.carousel-dots {
  position: absolute; bottom: 10px; inset-inline-end: 14px;
  display: flex; gap: 6px; z-index: 5;
}
.carousel-dots button {
  width: 9px; height: 9px; border-radius: 50%; border: 0; padding: 0;
  background: rgba(255, 255, 255, .55); cursor: pointer;
  box-shadow: 0 0 4px rgba(0,0,0,.35); transition: transform .2s, background .2s;
}
.carousel-dots button.on { background: #fff; transform: scale(1.25); }

/* ---------- utility ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* 3D scenes pause completely while off-screen (JS adds .scene-off) */
.scene-off .scn2d, .scene-off .scn2d *,
.scene-off .ascene2d, .scene-off .ascene2d * { animation-play-state: paused !important; }

.to-top {
  position: fixed; bottom: 22px; inset-inline-end: 22px; z-index: 90;
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--primary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow); opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: opacity .25s, visibility .25s, transform .25s;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top svg { width: 19px; height: 19px; }

.toast {
  position: fixed; bottom: 24px; inset-inline-start: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 12px 22px; border-radius: 12px;
  font-weight: 700; font-size: .9rem; z-index: 300; opacity: 0; visibility: hidden;
  transition: all .3s; max-width: min(92vw, 480px); text-align: center;
}
[dir="rtl"] .toast { transform: translateX(50%) translateY(20px); }
.toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
[dir="rtl"] .toast.show { transform: translateX(50%) translateY(0); }

.skeleton { min-height: 180px; }

/* ---------- 404 ---------- */
.err-body { text-align: center; padding: calc(var(--nav-h) + 60px) 20px 80px; }
.err-body svg { width: min(70vw, 300px); margin: 0 auto 26px; }
.err-body h1 { font-size: clamp(3.5rem, 10vw, 6rem); color: var(--primary); margin: 0; line-height: 1; }
.err-body h2 { font-size: 1.4rem; }
.err-body p { color: var(--text-soft); max-width: 46ch; margin-inline: auto; }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .hero-inner { grid-template-columns: 1fr; text-align: center; gap: 30px; }
  .hero .lead { margin-inline: auto; }
  .hero-cta, .hero-tags { justify-content: center; }
  .hero-art { justify-content: center; }
  [dir="ltr"] .hero-inner .hero-art { order: 0; }   /* text first again on small screens */
  .hero-art .scn2d { width: min(100%, 640px); }
  .about-wrap { grid-template-columns: 1fr; gap: 30px; }
}

@media (max-width: 860px) {
  .nav-links { display: none; }
  .burger { display: inline-flex; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .container { width: min(100% - 30px, var(--container)); }
  .section { padding: 60px 0; }
  .hero { padding-bottom: 56px; }
  .hero h1 { font-size: 1.75rem; }
  .btn { padding: 10px 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 26px; }
  .brand span.brand-name { display: none; }
  .lang-btn span.lang-label { display: none; }
  .lang-btn { padding-inline: 10px; }
  .prose { font-size: .96rem; }
}

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

/* v0.4.3: park the 2D scenes in a nice static composition */
@media (prefers-reduced-motion: reduce) {
  .scn2d .scn-boat { animation: none; transform: translateX(var(--rms-x, 200px)); }
  .scn2d .scn-cloud { animation: none; transform: translateX(var(--c-x, 240px)); }
  .scn2d .scn-bird { animation: none; }
  .scn2d .boat-glow, .scn2d .gate-ring { animation: none; opacity: 0; }
  .scn2d .scn-shine { animation: none; opacity: .35; }
  .ascene2d .a2-barge { animation: none; transform: translateX(var(--bx, 140px)); opacity: 1; }
  .ascene2d .a2-cloud, .ascene2d .a2-deco { animation: none; }
  .ascene2d .a2-shine { animation: none; opacity: .35; }
}

/* print: never hide content */
@media print {
  .reveal { opacity: 1 !important; transform: none !important; }
  .site-header, .mobile-menu, .to-top, .hero-tags { display: none !important; }
  .read-progress, .share-bar, .toc { display: none !important; }
}
