/* ==========================================================================
   shushin.io — "Dossier" design system
   One type family for all scripts: Noto Sans / Noto Sans Hebrew / Noto Sans Arabic.
   Layout uses logical properties only, so RTL mirrors without overrides.
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root, [data-theme="light"] {
  /* Neutral daylight, restrained green accents. */
  --paper: #F7F9F6;
  --paper-2: #EBF0EA;
  --surface: #FFFFFF;
  --ink: #202C27;
  --ink-2: #526159;
  --ink-3: #63756A;
  --rule: #D5DFD6;
  --rule-strong: #85978A;
  --accent: #286247;
  --accent-hover: #1D4C36;
  --accent-tint: rgba(40, 98, 71, 0.07);
  --on-accent: #FFFFFF;
  --hatch: rgba(32, 44, 39, 0.04);
  --shadow: rgba(32, 44, 39, 0.10);
  --focus: #286247;
  --hover: #E6EEE5;

  --sig-bg: #23392E;
  --sig-ink: #F2F6F1;
  --sig-ink-2: #BDCDC0;
  --sig-rule: #4A6051;
  color-scheme: light;
}

/* Layout & type tokens (theme-independent) */
:root {
  /* Type — one family; per-script stacks below */
  --font: "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  --fs-display: clamp(2.25rem, 1.5rem + 3.2vw, 4.25rem);
  --fw-display: 350;
  --lh-display: 1.02;
  --tr-display: -0.025em;

  --fs-lede: clamp(1.375rem, 1.05rem + 1.3vw, 2.125rem);
  --fw-lede: 300;
  --lh-lede: 1.28;
  --tr-lede: -0.01em;

  --fs-h2: clamp(2rem, 1.35rem + 2.4vw, 3.25rem);
  --fw-h2: 250;
  --lh-h2: 1.1;
  --tr-h2: -0.02em;

  --fs-h3: clamp(1.25rem, 1.12rem + 0.55vw, 1.5rem);
  --fw-h3: 400;
  --lh-h3: 1.28;

  --fs-body: 1rem;
  --lh-body: 1.6;
  --fs-small: 0.9375rem;
  --lh-small: 1.5;

  --fs-label: 0.75rem;
  --fw-label: 600;
  --tr-label: 0.1em;
  --tt-label: uppercase;

  --fs-fn: 0.8125rem;        /* "footnote": domain · language */

  /* Space (4px base) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px; --s-10: 128px;
  --section-pad: clamp(64px, 9vw, 120px);

  /* Layout */
  --container: 1200px;
  --gutter: 16px;
  --col-gap: 16px;
  --header-h: 56px;
  --chrome-h: 0px;           /* Header offset */
  --radius: 3px;
  --dir: 1;                  /* 1 = LTR, -1 = RTL; used for directional nudges */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1D2823;
    --paper-2: #26352D;
    --surface: #2A3B31;
    --ink: #EFF5EF;
    --ink-2: #BECCC0;
    --ink-3: #9FB3A2;
    --rule: #405247;
    --rule-strong: #7C9683;
    --accent: #AED6B7;
    --accent-hover: #C6E5CC;
    --accent-tint: rgba(174, 214, 183, 0.08);
    --on-accent: #1C3627;
    --hatch: rgba(239, 245, 239, 0.04);
    --shadow: rgba(0, 0, 0, 0.25);
    --focus: #AED6B7;
    --hover: #344C3B;

    --sig-bg: #283C2F;
    --sig-ink: #EFF5EF;
    --sig-ink-2: #B8CCBC;
    --sig-rule: #496250;
    color-scheme: dark;
  }
}
[data-theme="dark"] {
  --paper: #1D2823;
  --paper-2: #26352D;
  --surface: #2A3B31;
  --ink: #EFF5EF;
  --ink-2: #BECCC0;
  --ink-3: #9FB3A2;
  --rule: #405247;
  --rule-strong: #7C9683;
  --accent: #AED6B7;
  --accent-hover: #C6E5CC;
  --accent-tint: rgba(174, 214, 183, 0.08);
  --on-accent: #1C3627;
  --hatch: rgba(239, 245, 239, 0.04);
  --shadow: rgba(0, 0, 0, 0.25);
  --focus: #AED6B7;
  --hover: #344C3B;

  --sig-bg: #283C2F;
  --sig-ink: #EFF5EF;
  --sig-ink-2: #B8CCBC;
  --sig-rule: #496250;
  color-scheme: dark;
}

