/* Тостослав — editorial luxury: тёплый крем, серифный дисплей, винный акцент */

:root {
    --bg: #FAF5EC;
    --bg-tint: #F3EBDD;
    --card: #FFFDF8;
    --ink: #2A2118;
    --ink-soft: #7A6E60;
    --wine: #93353C;
    --wine-deep: #732A30;
    --line: rgba(42, 33, 24, .09);
    --ease: cubic-bezier(.32, .72, 0, 1);
    --serif: 'Playfair Display', Georgia, serif;
    --sans: 'Manrope', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* плёночное зерно поверх всего */
.grain {
    position: fixed; inset: 0; z-index: 40; pointer-events: none; opacity: .05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

em { font-style: italic; color: var(--wine); }

/* ---------- навигация: плавающая пилюля ---------- */

.nav-pill {
    position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
    z-index: 50; display: flex; align-items: center; gap: 26px;
    padding: 10px 12px 10px 22px; border-radius: 999px;
    background: rgba(255, 253, 248, .78);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--line);
    box-shadow: 0 18px 50px -24px rgba(42, 33, 24, .35);
    white-space: nowrap;
}

.nav-logo {
    font-family: var(--serif); font-weight: 800; font-size: 19px;
    color: var(--ink); text-decoration: none; letter-spacing: .01em;
}

.nav-glass { margin-left: 6px; }

.nav-links { display: flex; gap: 20px; }

.nav-links a {
    color: var(--ink-soft); text-decoration: none; font-size: 14px; font-weight: 600;
    transition: color .5s var(--ease);
}

.nav-links a:hover { color: var(--wine); }

.nav-user { display: flex; align-items: center; gap: 14px; }
.nav-name { font-size: 14px; font-weight: 700; color: var(--ink-soft); }

/* ---------- кнопки: пилюли с вложенной иконкой ---------- */

.btn {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 13px 15px 13px 24px; border-radius: 999px;
    font-family: var(--sans); font-size: 15px; font-weight: 700;
    text-decoration: none; cursor: pointer; border: none;
    transition: transform .6s var(--ease), box-shadow .6s var(--ease), background .6s var(--ease);
}

.btn:active { transform: scale(.97); }

.btn-ico {
    width: 30px; height: 30px; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, .16); font-size: 14px;
    transition: transform .6s var(--ease);
}

.btn:hover .btn-ico { transform: translate(2px, -1px) scale(1.06); }

.btn-wine {
    background: var(--wine); color: #FFF7EE;
    box-shadow: 0 20px 40px -18px rgba(147, 53, 60, .55);
}

.btn-wine:hover { background: var(--wine-deep); }

