/* «Тихий кофе» — одна семья Literata, бумага и чернила, зелёный кофейного листа как акцент.
   Палитра сортов живёт в данных каталога и приходит через --pack/--pack-text. */
:root {
  --paper: #f3f3ef;
  --paper-2: #e9e9e3;
  --ink: #1d1b18;
  --ink-2: #5e5850;
  --ink-3: #8f877c;
  --line: #d6d3cb;
  --leaf: #2f5241;
  --leaf-ink: #1f3a2d;
  --roast-1: #c9a86f;
  --roast-2: #a8753f;
  --roast-3: #5c3a22;
  --radius: 14px;
  --radius-s: 8px;
  --font: "Literata", Georgia, "Times New Roman", serif;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/1.6 var(--font); font-optical-sizing: auto; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.02em; line-height: 1.12; }
p { margin: 0; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--leaf); outline-offset: 3px; border-radius: 4px; }
.wrap { width: min(1180px, 100% - 64px); margin-inline: auto; }
@media (max-width: 680px) { .wrap { width: calc(100% - 40px); } }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border: 1px solid var(--ink); border-radius: var(--radius-s); background: var(--ink); color: var(--paper); font-weight: 500; font-size: 15px; line-height: 1; text-decoration: none; transition: background-color .15s, color .15s; }
.button:hover { background: var(--leaf-ink); border-color: var(--leaf-ink); }
.button.quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.button.quiet:hover { border-color: var(--ink); background: var(--paper-2); }
.button.leaf { background: var(--leaf); border-color: var(--leaf); }
.button.leaf:hover { background: var(--leaf-ink); }
.button:disabled { opacity: .55; cursor: default; }

/* шапка */
.site-head { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.site-head .wrap { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; min-height: 64px; gap: 16px; }
.logo { font-weight: 600; font-size: 20px; letter-spacing: -.02em; text-decoration: none; display: inline-flex; align-items: center; gap: 10px; }
.logo i { width: 22px; height: 22px; border-radius: 50% 50% 50% 4px; background: var(--leaf); transform: rotate(-20deg); display: inline-block; }
.site-nav { display: flex; gap: 26px; font-size: 15px; }
.site-nav a { text-decoration: none; color: var(--ink-2); }
.site-nav a:hover { color: var(--ink); }
.cart-button { justify-self: end; display: inline-flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: transparent; font-size: 15px; }
.cart-button:hover { border-color: var(--ink); }
.cart-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--ink); color: var(--paper); font-size: 12px; font-variant-numeric: tabular-nums; }
@media (max-width: 860px) { .site-nav { display: none; } .site-head .wrap { grid-template-columns: 1fr auto; } }