@media (min-width: 600px) {
  :root { --gutter: 24px; --col-gap: 24px; --fs-body: 1.0625rem; }
}
@media (min-width: 1024px) {
  :root { --gutter: 40px; --col-gap: 32px; --header-h: 72px; }
}

/* Per-script tuning (checked on real text; see design-system notes) */
[dir="rtl"] { --dir: -1; }
[dir="ltr"] { --dir: 1; }

[lang|="he"] {
  --font: "Noto Sans Hebrew", "Noto Sans", system-ui, sans-serif;
  --fw-display: 250;
  --lh-display: 1.08;
  --tr-display: 0;
  --tr-lede: 0;
  --tr-h2: 0;
  --lh-h2: 1.14;
  --lh-body: 1.65;
  --fs-label: 0.8125rem;
  --tr-label: 0;
  --tt-label: none;
}

[lang|="ar"] {
  --font: "Noto Sans Arabic", "Noto Sans", system-ui, sans-serif;
  --lh-display: 1.3;
  --tr-display: 0;
  --lh-lede: 1.55;
  --tr-lede: 0;
  --lh-h2: 1.32;
  --tr-h2: 0;
  --lh-h3: 1.45;
  --lh-body: 1.8;
  --lh-small: 1.7;
  --fs-label: 0.875rem;
  --tr-label: 0;
  --tt-label: none;
}

/* ---------- 2. Base ---------- */
.no-transitions *, .no-transitions *::before, .no-transitions *::after { transition: none !important; }

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + var(--chrome-h) + 16px);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }

/* Headings balance; paragraphs avoid orphans. Hyphenation only for EN/RU prose. */
h1, h2, h3, .lede, .toc-title { text-wrap: balance; }
p { text-wrap: pretty; }
[lang|="ru"] .hyphenate { hyphens: auto; }

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- 3. Type roles ---------- */
.display {
  font-size: var(--fs-display);
  font-weight: var(--fw-display);
  line-height: var(--lh-display);
  letter-spacing: var(--tr-display);
}
.lede {
  font-size: var(--fs-lede);
  font-weight: var(--fw-lede);
  line-height: var(--lh-lede);
  letter-spacing: var(--tr-lede);
}
.h2 {
  font-size: var(--fs-h2);
  font-weight: var(--fw-h2);
  line-height: var(--lh-h2);
  letter-spacing: var(--tr-h2);
}
.h3 {
  font-size: var(--fs-h3);
  font-weight: var(--fw-h3);
  line-height: var(--lh-h3);
}
.label {
  font-size: var(--fs-label);
  font-weight: var(--fw-label);
  letter-spacing: var(--tr-label);
  text-transform: var(--tt-label);
  line-height: 1.4;
  color: var(--ink-3);
}
.fn {
  font-size: var(--fs-fn);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  unicode-bidi: isolate;
}
.section-lede {
  font-size: clamp(1.125rem, 1.02rem + 0.45vw, 1.3125rem);
  font-weight: 300;
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 40em;
  margin-top: var(--s-4);
}
[lang|="ar"] .section-lede { line-height: 1.75; }

