/* Стилі prime.furnigen.app — Quiet Luxury Bespoke Atelier. Три розкладки за шириною (RULES §2). */
:root {
  --bg: #f7f3eb;
  --surface: #efe9dc;
  --surface-2: #e5decb;
  --card-dark: #18130f;
  --card-dark-ink: #f7f3eb;
  --ink: #16120e;
  --muted: #4f463d;
  --line: #cfc4b0;
  --acc: #7c4f12;
  --acc-bright: #d49b3b;
  --acc-ink: #ffffff;
  --ok: #14532d;
  --ok-bg: #dcfce7;
  --focus: #b45309;
  --radius: 12px;
  --radius-lg: 20px;
  --gut: 16px;
  --max: 1220px;
  --serif: Georgia, "Times New Roman", serif;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

html[data-contrast="high"] {
  --bg: #ffffff;
  --surface: #f3f0e6;
  --surface-2: #e6e0d0;
  --ink: #0a0806;
  --muted: #26211c;
  --line: #5c5144;
  --acc: #5c3604;
  --acc-ink: #ffffff;
}

html[data-font="large"] {
  font-size: 118.75%;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 16px; overflow-x: clip; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1.0625rem/1.62 var(--font);
  overflow-wrap: anywhere;
  overflow-x: clip;
  max-width: 100vw;
}

main, section, .wrap, .hero > *, .atelier-grid > *, .cards-grid > *, .seg-grid > *, .panel, .card, .seg-card {
  min-width: 0;
  max-width: 100%;
}

img, svg { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 700; line-height: 1.18; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: clamp(1.8rem, 1.2rem + 2.4vw, 2.85rem); letter-spacing: -.015em; }
h2 { font-size: clamp(1.4rem, 1.1rem + 1.25vw, 2.1rem); }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; margin-bottom: .35em; }
p { margin: 0 0 1em; }
a { color: var(--acc); text-underline-offset: .2em; font-weight: 600; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 60;
  background: var(--acc);
  color: var(--acc-ink);
  padding: 10px 16px;
  border-radius: 8px;
  font-weight: 700;
}
.skip:focus { left: 8px; }

/* Шапка */
.hd {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 40;
}
.hd-in {
  max-width: var(--max);
  margin: 0 auto;
  padding: 10px var(--gut);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  min-height: 44px;
}
.brand img { width: 32px; height: 32px; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font: 700 1.15rem/1.1 var(--serif); }
.brand-tag { font: 600 .74rem/1.1 var(--font); color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }

.hd-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.hd-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: .95rem;
  font-weight: 600;
  border: 1px solid transparent;
}
.hd-nav a:hover, .hd-nav a[aria-current="page"] {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--acc);
}

.hd-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: 700 .84rem/1 var(--font);
  cursor: pointer;
}
.tool-btn[aria-pressed="true"] {
  background: var(--card-dark);
  color: var(--card-dark-ink);
  border-color: var(--card-dark);
}
.langs { display: flex; gap: 4px; }
.langs a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: .86rem;
}
.langs a[aria-current="page"] {
  background: var(--acc);
  color: var(--acc-ink);
  border-color: var(--acc);
}

/* Секції */
.sec { padding: 36px 0; border-bottom: 1px solid var(--line); }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gut); }

.hero {
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  gap: 28px;
  align-items: center;
}
.kicker {
  font: 700 .78rem/1.3 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--acc);
  margin: 0 0 10px;
}
.lead {
  font-size: 1.1rem;
  color: var(--muted);
  margin: 0 0 20px;
}
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 20px;
  border-radius: 10px;
  background: var(--acc);
  color: var(--acc-ink);
  text-decoration: none;
  font-weight: 700;
  border: 2px solid var(--acc);
  cursor: pointer;
}
.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
.hero-art {
  background: var(--card-dark);
  color: var(--card-dark-ink);
  border: 2px solid #59442a;
  border-radius: var(--radius-lg);
  padding: 16px;
}
.hero-art svg { width: 100%; height: auto; border-radius: 10px; }

/* Сценарії ЦА */
.seg-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-top: 18px;
}
.seg-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.seg-tag {
  font: 700 .75rem/1.2 var(--mono);
  color: var(--acc);
  letter-spacing: .06em;
  margin-bottom: 8px;
}
.seg-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 8px;
}

/* Інтерактивне Ательє */
.atelier-grid {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: 24px;
  margin-top: 20px;
  align-items: start;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
}
.panel-dark {
  background: var(--card-dark);
  color: var(--card-dark-ink);
  border: 2px solid #6b4c24;
}
.panel-dark h3 { color: #f6d592; }
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-weight: 700;
  font-size: .94rem;
  margin-bottom: 6px;
}
.field select, .field input[type="number"] {
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: 600 .96rem/1.2 var(--font);
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.chk-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.chk {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: .92rem;
}
.chk input { width: 22px; height: 22px; accent-color: var(--acc); flex-shrink: 0; }

.metrics-list {
  display: grid;
  gap: 10px;
  margin: 12px 0 18px;
}
.m-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px 12px;
  padding: 10px 12px;
  background: #231c16;
  border: 1px solid #4a3926;
  border-radius: 8px;
}
.m-lbl { font-size: .9rem; color: #dfd6c7; }
.m-val { font: 700 1rem/1.3 var(--mono); color: #f7c96e; }

.badge-pass {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 6px;
  background: var(--ok-bg);
  color: var(--ok);
  font: 700 .78rem/1.2 var(--mono);
  margin-bottom: 10px;
}
.price-box {
  margin-top: 16px;
  padding: 14px;
  border-radius: 10px;
  background: #261e16;
  border: 1px solid #85602a;
}
.price-num {
  font: 700 1.45rem/1.2 var(--serif);
  color: #fbe0a2;
  margin: 4px 0 6px;
}
.price-sub { font-size: .86rem; color: #d6cbb9; margin: 0; }
.panel-dark .btn {
  background: #d49b3b;
  color: #16120e;
  border-color: #d49b3b;
  width: 100%;
  margin-top: 12px;
}
.panel-dark .btn-ghost {
  background: transparent;
  color: #f7f3eb;
  border-color: #6b5336;
}

/* Картки переваг */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-top: 18px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.card p:last-child { margin-bottom: 0; }

/* Таблиця норм */
.table-wrap {
  overflow-x: auto;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
table.rules-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}
.rules-tbl th, .rules-tbl td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.rules-tbl th {
  background: var(--surface-2);
  font-weight: 700;
}
.rules-tbl code {
  font: 700 .84rem/1.3 var(--mono);
  color: var(--acc);
}

/* FAQ */
.faq-list { display: grid; gap: 10px; margin-top: 16px; }
details.faq-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 16px;
}
details.faq-item summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  font-weight: 700;
  cursor: pointer;
}
details.faq-item p { padding: 6px 0 10px; color: var(--muted); margin: 0; }

/* Підвал */
.ft {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 28px 0 36px;
}
.ft-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.ft-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
  text-decoration: none;
}

