/* ==========================================================================
   LifeOS — направление A: «Личный премиум-дневник технократа»
   Линза: high-end-visual-design. Self-hosted Lora + Manrope, кириллица.
   ========================================================================== */

/* ---- Шрифты (self-hosted, только cyrillic + latin subsets) ---- */

@font-face {
  font-family: 'Lora';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/lora-cyrillic-500.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Lora';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/lora-latin-500.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2122, U+2191, U+2193, U+2212;
}
@font-face {
  font-family: 'Lora';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/lora-cyrillic-600.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Lora';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/lora-latin-600.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2122, U+2191, U+2193, U+2212;
}
@font-face {
  font-family: 'Lora';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/lora-cyrillic-700.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Lora';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('fonts/lora-latin-700.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2122, U+2191, U+2193, U+2212;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/manrope-cyrillic-400.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/manrope-latin-400.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2122, U+2191, U+2193, U+2212;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/manrope-cyrillic-500.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/manrope-latin-500.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2122, U+2191, U+2193, U+2212;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/manrope-cyrillic-600.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Manrope';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/manrope-latin-600.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2122, U+2191, U+2193, U+2212;
}

/* ---- Токены ---- */

:root {
  /* Палитра — 60/30/10, тёплая тёмная тема, все проверены на WCAG AA (манифест) */
  --bg: #0E0D0C;          /* 60% — фон, тёплый почти-чёрный */
  --surface: #1A1613;     /* 30% — поверхности: карточки, рельс оглавления, шапка */
  --surface-2: #211C18;   /* чуть светлее поверхности — hover/активные состояния */
  --text: #F2EDE4;        /* основной текст, тёплый off-white */
  --text-dim: #D8CDBE;    /* вторичный текст: метки, подписи, мета */
  --accent: #ECB273;      /* 10% — акцент: CTA-заливка, кикеры, активная глава */
  --accent-deep: #8B5A2B; /* тёмный бронзовый — вторичная заливка, тени, hover */
  --hairline: rgba(242, 237, 228, 0.09);

  --font-display: 'Lora', 'Georgia', serif;
  --font-body: 'Manrope', -apple-system, sans-serif;
  --font-mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  /* Модульная шкала ×1.333 (perfect fourth) — база 18px, редакционный/имиджевый выбор */
  --fs-caption: 0.75rem;   /* 13.5px -> округлено до 12px в rem-сетке браузера */
  --fs-body: 1.125rem;     /* 18px */
  --fs-lead: 1.5rem;       /* 24px */
  --fs-h3: 2rem;           /* 32px */
  --fs-h2: 2.6667rem;      /* 42.6px */
  --fs-h1-min: 2.6667rem;  /* нижняя граница clamp — 42.6px, ступень шкалы */
  --fs-h1-max: 4.7417rem;  /* верхняя граница clamp — 75.9px, ступень шкалы (n+5) */
  --fs-quote-min: 2rem;    /* нижняя граница пул-цитаты — 32px */
  --fs-quote-max: 3.5556rem; /* верхняя граница — 56.9px, ступень шкалы (n+4) */

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --space-7: 64px;
  --space-8: 96px;
  --space-9: 128px;

  --ease-editorial: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-slow: 900ms;
  --dur-med: 480ms;
}

/* ---- Сброс и база ---- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

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

img, svg { max-width: 100%; display: block; }

::selection { background: var(--accent-deep); color: var(--text); }

a { color: inherit; text-decoration: none; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; color: var(--text); }

p { margin: 0; }

/* ---- Доступность: skip-link и фокус ---- */

.skip-link {
  position: absolute;
  top: -48px;
  left: var(--space-3);
  background: var(--accent);
  color: var(--bg);
  padding: var(--space-2) var(--space-4);
  border-radius: 4px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9375rem;
  z-index: 200;
  transition: top var(--dur-med) var(--ease-editorial);
}
.skip-link:focus {
  top: var(--space-3);
}

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

/* ---- Текстура-«файлы» (декоративная, aria-hidden) ---- */

.hero__texture {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.hero__texture ul {
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  right: -2%;
  top: 8%;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 2.1;
  letter-spacing: 0.02em;
  color: var(--text);
  opacity: 0.05;
  white-space: nowrap;
  transform: rotate(-2deg);
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- Шапка ---- */

.chrome {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: rgba(14, 13, 12, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
}

.chrome__mark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
}
.chrome__mark span { color: var(--accent); }

.chrome__right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.chrome__github {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-dim);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  transition: color var(--dur-med) var(--ease-editorial);
}
.chrome__github:hover { color: var(--accent); }
.chrome__github svg { width: 16px; height: 16px; }

/* ---- Рельс оглавления (десктоп, слева) ---- */

.spine {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 88px;
  z-index: 80;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-7) 0;
  background: var(--surface);
  border-right: 1px solid var(--hairline);
}

.spine__label {
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  margin-bottom: var(--space-6);
}

.spine__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  overflow-y: auto;
}

.spine__item a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--text-dim);
  padding: var(--space-1);
  border-radius: 4px;
  transition: color var(--dur-med) var(--ease-editorial);
}

.spine__num {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.8125rem;
}

.spine__tick {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
  transition: opacity var(--dur-med) var(--ease-editorial), transform var(--dur-med) var(--ease-editorial), background var(--dur-med) var(--ease-editorial);
}

.spine__item a:hover,
.spine__item a:focus-visible {
  color: var(--accent);
}

.spine__item[aria-current="location"] a {
  color: var(--accent);
}
.spine__item[aria-current="location"] .spine__tick {
  opacity: 1;
  transform: scale(2.4);
  background: var(--accent);
}

@media (min-width: 1024px) {
  .spine { display: flex; }
  .chrome { left: 88px; }
  main { margin-left: 88px; }
}

