/* ============================================================
   Ремонт квартиры — концепт-борд
   Палитра взята из материалов самой квартиры:
   шалфейный фасад кухни, тёплый дуб, штукатурка, пыльно-голубая спальня.
   ============================================================ */

:root {
  /* поверхности */
  --plaster: #EDE8DE;   /* фон — тёплая штукатурка */
  --paper:   #F7F3EA;   /* карточки */
  --paper-2: #FBF9F3;   /* приподнятые карточки */
  --ink:     #2B2A25;   /* текст */
  --ink-soft:#6A675C;   /* вторичный текст */

  /* материалы квартиры */
  --sage:      #7C8A66;  /* фасад кухни */
  --sage-deep: #55613C;  /* тёмный шалфей для текста */
  --oak:       #C7A579;  /* дуб */
  --blue:      #97B0C3;  /* спальня */
  --graphite:  #4B4E52;  /* пол / диван */

  --line: rgba(43, 42, 37, .14);
  --line-strong: rgba(43, 42, 37, .28);
  --shadow: 0 1px 2px rgba(43,42,37,.05), 0 12px 32px -18px rgba(43,42,37,.28);
  --shadow-lift: 0 2px 4px rgba(43,42,37,.06), 0 24px 48px -22px rgba(43,42,37,.38);

  --maxw: 1160px;
  --r: 14px;
  --r-lg: 22px;

  --ff-display: "Spectral", Georgia, serif;
  --ff-body: "Onest", system-ui, -apple-system, sans-serif;
}

:root[data-theme="dark"] {
  --plaster: #201F1B;
  --paper:   #262521;
  --paper-2: #2D2C27;
  --ink:     #EFEADF;
  --ink-soft:#A7A296;
  --sage:      #9DAE84;
  --sage-deep: #B7C79E;
  --oak:       #D6B98E;
  --blue:      #A6BED0;
  --graphite:  #8A8D91;
  --line: rgba(239, 234, 223, .13);
  --line-strong: rgba(239, 234, 223, .26);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 14px 34px -18px rgba(0,0,0,.6);
  --shadow-lift: 0 2px 4px rgba(0,0,0,.35), 0 26px 52px -22px rgba(0,0,0,.7);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--plaster);
  color: var(--ink);
  font-family: var(--ff-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* тонкая тканевая текстура фона */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(circle at 1px 1px, rgba(43,42,37,.045) 1px, transparent 0);
  background-size: 22px 22px;
}
:root[data-theme="dark"] body::before {
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.03) 1px, transparent 0);
}

img { max-width: 100%; display: block; }
a { color: inherit; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

/* ---------- типографика ---------- */
.eyebrow {
  font-size: 12.5px;
  letter-spacing: .22em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--sage-deep);
  display: inline-flex;
  align-items: center;
  gap: .6em;
}
.eyebrow::before {
  content: "";
  width: 26px; height: 1px;
  background: currentColor;
  opacity: .6;
}

h1, h2, h3 { font-family: var(--ff-display); font-weight: 500; margin: 0; }

/* ---------- шапка ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(1.4) blur(10px);
  background: color-mix(in srgb, var(--plaster) 82%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .3s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
}
.brand { display: flex; align-items: baseline; gap: 10px; font-weight: 600; letter-spacing: .01em; }
.brand b { font-family: var(--ff-display); font-weight: 600; font-size: 19px; letter-spacing: .01em; }
.brand span { font-size: 12.5px; color: var(--ink-soft); letter-spacing: .04em; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  text-decoration: none; font-size: 14.5px; color: var(--ink-soft);
  padding: 7px 13px; border-radius: 999px; transition: color .2s, background .2s;
  white-space: nowrap;
}
.nav a:hover { color: var(--ink); background: color-mix(in srgb, var(--sage) 14%, transparent); }
.nav a.active { color: var(--sage-deep); background: color-mix(in srgb, var(--sage) 18%, transparent); }

.theme-toggle {
  border: 1px solid var(--line-strong); background: transparent; color: var(--ink);
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; flex: none; transition: background .2s, border-color .2s;
}
.theme-toggle:hover { background: color-mix(in srgb, var(--sage) 14%, transparent); border-color: var(--sage); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }

.nav a .sm { display: none; }
@media (max-width: 720px) {
  .nav a { padding: 6px 9px; font-size: 13px; }
  .brand span { display: none; }
}
@media (max-width: 560px) {
  .brand { display: none; }
  .nav a .lg { display: none; }
  .nav a .sm { display: inline; }
  .nav a { padding: 6px 11px; }
  .topbar__inner { justify-content: space-between; }
}

/* ---------- hero ---------- */
.hero { padding: clamp(48px, 8vw, 96px) 0 clamp(36px, 5vw, 60px); }
.hero__grid {
  display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(28px, 5vw, 64px);
  align-items: center;
}
.hero__title {
  font-size: clamp(52px, 9vw, 108px);
  line-height: .92; letter-spacing: -.02em; margin: 18px 0 0;
}
.hero__title em { font-style: italic; color: var(--sage-deep); }
.hero__lead {
  margin: 24px 0 0; max-width: 30ch; color: var(--ink-soft); font-size: 18px;
}
.hero__meta {
  margin-top: 30px; display: flex; flex-wrap: wrap; gap: 26px;
  border-top: 1px solid var(--line); padding-top: 22px;
}
.hero__meta div { display: flex; flex-direction: column; }
.hero__meta .num { font-family: var(--ff-display); font-size: 30px; line-height: 1; color: var(--ink); }
.hero__meta .lbl { font-size: 12.5px; letter-spacing: .04em; color: var(--ink-soft); margin-top: 6px; }