/* герой */
.hero { padding: 64px 0 56px; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 56px; align-items: center; border-bottom: 1px solid var(--line); }
.hero h1 { font-size: clamp(36px, 4.6vw, 60px); max-width: 12ch; }
.hero .lead { margin-top: 22px; font-size: 19px; line-height: 1.55; color: var(--ink-2); max-width: 46ch; }
.hero-actions { margin-top: 30px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.hero-actions small { color: var(--ink-3); font-size: 14px; }
.roast-profile { margin: 0; padding: 22px 22px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fafaf7; }
.roast-profile svg { width: 100%; height: auto; }
.roast-profile figcaption { margin-top: 12px; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.roast-profile figcaption b { font-weight: 600; color: var(--ink); }
@media (max-width: 960px) { .hero { grid-template-columns: 1fr; gap: 36px; padding: 44px 0; } }

/* каталог */
.catalog { padding: 64px 0 24px; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 28px; }
.section-head h2 { font-size: 30px; }
.section-head p { color: var(--ink-2); font-size: 16px; max-width: 48ch; text-align: right; }
@media (max-width: 760px) { .section-head { flex-direction: column; align-items: start; } .section-head p { text-align: left; } }
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 36px 24px; }
.product-card { display: grid; gap: 14px; }
.pack-link { text-decoration: none; display: block; }
.pack { position: relative; display: flex; flex-direction: column; justify-content: space-between; aspect-ratio: 3 / 4; padding: 18px; border-radius: 10px 10px 14px 14px; background: var(--pack); color: var(--pack-text); text-decoration: none; overflow: hidden; box-shadow: inset 0 2px 0 rgba(255,255,255,.25), inset 0 -3px 0 rgba(0,0,0,.12); transition: transform .18s; }
.pack::before { content: ""; position: absolute; inset: 0 0 auto; height: 10px; background: repeating-linear-gradient(90deg, rgba(0,0,0,.08) 0 6px, transparent 6px 12px); }
.pack:hover { transform: translateY(-3px); }
.pack .origin { font-size: 12px; opacity: .78; }
.pack .name { font-size: clamp(20px, 1.8vw, 24px); font-weight: 600; line-height: 1.1; letter-spacing: -.02em; }
.pack .weight { font-size: 13px; margin-top: 6px; opacity: .85; }
.pack .roast-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.roast-band { display: inline-flex; gap: 3px; }
.roast-band i { width: 16px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.35); }
.roast-band i.on:nth-child(1) { background: var(--roast-1); }
.roast-band i.on:nth-child(2) { background: var(--roast-2); }
.roast-band i.on:nth-child(3) { background: var(--roast-3); }
.product-card h3 { font-size: 18px; }
.product-card .notes { color: var(--ink-2); font-size: 15px; margin-top: 3px; }
.product-card .specs { color: var(--ink-3); font-size: 13.5px; margin-top: 2px; }
.product-card .row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.price { font-weight: 600; font-variant-numeric: tabular-nums; }
.add { min-height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-s); background: transparent; font-size: 14px; }
.add:hover { border-color: var(--ink); background: var(--paper-2); }
.add.added { background: var(--leaf); border-color: var(--leaf); color: var(--paper); }

/* как выбрать */
.how { padding: 56px 0; border-top: 1px solid var(--line); margin-top: 56px; display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 48px; }
.how h2 { font-size: 30px; max-width: 12ch; }
.how dl { margin: 0; }
.how dt { font-weight: 600; font-size: 19px; margin-top: 22px; }
.how dt:first-child { margin-top: 0; }
.how dd { margin: 6px 0 0; color: var(--ink-2); max-width: 56ch; }
@media (max-width: 860px) { .how { grid-template-columns: 1fr; gap: 24px; } }

.shipping { border-top: 1px solid var(--line); padding: 40px 0 56px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.shipping h3 { font-size: 17px; margin-bottom: 8px; }
.shipping p { color: var(--ink-2); font-size: 15.5px; }
@media (max-width: 760px) { .shipping { grid-template-columns: 1fr; gap: 22px; } }
.site-foot { border-top: 1px solid var(--line); padding: 24px 0 40px; color: var(--ink-3); font-size: 14px; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }

/* карточка товара */
dialog.product { width: min(760px, calc(100% - 32px)); padding: 0; border: 0; border-radius: var(--radius); background: var(--paper); color: var(--ink); }
dialog.product::backdrop { background: rgba(29, 27, 24, .45); }
.product-body { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 32px; padding: 32px; }
.product-body .pack { aspect-ratio: auto; min-height: 360px; }
.product-info h2 { font-size: 30px; }
.product-info .origin { color: var(--ink-3); font-size: 14px; margin-top: 4px; }
.product-info .description { margin-top: 16px; color: var(--ink-2); }
.product-info .facts { margin: 18px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14.5px; }
.product-info .facts dt { color: var(--ink-3); }
.product-info .facts dd { margin: 0; }
fieldset.grind { border: 0; padding: 0; margin: 20px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
fieldset.grind legend { font-size: 14px; color: var(--ink-3); margin-bottom: 8px; padding: 0; }
fieldset.grind label { position: relative; }
fieldset.grind input { position: absolute; opacity: 0; inset: 0; }
fieldset.grind span { display: inline-flex; min-height: 36px; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-s); font-size: 14px; }
fieldset.grind input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
fieldset.grind input:focus-visible + span { outline: 2px solid var(--leaf); outline-offset: 2px; }
.buy-row { margin-top: 22px; display: flex; align-items: center; gap: 12px; }
.stepper { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.stepper button { width: 38px; height: 44px; border: 0; background: transparent; font-size: 20px; }
.stepper button:hover { background: var(--paper-2); }
.stepper output { display: inline-grid; place-items: center; min-width: 38px; font-variant-numeric: tabular-nums; }
.close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: rgba(255,255,255,.7); font-size: 18px; }
@media (max-width: 680px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 14px; } .pack { padding: 12px; } .pack .name { font-size: 18px; } .product-card h3 { font-size: 16px; } .product-card .notes { font-size: 14px; } .product-card .row { flex-direction: column; align-items: stretch; } .product-card .add { width: 100%; }
  .product-body { grid-template-columns: 1fr; padding: 22px; } .product-body .pack { min-height: 220px; aspect-ratio: 4/3; } }