.btn-ink { background: var(--ink); color: #FFF7EE; }
.btn-ink:hover { background: #3B2F23; }
.btn-ink .btn-ico { background: rgba(255, 255, 255, .14); }

.btn-ghost {
    background: transparent; color: var(--ink);
    border: 1px solid rgba(42, 33, 24, .18); padding: 13px 24px;
}

.btn-ghost:hover { border-color: var(--wine); color: var(--wine); }

.btn-sm { padding: 9px 12px 9px 18px; font-size: 13px; }
.btn-sm .btn-ico { width: 24px; height: 24px; font-size: 12px; }
.btn-disabled { opacity: .55; cursor: default; }

/* ---------- типографика и секции ---------- */

.eyebrow {
    display: inline-block; padding: 5px 14px; border-radius: 999px;
    font-size: 10px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase;
    color: var(--wine); background: rgba(147, 53, 60, .08);
    border: 1px solid rgba(147, 53, 60, .18); margin-bottom: 22px;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 800; line-height: 1.12; }

.hero {
    max-width: 1180px; margin: 0 auto; padding: 168px 24px 110px;
    display: grid; grid-template-columns: 1.05fr .95fr; gap: 64px; align-items: center;
}

.hero h1 { font-size: clamp(40px, 5.4vw, 64px); letter-spacing: -.01em; margin-bottom: 24px; }

.lead { font-size: 18px; color: var(--ink-soft); max-width: 46ch; margin-bottom: 34px; }

.cta-row { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.cta-center { justify-content: center; }

.hero-note { margin-top: 18px; font-size: 13px; color: var(--ink-soft); }

.section { max-width: 1180px; margin: 0 auto; padding: 110px 24px; }

.section-tint {
    max-width: none; background: var(--bg-tint);
    border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}

.section-tint > * { max-width: 1180px; margin-left: auto; margin-right: auto; }

.section-head { text-align: center; margin-bottom: 64px; }
.section-head h2 { font-size: clamp(30px, 4vw, 46px); }
.section-sub { margin-top: 16px; color: var(--ink-soft); max-width: 56ch; margin-left: auto; margin-right: auto; }

/* ---------- двойная рамка (bezel) ---------- */

.bez {
    background: rgba(42, 33, 24, .045);
    border: 1px solid rgba(42, 33, 24, .07);
    border-radius: 30px; padding: 9px;
}

.bez-core {
    background: var(--card); border-radius: 22px; padding: 30px;
    border: 1px solid rgba(42, 33, 24, .05);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, .7),
                0 30px 70px -40px rgba(42, 33, 24, .3);
    height: 100%;
}

/* ---------- чат-карточки ---------- */

.chat { display: flex; flex-direction: column; gap: 12px; }

.msg {
    max-width: 88%; padding: 13px 17px; border-radius: 18px;
    font-size: 15px; line-height: 1.55;
}

.msg-user {
    align-self: flex-end; background: var(--ink); color: #FFF4E8;
    border-bottom-right-radius: 6px;
}

.msg-bot {
    align-self: flex-start; background: var(--bg-tint);
    border: 1px solid var(--line); border-bottom-left-radius: 6px;
}

.msg-tag {
    display: block; font-size: 10px; font-weight: 800; letter-spacing: .16em;
    text-transform: uppercase; color: var(--wine); margin-bottom: 6px;
}

.chat-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }

.chip {
    display: inline-flex; align-items: center; padding: 7px 14px; border-radius: 999px;
    font-size: 12.5px; font-weight: 700; color: var(--ink-soft);
    background: var(--card); border: 1px solid var(--line);
}

.chip-btn {
    cursor: pointer; font-family: var(--sans);
    transition: color .5s var(--ease), border-color .5s var(--ease), transform .5s var(--ease);
}

.chip-btn:hover { color: var(--wine); border-color: rgba(147, 53, 60, .4); }
.chip-btn:active { transform: scale(.96); }
.chip-danger:hover { color: #A0322A; border-color: rgba(160, 50, 42, .4); }

/* ---------- шаги и бенто ---------- */

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }

.step-num {
    font-family: var(--serif); font-style: italic; font-size: 15px;
    color: var(--wine); display: block; margin-bottom: 14px;
}

.steps h3 { font-size: 21px; margin-bottom: 10px; }
.steps p { color: var(--ink-soft); font-size: 15px; }

.examples { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; align-items: start; }

.bento { display: grid; grid-template-columns: 1.4fr 1fr; grid-auto-rows: auto; gap: 22px; }
.bento-big { grid-row: span 2; }
.bento h3 { font-size: 20px; margin-bottom: 10px; }
.bento p { color: var(--ink-soft); font-size: 15px; }

/* ---------- тарифы ---------- */

.pricing { display: grid; grid-template-columns: repeat(2, minmax(0, 440px)); gap: 22px; justify-content: center; }

.price-card { display: flex; flex-direction: column; gap: 6px; position: relative; }
.price-card h3 { font-size: 22px; }

.price {
    font-family: var(--serif); font-style: italic; font-size: 32px;
    color: var(--wine); margin: 6px 0 14px;
}

.price-card ul { list-style: none; margin-bottom: 24px; }

.price-card li {
    padding: 9px 0 9px 26px; position: relative;
    border-bottom: 1px dashed var(--line); font-size: 15px;
}

.price-card li::before { content: '🥂'; position: absolute; left: 0; font-size: 13px; }

.soon-badge {
    position: absolute; top: -12px; right: 18px; padding: 5px 14px;
    background: var(--wine); color: #FFF4E8; border-radius: 999px;
    font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
}

.price-soon { opacity: .92; }

/* ---------- финал и футер ---------- */

.final-cta { text-align: center; padding: 120px 24px 90px; }
.final-cta h2 { font-size: clamp(30px, 4vw, 46px); margin-bottom: 30px; }

.footer {
    max-width: 1180px; margin: 0 auto; padding: 30px 24px 40px;
    display: flex; justify-content: space-between; gap: 16px;
    color: var(--ink-soft); font-size: 13.5px;
    border-top: 1px solid var(--line);
}

.footer a { color: var(--wine); text-decoration: none; }

/* ---------- вход ---------- */

.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 120px 24px 60px; }
.auth-card { max-width: 460px; width: 100%; }
.auth-card .bez-core { text-align: center; padding: 42px 36px; }
.auth-title { font-size: 34px; margin-bottom: 12px; }
.auth-sub { color: var(--ink-soft); font-size: 15px; margin-bottom: 26px; }
.tg-widget { display: flex; justify-content: center; min-height: 48px; margin-bottom: 20px; }
.auth-note { font-size: 12.5px; color: var(--ink-soft); margin-top: 10px; }
.auth-link { color: var(--wine); font-weight: 700; text-decoration: none; }