/* ---------- 4. Icons ---------- */
.icon {
  width: 1.125em; height: 1.125em;
  flex: none;
  stroke: currentColor; fill: none;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.icon-sm { width: 0.95em; height: 0.95em; }
/* Directional icons mirror in RTL; globe, menu, close, check, ↓ ↑ do not. */
[dir="rtl"] .icon-dir { transform: scaleX(-1); }

/* ---------- 5. Buttons & links ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 1rem; font-weight: 500; line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn .icon { transition: transform .15s ease; }
.btn:hover .icon-dir { transform: translateX(calc(3px * var(--dir))); }
[dir="rtl"] .btn:hover .icon-dir { transform: scaleX(-1) translateX(3px); }
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn-secondary:hover { background: var(--hover); }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 0.9375rem; }
.btn-block { width: 100%; }

.link-quiet {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
}
.link-quiet:hover { text-decoration-color: var(--accent); text-decoration-thickness: 2px; color: var(--accent); }

/* ---------- 7. Skip link ---------- */
.skip-link {
  position: absolute; z-index: 100;
  inset-inline-start: 16px; top: -100px;
  background: var(--ink); color: var(--paper);
  padding: 10px 14px; border-radius: var(--radius);
  text-decoration: none;
}
.skip-link:focus { top: calc(var(--chrome-h) + 8px); }

/* ---------- 8. Header ---------- */
.site-header {
  position: sticky; top: var(--chrome-h); z-index: 30;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.header-inner {
  display: flex; align-items: center; gap: var(--s-5);
  min-height: var(--header-h);
}
.wordmark {
  display: inline-flex; align-items: center;
  min-height: 44px;
  margin-inline-end: auto;
  font-size: 1.125rem; font-weight: 400; letter-spacing: 0.01em;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
[lang|="he"] .wordmark, [lang|="ar"] .wordmark { letter-spacing: 0; }
.primary-nav ul { display: flex; gap: var(--s-6); }
.primary-nav a {
  display: inline-block; padding: 10px 0;
  font-size: 0.9375rem; color: var(--ink-2); text-decoration: none;
}
.primary-nav a:hover { color: var(--ink); }
.primary-nav a[aria-current] {
  color: var(--ink);
  text-decoration: underline; text-decoration-color: var(--accent);
  text-decoration-thickness: 2px; text-underline-offset: 8px;
}
.header-actions { display: flex; align-items: center; gap: var(--s-3); }

/* Language switch */
.lang-switch { position: relative; }
.lang-button {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 10px;
  background: none; border: 1px solid transparent; border-radius: var(--radius);
  font-size: 0.9375rem; color: var(--ink); cursor: pointer;
}
.lang-button:hover { border-color: var(--rule); }
.lang-button[aria-expanded="true"] { border-color: var(--ink); background: var(--surface); }
.lang-button .chevron { transition: transform .15s ease; }
.lang-button[aria-expanded="true"] .chevron { transform: rotate(180deg); }
.dropdown {
  position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 40;
  min-width: 208px; padding: 6px;
  background: var(--surface);
  border: 1px solid var(--ink); border-radius: var(--radius);
  box-shadow: 0 10px 28px var(--shadow);
}
.lang-option, .menu-option {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  min-height: 44px; padding: 0 12px;
  border-radius: 2px;
  font-size: 1rem; color: var(--ink); text-decoration: none;
}
.lang-option:hover, .menu-option:hover { background: var(--hover); }
.menu-option {
  width: 100%;
  background: none; border: 0;
  text-align: start; cursor: pointer;
}
.menu-option .mo-label { display: inline-flex; align-items: center; gap: 10px; }
.menu-option .check { visibility: hidden; }
.menu-option[aria-pressed="true"] { font-weight: 600; }
.menu-option[aria-pressed="true"] .check { visibility: visible; }
.lang-option[aria-current] { font-weight: 600; }
.lang-option[aria-current] .icon { color: var(--accent); }
/* Endonyms render in their own script's face whatever the page language. */
.lang-option [lang="en"], .lang-option [lang="ru"] { font-family: "Noto Sans", system-ui, sans-serif; }
.lang-option [lang="he"] { font-family: "Noto Sans Hebrew", system-ui, sans-serif; }
.lang-option [lang="ar"] { font-family: "Noto Sans Arabic", system-ui, sans-serif; }

.menu-button {
  display: none;
  align-items: center; justify-content: center;
  width: 44px; height: 44px;
  background: none; border: 1px solid var(--rule); border-radius: var(--radius);
  cursor: pointer;
}
.menu-button:hover { border-color: var(--ink); }

@media (max-width: 899px) {
  .primary-nav, .header-cta { display: none; }
  .menu-button { display: inline-flex; }
  .lang-button { min-height: 44px; padding: 0 8px; }
  .header-inner { gap: var(--s-3); }
  .header-actions { gap: var(--s-1); }
}
.lang-code { display: none; font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.06em; }
/* Narrow phones: the endonym gives way to the code; full names stay in the menus. */
@media (max-width: 399px) {
  .lang-current { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .lang-code { display: inline; }
}

/* Theme menu: System / Light / Dark. The button icon shows the current choice. */
.theme-switch { position: relative; }
.theme-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  background: none; border: 1px solid transparent; border-radius: var(--radius);
  color: var(--ink); cursor: pointer;
}
.theme-button:hover { border-color: var(--rule); }
.theme-button[aria-expanded="true"] { border-color: var(--ink); background: var(--surface); }
.theme-button .icon { display: none; }
.theme-button[data-choice="auto"] .i-auto,
.theme-button[data-choice="light"] .i-sun,
.theme-button[data-choice="dark"] .i-moon { display: block; }
.theme-menu { min-width: 196px; }
@media (max-width: 899px) { .theme-button { width: 44px; height: 44px; } }

/* Mobile menu (native <dialog>: focus trap, Esc, inert page) */
.mobile-menu {
  margin: 0; inset: 0;
  width: 100%; max-width: none;
  height: 100dvh; max-height: none;
  border: 0; padding: 0 var(--gutter) var(--s-6);
  background: var(--paper); color: var(--ink);
  overflow-y: auto;
}
.mobile-menu::backdrop { background: rgba(31, 30, 28, 0.35); }
@media (prefers-reduced-motion: no-preference) {
  .mobile-menu[open] { animation: menu-in .18s ease-out; }
  @keyframes menu-in { from { opacity: 0; transform: translateY(-8px); } }
}
.mm-head {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 56px; border-bottom: 1px solid var(--rule);
}
.mm-nav a {
  display: flex; align-items: baseline; gap: var(--s-4);
  min-height: 60px; padding: var(--s-4) 0;
  border-bottom: 1px solid var(--rule);
  font-size: 1.5rem; font-weight: 300; line-height: 1.25;
  color: var(--ink); text-decoration: none;
}
.mm-nav .num { font-size: var(--fs-fn); font-weight: 600; color: var(--accent); min-width: 2ch; }
.mm-langs { margin-top: var(--s-6); }
.mm-langs ul { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); margin-top: var(--s-3); }
.mm-langs .lang-option { border: 1px solid var(--rule); }
.mm-langs .lang-option[aria-current] { border-color: var(--ink); }
.mobile-menu .btn-block { margin-top: var(--s-6); }

/* ---------- 9. Hero: natural colour portrait ---------- */
/* A single real-alpha cutout is shared by both themes. No engraving, image tint,
   vignette, framing panel or mirrored face. The page itself supplies the background. */
.hero { padding-top: 0; }
.hero-stage { position: relative; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 1fr);
  align-items: center;
  gap: clamp(28px, 4.5vw, 72px);
  padding-block: 40px 0;
}
.hero-text { min-width: 0; padding-block: 28px 40px; }
.hero-text .display { font-weight: 350; }
.hero-text .lede { margin-top: 24px; max-width: 22ch; }
.hero-text .hero-desc { margin-top: 24px; color: var(--ink-2); max-width: 36em; }
.hero-text .actions { margin-top: 32px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-4) var(--s-6); }
.hero-portrait {
  position: relative;
  isolation: isolate;
  justify-self: end;
  align-self: end;
  width: min(100%, 400px);
  aspect-ratio: 4 / 5;
  overflow: hidden;
}
.hero-portrait picture, .hero-portrait img {
  display: block;
  width: 100%;
  height: 100%;
}
.hero-portrait img { object-fit: contain; object-position: center bottom; }
@media (min-width: 720px) and (max-width: 1023px) {
  .hero-grid { grid-template-columns: minmax(0, 1.35fr) minmax(230px, 1fr); gap: 24px; padding-top: 24px; }
  .hero-text .display { font-size: clamp(2.5rem, 5.1vw, 3.4rem); }
  .hero-text .lede { font-size: 1.5rem; }
  .hero-text .actions { gap: 12px; }
}
@media (max-width: 719px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; padding-top: 28px; }
  .hero-text { padding: 0; }
  .hero-text .display { font-size: clamp(2.25rem, 8.8vw, 3.4rem); }
  .hero-text .lede { margin-top: 16px; max-width: 25ch; }
  .hero-text .hero-desc { margin-top: 20px; }
  .hero-text .actions { margin-top: 24px; gap: 8px; }
  .hero-text .actions .btn { width: 100%; }
  .hero-text .actions .link-quiet { margin-inline: auto; }
  .hero-portrait {
    justify-self: stretch;
    width: 100%; height: 250px;
    aspect-ratio: auto;
    margin-top: 4px;
  }
    .hero-portrait picture {
    position: absolute;
    top: 0; left: 50%;
    width: 280px; height: 350px;
    transform: translateX(-50%);
  }
}