/* ---- Рельс оглавления (мобиль, горизонтальная лента) ---- */

.spine-m {
  position: sticky;
  top: 57px;
  z-index: 70;
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  padding: var(--space-2) var(--space-4);
  background: var(--bg);
  border-bottom: 1px solid var(--hairline);
  scrollbar-width: none;
}
.spine-m::-webkit-scrollbar { display: none; }

.spine-m a {
  flex: none;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-dim);
  white-space: nowrap;
  padding: var(--space-1) var(--space-3);
  border-radius: 999px;
  background: var(--surface);
}

.spine-m a[aria-current="location"] {
  color: var(--bg);
  background: var(--accent);
  font-weight: 600;
}

@media (min-width: 1024px) {
  .spine-m { display: none; }
}

/* ---- Layout base ---- */

main { display: block; }

section {
  position: relative;
  padding: var(--space-8) var(--space-4);
}

.section__inner {
  max-width: 760px;
  margin: 0 auto;
}

@media (min-width: 640px) {
  section { padding: var(--space-9) var(--space-6); }
}

/* ---- Hero ---- */

.hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-top: calc(var(--space-8) + 56px);
  overflow: hidden;
}

.hero__inner {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
}

.hero__kicker {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: var(--space-5);
}

.hero__kicker-rule {
  display: inline-block;
  width: 32px;
  height: 1px;
  background: var(--accent);
  transform-origin: left;
}

.hero__title {
  font-size: clamp(var(--fs-h1-min), 6vw + 1rem, var(--fs-h1-max));
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: var(--space-5);
}

.hero__tagline {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: var(--text-dim);
  max-width: 62ch;
  margin-bottom: var(--space-6);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* Reveal-состояния для орchestrованного момента входа (JS переключает .is-revealed) */
.reveal-line {
  overflow: hidden;
}
.reveal-line > * {
  display: block;
  transform: translateY(110%);
  transition: transform var(--dur-slow) var(--ease-editorial);
}
.is-revealed .reveal-line > * { transform: translateY(0); }

.hero__kicker-rule {
  transform: scaleX(0);
  transition: transform var(--dur-slow) var(--ease-editorial);
}
.is-revealed .hero__kicker-rule { transform: scaleX(1); }

.hero__actions {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--dur-med) var(--ease-editorial), transform var(--dur-med) var(--ease-editorial);
  transition-delay: 520ms;
}
.is-revealed .hero__actions { opacity: 1; transform: translateY(0); }

/* ---- Кнопки ---- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9375rem;
  padding: 16px 28px;
  border-radius: 999px;
  transition: background var(--dur-med) var(--ease-editorial), color var(--dur-med) var(--ease-editorial), transform var(--dur-med) var(--ease-editorial);
}

.btn--primary {
  background: var(--accent);
  color: var(--bg);
}
.btn--primary:hover { background: #F0BE8B; transform: translateY(-1px); }

.btn--ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--hairline);
}
.btn--ghost:hover {
  background: var(--accent-deep);
  color: var(--text);
  border-color: var(--accent-deep);
}

.btn__icon { width: 16px; height: 16px; }

/* ---- «Что это» — 2 карточки ---- */

.intro-cards { padding-top: 0; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  max-width: 760px;
  margin: 0 auto;
}

@media (min-width: 720px) {
  .cards-grid { grid-template-columns: 1fr 1fr; gap: var(--space-5); }
}

.card {
  background: var(--surface);
  padding: var(--space-5);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(10, 7, 5, 0.25), 0 16px 32px -16px rgba(10, 7, 5, 0.4);
}

.card h3 {
  font-size: var(--fs-h3);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-3);
}

.card p {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-dim);
  max-width: 42ch;
}

/* ---- Введение (главa 1) ---- */

.chapter { background: var(--bg); }

.chapter__meta {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.chapter__num {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-h3);
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.chapter__eyebrow {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.chapter h2 {
  font-size: var(--fs-h2);
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin-bottom: var(--space-7);
}

.confession {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(var(--fs-quote-min), 3.4vw + 1rem, var(--fs-quote-max));
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: var(--space-7);
  max-width: 22ch;
}

.confession--emphasis { font-weight: 700; color: var(--accent); }

.chapter__prose {
  font-family: var(--font-body);
  font-size: var(--fs-lead);
  line-height: 1.55;
  color: var(--text-dim);
  max-width: 62ch;
  margin-bottom: var(--space-7);
}

.next-chapter {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-dim);
  padding-top: var(--space-5);
  border-top: 1px solid var(--hairline);
  width: 100%;
  transition: color var(--dur-med) var(--ease-editorial);
}
.next-chapter:hover { color: var(--accent); }
.next-chapter small {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 4px;
}

/* ---- Подвал ---- */

footer {
  padding: var(--space-6) var(--space-4);
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: space-between;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  color: var(--text-dim);
}
footer a { color: var(--text-dim); transition: color var(--dur-med) var(--ease-editorial); }
footer a:hover { color: var(--accent); }

/* ---- Скролл-reveal для «Что это» и «Введение» (один сдержанный приём, не «ковёр») ---- */

.observe-fade {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 700ms var(--ease-editorial), transform 700ms var(--ease-editorial);
}
.observe-fade.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---- Reduced motion ---- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal-line > * { transform: translateY(0) !important; }
  .hero__kicker-rule { transform: scaleX(1) !important; }
  .hero__actions { opacity: 1 !important; transform: translateY(0) !important; }
  .observe-fade { opacity: 1 !important; transform: translateY(0) !important; }
}

/* ---- Responsive: типографика ---- */

@media (max-width: 480px) {
  .hero { padding-top: calc(var(--space-6) + 56px); }
  .card { padding: var(--space-4); }
  .confession { max-width: 100%; }
}
