/* Каркас: шапка-«масхед», подвал, контейнеры, тосты, модальные окна. */
.wrap { width: min(100% - 2 * var(--gut), var(--wrap)); margin-inline: auto; }
.section { padding-block: clamp(48px, 8vw, 104px); position: relative; }
.section.tight { padding-block: clamp(32px, 5vw, 64px); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: clamp(24px, 4vw, 44px); flex-wrap: wrap; }
.section-head h2 { max-width: 18ch; }
.section-head .lead { max-width: 46ch; margin: 0; color: var(--mocha); }

/* ---------- шапка ---------- */
.hdr { position: sticky; top: 0; z-index: 60; border-bottom: 1px solid var(--line); }
/* размытие — на псевдоэлементе: backdrop-filter на самой шапке сделал бы её контейнером для position:fixed и сломал бы мобильное меню */
.hdr::before { content: ''; position: absolute; inset: 0; z-index: -1; background: color-mix(in srgb, var(--cream) 90%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); }
.hdr-strip { background: var(--espresso); color: var(--cream-2); font-size: .74rem; letter-spacing: .04em; }
.hdr-strip .wrap { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 30px; }
.hdr-strip a { color: var(--caramel-l); text-decoration: none; font-weight: 600; }
.hdr-strip a:hover { text-decoration: underline; }
.upd { display: inline-flex; align-items: center; gap: 8px; }
.upd i { width: 8px; height: 8px; border-radius: 50%; background: #8FBF6A; box-shadow: 0 0 0 0 rgba(143, 191, 106, .7); animation: pulse 2.4s infinite; }
.upd.stale i { background: var(--caramel); animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(143, 191, 106, 0); } 100% { box-shadow: 0 0 0 0 rgba(143, 191, 106, 0); } }
.hdr-main { display: flex; align-items: center; gap: clamp(12px, 2.4vw, 36px); min-height: var(--hdr-h); }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--espresso); flex: none; }
.logo .cup { width: 44px; height: 44px; overflow: visible; }
.logo b { font: italic 900 1.75rem/1 var(--f-display); letter-spacing: -.02em; }
.logo small { display: block; font: 600 .58rem/1 var(--f-body); letter-spacing: .22em; text-transform: uppercase; color: var(--mocha); margin-top: 3px; }
.steam path { fill: none; stroke: var(--caramel); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 22; animation: steam 3.6s ease-in-out infinite; opacity: .9; }
.steam path:nth-child(2) { animation-delay: -1.2s; } .steam path:nth-child(3) { animation-delay: -2.4s; }
@keyframes steam { 0% { stroke-dashoffset: 22; transform: translateY(6px); opacity: 0; } 35% { opacity: .95; } 100% { stroke-dashoffset: -22; transform: translateY(-8px); opacity: 0; } }
.nav { display: flex; gap: 4px; margin-inline: auto; }
.nav a { position: relative; padding: 10px 14px; border-radius: 999px; font-weight: 600; font-size: .92rem; text-decoration: none; color: var(--mocha); transition: color .2s, background .2s; }
.nav a:hover { color: var(--espresso); background: var(--cream-2); }
.nav a[aria-current=page] { color: var(--espresso); }
.nav a[aria-current=page]::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: 4px; height: 2.5px; border-radius: 2px; background: var(--cherry); }
.hdr-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%; border: 1.5px solid transparent; background: transparent; transition: background .2s, border-color .2s; }
.icon-btn:hover { background: var(--cream-2); border-color: var(--line); }
.icon-btn svg { width: 22px; height: 22px; }
.burger { display: none; }
.userchip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 6px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--foam); text-decoration: none; font-weight: 600; font-size: .9rem; max-width: 200px; }
.userchip:hover { border-color: var(--espresso); }
.userchip span.av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--cherry); color: #fff; font: italic 800 1rem/1 var(--f-display); flex: none; }
.userchip span.nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.hsearch { position: absolute; inset: 0; background: var(--cream); z-index: 5; display: flex; align-items: center; }
.hsearch .wrap { display: flex; align-items: center; gap: 10px; }
.hsearch .input { font-size: 1.05rem; }
.sugg { position: absolute; left: 0; right: 0; top: 100%; background: var(--foam); border: 1.5px solid var(--espresso); border-radius: var(--r); box-shadow: var(--shadow-lg); margin-top: 8px; padding: 8px; z-index: 40; max-height: min(70vh, 480px); overflow: auto; }
.sugg h4 { font: 700 .7rem/1 var(--f-body); letter-spacing: .14em; text-transform: uppercase; color: var(--mocha); margin: 10px 10px 6px; }
.sugg a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-sm); text-decoration: none; min-height: 44px; }
.sugg a:hover, .sugg a[aria-selected=true] { background: var(--cream-2); }
.sugg a small { color: var(--mocha); }
.sugg .empty { padding: 14px; color: var(--mocha); }