/* Table of contents (numbered, doubles as the page's story) */
.toc { margin-top: var(--s-6); }
.toc > .label { margin-bottom: var(--s-3); }
.toc-list {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
}
.toc-list li + li { border-inline-start: 1px solid var(--rule); }
.toc-item {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 4px 12px;
  height: 100%;
  padding: var(--s-5) var(--s-5) var(--s-6);
  color: var(--ink); text-decoration: none;
  transition: background-color .15s ease;
}
.toc-item:hover { background: var(--hover); }
.toc-item:hover .toc-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.toc-num { font-size: var(--fs-fn); font-weight: 600; color: var(--accent); padding-top: 0.35em; font-variant-numeric: tabular-nums; }
.toc-title { font-size: 1.375rem; font-weight: 300; line-height: 1.25; }
.toc-hint { grid-column: 2; font-size: var(--fs-small); line-height: var(--lh-small); color: var(--ink-2); }
.toc-arrow { grid-column: 3; grid-row: 1; margin-top: 0.3em; color: var(--ink-3); }
.toc-item:hover .toc-arrow { color: var(--accent); }

@media (max-width: 1023px) {
  .toc-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toc-list li:nth-child(3) { border-inline-start: 0; }
  .toc-list li:nth-child(n+3) { border-top: 1px solid var(--rule); }
}
@media (max-width: 599px) {
  .toc-list { grid-template-columns: minmax(0, 1fr); }
  .toc-list li + li { border-inline-start: 0; border-top: 1px solid var(--rule); }
  .toc-item { padding: var(--s-4) 0; }
  .toc-item:hover { background: none; }
}