.hero__plan {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 22px; box-shadow: var(--shadow); position: relative;
}
.hero__plan img { border-radius: 8px; margin: 0 auto; max-height: 460px; width: auto; cursor: zoom-in; }
.hero__plan .cap {
  position: absolute; top: 22px; left: 22px;
  font-size: 11.5px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-soft); background: var(--paper); padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line);
}

@media (max-width: 860px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__plan { order: -1; }
  .hero__plan img { max-height: 380px; }
}

/* ---------- палитра материалов ---------- */
.swatches { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 30px; }
.swatch { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-soft); }
.swatch i {
  width: 22px; height: 22px; border-radius: 50%; display: block;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}

/* ---------- секции ---------- */
.section { padding: clamp(52px, 8vw, 104px) 0; border-top: 1px solid var(--line); }
.section__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.section__head h2 { font-size: clamp(34px, 5vw, 56px); letter-spacing: -.015em; line-height: 1; margin-top: 14px; }
.section__index {
  font-family: var(--ff-display); font-size: clamp(46px, 7vw, 84px); line-height: 1;
  color: var(--line-strong); font-weight: 500;
}
.section__lead { max-width: 46ch; color: var(--ink-soft); margin: 20px 0 0; }

/* планировка */
.plan-layout { display: grid; grid-template-columns: 1.4fr 1fr; gap: clamp(24px,4vw,52px); margin-top: 44px; align-items: start; }
.plan-figure {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 26px; box-shadow: var(--shadow); display: grid; place-items: center;
}
.plan-figure img { max-height: 540px; width: auto; cursor: zoom-in; }
.rooms { list-style: none; margin: 0; padding: 0; }
.rooms li {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px;
  padding: 15px 4px; border-bottom: 1px solid var(--line);
}
.rooms li:first-child { border-top: 1px solid var(--line); }
.room-no {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--ff-display); font-size: 17px; color: var(--sage-deep);
  border: 1px solid var(--sage); background: color-mix(in srgb, var(--sage) 10%, transparent);
}
.room-name { font-weight: 500; }
.room-name small { display: block; font-weight: 400; color: var(--ink-soft); font-size: 13px; }
.room-area { font-family: var(--ff-display); font-size: 20px; color: var(--ink); white-space: nowrap; }
a.rooms-link { text-decoration: none; }
a.rooms-link .room-name { transition: color .2s; }
a.rooms-link:hover .room-name { color: var(--sage-deep); }
.tag {
  font-size: 11px; letter-spacing: .04em; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.tag--done { color: var(--sage-deep); background: color-mix(in srgb, var(--sage) 16%, transparent); }
.tag--wip  { color: var(--ink-soft); background: color-mix(in srgb, var(--ink-soft) 12%, transparent); }

@media (max-width: 860px) { .plan-layout { grid-template-columns: 1fr; } }

/* галерея рендеров */
.renders { display: grid; gap: 18px; margin-top: 40px; }
.renders--hero { grid-template-columns: 1fr; }
.renders--trio { grid-template-columns: repeat(3, 1fr); margin-top: 18px; }
.render {
  position: relative; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line);
  box-shadow: var(--shadow); cursor: zoom-in; background: var(--paper);
}
.render img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.render:hover img { transform: scale(1.035); }
.render .rcap {
  position: absolute; left: 12px; bottom: 12px;
  font-size: 12px; letter-spacing: .04em; color: #fff;
  background: rgba(20,20,18,.55); backdrop-filter: blur(4px);
  padding: 5px 11px; border-radius: 999px;
}
@media (max-width: 720px) { .renders--trio { grid-template-columns: 1fr; } }

/* блок вариантов (мебель) */
.subhead { display: flex; align-items: baseline; gap: 14px; margin: 56px 0 22px; }
.subhead h3 { font-size: 26px; letter-spacing: -.01em; }
.subhead .count { font-size: 13px; color: var(--ink-soft); letter-spacing: .04em; }
.subhead::after { content: ""; flex: 1; height: 1px; background: var(--line); align-self: center; }

