/*
 * mom.snapro.pro — Soft Linen design system
 * Тёплые нейтрали + один тёплый mauve акцент. Спокойно, без украшательств.
 *
 * См. дизайн-гайд: 8-pt grid, modular type ratio 1.25, WCAG AA контраст,
 * touch ≥ 48px, motion-safe-only анимации, prefers-reduced-motion уважается.
 */

:root {
  /* Surfaces */
  --bg:        #F8F4EE;
  --surface:   #FFFFFF;
  --surface-2: #F1ECE3;
  --border:    #E8E0D5;
  --border-2:  #D9CFC0;

  /* Text */
  --text:   #2A2522;
  --text-2: #6B6562;
  --text-3: #9C948D;

  /* Accent — warm mauve */
  --accent:      #B4828B;
  --accent-2:    #8E5E66;
  --accent-soft: #EFD9DC;

  /* Systemic */
  --success: #7BA889;
  --warning: #C9A567;
  --error:   #B86F6F;

  /* Type */
  --serif: 'Fraunces', 'Cormorant Garamond', Georgia, serif;
  --sans:  'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

  /* Radii */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* Shadow — almost invisible */
  --shadow-1: 0 1px 2px rgba(42, 37, 34, 0.04);
  --shadow-2: 0 4px 12px rgba(42, 37, 34, 0.06);

  /* Layout */
  --pad: 20px;
  --pad-lg: 32px;
  --maxw: 1080px;
}

@media (prefers-color-scheme: dark) {
  /* Намеренно остаёмся в light. Тёмная — следующая итерация. */
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--accent); }

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

button { font-family: inherit; cursor: pointer; }

::selection { background: var(--accent-soft); color: var(--accent-2); }

.is-hidden { display: none !important; }

/* ── Top bar ─────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px var(--pad);
  max-width: var(--maxw);
  margin: 0 auto;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
  border-bottom: 1px solid transparent;
  transition: border-color 200ms ease;
}
.topbar.is-scrolled { border-bottom-color: var(--border); }

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  text-decoration: none;
  color: var(--text);
}
.brand-mark {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 380;
  font-size: 28px;
  letter-spacing: -0.01em;
  line-height: 1;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}
.pill:hover { background: var(--surface-2); }
.pill-icon { color: var(--accent); font-size: 16px; line-height: 1; }

.btn-ghost {
  height: 36px;
  padding: 0 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  transition: background 150ms ease, border-color 150ms ease;
}
.btn-ghost:hover { background: var(--surface); border-color: var(--border-2); }

/* ── Hero ────────────────────────────────────────────────────────────── */
.hero {
  max-width: 760px;
  margin: 32px auto 24px;
  padding: 16px var(--pad) 24px;
  text-align: center;
}
.hero-title {
  font-family: var(--serif);
  font-weight: 380;
  font-size: clamp(36px, 6vw, 56px);
  line-height: 1.1;
  margin: 0 0 16px;
  letter-spacing: -0.015em;
  color: var(--text);
}
.hero-title .italic { font-style: italic; color: var(--accent-2); }

.hero-sub {
  color: var(--text-2);
  font-size: 17px;
  line-height: 1.55;
  max-width: 580px;
  margin: 0 auto 24px;
}

.hero-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.hero-hint {
  color: var(--text-3);
  font-size: 13px;
  margin: 0;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 52px;
  padding: 0 28px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--r-md);
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  transition: background 150ms ease, transform 100ms ease;
}
.btn-primary:hover { background: var(--accent-2); color: #fff; }
.btn-primary:active { transform: translateY(1px); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  padding: 0 24px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  transition: background 150ms ease;
}
.btn-secondary:hover { background: var(--surface-2); }

.btn-full { width: 100%; }

/* ── Chips (categories) ──────────────────────────────────────────────── */
.chips {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 8px var(--pad);
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  transition: background 150ms ease, border-color 150ms ease;
  white-space: nowrap;
}
.chip:hover { border-color: var(--border-2); }
.chip.is-active {
  background: var(--accent-soft);
  color: var(--accent-2);
  border-color: var(--accent-soft);
}

/* ── Search ──────────────────────────────────────────────────────────── */
.search-wrap {
  max-width: var(--maxw);
  margin: 8px auto 16px;
  padding: 0 var(--pad);
}
.search {
  width: 100%;
  height: 48px;
  padding: 0 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  transition: border-color 150ms ease;
}
.search::placeholder { color: var(--text-3); }
.search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

/* ── Grid ────────────────────────────────────────────────────────────── */
.grid {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad) 80px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
@media (min-width: 720px) {
  .grid { gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

.card {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--surface-2);
  border-radius: var(--r-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform 200ms ease, box-shadow 200ms ease;
  box-shadow: var(--shadow-1);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.card img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: opacity 200ms ease;
}
.card-meta {
  position: absolute;
  left: 12px; right: 12px; bottom: 12px;
  font-family: var(--serif);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  pointer-events: none;
  font-style: italic;
}

.grid-loader {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px;
  color: var(--text-3);
  font-size: 14px;
}

/* ── Footer ──────────────────────────────────────────────────────────── */
.foot {
  max-width: var(--maxw);
  margin: 32px auto 0;
  padding: 32px var(--pad) 56px;
  text-align: center;
  color: var(--text-2);
  border-top: 1px solid var(--border);
  font-size: 14px;
}
.foot p { margin: 4px 0; }
.foot-sub { color: var(--text-3); font-size: 13px; }
.foot-sub a { color: var(--text-2); }
.foot-sub a:hover { color: var(--accent-2); }

/* ── Dialog ──────────────────────────────────────────────────────────── */
.dialog {
  border: none;
  padding: 32px;
  max-width: 460px;
  width: calc(100% - 32px);
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: 0 16px 48px rgba(42, 37, 34, 0.12);
  font-family: inherit;
  color: var(--text);
}
.dialog-wide { max-width: 620px; }
.dialog::backdrop {
  background: rgba(42, 37, 34, 0.32);
  backdrop-filter: blur(2px);
}
.dialog[open] { animation: dialog-in 200ms ease; }
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0);   }
}
@media (prefers-reduced-motion: reduce) {
  .dialog[open] { animation: none; }
}