/* ---------- 10. Sections ---------- */
.section { padding-block: var(--section-pad); }
.section + .section { border-top: 1px solid var(--rule); }
.section--band { background: var(--paper-2); border-top: 0 !important; }
.section--band + .section { border-top: 0; }

.section-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--col-gap);
}
.rail {
  grid-column: 1 / 4;
  display: flex; align-items: baseline; gap: var(--s-3);
  padding-top: 0.6em;
}
.rail-num { font-size: var(--fs-fn); font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.rail-name { font-size: var(--fs-small); color: var(--ink-2); }
.section-body { grid-column: 4 / 13; min-width: 0; }

@media (max-width: 1023px) {
  .rail { grid-column: 1 / -1; padding-top: 0; margin-bottom: var(--s-4); }
  .section-body { grid-column: 1 / -1; }
}

/* 01 Practice */
.practice-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 4fr);
  gap: var(--s-7);
  margin-top: var(--s-7);
}
.topic-list { margin-top: var(--s-3); border-bottom: 1px solid var(--rule); }
.topic-list li {
  display: flex; gap: var(--s-3);
  padding: 14px 0;
  border-top: 1px solid var(--rule);
}
.topic-list .dash { color: var(--ink-3); flex: none; }
/* An empty topic ("" in content.js) removes the whole row, dash included. */
.topic-list li:has(> [data-slot][hidden]) { display: none; }
.practice-actions { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s-3); padding-top: calc(var(--fs-label) * 1.4 + var(--s-3)); }
.practice-actions .fn { margin-top: -4px; }
@media (max-width: 767px) {
  .practice-grid { grid-template-columns: minmax(0, 1fr); gap: var(--s-6); }
  .practice-actions { padding-top: 0; align-items: stretch; }
  .practice-actions .btn { width: 100%; }
}