.root main { max-width: 480px; margin: 16vh auto; padding: 0 var(--gut); }
.root ul { list-style: none; padding: 0; }
.root li a { display: inline-flex; min-height: 48px; align-items: center; font-size: 1.1rem; }

/* 3D-конфігуратор, екшн-чипси та мобільний док */
.anchor-target { display: block; position: relative; top: -20px; visibility: hidden; }

.action-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  padding: 4px 2px 14px;
  margin: 12px 0 16px;
  touch-action: pan-x;
}
.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: 600 .9rem/1 var(--font);
  cursor: pointer;
  scroll-snap-align: start;
  white-space: nowrap;
}
.chip:hover, .chip.active, .chip[aria-pressed="true"] {
  background: var(--acc);
  color: var(--acc-ink);
  border-color: var(--acc);
}

.stage3d-box {
  position: relative;
  background: #14100d;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  overflow: hidden;
  margin: 16px 0 20px;
  touch-action: none;
}
.stage3d-toolbar {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  z-index: 10;
  pointer-events: none;
}
.stage3d-cam {
  display: flex;
  gap: 6px;
  pointer-events: auto;
  flex-wrap: wrap;
}
.cam-btn {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(20, 16, 13, .85);
  color: #f7f3eb;
  font: 600 .82rem/1 var(--font);
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.cam-btn:hover, .cam-btn:focus-visible {
  border-color: var(--acc-bright);
  color: var(--acc-bright);
}
.stage-ar-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(212, 155, 59, .95);
  color: #16120e;
  font: 800 .84rem/1 var(--font);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,.35);
  pointer-events: auto;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.stage-ar-badge:hover {
  background: #f7c96e;
}
.stage3d-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  max-height: 440px;
  display: block;
  cursor: grab;
}
.stage3d-canvas:active {
  cursor: grabbing;
}
.stage3d-cue {
  position: absolute;
  bottom: 8px;
  left: 14px;
  right: 14px;
  pointer-events: none;
  font: 600 .76rem/1.2 var(--mono);
  color: rgba(247, 243, 235, .7);
  display: flex;
  justify-content: space-between;
}
.stage3d-cue b { color: #f7c96e; }

/* Мобільна висувна шторка Bottom Sheet */
.mob-sheet {
  background: transparent;
}
.sheet-grab { display: none; }
.sheet-peek-bar { display: none; }

/* Фіксований мобільний док */
.mob-dock { display: none; }

@media (min-width: 761px) and (min-height: 501px), (min-width: 761px) and (pointer: fine) {
  :root { --gut: 28px; }
}
@media (min-width: 761px) and (max-width: 1100px) and (min-height: 501px), (min-width: 761px) and (max-width: 1100px) and (pointer: fine) {
  .hero { grid-template-columns: 1fr; }
  .atelier-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px), (pointer: coarse) and (max-height: 500px) {
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }
  .hd { position: static; }
  .hero { grid-template-columns: 1fr; }
  .seg-grid { grid-template-columns: 1fr; }
  .atelier-grid { grid-template-columns: 1fr; }
  .cards-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }

  /* Bottom Sheet на телефоні */
  .mob-sheet {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    margin-top: 14px;
    overflow: hidden;
  }
  .sheet-grab {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 10px 0 6px;
    cursor: pointer;
  }
  .sheet-bar {
    width: 42px;
    height: 4px;
    border-radius: 2px;
    background: var(--line);
  }
  .sheet-peek-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px 12px;
    border-bottom: 1px solid var(--line);
    gap: 10px;
  }
  .peek-txt {
    display: flex;
    flex-direction: column;
    font-size: .88rem;
    line-height: 1.25;
  }
  .peek-txt strong { color: var(--acc); font-size: .95rem; }
  .btn-sm {
    min-height: 40px;
    padding: 6px 12px;
    font-size: .84rem;
  }
  .mob-sheet:not(.expanded) .sheet-body {
    display: none;
  }

  /* Нижній док на телефоні */
  .mob-dock {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: rgba(247, 243, 235, .96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    padding: 8px var(--gut);
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    gap: 10px;
  }
  .dock-act {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    border-radius: 12px;
    font-weight: 800;
    font-size: .95rem;
    text-decoration: none;
    border: 2px solid transparent;
  }
  .dock-act-primary {
    background: var(--acc);
    color: var(--acc-ink);
    border-color: var(--acc);
  }
  .dock-act-tg {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--line);
  }
}