/* корзина */
.drawer { position: fixed; inset: 0 0 0 auto; width: min(440px, 100%); background: var(--paper); border-left: 1px solid var(--line); box-shadow: -20px 0 60px rgba(0,0,0,.12); transform: translateX(100%); transition: transform .24s ease; z-index: 10; display: flex; flex-direction: column; visibility: hidden; }
.drawer.open { transform: none; visibility: visible; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 22px; }
.drawer-body { padding: 20px 24px; overflow: auto; flex: 1; }
.cart-line { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-line .swatch { width: 48px; height: 62px; border-radius: 6px; background: var(--pack); }
.cart-line strong { font-weight: 600; font-size: 15px; display: block; }
.cart-line small { color: var(--ink-3); font-size: 13px; }
.cart-line .qty { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 13px; }
.cart-line .qty button { width: 26px; height: 26px; border: 1px solid var(--line); border-radius: 6px; background: transparent; line-height: 1; }
.cart-line .amount { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty-cart { color: var(--ink-2); padding: 24px 0; }
.checkout { margin-top: 18px; display: grid; gap: 12px; }
.checkout label { display: grid; gap: 5px; font-size: 13.5px; color: var(--ink-2); }
.checkout input, .checkout select { min-height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff; }
.pay-mode { display: grid; gap: 6px; border: 0; padding: 0; margin: 4px 0 0; }
.pay-mode legend { font-size: 13.5px; color: var(--ink-2); margin-bottom: 6px; }
.pay-mode label { grid-template-columns: auto 1fr; align-items: start; gap: 10px; }
.pay-mode input { min-height: 0; margin-top: 4px; accent-color: var(--leaf); }
.pay-mode small { display: block; color: var(--ink-3); }
.totals { display: flex; justify-content: space-between; align-items: baseline; padding: 16px 0 4px; font-size: 16px; }
.totals strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.drawer-foot { padding: 16px 24px 20px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.drawer-foot .note { color: var(--ink-3); font-size: 12.5px; }
.form-error { color: #9b2c2c; font-size: 13.5px; }

/* тост и результат */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: var(--radius-s); font-size: 14.5px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.result { max-width: 640px; margin: 64px auto; padding: 0 24px; }
.result h1 { font-size: 40px; }
.result .sub { color: var(--ink-2); margin-top: 12px; }
.result .items { margin: 24px 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.result .items li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15.5px; }
.result .items li.added span { color: var(--leaf); font-size: 13px; display: block; }
.after-offer { margin-top: 28px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: #fafaf7; display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 18px; align-items: center; }
.after-offer .swatch { width: 72px; height: 96px; border-radius: 8px; background: var(--pack); color: var(--pack-text); display: grid; place-items: end center; padding: 10px; font-size: 11px; }
.after-offer h2 { font-size: 22px; }
.after-offer p { color: var(--ink-2); margin-top: 6px; font-size: 15px; }
.after-offer .button { margin-top: 14px; }
.status-badge { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--leaf-ink); }
.status-badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--leaf); }
@media (max-width: 560px) { .after-offer { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