/* 02 Legal Notes */
.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: var(--s-4);
  margin-top: var(--s-6);
}
.country-card {
  position: relative;
  display: flex; flex-direction: column; gap: var(--s-2);
  min-height: 228px;
  padding: var(--s-5) var(--s-5) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  transition: border-color .15s ease;
}
.country-card:hover { border-color: var(--ink); }
.country-card:has(.stretched:focus-visible) { outline: 3px solid var(--focus); outline-offset: 3px; }
.cc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); }
.cc-head .h3 { font-weight: 300; font-size: clamp(1.375rem, 1.2rem + 0.6vw, 1.625rem); }
.code-tag {
  flex: none;
  margin-top: 0.3em;
  padding: 2px 6px;
  border: 1px solid var(--rule); border-radius: 2px;
  font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.08em;
  color: var(--ink-3);
  direction: ltr;
}
.cc-project { font-size: var(--fs-small); font-weight: 500; color: var(--ink-2); }
.cc-desc { font-size: var(--fs-small); line-height: var(--lh-small); color: var(--ink-2); }
.cc-foot { margin-top: auto; padding-top: var(--s-3); display: flex; align-items: center; gap: 6px; }

.stretched { text-decoration: none; color: inherit; }
.stretched::after { content: ""; position: absolute; inset: 0; }
.stretched:focus-visible { outline: none; }
/* Without :has() the card cannot draw the ring — keep it on the link instead. */
@supports not selector(:has(*)) { .stretched:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; } }
.country-card:hover .stretched, .post:hover .stretched {
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em;
}

/* 03 Sudius */
.sudius-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s-7);
  align-items: start;
}
.deliverables { margin: var(--s-3) 0 var(--s-6); border-bottom: 1px solid var(--rule); }
.deliverables li {
  display: flex; align-items: baseline; gap: var(--s-4);
  padding: 14px 0; border-top: 1px solid var(--rule);
  font-size: 1.125rem; font-weight: 300;
}
.dl-num { font-size: var(--fs-fn); font-weight: 600; color: var(--accent); min-width: 1ch; }
.sudius-text { max-width: 48rem; }
.sudius-text .label { margin-top: var(--s-6); }
.sudius-demo .fn { margin-top: var(--s-2); max-width: 40em; }

.excerpt .sheet {
  position: relative;
  padding: var(--s-6) var(--s-5);
  background: var(--surface);
  border: 1px solid var(--rule);
  box-shadow: calc(10px * var(--dir)) 10px 0 -1px var(--paper-2),
              calc(10px * var(--dir)) 10px 0 0 var(--rule);
}
.sk { height: 7px; margin: 11px 0; background: var(--rule); border-radius: 1px; }
.sk-title { height: 11px; width: 55%; background: var(--ink-3); opacity: .45; margin-bottom: 18px; }
.sk-quote {
  margin: 20px 0; padding: 10px 14px;
  border-inline-start: 3px solid var(--accent);
  background: var(--accent-tint);
}
.sk-quote .sk { background: var(--accent); opacity: .28; }
.sk-foot { margin-top: 22px; padding-top: 10px; border-top: 1px dashed var(--rule); }
.sk-foot .sk { height: 5px; }
.excerpt figcaption { margin-top: var(--s-5); font-size: var(--fs-small); line-height: var(--lh-small); color: var(--ink-3); }
@media (max-width: 899px) {
  .sudius-grid { grid-template-columns: minmax(0, 1fr); }
  .sudius-text .actions .btn { width: 100%; }
}

/* Compact, transparent supporting portraits; the hero remains the primary image. */
.section-portrait { display: block; width: 100%; aspect-ratio: 4 / 5; overflow: hidden; }
.section-portrait img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }

