/* Общая основа всех вариантов. Варианты задают токены в :root и свою раскладку. */
:root {
  --bg: #eeeeeb; --surface: #f7f7f5; --ink: #1c1e1d; --muted: #616563; --line: #d2d4d0;
  --accent: #2b7a5f; --on-accent: #f7f7f5;
  --display: "Geologica", system-ui, sans-serif; --body: "Geologica", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --r-card: 14px; --r-btn: 10px; --gut: 16px;
  --ease: cubic-bezier(.16, 1, .3, 1); --ease-io: cubic-bezier(.65, 0, .35, 1);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.5 var(--body); -webkit-font-smoothing: antialiased; overflow-x: clip; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 600; letter-spacing: -0.03em; line-height: 1.02; text-wrap: balance; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 var(--gut); }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 22px;
  border-radius: var(--r-btn); border: 1px solid transparent; font-weight: 500; font-size: 16px; text-decoration: none;
  white-space: nowrap; cursor: pointer; transition: transform .25s var(--ease), background-color .25s, color .25s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-ghost { border-color: var(--line); background: transparent; }
.btn i { font-size: 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 8px 14px; font-size: 14px; cursor: pointer; transition: background-color .25s, color .25s; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* Карточка «образец → объект» */
.stones { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stone { display: grid; gap: 6px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.stone-media { position: relative; aspect-ratio: 1; overflow: hidden; border-radius: var(--r-card); background: var(--surface); isolation: isolate; }
.stone-media > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.stone-media .obj { clip-path: inset(0 0 0 100%); transform: scale(1.15); transition: clip-path .9s var(--ease-io), transform 1.2s var(--ease); }
.stone-media .seam { position: absolute; top: 0; bottom: 0; left: 100%; width: 3px; margin-left: -1px; z-index: 2;
  background: linear-gradient(90deg, #9fa3a6, #f4f5f6 50%, #9fa3a6); transition: left .9s var(--ease-io); }
.stone.on .obj { clip-path: inset(0 0 0 0); transform: scale(1); }
.stone.on .seam { left: 0; }
.stone.has-obj .stone-media::after { content: ""; position: absolute; right: 8px; bottom: 8px; z-index: 3; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(20,22,21,.55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2'%3E%3Cpath d='M3 12h18M15 6l6 6-6 6'/%3E%3C/svg%3E") center/14px no-repeat;
  transition: transform .5s var(--ease); }
.stone.on .stone-media::after { transform: rotate(180deg); }
.stone b { font-weight: 500; font-size: 14px; }
@media (hover: hover) {
  .stone.has-obj:hover .obj { clip-path: inset(0 0 0 0); transform: scale(1); }
  .stone.has-obj:hover .seam { left: 0; }
}

/* После дождя */
.compare { position: relative; aspect-ratio: 3/2; border-radius: var(--r-card); overflow: hidden; touch-action: pan-y; user-select: none; background: var(--surface); cursor: ew-resize; }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.compare .before { clip-path: inset(0 calc(100% - var(--x, 50%)) 0 0); }
.compare .handle { position: absolute; top: 0; bottom: 0; left: var(--x, 50%); width: 3px; margin-left: -1px; background: linear-gradient(90deg, #9fa3a6, #f4f5f6 50%, #9fa3a6); }
.compare .handle::after { content: ""; position: absolute; top: 50%; left: 50%; width: 46px; height: 46px; margin: -23px; border-radius: 50%;
  background: #f4f5f6 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231c1e1d' stroke-width='2'%3E%3Cpath d='M9 6l-6 6 6 6M15 6l6 6-6 6'/%3E%3C/svg%3E") center/22px no-repeat; box-shadow: 0 2px 12px rgba(0,0,0,.25); }
.compare .tag { position: absolute; top: 12px; font-size: 13px; background: rgba(20,22,21,.7); color: #f2f2ef; padding: 4px 10px; border-radius: 999px; }
.compare .tag.l { left: 12px; } .compare .tag.r { right: 12px; }

/* Карусель работ: карточка всегда по центру, точки и стрелки показывают, что листается */
.carousel { position: relative; }
.track { display: grid; grid-auto-flow: column; grid-auto-columns: 80%; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 0 10%; scrollbar-width: none; overscroll-behavior-x: contain; }
.track::-webkit-scrollbar { display: none; }
.slide { scroll-snap-align: center; display: grid; gap: 10px; transition: opacity .4s, transform .5s var(--ease); }
.slide:not(.cur) { opacity: .45; transform: scale(.94); }
.slide .ph { aspect-ratio: 4/5; border-radius: var(--r-card); overflow: hidden; }
.slide .ph img { width: 100%; height: 100%; object-fit: cover; }
.slide-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.slide-row span { font-weight: 500; }
.want { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; color: var(--accent); font-weight: 500; text-decoration: none; font-size: 15px; }
.car-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.car-nav button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: transparent; display: grid; place-items: center; font-size: 18px; cursor: pointer; }
.dots { display: flex; gap: 6px; }
.dots i { width: 6px; height: 6px; border-radius: 999px; background: var(--line); transition: width .4s var(--ease), background-color .4s; }
.dots i.cur { width: 22px; background: var(--ink); }

/* Нижняя панель на телефоне */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: 1fr 52px 52px; gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); transition: transform .45s var(--ease); }
.dock.away { transform: translateY(110%); }
.dock .btn { min-height: 48px; padding: 0 12px; }
.dock .ic { border: 1px solid var(--line); border-radius: var(--r-btn); display: grid; place-items: center; font-size: 22px; text-decoration: none; }
@media (min-width: 900px) { .dock { display: none; } }

/* Переключатель вариантов прототипа */
.variants { position: fixed; z-index: 50; top: 42%; right: 4px; display: flex; flex-direction: column; gap: 2px; padding: 3px; border-radius: 999px;
  background: rgba(20,22,21,.78); backdrop-filter: blur(8px); }
.variants a { color: #e9e9e6; text-decoration: none; font: 500 12px/1 var(--mono); padding: 7px 9px; border-radius: 999px; }
.variants a.cur { background: #e9e9e6; color: #1c1e1d; }

.split-line { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  .stone-media .obj, .stone-media .seam, .slide, .dock { transition: none; }
}
/* сетка не должна растягиваться по ширине ленты работ */
.carousel, .track { min-width: 0; max-width: 100%; }
.sec > *, .msec > * { min-width: 0; }
@media (min-width: 900px) {
  .track { grid-auto-columns: calc((100% - 24px) / 3.3); padding: 0 max(var(--gut), calc((100% - 1240px) / 2 + var(--gut))); scroll-padding: 0 max(var(--gut), calc((100% - 1240px) / 2 + var(--gut))); }
  .slide { scroll-snap-align: start; }
  .slide:not(.cur) { opacity: 1; transform: none; }
}
.compare img { object-position: 50% 78%; }

/* микроанимации кнопок (shared/fx.js) */
.btn { position: relative; overflow: hidden; isolation: isolate; }
.btn-fill { position: absolute; z-index: -1; width: 300%; aspect-ratio: 1; margin: -150% 0 0 -150%; border-radius: 50%; transform: scale(0); pointer-events: none;
  background: color-mix(in srgb, currentColor 16%, transparent); }
.btn-wave { position: absolute; z-index: -1; width: 240%; aspect-ratio: 1; margin: -120% 0 0 -120%; border-radius: 50%; background: currentColor; pointer-events: none; }
.scroll-bar { position: fixed; z-index: 60; top: 0; left: 0; right: 0; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; pointer-events: none; }
.ulink { text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .45s var(--ease); }
.ulink:hover, .ulink:focus-visible { background-size: 100% 1px; }
.stone-media .viz { position: absolute; left: 6px; top: 6px; z-index: 3; font-size: 12px; line-height: 1; padding: 4px 6px; border-radius: 6px; background: rgba(20,22,21,.6); color: #f2f2ef; opacity: 0; transition: opacity .4s .3s; }
.stone.on .viz { opacity: 1; }
@media (hover: hover) { .stone.has-obj:hover .viz { opacity: 1; } }
