/* xASH · xash.dev. Строгая сетка, волосяные линии, один тёплый акцент. */

/* ---------- Шрифты (OFL, свои копии) ---------- */
@font-face {
  font-family: "Onest";
  src: url(fonts/onest-5.3.1-cyrillic-normal.woff2) format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Onest";
  src: url(fonts/onest-5.3.1-latin-normal.woff2) format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Cormorant";
  src: url(fonts/cormorant-5.3.0-cyrillic-italic.woff2) format("woff2");
  font-weight: 300 700; font-style: italic; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Cormorant";
  src: url(fonts/cormorant-5.3.0-latin-italic.woff2) format("woff2");
  font-weight: 300 700; font-style: italic; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url(fonts/jetbrains-mono-5.3.0-cyrillic-normal.woff2) format("woff2");
  font-weight: 100 800; font-style: normal; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url(fonts/jetbrains-mono-5.3.0-latin-normal.woff2) format("woff2");
  font-weight: 100 800; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Токены ---------- */
:root {
  --bg: #0c0c0d;
  --surface: #131315;
  --text: #ece8e1;
  --text-rgb: 236 232 225;
  --mute: #8c8882;
  --line: rgb(236 232 225 / 0.1);
  --line-strong: rgb(236 232 225 / 0.2);
  --accent: #e8b888;          /* линии, точки, заливки */
  --accent-rgb: 232 184 136;
  --accent-text: #e8b888;     /* текст акцентом, контраст ≥ 4,5:1 */
  --on-accent: #0c0c0d;
  --canvas-alpha: 1;

  --font: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Cormorant", "Cormorant Garamond", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --wrap: 1280px;
  --gutter: 24px;
  --top: 64px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f0ea;
    --surface: #ebe7df;
    --text: #141414;
    --text-rgb: 20 20 20;
    --mute: #625e58;
    --line: rgb(20 20 20 / 0.11);
    --line-strong: rgb(20 20 20 / 0.22);
    --accent: #c08350;
    --accent-rgb: 192 131 80;
    --accent-text: #8e5426;
    --on-accent: #f3f0ea;
    --canvas-alpha: 1.25;
    color-scheme: light;
  }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; --top: 56px; }
}

/* ---------- Основа ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

/* Где цвет несёт смысл (фокус, выделение, кнопка), берём --accent-text: контраст ≥ 4,5:1. */
::selection { background: var(--accent-text); color: var(--on-accent); }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 1px solid var(--accent-text); outline-offset: 4px; }
h1, h2, h3, p, ol, ul, figure { margin: 0; }

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.skip {
  position: fixed; left: var(--gutter); top: -80px; z-index: 30;
  background: var(--text); color: var(--bg); padding: 10px 16px; font-size: 14px;
}
.skip:focus { top: 12px; }

.ico {
  width: 0.72em; height: 0.72em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.4;
  stroke-linecap: square; transition: transform 0.35s var(--ease);
}

.mono, .label, .kind, .num, .count, .section-title, .status, .ver,
.cue, .hero-index, .contact-label, figcaption, .foot-in, .lang {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ---------- Шапка ---------- */
.top {
  position: fixed; inset: 0 0 auto; z-index: 20;
  border-bottom: 1px solid transparent;
  transition: background-color 0.4s, border-color 0.4s, backdrop-filter 0.4s;
}
.top.is-scrolled {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  backdrop-filter: blur(16px) saturate(1.3);
  border-bottom-color: var(--line);
}
.top-in { display: flex; align-items: center; gap: 32px; height: var(--top); }

.mark { font-weight: 600; font-size: 21px; letter-spacing: -0.03em; line-height: 1; }
.mark-x { color: var(--accent-text); }

.nav { margin-left: auto; display: flex; gap: 32px; font-size: 14px; color: var(--mute); }
.nav a { position: relative; transition: color 0.25s; }
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 1px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform 0.4s var(--ease);
}
.nav a:hover { color: var(--text); }
.nav a:hover::after { transform: scaleX(1); }