/* 04 Writing */
.channel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: var(--s-5) var(--s-7);
  align-items: center;
  margin-top: var(--s-6);
  padding: var(--s-5) 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule);
}
.channel-copy { min-width: 0; }
.channel-name { font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem); font-weight: 300; line-height: 1.2; }
.channel-orig { display: block; margin-top: 2px; font-size: var(--fs-small); color: var(--ink-3); }
.channel-desc { margin-top: var(--s-3); color: var(--ink-2); max-width: 40em; }
.channel-link { margin-top: var(--s-5); display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
@media (max-width: 767px) {
  .channel { grid-template-columns: minmax(0, 1fr) 104px; gap: var(--s-4); }
  .channel-copy { display: contents; }
  .channel-name { grid-column: 1; grid-row: 1; }
  .channel-portrait { grid-column: 2; grid-row: 1; }
  .channel-desc { grid-column: 1 / -1; grid-row: 2; margin-top: 0; }
  .channel-link { grid-column: 1 / -1; grid-row: 3; margin-top: 0; }
}

.posts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0 var(--s-6);
  margin-top: var(--s-6);
}
.post {
  position: relative;
  display: grid; grid-row: span 4; grid-template-rows: subgrid; row-gap: var(--s-3);
  padding-top: var(--s-4);
  border-top: 1px solid var(--rule);
  transition: border-color .15s ease;
}
.post:hover { border-top-color: var(--accent); }
.post:has(.stretched:focus-visible) { outline: 3px solid var(--focus); outline-offset: 6px; }
.post-rubric { color: var(--accent); }
.post .h3 { font-weight: 400; font-size: clamp(1.125rem, 1.05rem + 0.35vw, 1.3125rem); }
.post-summary { font-size: var(--fs-small); line-height: var(--lh-small); color: var(--ink-2); }
.post-meta { align-self: end; display: flex; align-items: center; gap: 6px; }
.post-date:not([hidden])::after { content: " · "; }
@media (max-width: 899px) {
  .posts { grid-template-columns: minmax(0, 1fr); row-gap: 0; }
  .post { grid-row: auto; grid-template-rows: none; padding-block: var(--s-4) var(--s-5); }
}

/* ---------- 11. Closing: About + Contact ("the signature") ---------- */
.closing {
  --focus: var(--sig-ink);
  background: var(--sig-bg);
  color: var(--sig-ink);
  padding-block: var(--section-pad);
}
.closing-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  column-gap: clamp(32px, 4.5vw, 64px);
  row-gap: var(--s-8);
}
.scope-note { grid-column: 1 / -1; max-width: 65em; font-size: var(--fs-small); line-height: var(--lh-small); color: var(--sig-ink-2); }
.about {
  grid-column: 1;
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  align-items: start;
  gap: var(--s-5);
}
.about-portrait { width: 100%; }
.about-copy { min-width: 0; }
.about-affiliation { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-top: var(--s-3); font-size: var(--fs-small); line-height: 1.6; color: var(--sig-ink); }
.about-affiliation [data-slot="about.partnership"] { white-space: nowrap; }
/* The Hebrew prefix ends in a maqaf and must meet the firm name without a flex gap. */
html[lang="he"] .about-affiliation { column-gap: 0; flex-wrap: nowrap; }
.about-affiliation a { display: inline-flex; align-items: baseline; gap: 6px; min-height: 32px; max-width: 100%; color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.about-affiliation a:hover { color: #FFFFFF; }
.about-affiliation .icon { flex: none; align-self: center; }
.affiliation-brand { unicode-bidi: isolate; }
.affiliation-brand bdi { white-space: nowrap; }

.contact { grid-column: 2; }
.closing .label { color: var(--sig-ink-2); }
.about-text {
  margin-top: var(--s-4);
  font-size: 1.125rem;
  font-weight: 300;
  line-height: 1.55;
  color: var(--sig-ink);
}
[lang|="ar"] .about-text { line-height: 1.8; }
.contact .h2 { color: var(--sig-ink); font-size: clamp(2rem, 3.1vw, 2.75rem); }
.contact-inv { margin-top: var(--s-4); color: var(--sig-ink-2); max-width: 32em; }
/* Email — primary contact card */
.email-card {
  margin-top: var(--s-6);
  padding-top: var(--s-5);
  border-top: 1px solid var(--sig-rule);
}
.cr-label { font-size: var(--fs-label); font-weight: var(--fw-label); letter-spacing: var(--tr-label); text-transform: var(--tt-label); color: var(--sig-ink-2); }
.email-address {
  margin-top: var(--s-2);
  font-size: clamp(1.625rem, 1.3rem + 1.3vw, 2.375rem);
  font-weight: 300; line-height: 1.2;
  overflow-wrap: anywhere;
}
[data-email-langs][hidden] { display: none !important; }
.email-address [data-email-text] { -webkit-user-select: all; user-select: all; }   /* one click selects the whole address */
.email-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-5); }