.options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.opt {
  display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow);
  transition: transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .35s, border-color .35s;
}
.opt:hover { transform: translateY(-5px); box-shadow: var(--shadow-lift); border-color: var(--sage); }
.opt__media { aspect-ratio: 16 / 10; background: var(--paper-2); cursor: zoom-in; overflow: hidden; }
.opt__media img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.opt__body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.opt__no { font-size: 12px; letter-spacing: .12em; color: var(--sage-deep); font-weight: 600; }
.opt__name { font-family: var(--ff-display); font-size: 20px; line-height: 1.15; }
.opt__desc { font-size: 13.5px; line-height: 1.5; color: var(--ink-soft); margin-top: 2px; }
.opt__price { font-family: var(--ff-display); font-size: 28px; margin-top: 8px; }
.opt__price span { font-size: 15px; color: var(--ink-soft); }
.opt__link {
  margin-top: auto; padding-top: 16px; display: inline-flex; align-items: center; gap: 7px;
  text-decoration: none; font-size: 14px; font-weight: 600; color: var(--sage-deep);
}
.opt__link svg { width: 15px; height: 15px; transition: transform .2s; }
.opt__link:hover svg { transform: translate(2px,-2px); }
/* группа карточек по типу (техника) */
.opt-group { margin-top: 34px; }
.opt-group:first-child { margin-top: 0; }
.opt-group__title {
  display: flex; align-items: baseline; gap: 12px; margin: 0 0 16px;
  font-family: var(--ff-display); font-size: 21px; letter-spacing: -.01em;
}
.opt-group__title span { font-size: 12px; letter-spacing: .06em; color: var(--ink-soft); font-weight: 400; }
.opt-group__title::after { content: ""; flex: 1; height: 1px; background: var(--line); align-self: center; }
@media (max-width: 860px) { .options { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .options { grid-template-columns: 1fr; } }

/* варианты отделки (нумерованный список к изображению) */
.finish { display: grid; grid-template-columns: 1.35fr 1fr; gap: clamp(24px,4vw,48px); margin-top: 40px; align-items: center; }
.finish__img { border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); cursor: zoom-in; }
.variants { list-style: none; margin: 0; padding: 0; counter-reset: v; }
.variants li {
  display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: start;
  padding: 16px 0; border-bottom: 1px solid var(--line);
}
.variants li:first-child { border-top: 1px solid var(--line); }
.variants li::before {
  counter-increment: v; content: counter(v);
  font-family: var(--ff-display); font-size: 17px; color: var(--sage-deep);
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--sage); background: color-mix(in srgb, var(--sage) 10%, transparent);
}
.variants b { font-weight: 500; }
.variants small { color: var(--ink-soft); display: block; font-size: 13.5px; }
@media (max-width: 860px) { .finish { grid-template-columns: 1fr; } }

/* парный ряд / сетка 2×2 рендеров */
.renders--duo { grid-template-columns: repeat(2, 1fr); margin-top: 18px; }
.renders--quad { grid-template-columns: repeat(2, 1fr); margin-top: 18px; }
@media (max-width: 720px) { .renders--duo, .renders--quad { grid-template-columns: 1fr; } }

/* пустой раздел (в работе) */
.section-empty {
  margin-top: 36px; padding: 28px 30px; border: 1px dashed var(--line-strong); border-radius: var(--r);
  color: var(--ink-soft); font-size: 16px; background: color-mix(in srgb, var(--sage) 5%, transparent);
}

/* проза и заметки из markdown */
.prose { max-width: 62ch; color: var(--ink-soft); margin: 22px 0 0; }
.note {
  max-width: 62ch; margin: 26px 0 0; padding: 14px 20px; font-size: 15px; color: var(--ink-soft);
  border-left: 2px solid var(--sage); background: color-mix(in srgb, var(--sage) 8%, transparent);
  border-radius: 0 8px 8px 0;
}

/* обычные таблицы из markdown */
.table-wrap { margin-top: 30px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 15px; background: var(--paper); }
.table-wrap th, .table-wrap td { text-align: left; padding: 13px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table-wrap th { font-weight: 600; color: var(--sage-deep); font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; }
.table-wrap tr:last-child td { border-bottom: none; }
.table-wrap td:first-child { font-weight: 500; color: var(--ink); white-space: nowrap; }
.table-wrap td img { width: 84px; border-radius: 8px; }
.table-wrap .tlink {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  color: var(--sage-deep); font-weight: 600; text-decoration: none;
}
.table-wrap .tlink svg { width: 13px; height: 13px; }
.table-wrap .tlink:hover { text-decoration: underline; }

/* ---------- футер ---------- */
.footer { border-top: 1px solid var(--line); padding: 46px 0 60px; color: var(--ink-soft); font-size: 14px; }
.footer__inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: center; }
.footer b { font-family: var(--ff-display); color: var(--ink); font-weight: 500; }

/* ---------- лайтбокс ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100; display: none;
  background: rgba(18,17,15,.86); backdrop-filter: blur(6px);
  align-items: center; justify-content: center; padding: 4vw; cursor: zoom-out;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 94vw; max-height: 90vh; width: auto; border-radius: 8px; box-shadow: 0 30px 80px rgba(0,0,0,.6); cursor: default; }
.lightbox__close {
  position: absolute; top: 20px; right: 24px; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.3); background: rgba(0,0,0,.3); color: #fff; cursor: pointer;
  display: grid; place-items: center; font-size: 22px; line-height: 1;
}
.lightbox__close:hover { background: rgba(0,0,0,.55); }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .render img, .opt { transition: none; }
}

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