.auth-form { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }

.auth-form input {
    border: 1px solid var(--line); border-radius: 999px;
    padding: 13px 22px; font-family: var(--sans); font-size: 15px;
    background: var(--bg); color: var(--ink);
    transition: border-color .5s var(--ease), box-shadow .5s var(--ease);
}

.auth-form input:focus {
    outline: none; border-color: rgba(147, 53, 60, .5);
    box-shadow: 0 0 0 4px rgba(147, 53, 60, .08);
}

.btn-wide { justify-content: center; width: 100%; }

.auth-divider {
    display: flex; align-items: center; gap: 14px; margin: 26px 0 18px;
    color: var(--ink-soft); font-size: 12.5px;
}

.auth-divider::before, .auth-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--line);
}

/* ---------- кабинет ---------- */

.app-wrap { max-width: 860px; margin: 0 auto; padding: 130px 24px 40px; }

.app-block { margin-bottom: 42px; }

.app-head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}

.app-head h1 { font-size: 34px; }
.app-head h2 { font-size: 24px; }

.pill-counter {
    padding: 6px 16px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
    color: var(--wine); background: rgba(147, 53, 60, .08);
    border: 1px solid rgba(147, 53, 60, .18);
}

.gen-card textarea {
    width: 100%; border: 1px solid var(--line); border-radius: 16px;
    padding: 16px 18px; font-family: var(--sans); font-size: 16px;
    background: var(--bg); color: var(--ink); resize: vertical; min-height: 88px;
    transition: border-color .5s var(--ease), box-shadow .5s var(--ease);
}

.gen-card textarea:focus {
    outline: none; border-color: rgba(147, 53, 60, .5);
    box-shadow: 0 0 0 4px rgba(147, 53, 60, .08);
}

.gen-actions { display: flex; align-items: center; gap: 16px; margin-top: 14px; }

.spinner {
    display: none; font-size: 14px; color: var(--wine); font-style: italic;
    font-family: var(--serif);
}

.htmx-request .spinner, .spinner.htmx-request { display: inline; }

.variants { margin-top: 26px; display: flex; flex-direction: column; gap: 14px; }

.variants-heading {
    font-family: var(--serif); font-style: italic; font-size: 17px; color: var(--wine);
}

.variant {
    background: var(--bg-tint); border: 1px solid var(--line);
    border-radius: 16px; padding: 16px 18px;
}

.variant-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }

