/* ==========================================================================
   «Оптион» — онлайн-примерка фартука и скинали

   Оформление повторяет основной сайт: те же шрифты, цвета, скругления и
   кнопки. Значения взяты из дизайн-системы сайта (site/src/app/globals.css),
   чтобы страница примерки выглядела его частью, а не отдельным сервисом.
   Менять цвета и отступы нужно здесь, в :root — остальное подстроится.

   Площадка полностью статическая, стили вынесены в этот файл целиком:
   политика безопасности запрещает встроенные <style> и атрибуты style.
   ========================================================================== */

/* --------------------------------------------------------------- шрифты */

/* Интерфейсный Inter и заголовочный Montserrat лежат рядом, в fonts/.
   Внешние источники запрещены политикой безопасности площадки. */

/* cyrillic-ext */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/inter-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* cyrillic */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/inter-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* latin-ext */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308,
    U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
  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;
}

/* cyrillic-ext */
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url("fonts/montserrat-cyrillic-ext.woff2") format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

/* cyrillic */
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url("fonts/montserrat-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* latin-ext */
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url("fonts/montserrat-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308,
    U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 500 800;
  font-display: swap;
  src: url("fonts/montserrat-latin.woff2") format("woff2");
  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 {
  --brand: #1176bc;
  --brand-strong: #0e639e;
  --brand-deep: #0b3a63;
  --brand-soft: #eaf3fb;

  --accent: #e2752b;
  --accent-strong: #c25a17;
  --accent-soft: #fdeade;

  --ink: #16232b;
  --ink-soft: #34444d;
  --muted: #67777f;
  --line: #e6edf1;
  --line-strong: #d3dfe5;
  --bg: #ffffff;
  --bg-soft: #f6f9fb;
  --bg-tint: #edf4f8;

  --night: #0b2033;
  --night-2: #123049;
  --night-line: rgb(255 255 255 / 12%);

  --wrap: 1240px;
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 26px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgb(20 35 43 / 6%);
  --shadow: 0 10px 30px -14px rgb(20 35 43 / 22%);
  --shadow-lg: 0 30px 70px -28px rgb(20 35 43 / 32%);

  --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Montserrat", "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* ---------------------------------------------------------------- сброс */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin: 0 0 0.6rem;
}

p {
  margin: 0 0 0.8rem;
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: color 0.18s ease;
}

a:hover {
  color: var(--accent);
}

img {
  max-width: 100%;
  display: block;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: var(--brand);
  color: #fff;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.65rem 1.1rem;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 100;
}

.skip-link:focus {
  left: 0;
  color: #fff;
}

/* --------------------------------------------------------------- кнопки */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.78rem 1.6rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease,
    border-color 0.18s ease, color 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.btn-accent {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 26px -14px rgb(226 117 43 / 80%);
}

.btn-accent:hover {
  background: var(--accent-strong);
  color: #fff;
}

.btn-ghost {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--brand-deep);
}

.btn-ghost:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.btn-light {
  background: #fff;
  color: var(--brand-deep);
}

.btn-light:hover {
  color: var(--brand);
}

.btn-outline-light {
  background: rgb(255 255 255 / 10%);
  border-color: rgb(255 255 255 / 55%);
  color: #fff;
}

.btn-outline-light:hover {
  background: rgb(255 255 255 / 20%);
  border-color: #fff;
  color: #fff;
}

/* ------------------------------------------------------------ шапка */

.topbar {
  background: var(--night);
  color: rgb(255 255 255 / 74%);
  font-size: 0.8rem;
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 36px;
}

.topbar-address {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar a {
  color: #fff;
  white-space: nowrap;
}

.topbar a:hover {
  color: var(--accent-soft);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgb(255 255 255 / 96%);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.4) blur(10px);
}

.header-main {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 78px;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
}

.logo img {
  height: 42px;
  width: auto;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.logo-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--brand-deep);
}

.logo-tagline {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.header-contacts {
  margin-left: auto;
  text-align: right;
  line-height: 1.25;
}

.header-note {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
}

.header-phone {
  font-family: var(--font-display);
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--brand-deep);
  white-space: nowrap;
}

.header-phone:hover {
  color: var(--accent);
}

.header-cta {
  flex-shrink: 0;
}

/* ------------------------------------------------------- хлебные крошки */

.breadcrumbs {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 1.1rem 0 0;
}

