/* ==========================================================================
   dia-design — тёплая «солнечная» дизайн-система в духе diabrowser.com
   Подключение:
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   <link href="https://fonts.googleapis.com/css2?family=Caveat:wght@500&family=IBM+Plex+Mono:wght@400;500&family=Inter+Tight:wght@300;400;500;600&family=Playfair+Display:ital,wght@0,400;0,500;1,400&family=Spectral:ital,wght@0,400;0,500;1,400&display=swap" rel="stylesheet">
   <link rel="stylesheet" href="dia.css">
   ========================================================================== */

:root {
  /* Бумага и поверхности */
  --paper: #fbfaf6;
  --surface: #ffffff;
  --surface-2: #f8f8f8;
  --chip: rgba(235, 235, 235, 0.7);
  --chip-solid: #efefef;

  /* Чернила: всегда чёрный с прозрачностью, а не серые hex */
  --ink: rgba(0, 0, 0, 0.85);
  --ink-strong: #000;
  --ink-2: rgba(0, 0, 0, 0.6);
  --ink-3: rgba(0, 0, 0, 0.42);
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.3);

  /* Солнце */
  --sun-50: #fffaeb;
  --sun-100: #fff3c4;
  --sun-200: #ffe48c;
  --sun-300: #ffdc5c;
  --sun-400: #ffcb30;
  --sun-500: #f2bf3a;
  --sun-600: #e1b746;
  --sun-700: #c9962a;
  --sun-shade: #b98a22;
  --lime: #f2fcb3;
  --window-tint: #f7efd6; /* сайдбар окна приложения */

  /* Шрифты: бесплатные замены оригинальным (Exposure, ABC Oracle, Favorit Mono, Ammer) */
  --font-display: "Playfair Display", "Times New Roman", serif;   /* огромный вордмарк */
  --font-serif: "Spectral", Georgia, serif;                        /* заголовки */
  --font-sans: "Inter Tight", "Helvetica Neue", Helvetica, sans-serif; /* текст и UI */
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;           /* метки, футер */
  --font-hand: "Caveat", "Comic Sans MS", cursive;                 /* рукописные пометки */

  /* Скругления */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-2xl: 30px;
  --r-pill: 9999px;

  /* Тени: многослойные, мягкие, с отрицательным spread */
  --shadow-pill: 0 2px 8px rgba(0, 0, 0, 0.06), 0 0 2px rgba(0, 0, 0, 0.04);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04), 0 10px 24px -12px rgba(0, 0, 0, 0.1), 0 24px 48px -24px rgba(0, 0, 0, 0.12);
  --shadow-window: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 28px -12px rgba(0, 0, 0, 0.1), 0 28px 56px -28px rgba(0, 0, 0, 0.12), 0 60px 120px -40px rgba(120, 80, 10, 0.25);
  --shadow-arc: 0 -1px 2px -1px rgba(45, 35, 24, 0.09), 0 -7px 18px -8px rgba(73, 54, 34, 0.09), 0 -20px 44px -20px rgba(101, 76, 47, 0.1);

  /* Движение */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);

  /* Сетка */
  --container: 1120px;
  --gutter: 24px;
}

/* --------------------------------------------------------------------------
   База
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
::selection { background: var(--sun-200); color: #000; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--gutter); }
.center { text-align: center; }

/* --------------------------------------------------------------------------
   Типографика
   -------------------------------------------------------------------------- */