.copy-btn {
    background: none; border: none; cursor: pointer; font-family: var(--sans);
    font-size: 12px; font-weight: 700; color: var(--ink-soft);
    transition: color .4s var(--ease);
}

.copy-btn:hover, .copy-btn.copied { color: var(--wine); }

.g-text { white-space: pre-line; font-size: 15.5px; }

.regen-row { display: flex; gap: 8px; flex-wrap: wrap; }

.flash {
    margin-top: 16px; padding: 13px 18px; border-radius: 14px; font-size: 14.5px;
    background: rgba(147, 53, 60, .07); border: 1px solid rgba(147, 53, 60, .18);
    color: var(--wine-deep);
}

.flash-error { background: rgba(160, 50, 42, .08); }

/* книжка */

.people-list { display: flex; flex-direction: column; }

.person-row {
    display: flex; justify-content: space-between; gap: 18px; align-items: center;
    padding: 16px 2px; border-bottom: 1px dashed var(--line);
}

.person-name { font-weight: 800; font-size: 16px; }
.person-rel { color: var(--ink-soft); font-weight: 600; font-size: 14px; }
.person-event, .person-facts { font-size: 13.5px; color: var(--ink-soft); margin-top: 3px; }
.person-actions { display: flex; gap: 8px; flex-shrink: 0; }

.people-empty { color: var(--ink-soft); font-style: italic; }

.people-add { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

.people-add input {
    flex: 1; min-width: 220px; border: 1px solid var(--line); border-radius: 999px;
    padding: 11px 20px; font-family: var(--sans); font-size: 14.5px;
    background: var(--bg); color: var(--ink);
}

.people-add input:focus { outline: none; border-color: rgba(147, 53, 60, .5); }

.people-note { margin-top: 10px; font-size: 12.5px; color: var(--ink-soft); }

/* аккаунт */

.flash-top { margin: 0 0 26px; }

.account-card { display: flex; flex-direction: column; gap: 10px; }

.account-row { display: flex; gap: 16px; font-size: 15px; align-items: baseline; }

.account-label {
    flex: 0 0 90px; font-size: 11px; font-weight: 800; letter-spacing: .14em;
    text-transform: uppercase; color: var(--ink-soft);
}

.account-hint { font-size: 13.5px; color: var(--ink-soft); margin-top: 8px; }

.tg-widget-left { justify-content: flex-start; margin: 10px 0 0; }

/* история */

.history { display: flex; flex-direction: column; gap: 4px; }

.history-item summary {
    display: flex; justify-content: space-between; gap: 14px; cursor: pointer;
    padding: 12px 4px; list-style: none; border-bottom: 1px dashed var(--line);
}

.history-item summary::-webkit-details-marker { display: none; }
.history-input { font-weight: 600; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-meta { color: var(--ink-soft); font-size: 12px; flex-shrink: 0; }
.history-text { padding: 12px 4px 16px; white-space: pre-line; font-size: 14.5px; color: var(--ink-soft); }

/* ---------- появление при скролле ---------- */

.reveal {
    opacity: 0; transform: translateY(26px); filter: blur(5px);
    transition: opacity .9s var(--ease), transform .9s var(--ease), filter .9s var(--ease);
}

.reveal.in { opacity: 1; transform: translateY(0); filter: blur(0); }

@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; filter: none; transition: none; }
}

/* ---------- мобильные ---------- */

@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; padding-top: 130px; gap: 44px; }
    .steps, .examples, .bento, .pricing { grid-template-columns: 1fr; }
    .bento-big { grid-row: auto; }
    .nav-links { display: none; }
    .section { padding: 72px 20px; }
}

@media (max-width: 560px) {
    .nav-pill { gap: 12px; padding: 8px 10px 8px 16px; max-width: calc(100vw - 24px); }
    .person-row { flex-direction: column; align-items: flex-start; }
    .app-wrap { padding-top: 110px; }
    .footer { flex-direction: column; text-align: center; }
}
