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

:root {
  --font-main: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --green: #32704b;
  --green-text: #2f6a48;
  --green-soft: rgba(47,106,72,0.10);
  --green-border: rgba(47,106,72,0.32);
  --green-glow: rgba(47,106,72,0.18);
  --green-button-bg: #2f6a48;
  --green-button-bg-hover: #3a7a55;
  --green-button-gradient: linear-gradient(180deg, #32704b 0%, #2b6242 100%);
  --green-button-gradient-hover: linear-gradient(180deg, #3b7d56 0%, #33704c 100%);
  --green-button-border: #234f36;
  --green-button-shadow: inset 0 1px 0 rgba(255,255,255,0.14), 0 1px 2px rgba(15,40,25,0.18);
  --green-button-text: #f4f1e8;

  --ease-out: cubic-bezier(.22,1,.36,1);
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  --spotlight: rgba(29,29,31,0.06);
  --spotlight-border: rgba(29,29,31,0.22);

  --site-max-width: 1440px;
  --site-gutter: 40px;
  --site-gutter-tablet: 24px;
  --site-gutter-mobile: 18px;
  --site-gutter-mobile-sm: 14px;

  --bg-main: #f3f3f2;
  --bg-page: #f3f3f2;
  --bg-card: #fbfbfa;
  --bg-elevated: #fbfbfa;
  --bg-inset: #eeeeef;

  --text-main: #232326;
  --text-muted: rgba(29,29,31,0.68);
  --text-soft: rgba(29,29,31,0.48);
  --text-inverse: #fbfbfa;
  --text-inverse-muted: rgba(255,255,255,0.72);
  --text-inverse-soft: rgba(255,255,255,0.54);

  --accent: #232326;
  --accent-hover: #18181a;
  --accent-active: #3a3a3e;

  --divider: rgba(29,29,31,0.10);
  --divider-strong: rgba(29,29,31,0.16);
  --border-soft: rgba(29,29,31,0.08);
  --border-strong: rgba(29,29,31,0.14);

  --rail-line: rgba(29,29,31,0.09);
  --rail-cross: rgba(29,29,31,0.32);
  --rail-light: rgba(47,106,72,0.9);
  --rail-glow: rgba(47,106,72,0.25);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 10px;
  --radius-pill: 999px;

  --shadow-soft: none;
  --shadow-card: none;
  --shadow-panel: none;
  --shadow-strong: 0 28px 90px rgba(0,0,0,0.12);

  --motion-fast: 0.16s ease;
  --motion-base: 0.22s ease;
  --motion-slow: 0.35s ease;

  --fs-header-title: 17px;
  --fs-header-subtitle: 12px;
  --fs-header-nav: 14px;
  --fs-header-cta: 14px;
  --fs-header-lang: 14px;
  --fs-header-badge: 12px;

  --fs-mobile-brand-title: 16px;
  --fs-mobile-brand-subtitle: 11px;
  --fs-mobile-menu-item: 17px;
  --fs-mobile-menu-meta: 17px;
  --fs-mobile-menu-cta: 16px;

  --fs-search-input: 16px;
  --fs-search-title: 14px;
  --fs-search-desc: 13px;
  --fs-search-empty: 13px;

  --fs-story-title: 24px;
  --fs-story-desc: 16px;
  --fs-story-meta-title: 17px;
  --fs-story-meta-subtitle: 13px;

  --fs-story-title-mobile: 22px;
  --fs-story-desc-mobile: 15px;
  --fs-story-meta-title-mobile: 16px;
  --fs-story-meta-subtitle-mobile: 13px;

  --fs-hero-title-desktop: clamp(56px, 4.8vw, 92px);
  --fs-hero-title-tablet: clamp(38px, 5vw, 54px);
  --fs-hero-title-mobile: clamp(24px, 6.2vw, 31px);
  --fs-hero-title-mobile-sm: clamp(22px, 5.8vw, 28px);

  --fs-hero-desc-desktop: clamp(20px, 1.4vw, 26px);
  --fs-hero-desc-tablet: clamp(16px, 2vw, 19px);
  --fs-hero-desc-mobile: 15px;
  --fs-hero-desc-mobile-sm: 14px;

  --fs-hero-button-desktop: 20px;
  --fs-hero-button-tablet: 18px;
  --fs-hero-button-mobile: 16px;

  --lh-tight: 0.95;
  --lh-title: 1.04;
  --lh-base: 1.4;
  --lh-text: 1.5;
  --lh-menu: 1.2;

  --letter-title-desktop: -0.06em;
  --letter-title-mobile: -0.04em;
  --letter-text: -0.01em;
  --letter-button: -0.02em;

  --header-height-desktop: 80px;
  --header-height-tablet: 78px;
  --header-height-mobile: 72px;

  --header-bg: var(--bg-page);
  --header-bg-solid: var(--bg-page);
  --header-text: #232326;
  --header-muted: rgba(29,29,31,0.62);
  --header-icon: #232326;
  --header-border: rgba(29,29,31,0.10);
  --header-divider: rgba(29,29,31,0.12);

  --header-avatar-size: 50px;
  --header-avatar-size-mobile: 44px;
  --header-avatar-border: rgba(29,29,31,0.24);
  --header-avatar-bg: rgba(255,255,255,0.48);

  --header-panel-bg: #f3f3f2;
  --header-panel-bg-solid: #f3f3f2;
  --header-panel-border: rgba(29,29,31,0.10);
  --header-panel-icon: rgba(29,29,31,0.68);

  --header-cta-bg: var(--green-button-gradient);
  --header-cta-bg-hover: var(--green-button-gradient-hover);
  --header-cta-border: var(--green-button-border);
  --header-cta-border-hover: var(--green-button-border);
  --header-cta-text: var(--green-button-text);

  --header-panel-cta-bg: var(--green-button-gradient);
  --header-panel-cta-bg-hover: var(--green-button-gradient-hover);
  --header-panel-cta-border: var(--green-button-border);
  --header-panel-cta-border-hover: var(--green-button-border);
  --header-panel-cta-text: var(--green-button-text);

  --badge-bg: #ffffff;
  --badge-bg-hover: #ffffff;
  --badge-border: rgba(29,29,31,0.18);
  --badge-text: #232326;

  --button-primary-bg: #232326;
  --button-primary-bg-hover: #3a3a3e;
  --button-primary-bg-active: #3a3a3e;
  --button-primary-text: #fbfbfa;
  --button-primary-border: #232326;


  --search-overlay-bg: rgba(24,24,27,0.48);
  --search-modal-bg: #fbfbfa;
  --search-field-bg: transparent;
  --search-item-bg: transparent;
  --search-item-hover-bg: rgba(29,29,31,0.045);
  --search-border: rgba(29,29,31,0.14);
  --search-border-strong: rgba(29,29,31,0.22);
  --search-divider: rgba(29,29,31,0.10);
  --search-text: #232326;
  --search-muted: rgba(29,29,31,0.62);

  --story-frame-w: 460px;
  --story-frame-h: 820px;
  --story-frame-radius: var(--radius-lg);
  --story-bg: #0c0c0e;
  --story-overlay-bg: rgba(0,0,0,0.86);
  --story-border: rgba(255,255,255,0.16);
  --story-progress-bg: rgba(255,255,255,0.24);
  --story-progress-fill: rgba(255,255,255,0.92);
  --story-title: #fbfbfa;
  --story-muted: rgba(255,255,255,0.72);
  --story-soft: rgba(255,255,255,0.54);

  --hero-bg: #05070a;
  --hero-text: #fbfbfa;
  --hero-muted: rgba(255,255,255,0.72);
  --hero-muted-mobile: rgba(255,255,255,0.76);
  --hero-content-max: 980px;
  --hero-content-tablet-max: 880px;
  --hero-title-max: 980px;
  --hero-desc-max: 860px;
  --hero-desc-tablet-max: 720px;
  --hero-desc-mobile-max: 390px;
  --hero-control-size: 38px;
  --hero-control-size-mobile: 36px;

  --modal-bg: #fbfbfa;
  --modal-text: #232326;
  --modal-muted: rgba(29,29,31,0.62);
  --modal-border: rgba(29,29,31,0.12);
  --modal-radius: var(--radius-lg);
}

/*
  Breakpoints (use only these):
  desktop  >= 1360px
  tablet   <= 1359px  (header switches to burger)
  narrow   <= 1023px  (sidebars collapse into sheets)
  mobile   <= 767px
  small    <= 390px
*/

:root {
  --gutter: var(--site-gutter);
  --header-h: var(--header-height-desktop);
  /* Adaptive header action icons (search / burger / close) — one size everywhere */
  --header-action-size: 22px;
  --header-action-gap: 20px;
  --page-top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 24px);
  --page-bottom: 72px;

  --fs-page-title: 58px;
  --fs-lead: 16px;
  --fs-card-title: 19px;
  --fs-body: 14.5px;
  --fs-ui: 14px;
  --fs-small: 13px;
  --fs-caption: 12px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
}

@media (max-width: 1359px) {
  :root {
    --gutter: var(--site-gutter-tablet);
    --header-h: var(--header-height-tablet);
    --header-action-size: 28px;
    --header-action-gap: 14px;
    --fs-page-title: 48px;
  }
}

@media (max-width: 767px) {
  :root {
    --gutter: var(--site-gutter-mobile);
    --header-h: var(--header-height-mobile);
    --header-action-size: 26px;
    --header-action-gap: 18px;
    --page-top: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 20px);
    --page-bottom: 48px;
    --fs-page-title: 38px;
    --fs-lead: 15px;
    --fs-card-title: 18px;
    --fs-body: 14px;
  }
}