/* Buttons on the signature block: light primary in both themes */
.closing .btn-primary { background: var(--sig-ink); color: var(--sig-bg); }
.closing .btn-primary:hover { background: #FFFFFF; }
.closing .btn-secondary { border-color: var(--sig-ink-2); color: var(--sig-ink); }
.closing .btn-secondary:hover { background: var(--sig-rule); border-color: var(--sig-ink); }

/* Copy button: icon + label swap to a confirmation for 2.5 s (announced via role=status) */
[data-copy-email] .i-done, [data-copy-email] .copied-label { display: none; }
[data-copy-email][data-copied] .i-copy, [data-copy-email][data-copied] .copy-label { display: none; }
[data-copy-email][data-copied] .i-done, [data-copy-email][data-copied] .copied-label { display: inline; }
[data-copy-email][data-copied] .i-done { display: block; }

/* Telegram — secondary contact */
.contact-alt { margin-top: var(--s-6); padding-top: var(--s-4); border-top: 1px solid var(--sig-rule); }
.contact-alt-link {
  display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 4px var(--s-3);
  min-height: 44px; padding-block: 10px;
  color: var(--sig-ink); text-decoration: none;
}
.contact-alt-link .cr-value { font-size: 1.125rem; font-weight: 400; }
.contact-alt-link .icon { align-self: center; transition: transform .15s ease; }
.contact-alt-link:hover .cr-value { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.contact-alt-link:hover .icon { transform: translate(calc(3px * var(--dir)), -3px); }
[dir="rtl"] .contact-alt-link:hover .icon { transform: scaleX(-1) translate(3px, -3px); }

@media (max-width: 599px) {
  .email-actions { flex-direction: column; align-items: stretch; }
  .email-actions .btn { width: 100%; }
}
@media (max-width: 1099px) {
  .closing-grid { grid-template-columns: minmax(0, 1fr); }
  .about, .contact { grid-column: 1; }
}
@media (max-width: 599px) {
  .about { grid-template-columns: minmax(0, 1fr); gap: var(--s-5); }
  .about-portrait { width: min(100%, 260px); justify-self: center; }
}

/* ---------- 12. Footer ---------- */
.site-footer { padding-block: var(--s-6); font-size: var(--fs-small); color: var(--ink-2); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-4) var(--s-6); }
.footer-langs-wrap { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }
.footer-langs { display: flex; flex-wrap: wrap; gap: 0 var(--s-2); }
.footer-langs .lang-option { min-height: 44px; padding: 0 8px; font-size: var(--fs-small); color: var(--ink-2); }
.footer-langs .lang-option[aria-current] { color: var(--ink); }
.footer-langs .lang-option .icon { display: none; }
.footer-langs .lang-option[aria-current] span { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 6px; }
@media (max-width: 599px) {
  .footer-inner { flex-direction: column; align-items: flex-start; }
}


/* Progressive enhancement: navigation and content remain usable without JavaScript. */
html:not(.js) [data-menu] { display: none; }
html:not(.js) [data-menu-open] { display: none; }
html:not(.js) .primary-nav { display: block; }
html:not(.js) .header-cta { display: inline-flex; }
html:not(.js) [data-copy-email] { display: none; }
html:not(.js) [data-email-link] { display: none; }