.lang {
  border: 1px solid var(--line-strong); padding: 8px 10px; line-height: 1;
  transition: border-color 0.25s, color 0.25s;
}
.lang:hover { border-color: var(--accent); color: var(--accent-text); }

@media (max-width: 640px) {
  .nav { display: none; }
  .lang { margin-left: auto; }
}

/* ---------- Первый экран ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  grid-template-rows: 1fr auto;
  padding-top: var(--top);
  isolation: isolate;
}
.hero-canvas {
  position: absolute; inset: 0; z-index: -1;
  width: 100%; height: 100%;
  opacity: 0; transition: opacity 2.4s var(--ease);
  /* Сверху и снизу линии растворяются, слева, под текстом, приглушены. */
  -webkit-mask-image:
    linear-gradient(to bottom, transparent, #000 14%, #000 74%, transparent),
    linear-gradient(to right, rgb(0 0 0 / 0.4), #000 62%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to bottom, transparent, #000 14%, #000 74%, transparent),
    linear-gradient(to right, rgb(0 0 0 / 0.4), #000 62%);
  mask-composite: intersect;
}
.hero-canvas.on { opacity: 1; }

.hero-in { align-self: end; padding-bottom: clamp(40px, 7vh, 72px); }

.label { display: flex; align-items: center; gap: 14px; color: var(--mute); }
.label::before { content: ""; width: 32px; height: 1px; background: var(--accent); }

.hero-title {
  margin-top: clamp(20px, 3vh, 32px);
  max-width: 11.2em;
  font-weight: 500;
  font-size: clamp(44px, 8.6vw, 132px);
  line-height: 0.96;
  letter-spacing: -0.045em;
  text-wrap: balance;
}
.hero-title em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 1.12em;
  line-height: 0.8;
  letter-spacing: -0.02em;
  color: var(--accent-text);
  padding-right: 0.04em;
}

.hero-lead {
  margin-top: clamp(24px, 3.5vh, 36px);
  max-width: 38ch;
  font-size: clamp(16px, 1.45vw, 19px);
  line-height: 1.6;
  color: var(--mute);
}

.hero-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  border-top: 1px solid var(--line);
  padding: 18px 0 22px;
  color: var(--mute);
}
.cue { display: inline-flex; align-items: center; gap: 10px; transition: color 0.25s; }
.cue:hover { color: var(--text); }
.cue:hover .ico { transform: translateY(3px); }
.hero-index { display: flex; gap: 32px; list-style: none; padding: 0; }
/* Имена продуктов и знак xASH пишутся как есть, без верхнего регистра. */
.hero-index a { text-transform: none; letter-spacing: 0.04em; transition: color 0.25s; }
.hero-index a:hover { color: var(--text); }
.num { color: var(--accent-text); }

@media (max-width: 640px) {
  .hero-index { display: none; }
}

/* Появление первого экрана при загрузке, без JS. */
@media (prefers-reduced-motion: no-preference) {
  .rise { animation: rise 1.2s var(--ease) both; }
  .r2 { animation-delay: 0.12s; }
  .r3 { animation-delay: 0.26s; }
  .r4 { animation-delay: 0.42s; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: none; }
}

/* Появление при прокрутке, только когда работает скрипт. */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0; transform: translateY(20px);
    transition: opacity 1s var(--ease), transform 1s var(--ease);
  }
  .js .reveal.is-in { opacity: 1; transform: none; }
}

/* ---------- Разделы ---------- */
.section { padding-top: clamp(96px, 13vw, 176px); }

.section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  border-top: 1px solid var(--line-strong);
  padding-top: 18px;
  margin-bottom: clamp(56px, 8vw, 112px);
  color: var(--mute);
}
.section-title { color: var(--text); }

/* ---------- Продукты ---------- */
.product {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 24px;
  align-items: center;
}
.product + .product { margin-top: clamp(96px, 12vw, 168px); }
.product-text { grid-column: 1 / span 5; }
.product-fig { grid-column: 7 / span 6; }
.product-alt .product-text { grid-column: 8 / span 5; grid-row: 1; }
.product-alt .product-fig { grid-column: 1 / span 6; grid-row: 1; }