.wordmark {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(64px, 19vw, 300px);
  line-height: 0.85;
  letter-spacing: -0.02em;
  color: #fffdf3;
  margin: 0;
}
.h-hero {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(26px, 2.8vw, 39px);
  line-height: 1.1;
  letter-spacing: -0.04em;
  margin: 0;
}
.h-section {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(34px, 4vw, 48px);
  line-height: 1.16;
  letter-spacing: -0.05em;
  margin: 0;
}
.h-section-sans {
  font-family: var(--font-sans);
  font-weight: 300;
  font-size: clamp(36px, 4.4vw, 54px);
  line-height: 1.11;
  letter-spacing: -0.04em;
  margin: 0;
}
.h-item {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.04em;
  margin: 0;
}
.h-hero, .h-section, .h-section-sans, .h-item { text-wrap: balance; }
.lead { font-size: 20px; line-height: 1.5; font-weight: 400; letter-spacing: -0.02em; color: rgba(0, 0, 0, 0.7); }
.body { font-size: 16px; line-height: 1.5; }
.small { font-size: 14px; line-height: 1.43; color: var(--ink-2); }
.caption { font-size: 14px; color: rgba(0, 0, 0, 0.5); }
.mono {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.3;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.hand { font-family: var(--font-hand); font-weight: 500; font-size: 26px; line-height: 1; }

/* --------------------------------------------------------------------------
   Кнопки
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 48px; padding: 0 24px;
  border-radius: var(--r-xl);
  font-size: 16px; font-weight: 500; letter-spacing: -0.01em;
  white-space: nowrap;
  transition: transform 0.3s var(--ease-out), background-color 0.2s, box-shadow 0.3s;
}
.btn:active { transform: scale(0.97); }
.btn-dark { background: #000; color: #fff; }
.btn-dark:hover { background: #222; }
.btn-ghost { background: var(--chip); color: var(--ink); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.btn-ghost:hover { background: rgba(225, 225, 225, 0.85); }
.btn-pill { border-radius: var(--r-pill); }
.btn-lg { height: 56px; padding: 0 40px; font-size: 18px; font-weight: 400; }
.btn-sm { height: 36px; padding: 0 16px; font-size: 14px; border-radius: var(--r-pill); }
.btn .arrow { transition: transform 0.3s var(--ease-out); }
.btn:hover .arrow-down { transform: translateY(2px); }
.btn:hover .arrow-right { transform: translateX(3px); }

/* --------------------------------------------------------------------------
   Плавающая навигация-пилюля (по центру сверху)
   -------------------------------------------------------------------------- */
.pill-nav {
  position: fixed; top: 22px; left: 50%; z-index: 50;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 24px;
  width: max-content; height: 48px; padding: 0 24px 0 14px;
  background: rgba(248, 248, 248, 0.82);
  backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-pill);
  font-size: 15px;
}
.pill-nav .logo { display: flex; align-items: center; flex: none; }
.pill-nav a:not(.logo) { color: var(--ink); white-space: nowrap; transition: opacity 0.2s; }
.pill-nav a:not(.logo):hover { opacity: 0.6; }

/* Кнопка справа сверху, появляется после скролла */
.corner-cta {
  position: fixed; top: 22px; right: 24px; z-index: 50;
  opacity: 0; transform: translateY(-8px); pointer-events: none;
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
  background: rgba(248, 248, 248, 0.82);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  box-shadow: var(--shadow-pill);
}
.corner-cta.is-visible { opacity: 1; transform: none; pointer-events: auto; }

/* --------------------------------------------------------------------------
   Солнечный герой: тёплый градиент + «тени листвы»
   -------------------------------------------------------------------------- */