.dialog-close {
  position: absolute;
  top: 12px; right: 14px;
  width: 32px; height: 32px;
  background: transparent;
  border: none;
  font-size: 22px;
  color: var(--text-2);
  border-radius: var(--r-pill);
  transition: background 150ms ease;
}
.dialog-close:hover { background: var(--surface-2); }

.dialog-title {
  font-family: var(--serif);
  font-weight: 380;
  font-size: 28px;
  line-height: 1.2;
  margin: 0 0 8px;
}
.dialog-text {
  color: var(--text-2);
  margin: 0 0 24px;
  line-height: 1.5;
}

/* ── Auth dialog innards ─────────────────────────────────────────────── */
.auth-tg {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
  min-height: 50px;
}

.auth-divider {
  position: relative;
  text-align: center;
  margin: 24px 0;
  color: var(--text-3);
  font-size: 13px;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: calc(50% - 28px);
  height: 1px;
  background: var(--border);
}
.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }
.auth-divider span {
  background: var(--surface);
  padding: 0 8px;
  position: relative;
}

.auth-email .form-label {
  display: block;
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 6px;
}
.auth-email input[type="email"] {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  margin-bottom: 12px;
}
.auth-email input[type="email"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.form-hint {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--text-3);
}

/* ── Order dialog ────────────────────────────────────────────────────── */
.order-head {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}
.order-head img {
  width: 100px; height: 130px;
  object-fit: cover;
  border-radius: var(--r-md);
  background: var(--surface-2);
  flex-shrink: 0;
}
.order-info { flex: 1; min-width: 0; }
.order-cat {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  margin: 0 0 4px;
}
.order-title {
  font-family: var(--serif);
  font-weight: 380;
  font-size: 22px;
  line-height: 1.2;
  margin: 0 0 8px;
}
.order-text {
  font-size: 14px;
  color: var(--text-2);
  margin: 0;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.order-body { display: grid; gap: 20px; }

/* Drop zone */
.drop {
  display: block;
  position: relative;
  min-height: 180px;
  border: 1.5px dashed var(--border-2);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 200ms ease, background 200ms ease;
  overflow: hidden;
}
.drop:hover, .drop.is-drag {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 24px;
}
.drop-title { font-size: 16px; font-weight: 500; margin: 0 0 4px; }
.drop-sub { color: var(--text-2); font-size: 14px; margin: 0 0 12px; }
.drop-hint { color: var(--text-3); font-size: 12px; margin: 0; max-width: 320px; }
.drop-preview { width: 100%; height: 240px; object-fit: cover; }

/* Count radio chips */
.count {
  border: none;
  margin: 0;
  padding: 0;
}
.count legend {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 8px;
  padding: 0;
}
.count-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.count-row label {
  flex: 1;
  position: relative;
}
.count-row input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.count-row span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease;
}
.count-row label:hover span { border-color: var(--border-2); }
.count-row input[type="radio"]:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.count-hint {
  font-size: 13px;
  color: var(--text-2);
  margin: 0;
}

.order-meta {
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
  margin: 0;
}

/* ── Toast ───────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translate(-50%, -100%);
  background: var(--text);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--r-md);
  font-size: 14px;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: transform 200ms ease, opacity 200ms ease;
  max-width: calc(100% - 32px);
  text-align: center;
}
.toast.is-show {
  transform: translate(-50%, 0);
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .toast { transition: opacity 200ms ease; transform: translate(-50%, 0); }
}