.num-row { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.num-row .num { font-size: 13px; }
.rule { flex: 1; height: 1px; background: var(--line-strong); }

.product-name {
  font-weight: 500;
  font-size: clamp(40px, 5.4vw, 76px);
  line-height: 1;
  letter-spacing: -0.04em;
}
.kind { margin-top: 18px; color: var(--mute); line-height: 1.5; }
.product-lead { margin-top: 28px; font-size: 18px; line-height: 1.6; max-width: 42ch; }

.points { list-style: none; padding: 0; margin-top: 30px; border-top: 1px solid var(--line); }
.points li {
  position: relative;
  padding: 13px 0 13px 30px;
  border-bottom: 1px solid var(--line);
  font-size: 15px; line-height: 1.5;
  color: var(--mute);
}
.points li::before {
  content: ""; position: absolute; left: 0; top: 1.4em;
  width: 14px; height: 1px; background: var(--accent);
}

.actions { margin-top: 34px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }

.status {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 13px 18px;
  color: var(--accent-text);
  border: 1px solid rgb(var(--accent-rgb) / 0.45);
}
.dot { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .dot::after {
    content: ""; position: absolute; inset: 0; border-radius: 50%;
    border: 1px solid var(--accent);
    animation: ping 2.6s var(--ease) infinite;
  }
}
@keyframes ping {
  from { transform: scale(1); opacity: 0.9; }
  to { transform: scale(3.4); opacity: 0; }
}

.btn {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 14px 22px;
  background: var(--text); color: var(--bg);
  font-weight: 500; font-size: 15px; line-height: 1.2;
  transition: background-color 0.3s, color 0.3s;
}
.btn:hover { background: var(--accent-text); color: var(--on-accent); }
.btn:hover .ico, .link:hover .ico, .contact-value:hover .ico { transform: translate(2px, -2px); }

.link {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 15px; padding: 4px 0;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size 0.45s var(--ease), color 0.25s;
}
.link:hover { background-size: 100% 1px; }

.ver { color: var(--mute); }

/* Иллюстрации в рамке с отметками по углам, как на чертеже. */
.fig-frame {
  position: relative;
  border: 1px solid var(--line);
  background:
    linear-gradient(var(--accent), var(--accent)) left top / 10px 1px,
    linear-gradient(var(--accent), var(--accent)) left top / 1px 10px,
    linear-gradient(var(--accent), var(--accent)) right bottom / 10px 1px,
    linear-gradient(var(--accent), var(--accent)) right bottom / 1px 10px,
    radial-gradient(ellipse at 55% 50%, rgb(var(--text-rgb) / 0.035), transparent 70%);
  background-repeat: no-repeat;
}
.ill { display: block; width: 100%; height: auto; color: var(--text); }
.ill .l, .ill .a, .ill .flow { fill: none; vector-effect: non-scaling-stroke; }
.ill .l { stroke: currentColor; stroke-opacity: 0.3; stroke-width: 1; }
.ill .ring-o { stroke-opacity: 0.16; }
.ill .tick { stroke-opacity: 0.4; }
.ill .a { stroke: var(--accent); stroke-width: 1.2; }
.ill .flow {
  stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round;
  stroke-dasharray: 0.6 99.4; stroke-dashoffset: 0;
  opacity: 0;
}
.ill .t { font-family: var(--mono); font-size: 13px; letter-spacing: 0.04em; fill: var(--mute); }
.ill .t-out { fill: var(--accent-text); }

@media (prefers-reduced-motion: no-preference) {
  .ill .flow { opacity: 1; animation: flow 5.5s linear infinite; }
  .ill .d1 { animation-delay: -1.1s; }
  .ill .d2 { animation-delay: -2.2s; }
  .ill .d3 { animation-delay: -3.3s; }
  .ill .d4 { animation-delay: -4.4s; }
}
@keyframes flow {
  from { stroke-dashoffset: 0; }
  to { stroke-dashoffset: -100; }
}

figcaption {
  display: flex; justify-content: space-between; gap: 16px;
  margin-top: 14px;
  font-size: 11px;
  color: var(--mute);
}

@media (max-width: 900px) {
  .product-text, .product-alt .product-text { grid-column: 1 / -1; grid-row: 1; }
  .product-fig, .product-alt .product-fig { grid-column: 1 / -1; grid-row: 2; margin-top: 48px; }
}

/* ---------- Принципы ---------- */
.principles {
  list-style: none; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px;
}
.principle { border-top: 1px solid var(--line); padding-top: 26px; }
.roman {
  display: block;
  font-family: var(--serif); font-style: italic; font-weight: 500;
  font-size: 48px; line-height: 1;
  color: var(--accent-text);
}
.principle h3 {
  margin-top: clamp(32px, 4vw, 56px);
  font-weight: 500; font-size: clamp(22px, 2.1vw, 28px);
  line-height: 1.2; letter-spacing: -0.025em;
}
.principle p { margin-top: 14px; max-width: 36ch; font-size: 16px; color: var(--mute); }

@media (max-width: 860px) {
  .principles { grid-template-columns: 1fr; gap: 48px; }
}

/* ---------- Контакты ---------- */
.contact-title {
  font-weight: 500;
  font-size: clamp(52px, 9.4vw, 144px);
  line-height: 0.92;
  letter-spacing: -0.05em;
  margin-bottom: clamp(40px, 6vw, 80px);
}
.contact-list { list-style: none; padding: 0; border-top: 1px solid var(--line-strong); }
.contact-list li {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  align-items: center; column-gap: 24px;
  border-bottom: 1px solid var(--line-strong);
}
.contact-label { color: var(--mute); }
.contact-value {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: clamp(18px, 2.4vw, 28px) 0;
  font-size: clamp(22px, 3.2vw, 42px);
  line-height: 1.15; letter-spacing: -0.025em;
  overflow-wrap: anywhere;
  transition: color 0.3s, padding-left 0.5s var(--ease);
}
.contact-value .ico { width: 0.5em; height: 0.5em; stroke-width: 1; }
.contact-value:hover { color: var(--accent-text); padding-left: 14px; }

@media (max-width: 640px) {
  .contact-list li { grid-template-columns: 1fr; padding-top: 18px; }
  .contact-value { padding-top: 6px; }
}

/* ---------- Подвал ---------- */
.foot { margin-top: clamp(112px, 14vw, 200px); overflow: hidden; }
.giant {
  font-weight: 600;
  font-size: clamp(120px, 30vw, 460px);
  line-height: 0.74;
  letter-spacing: -0.07em;
  text-align: center;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 1px var(--line-strong);
  height: 0.62em;
  overflow: hidden;
  user-select: none;
  padding-top: 0.04em;
}
.giant-x { -webkit-text-stroke-color: rgb(var(--accent-rgb) / 0.7); }
.foot-in {
  display: flex; justify-content: space-between; gap: 16px;
  padding-block: 22px calc(22px + env(safe-area-inset-bottom));
  color: var(--mute);
  text-transform: none;
  letter-spacing: 0.04em;
}
.foot-row { border-top: 1px solid var(--line-strong); }
.foot-in a { transition: color 0.25s; }
.foot-in a:hover { color: var(--accent-text); }

/* ---------- 404 ---------- */
.nf { min-height: 100vh; min-height: 100svh; display: grid; grid-template-rows: auto 1fr; }
.nf-in { align-self: center; padding-block: calc(var(--top) + 32px) 64px; }
.nf-code {
  font-weight: 500; font-size: clamp(120px, 26vw, 360px);
  line-height: 0.85; letter-spacing: -0.07em;
  color: transparent; -webkit-text-stroke: 1px var(--line-strong);
}
.nf-pair {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px;
  margin-top: 40px; border-top: 1px solid var(--line-strong); padding-top: 24px;
}
.nf-title { font-size: clamp(22px, 2.4vw, 30px); font-weight: 500; letter-spacing: -0.02em; margin-bottom: 12px; }
.nf .link { color: var(--accent-text); }
@media (max-width: 640px) { .nf-pair { grid-template-columns: 1fr; gap: 32px; } }