/* ---------- подвал ---------- */
.ftr { background: var(--espresso); color: var(--cream-2); margin-top: clamp(40px, 8vw, 100px); position: relative; }
.ftr::before { content: ''; position: absolute; left: 0; right: 0; top: -14px; height: 15px; background: radial-gradient(circle at 10px -2px, transparent 11px, var(--espresso) 11.5px) repeat-x; background-size: 20px 15px; }
.ftr .wrap { padding-block: 56px 36px; display: grid; gap: 40px; grid-template-columns: 1.4fr 1fr 1fr 1fr; }
.ftr h4 { font: 700 .72rem/1 var(--f-body); letter-spacing: .16em; text-transform: uppercase; color: var(--caramel-l); margin-bottom: 16px; }
.ftr ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.ftr a { color: var(--cream-2); text-decoration-color: rgba(246, 239, 228, .25); display: inline-block; padding: 3px 0; }
.ftr a:hover { color: #fff; text-decoration-color: var(--caramel); }
.ftr .brand b { font: italic 900 2.4rem/1 var(--f-display); color: var(--cream); }
.ftr .brand p { color: rgba(246, 239, 228, .72); max-width: 36ch; margin: 12px 0 0; font-size: .92rem; }
.ftr .legal { grid-column: 1 / -1; border-top: 1px solid rgba(246, 239, 228, .14); padding-top: 24px; font-size: .8rem; color: rgba(246, 239, 228, .6); display: grid; gap: 6px; }
.ftr .legal p { margin: 0; max-width: 110ch; }

/* ---------- тосты ---------- */
.toasts { position: fixed; z-index: 150; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { pointer-events: auto; background: var(--espresso); color: var(--cream); padding: 12px 16px; border-radius: var(--r); box-shadow: var(--shadow-lg); display: flex; gap: 12px; align-items: center; font-size: .92rem; animation: toast-in .35s var(--spring) both; }
.toast.err { background: var(--cherry); }
.toast.out { animation: toast-out .25s ease forwards; }
.toast button { margin-left: auto; background: none; border: 0; color: inherit; font-weight: 700; text-decoration: underline; min-height: 32px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px); } }

/* ---------- модальное окно ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 120; background: rgba(43, 27, 20, .55); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: fade .25s ease both; }
.modal { width: min(100%, 880px); max-height: calc(100dvh - 32px); overflow: auto; background: var(--cream); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); position: relative; animation: pop .4s var(--spring) both; display: grid; grid-template-columns: 1fr 1fr; }
.modal.narrow { width: min(100%, 460px); grid-template-columns: 1fr; }
.modal .m-close { position: absolute; right: 10px; top: 10px; z-index: 3; background: var(--foam); border: 1.5px solid var(--line); }
.modal .m-art { position: relative; background: var(--espresso) center/cover; min-height: 420px; color: var(--cream); display: flex; align-items: flex-end; padding: 28px; }
.modal .m-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(43, 27, 20, .85), transparent 60%); }
.modal .m-art > * { position: relative; z-index: 1; }
.modal .m-art .tag { position: absolute; z-index: 2; left: 14px; top: 14px; }
.modal .m-art blockquote { margin: 0; font: italic 700 1.5rem/1.25 var(--f-display); }
.modal .m-body { padding: clamp(24px, 4vw, 40px); }
.modal h2 { font-size: 1.9rem; margin-bottom: 6px; }
.tabs { display: inline-flex; background: var(--cream-2); border-radius: 999px; padding: 4px; margin: 14px 0 20px; }
.tabs button { border: 0; background: transparent; padding: 0 18px; min-height: 44px; border-radius: 999px; font-weight: 600; color: var(--mocha); }
.tabs button[aria-selected=true] { background: var(--espresso); color: var(--cream); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(24px) scale(.97); } }

/* ---------- переходы между страницами ---------- */
.page-in { animation: page-in .55s var(--ease) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(14px); } }
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s var(--ease), transform .7s var(--ease); transition-delay: calc(var(--i, 0) * 70ms); }
.reveal.in { opacity: 1; transform: none; }

@media (max-width: 960px) {
  .nav { position: fixed; inset: 0; top: 0; background: var(--cream); flex-direction: column; justify-content: center; align-items: center; gap: 6px; z-index: 70; transform: translateY(-100%); visibility: hidden; transition: transform .45s var(--ease), visibility 0s .45s; margin: 0; padding: 80px 24px 24px; }
  .nav.open { transform: none; visibility: visible; transition: transform .45s var(--ease), visibility 0s; }
  .nav a { font: italic 800 2.1rem/1.2 var(--f-display); padding: 8px 20px; color: var(--espresso); }
  .nav a[aria-current=page]::after { bottom: 6px; }
  .burger { display: inline-grid; position: relative; z-index: 80; }
  .hdr-actions { margin-left: auto; }
  .userchip .nm { display: none; } .userchip { padding: 0 6px; }
  .ftr .wrap { grid-template-columns: 1fr 1fr; }
  .ftr .brand { grid-column: 1 / -1; }
  .modal { grid-template-columns: 1fr; }
  .modal .m-art { display: none; }
  .hdr-strip .hide-m { display: none; }
}
@media (max-width: 520px) { .logo small { display: none; } .ftr .wrap { grid-template-columns: 1fr; } }