@media (max-width: 390px) {
  :root {
    --gutter: var(--site-gutter-mobile-sm);
    --header-action-gap: 16px;
    --fs-page-title: 34px;
  }
}

html[data-theme="dark"] {
  --green: #71b78e;
  --green-text: #71b78e;
  --green-soft: rgba(113,183,142,0.12);
  --green-border: rgba(113,183,142,0.32);
  --green-glow: rgba(113,183,142,0.20);
  --green-button-bg: #2f6a48;
  --green-button-bg-hover: #3a8058;
  --green-button-gradient: linear-gradient(180deg, #32704b 0%, #2b6242 100%);
  --green-button-gradient-hover: linear-gradient(180deg, #377a52 0%, #2f6a48 100%);
  --green-button-border: #1f4831;
  --green-button-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 1px 2px rgba(0,0,0,0.4);

  --spotlight: rgba(245,245,247,0.07);
  --spotlight-border: rgba(245,245,247,0.28);

  --bg-main: #121214;
  --bg-page: #121214;
  --bg-card: #19191c;
  --bg-elevated: #1e1e21;
  --bg-inset: #0d0d0f;

  --text-main: #ececee;
  --text-muted: rgba(245,245,247,0.68);
  --text-soft: rgba(245,245,247,0.48);

  --accent: #ececee;
  --accent-hover: #f6f6f7;
  --accent-active: #d4d4d8;

  --divider: rgba(245,245,247,0.10);
  --divider-strong: rgba(245,245,247,0.16);
  --border-soft: rgba(245,245,247,0.08);
  --border-strong: rgba(245,245,247,0.14);

  --rail-line: rgba(245,245,247,0.08);
  --rail-cross: rgba(245,245,247,0.30);
  --rail-light: rgba(113,183,142,0.9);
  --rail-glow: rgba(113,183,142,0.3);
  --ui-bg-hover: rgba(245,245,247,0.055);
  --ui-bg-active: rgba(245,245,247,0.085);
  --ui-border: rgba(245,245,247,0.14);
  --ui-border-hover: rgba(245,245,247,0.24);
  --ui-border-active: rgba(245,245,247,0.30);

  --header-text: #ececee;
  --header-muted: rgba(245,245,247,0.68);
  --header-icon: #ececee;
  --header-border: rgba(245,245,247,0.10);
  --header-divider: rgba(245,245,247,0.12);

  --header-avatar-border: rgba(245,245,247,0.34);
  --header-avatar-bg: rgba(245,245,247,0.10);

  --header-panel-bg: #121214;
  --header-panel-bg-solid: #121214;
  --header-panel-border: rgba(245,245,247,0.10);
  --header-panel-icon: rgba(245,245,247,0.68);

  --header-cta-bg: var(--green-button-gradient);
  --header-cta-bg-hover: var(--green-button-gradient-hover);
  --header-cta-border: var(--green-button-border);
  --header-cta-border-hover: var(--green-button-border);
  --header-cta-text: var(--green-button-text);

  --header-panel-cta-bg: var(--green-button-gradient);
  --header-panel-cta-bg-hover: var(--green-button-gradient-hover);
  --header-panel-cta-border: var(--green-button-border);
  --header-panel-cta-border-hover: var(--green-button-border);
  --header-panel-cta-text: var(--green-button-text);

  --badge-bg: #1e1e21;
  --badge-bg-hover: #1e1e21;
  --badge-border: rgba(245,245,247,0.18);
  --badge-text: #ececee;

  --button-primary-bg: #ececee;
  --button-primary-bg-hover: #f6f6f7;
  --button-primary-bg-active: #d4d4d8;
  --button-primary-text: #121214;
  --button-primary-border: #ececee;


  --search-overlay-bg: rgba(0,0,0,0.72);
  --search-modal-bg: #19191c;
  --search-field-bg: transparent;
  --search-item-hover-bg: rgba(245,245,247,0.055);
  --search-border: rgba(245,245,247,0.14);
  --search-border-strong: rgba(245,245,247,0.24);
  --search-divider: rgba(245,245,247,0.10);
  --search-text: #ececee;
  --search-muted: rgba(245,245,247,0.68);

  --modal-bg: #19191c;
  --modal-text: #ececee;
  --modal-muted: rgba(245,245,247,0.68);
  --modal-border: rgba(245,245,247,0.12);
}

.header[data-scheme="dark"] {
  --green: #71b78e;
  --green-border: rgba(113,183,142,0.40);
  --green-glow: rgba(113,183,142,0.22);
  --header-hover-bg: rgba(245,245,247,0.06);
  --header-text: #ececee;
  --header-muted: rgba(245,245,247,0.68);
  --header-icon: #ececee;
  --header-divider: rgba(245,245,247,0.12);
  --header-border: rgba(245,245,247,0.10);
  --header-avatar-border: rgba(255,255,255,0.34);
  --header-avatar-bg: rgba(255,255,255,0.10);

  --badge-text: #ececee;
  --badge-border: rgba(245,245,247,0.16);
  --badge-bg: #1e1e21;

  --header-cta-bg: var(--green-button-gradient);
  --header-cta-bg-hover: var(--green-button-gradient-hover);
  --header-cta-border: var(--green-button-border);
  --header-cta-border-hover: var(--green-button-border);
  --header-cta-text: var(--green-button-text);
}

.header[data-scheme="light"] {
  --green: #32704b;
  --green-border: rgba(47,106,72,0.32);
  --green-glow: rgba(47,106,72,0.16);
  --header-hover-bg: rgba(29,29,31,0.06);
  --header-text: #232326;
  --header-muted: rgba(29,29,31,0.62);
  --header-icon: #232326;
  --header-divider: rgba(29,29,31,0.12);
  --header-border: rgba(29,29,31,0.10);
  --header-avatar-border: rgba(29,29,31,0.24);
  --header-avatar-bg: rgba(255,255,255,0.48);

  --badge-text: #232326;
  --badge-border: rgba(29,29,31,0.18);
  --badge-bg: #ffffff;

  --header-cta-bg: var(--green-button-gradient);
  --header-cta-bg-hover: var(--green-button-gradient-hover);
  --header-cta-border: var(--green-button-border);
  --header-cta-border-hover: var(--green-button-border);
  --header-cta-text: var(--green-button-text);
}

.header[data-state="menu"][data-scheme="light"] {
  --header-bg: #f3f3f2;
  --header-bg-solid: #f3f3f2;
  --header-panel-bg: #f3f3f2;
  --header-panel-bg-solid: #f3f3f2;
  --header-panel-border: rgba(29,29,31,0.10);
}

.header[data-state="menu"][data-scheme="dark"] {
  --header-bg: #121214;
  --header-bg-solid: #121214;
  --header-panel-bg: #121214;
  --header-panel-bg-solid: #121214;
  --header-panel-border: rgba(245,245,247,0.10);
}

html {
  width: 100%;
  max-width: 100%;
  /* hidden, not clip — Telegram/Chrome iOS WebViews mishandle overflow-x: clip */
  overflow-x: hidden;
  overscroll-behavior-x: none;
  /* Telegram iOS auto-boosts text and breaks layouts */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

html,
body {
  min-height: 100%;
  min-height: 100svh;
  background: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  width: 100%;
  max-width: 100%;
  /* Do NOT set overflow-x on body — it turns body into a scrollport and kills position:sticky (library sidebar/toolbar) */
  overscroll-behavior-x: none;
  position: relative;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

/* iOS-safe lock while mobile menu is open (search/stories use html.is-*-open) */
body.menu-open {
  overflow: hidden;
  overscroll-behavior: none;
}

body.menu-open.is-scroll-locked {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
}

main {
  width: 100%;
  max-width: 100%;
  /* Do NOT clip here — sheet rail "+" marks stick out of the content box */
}

h1,
h2,
h3,
h4 {
  text-wrap: balance;
}

p,
li,
blockquote,
dd {
  text-wrap: pretty;
}