.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  align-items: center;
}

.breadcrumbs a {
  color: var(--muted);
}

.breadcrumbs a:hover {
  color: var(--brand);
}

.breadcrumbs li + li::before {
  content: "/";
  margin-right: 0.45rem;
  color: var(--line-strong);
}

.breadcrumbs [aria-current="page"] {
  color: var(--ink-soft);
  font-weight: 500;
}

/* ------------------------------------------------------- заголовок страницы */

.page-head {
  position: relative;
  margin: 0.85rem 0 1.8rem;
  padding: 2.1rem 2.3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background:
    radial-gradient(720px 260px at 92% -40%, rgb(226 117 43 / 14%) 0%, transparent 62%),
    radial-gradient(680px 300px at -6% 130%, rgb(17 118 188 / 14%) 0%, transparent 62%),
    linear-gradient(120deg, var(--brand-soft) 0%, var(--bg-soft) 60%, #fff 100%);
}

.page-head h1 {
  position: relative;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  color: var(--brand-deep);
  font-weight: 800;
  margin: 0;
}

.page-head::after {
  content: "";
  display: block;
  width: 64px;
  height: 4px;
  border-radius: 4px;
  margin-top: 1rem;
  background: linear-gradient(90deg, var(--accent), var(--brand));
}

.page-lead {
  position: relative;
  margin: 1rem 0 0;
  max-width: 68ch;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------- рабочая область */

.work {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 1.6rem;
  align-items: start;
  margin-bottom: 3rem;
}

.stage {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 1.2rem;
  min-width: 0;
}

.tools {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.9rem 1.4rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.1rem;
}

.tool-wide {
  grid-column: 1 / -1;
}

.tool-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.tool-label output {
  font-weight: 700;
  color: var(--brand);
  letter-spacing: 0;
}

.tool-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.tool-note {
  margin: 0.45rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Что показывать в текущем режиме, задаёт атрибут у <body>:
   в просмотре прячем всё, что относится к ручной разметке. */
body[data-mode="browse"] .only-fit {
  display: none;
}

body[data-mode="fit"] .only-browse {
  display: none;
}

.tool-hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.select {
  width: 100%;
  padding: 0.62rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.92rem;
}

.range {
  width: 100%;
  accent-color: var(--brand);
}

/* Сегментированный переключатель и «чипы» фотобанка — одна и та же
   визуальная деталь: пилюля с рамкой, выбранная залита фирменным цветом. */
.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.seg-btn,
.chip {
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: #fff;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.seg-btn:hover,
.chip:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.seg-btn.is-on,
.chip.is-on {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.chip-demo {
  font-size: 0.8rem;
  padding: 0.35rem 0.7rem;
}

/* ------------------------------------------------------------- холст */

.canvas-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 340px;
  padding: 0.6rem;
  border-radius: var(--radius);
  background:
    repeating-conic-gradient(var(--bg-tint) 0% 25%, var(--bg-soft) 0% 50%) 50% / 20px 20px;
  transition: box-shadow 0.18s ease;
}

.canvas-wrap.is-over {
  box-shadow: inset 0 0 0 3px var(--brand);
}

.canvas-wrap canvas {
  display: block;
  max-width: 100%;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  touch-action: none;
  cursor: crosshair;
}

.hint {
  position: absolute;
  left: 50%;
  bottom: 1.1rem;
  transform: translateX(-50%);
  margin: 0;
  max-width: min(92%, 44rem);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  background: rgb(11 32 51 / 82%);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1.45;
  text-align: center;
  box-shadow: var(--shadow);
  pointer-events: none;
}

.hint[hidden] {
  display: none;
}

.stage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.1rem;
}

.status {
  margin: 0.8rem 0 0;
  min-height: 1.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ------------------------------------------------------------- фотобанк */

.side {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: sticky;
  top: 96px;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}

.tab {
  flex: 1;
  padding: 0.85rem 0.5rem;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}

.tab.is-on {
  color: var(--brand-deep);
  border-bottom-color: var(--accent);
  background: #fff;
}

.panel {
  padding: 1rem;
}

.panel[hidden] {
  display: none;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-height: 8.5rem;
  overflow-y: auto;
  padding-bottom: 0.2rem;
}

.chips .chip {
  font-size: 0.78rem;
  padding: 0.32rem 0.7rem;
}

.decor-name {
  margin: 0.8rem 0 0.6rem;
  font-size: 0.82rem;
  color: var(--muted);
  min-height: 1.3rem;
}

.decor {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 0.4rem;
  max-height: 26rem;
  overflow-y: auto;
}

.decor-item {
  padding: 0;
  border: 2px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--bg-soft);
  cursor: pointer;
  overflow: hidden;
  aspect-ratio: 1;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.decor-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.decor-item:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
}

.decor-item.is-on {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgb(226 117 43 / 30%);
}

.more {
  width: 100%;
  margin-top: 0.7rem;
  padding: 0.55rem 1rem;
  font-size: 0.85rem;
}

.more[hidden] {
  display: none;
}

/* --------------------------------------------------------------- справка */

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
}

.steps li {
  display: flex;
  gap: 0.8rem;
  margin-bottom: 1.1rem;
}

.step-num {
  flex-shrink: 0;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.steps h2 {
  font-size: 0.95rem;
  margin: 0.25rem 0 0.3rem;
  color: var(--brand-deep);
}

.steps p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.panel-note {
  margin: 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--muted);
}

/* Пояснение про режимы стоит в начале вкладки, поэтому линия сверху не нужна:
   выше и так заголовок вкладки. */
.panel-note-top {
  padding: 0 0 0.9rem;
  border-top: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1rem;
}

/* ------------------------------------------------------------- призыв */

.after {
  margin-bottom: 3.5rem;
}

.cta-card {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 2rem;
  align-items: center;
  background: linear-gradient(120deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 2.4rem 2.6rem;
  box-shadow: var(--shadow-lg);
}

.cta-card h2 {
  font-size: clamp(1.4rem, 2.2vw, 1.8rem);
  color: #fff;
  margin: 0 0 0.8rem;
}

.cta-card p {
  margin: 0;
  color: rgb(255 255 255 / 88%);
  max-width: 60ch;
}

.cta-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.8rem;
}

/* -------------------------------------------------------------- подвал */

.site-footer {
  background: var(--night);
  color: rgb(255 255 255 / 72%);
  font-size: 0.92rem;
  padding: 3.4rem 0 1.4rem;
}

.site-footer a {
  color: #fff;
}

.site-footer a:hover {
  color: var(--accent-soft);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1.1fr;
  gap: 2.5rem;
}

.footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
}

.footer-logo img {
  height: 36px;
  width: auto;
  filter: brightness(0) invert(1);
}

.footer-text {
  margin: 0.9rem 0 0;
  max-width: 36ch;
  line-height: 1.6;
}

.footer-col h2 {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  margin: 0 0 1rem;
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer li {
  margin-bottom: 0.5rem;
}

.footer-contacts li:first-child {
  color: rgb(255 255 255 / 60%);
}

.footer-bottom {
  border-top: 1px solid var(--night-line);
  margin-top: 2.5rem;
  padding-top: 1.2rem;
  font-size: 0.8rem;
  color: rgb(255 255 255 / 46%);
}

.footer-bottom p {
  margin: 0;
}

/* --------------------------------------------------------- узкие экраны */

@media (max-width: 1040px) {
  .work {
    grid-template-columns: minmax(0, 1fr);
  }

  .side {
    position: static;
  }

  .decor {
    max-height: none;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  }
}

@media (max-width: 900px) {
  .topbar {
    display: none;
  }

  .header-note {
    display: none;
  }

  .logo-tagline {
    display: none;
  }

  .cta-card {
    grid-template-columns: minmax(0, 1fr);
    padding: 1.8rem 1.5rem;
  }

  .footer-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.8rem;
  }
}

@media (max-width: 620px) {
  .wrap {
    padding: 0 1rem;
  }

  .header-main {
    flex-wrap: wrap;
    gap: 0.6rem;
    padding-bottom: 0.8rem;
  }

  .header-cta {
    width: 100%;
    order: 3;
  }

  .page-head {
    padding: 1.5rem 1.3rem;
  }

  .stage {
    padding: 0.7rem;
  }

  /* Отступы вокруг холста на телефоне съедают треть ширины, а по холсту
     нужно ещё и попасть пальцем — отдаём место ему. */
  .canvas-wrap {
    padding: 0.2rem;
  }

  .tool {
    min-width: 0;
  }

  .stage-actions .btn {
    flex: 1 1 auto;
    padding: 0.7rem 1rem;
    font-size: 0.88rem;
  }
}