.sun-hero {
  position: relative; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(120% 80% at 50% 0%, #f9d867 0%, transparent 60%),
    linear-gradient(180deg, var(--sun-500) 0%, #f5c94c 55%, #f8d877 100%);
  color: #fffdf3;
}
.sunlight { position: absolute; inset: -10%; z-index: -1; pointer-events: none; filter: blur(38px); mix-blend-mode: multiply; opacity: 0.55; }
.sunlight span {
  position: absolute; display: block; border-radius: 50%;
  background: var(--sun-shade);
  animation: leaf-sway 14s ease-in-out infinite alternate;
}
.sunlight span:nth-child(1) { width: 34%; height: 26%; left: 4%;  top: 6%;  border-radius: 60% 40% 55% 45%; animation-duration: 13s; }
.sunlight span:nth-child(2) { width: 22%; height: 34%; left: 30%; top: 22%; border-radius: 45% 55% 40% 60%; animation-duration: 17s; animation-delay: -4s; }
.sunlight span:nth-child(3) { width: 30%; height: 20%; left: 62%; top: 4%;  border-radius: 50% 50% 35% 65%; animation-duration: 15s; animation-delay: -8s; }
.sunlight span:nth-child(4) { width: 18%; height: 28%; left: 80%; top: 30%; animation-duration: 19s; animation-delay: -2s; }
.sunlight span:nth-child(5) { width: 26%; height: 18%; left: 12%; top: 48%; border-radius: 65% 35% 50% 50%; animation-duration: 16s; animation-delay: -6s; }
.sunlight span:nth-child(6) { width: 14%; height: 16%; left: 50%; top: 56%; animation-duration: 12s; animation-delay: -10s; }
.sunlight span:nth-child(7) { width: 20%; height: 14%; left: 70%; top: 60%; border-radius: 40% 60% 60% 40%; animation-duration: 18s; }
.sunlight span:nth-child(8) { width: 10%; height: 12%; left: 40%; top: 6%; animation-duration: 11s; animation-delay: -3s; }
@keyframes leaf-sway {
  0%   { transform: translate(0, 0) rotate(0deg) scale(1); }
  50%  { transform: translate(2.5%, 1.5%) rotate(6deg) scale(1.06); }
  100% { transform: translate(-2%, 3%) rotate(-5deg) scale(0.96); }
}
/* узор листвы: процедурный шум SVG → пятна тени, медленно качаются */
.leaves {
  position: absolute; inset: -15%; z-index: -1; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='700'%3E%3Cfilter id='f' x='0' y='0'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.0065 .0055' numOctaves='2' seed='11' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .62 0 0 0 0 .42 0 0 0 0 .06 -6 0 0 0 3.35'/%3E%3CfeGaussianBlur stdDeviation='9'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
  background-size: 900px 700px;
  mix-blend-mode: multiply; opacity: 0.5;
  filter: blur(3px);
  transform-origin: 30% 20%;
  animation: leaves-wind 18s ease-in-out infinite alternate;
}
@keyframes leaves-wind {
  0%   { transform: rotate(0deg) skewX(0deg) translate(0, 0); }
  40%  { transform: rotate(1.2deg) skewX(2deg) translate(1%, 0.5%); }
  100% { transform: rotate(-1deg) skewX(-1.5deg) translate(-1%, 1%); }
}
/* лёгкое зерно поверх */
.grain::after {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: 0.18; 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='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   Нижняя дуга с главной кнопкой (фиксирована внизу экрана)
   -------------------------------------------------------------------------- */
.arc-cta {
  position: fixed; left: 50%; bottom: 0; z-index: 40;
  width: max(1400px, 140vw); height: 150px;
  transform: translate(-50%, 0);
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 10px;
  padding-top: 26px;
  background: var(--paper);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  box-shadow: var(--shadow-arc);
  transition: transform 0.6s var(--ease-out);
}
.arc-cta.is-hidden { transform: translate(-50%, 110%); }
.arc-cta .btn { min-width: min(346px, calc(100vw - 48px)); }

/* --------------------------------------------------------------------------
   Окно приложения (macOS)
   -------------------------------------------------------------------------- */
.window {
  position: relative;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-window), 0 0 0 0.5px rgba(0, 0, 0, 0.12);
  overflow: hidden;
  color: var(--ink);
  text-align: left;
}
.window-bar { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; }
.traffic { display: flex; gap: 7px; }
.traffic i { width: 12px; height: 12px; border-radius: 50%; display: block; background: #ff5f57; box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.15); }
.traffic i:nth-child(2) { background: #febc2e; }
.traffic i:nth-child(3) { background: #28c840; }
.window-sidebar { background: var(--window-tint); }

/* --------------------------------------------------------------------------
   Пронумерованный аккордеон (слева) + сцена (справа)
   -------------------------------------------------------------------------- */
.steps { display: flex; flex-direction: column; gap: 8px; }
.step {
  display: block; width: 100%; text-align: left;
  padding: 20px 24px; border-radius: var(--r-lg);
  border-left: 1px solid var(--line);
  border-radius: 0;
  position: relative;
  opacity: 0.42; transition: opacity 0.4s var(--ease-soft);
}
.step:hover { opacity: 0.7; }
.step.is-active { opacity: 1; }
.step::before { /* прогресс-линия */
  content: ""; position: absolute; left: -1px; top: 0; width: 1px; height: 0; background: #000;
}
.step.is-active::before { animation: step-progress var(--step-duration, 7s) linear forwards; }
@keyframes step-progress { to { height: 100%; } }
.step .num { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; color: var(--ink-3); display: block; margin-bottom: 8px; }
.step .desc {
  display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.5s var(--ease-out), margin 0.5s var(--ease-out);
}
.step .desc > div { overflow: hidden; }
.step.is-active .desc { grid-template-rows: 1fr; margin-top: 10px; }

/* --------------------------------------------------------------------------
   Карточки (бенто)
   -------------------------------------------------------------------------- */
.bento { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.card {
  position: relative; overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 32px;
}
.card-dashed { background: transparent; border: 1px dashed rgba(0, 0, 0, 0.18); border-radius: var(--r-2xl); }
.label {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px;
  border: 0.5px solid var(--line-strong); border-radius: var(--r-sm);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2);
}
.card .card-text { font-size: 20px; line-height: 1.5; font-weight: 400; letter-spacing: -0.02em; color: rgba(0, 0, 0, 0.7); margin: 18px 0 0; }
.card-stage {
  margin: 32px -32px -32px; padding: 32px 32px 0; min-height: 260px;
  background: linear-gradient(180deg, transparent, var(--sun-50) 60%);
  display: flex; align-items: flex-end; justify-content: center;
}

/* --------------------------------------------------------------------------
   Переключатели-чипы и бегущая строка
   -------------------------------------------------------------------------- */
.toggle-chip {
  display: inline-flex; align-items: center; gap: 10px; flex: none;
  height: 34px; padding: 0 6px 0 12px;
  background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-pill);
  font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.02em; color: var(--ink);
}
.toggle-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sun-400); }
.toggle-chip .state { padding: 3px 7px; border-radius: 6px; background: var(--chip-solid); color: var(--ink-2); }
.toggle-chip .state.on { background: var(--lime); color: #3a4a00; }
.marquee { overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }
.marquee-track { display: flex; gap: 14px; width: max-content; padding: 10px 0; animation: marquee 40s linear infinite; }
.marquee-track.reverse { animation-direction: reverse; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* --------------------------------------------------------------------------
   Граф связей (.graph[data-edges] + .gnode[data-id], рёбра рисует dia.js)
   -------------------------------------------------------------------------- */
:root { --e-delegate: #1a1a1a; --e-handoff: var(--sun-700); --e-review: #2f9e57; --e-context: #3d7be0; }
.graph { position: relative; }
.graph-svg { position: absolute; inset: 0; z-index: 0; overflow: visible; pointer-events: none; }
.gnode { position: absolute; z-index: 2; transform: translate(-50%, -50%); cursor: default; transition: opacity 0.3s, box-shadow 0.3s, transform 0.3s var(--ease-out); }
.gedge { color: var(--e-delegate); transition: opacity 0.3s; }
.gedge.t-handoff { color: var(--e-handoff); }
.gedge.t-review { color: var(--e-review); }
.gedge.t-context { color: var(--e-context); }
.gedge-line { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-opacity: 0.35; }
.gedge.t-context .gedge-line { stroke-dasharray: 3 4; }
.gedge-flow { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-dasharray: 2 26; animation: edge-flow 1.6s linear infinite; }
.gedge-head { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@keyframes edge-flow { to { stroke-dashoffset: -28; } }
.glabel {
  position: absolute; z-index: 1; transform: translate(-50%, -50%);
  padding: 3px 8px; border-radius: 999px; white-space: nowrap;
  background: var(--paper); box-shadow: inset 0 0 0 1px var(--line);
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.02em; color: var(--ink-2);
  transition: opacity 0.3s, background 0.3s, color 0.3s;
}
.glabel.t-handoff { color: #7a5a10; }
.glabel.t-review { color: #23763f; }
.glabel.t-context { color: #2c5fb3; }
.graph.is-focus .gedge:not(.is-on), .graph.is-focus .glabel:not(.is-on) { opacity: 0.12; }
.graph.is-focus .gnode:not(.is-on) { opacity: 0.35; }
.graph.is-focus .gedge.is-on .gedge-line { stroke-opacity: 0.8; }
.graph.is-focus .glabel.is-on { background: #fff; box-shadow: var(--shadow-pill); }
.graph-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; color: var(--ink-2); }
.graph-legend span { display: inline-flex; align-items: center; gap: 8px; }
.graph-legend i { width: 22px; height: 0; border-top: 2px solid var(--c); }
.graph-legend i.dashed { border-top-style: dashed; }

/* --------------------------------------------------------------------------
   Футер
   -------------------------------------------------------------------------- */
.footer { padding: 72px 0 40px; }
.footer-cols { display: grid; grid-template-columns: repeat(4, auto) 1fr; gap: 48px; align-items: start; }
.footer h3 { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.1em; font-weight: 500; text-transform: uppercase; margin: 0 0 14px; color: var(--ink); }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer li a { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); transition: color 0.2s; }
.footer li a:hover { color: #000; }
.footer-bottom { display: flex; justify-content: space-between; gap: 24px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); }
.stamp { justify-self: end; width: 104px; height: 104px; animation: spin 40s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   Появление при скролле
   -------------------------------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out); transition-delay: var(--d, 0s); }
.reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition-duration: 0.001s !important; }
  .reveal { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Адаптив
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .bento { grid-template-columns: 1fr; }
  .footer-cols { grid-template-columns: repeat(2, 1fr); }
  .stamp { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .pill-nav { gap: 16px; padding: 0 18px 0 12px; font-size: 14px; top: 14px; }
  .corner-cta { display: none; }
  .card { padding: 24px; }
  .card-stage { margin: 24px -24px -24px; padding: 24px 16px 0; }
  .card .card-text { font-size: 17px; }
  .arc-cta { height: 120px; padding-top: 20px; }
  .btn-lg { height: 52px; padding: 0 28px; font-size: 17px; }
}
