/* ===== Токены (из globals.css дизайна) ===== */
:root {
    color-scheme: light;
    --background: oklch(0.975 0.006 160);
    --foreground: oklch(0.27 0.03 200);
    --card: oklch(1 0 0);
    --card-foreground: oklch(0.27 0.03 200);
    --primary: oklch(0.47 0.07 165);
    --primary-foreground: oklch(0.985 0.005 160);
    --secondary: oklch(0.94 0.02 165);
    --secondary-foreground: oklch(0.33 0.05 165);
    --muted: oklch(0.95 0.01 160);
    --muted-foreground: oklch(0.5 0.02 200);
    --accent: oklch(0.7 0.14 50);
    --accent-foreground: oklch(0.99 0 0);
    --destructive: oklch(0.577 0.245 27.325);
    --border: oklch(0.9 0.012 160);
    --input: oklch(0.88 0.015 160);
    --ring: oklch(0.47 0.07 165);
    --radius: 0.75rem;

    --font-sans: 'Manrope', system-ui, sans-serif;
    --font-heading: 'Unbounded', system-ui, sans-serif;
}

/* ===== База ===== */
*, *::before, *::after { box-sizing: border-box; border: 0 solid var(--border); }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    min-height: 100vh;
    background: var(--background);
    color: var(--foreground);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
ul { list-style: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid color-mix(in oklch, var(--ring) 50%, transparent); outline-offset: 2px; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0;
}

.container { width: 100%; max-width: 72rem; margin-inline: auto; padding-inline: 1rem; }
@media (min-width: 768px) { .container { padding-inline: 2rem; } }

.heading { font-family: var(--font-heading); font-weight: 600; text-wrap: balance; }
.text-xl { font-size: 1.25rem; line-height: 1.4; }
.text-2xl { font-size: 1.5rem; line-height: 1.33; }
.text-3xl { font-size: 1.875rem; line-height: 1.2; }
.text-sm { font-size: 0.875rem; line-height: 1.43; }
.text-muted { color: var(--muted-foreground); line-height: 1.625; }
.text-primary { color: var(--primary); }
.text-strong { font-weight: 500; color: var(--foreground); }
.stack-2 { display: flex; flex-direction: column; gap: 0.5rem; }

/* ===== Иконки ===== */
.icon { width: 1rem; height: 1rem; flex-shrink: 0; }
.icon-xs { width: 0.875rem; height: 0.875rem; }
.icon-md { width: 1.25rem; height: 1.25rem; }
.icon-lg { width: 1.5rem; height: 1.5rem; }
.icon-xl { width: 2.5rem; height: 2.5rem; }

/* ===== Кнопки ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem;
    height: 2.25rem; padding: 0 0.875rem;
    border: 1px solid transparent; border-radius: calc(var(--radius) * 0.8);
    font-size: 0.875rem; font-weight: 500; white-space: nowrap;
    cursor: pointer; user-select: none; background: transparent;
    transition: background-color .15s, color .15s, box-shadow .15s, opacity .15s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover { background: color-mix(in oklch, var(--primary) 88%, black); }
.btn-secondary { background: var(--secondary); color: var(--secondary-foreground); }
.btn-secondary:hover { background: color-mix(in oklch, var(--secondary) 80%, transparent); }
.btn-outline { border-color: var(--border); background: var(--background); }
.btn-outline:hover { background: var(--muted); }
.btn-ghost:hover { background: var(--muted); }
.btn-glass { background: color-mix(in oklch, var(--card) 80%, transparent); backdrop-filter: blur(8px); }
.btn-lg { height: 3rem; padding: 0 1.5rem; font-size: 1rem; gap: 0.5rem; }

/* ===== Поля ===== */
.field { display: flex; flex-direction: column; gap: 0.5rem; }
.field label { font-size: 0.875rem; font-weight: 500; line-height: 1; }
.input {
    width: 100%; height: 2.25rem; padding: 0.25rem 0.75rem;
    border: 1px solid var(--input); border-radius: calc(var(--radius) * 0.8);
    background: transparent; font-size: 0.875rem;
    transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--muted-foreground); }
.input:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 30%, transparent); }
textarea.input { height: auto; min-height: 4rem; padding-block: 0.5rem; resize: vertical; }
select.input {
    appearance: none; padding-right: 2.25rem; cursor: pointer; background-color: var(--card);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a8a8f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 1rem;
}
.input-lg { height: 2.75rem; }

.grid { display: grid; gap: 1rem; }
.grid-3 { grid-template-columns: repeat(2, 1fr); }
.grid-3 .field--wide { grid-column: span 2; }
@media (min-width: 640px) {
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-3 .field--wide { grid-column: auto; }
}

/* ===== Шапка ===== */
.site-header__inner { display: flex; align-items: center; justify-content: space-between; padding-block: 1.25rem; }
.has-hero .site-header { position: absolute; inset: 0 0 auto; z-index: 20; }
.logo { display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-heading); font-size: 1.25rem; font-weight: 600; }
.site-nav { display: none; gap: 1.5rem; font-size: 0.875rem; font-weight: 500; color: color-mix(in oklch, var(--foreground) 80%, transparent); }
.site-nav a:hover { color: var(--foreground); }
@media (min-width: 768px) { .site-nav { display: flex; } }

/* ===== Hero ===== */
.hero { position: relative; isolation: isolate; overflow: hidden; }
.hero__image { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.hero::after {
    content: ''; position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(to bottom,
        color-mix(in oklch, var(--background) 70%, transparent),
        color-mix(in oklch, var(--background) 20%, transparent),
        var(--background));
}
.hero__inner {
    display: flex; flex-direction: column; align-items: flex-start; gap: 1.5rem;
    padding-top: calc(5rem + 4.75rem); padding-bottom: 10rem;
}
.pill {
    padding: 0.25rem 0.75rem; border-radius: 999px;
    background: color-mix(in oklch, var(--card) 80%, transparent); backdrop-filter: blur(8px);
    font-size: 0.875rem; font-weight: 500; color: var(--primary);
}
.hero__title { max-width: 42rem; font-size: 2.25rem; line-height: 1.25; }
.hero__lead { max-width: 36rem; font-size: 1.125rem; line-height: 1.625; text-wrap: pretty; color: color-mix(in oklch, var(--foreground) 80%, transparent); }
@media (min-width: 768px) {
    .hero__inner { padding-top: calc(7rem + 4.75rem); padding-bottom: 14rem; }
    .hero__title { font-size: 3.75rem; }
}

/* ===== Поиск по городу ===== */
.search { position: relative; z-index: 10; margin-top: -7rem; }
.search__card {
    display: grid; overflow: hidden;
    border: 1px solid var(--border); border-radius: calc(var(--radius) * 2.2);
    background: var(--card);
    box-shadow: 0 20px 25px -5px color-mix(in oklch, var(--primary) 5%, transparent), 0 8px 10px -6px color-mix(in oklch, var(--primary) 5%, transparent);
}
.search__form { display: flex; flex-direction: column; gap: 1.5rem; padding: 1.5rem; }
.search__map { height: 20rem; background: var(--muted); }
@media (min-width: 768px) {
    .search { margin-top: -10rem; }
    .search__card { grid-template-columns: 2fr 3fr; }
    .search__form { padding: 2rem; }
    .search__map { height: auto; min-height: 24rem; }
}

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
    display: flex; align-items: center; gap: 0.375rem;
    padding: 0.375rem 0.75rem; border-radius: 999px; cursor: pointer;
    background: var(--secondary); color: var(--secondary-foreground); font-size: 0.875rem;
}
.chip:hover { background: color-mix(in oklch, var(--secondary) 70%, transparent); }
.chip[aria-pressed="true"] { background: var(--primary); color: var(--primary-foreground); }
.chip__count { opacity: 0.7; }

.leaflet-container { font-family: var(--font-sans); background: var(--muted); }

/* ===== Список путешествий ===== */
.trips { display: flex; flex-direction: column; gap: 2rem; padding-block: 4rem; }
.trips__header { display: flex; flex-direction: column; justify-content: space-between; gap: 1rem; }
.trips__grid { display: grid; gap: 1.5rem; }
@media (min-width: 640px) {
    .trips__header { flex-direction: row; align-items: flex-end; }
    .trips__grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 768px) { .trips { padding-block: 6rem; } }
@media (min-width: 1024px) { .trips__grid { grid-template-columns: repeat(3, 1fr); } }

.empty {
    display: flex; flex-direction: column; align-items: center; gap: 1rem;
    padding: 4rem 1.5rem; text-align: center;
    border: 1px dashed var(--border); border-radius: calc(var(--radius) * 1.8); background: var(--card);
}
.empty p { max-width: 24rem; }

/* ===== Карточка путешествия ===== */
.trip-card {
    display: flex; flex-direction: column; overflow: hidden;
    border: 1px solid var(--border); border-radius: calc(var(--radius) * 1.8);
    background: var(--card); color: var(--card-foreground);
    transition: box-shadow .2s;
}
.trip-card:hover { box-shadow: 0 10px 15px -3px color-mix(in oklch, var(--primary) 5%, transparent), 0 4px 6px -4px color-mix(in oklch, var(--primary) 5%, transparent); }
.trip-card__media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; }
.trip-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.trip-card:hover .trip-card__media img { transform: scale(1.05); }
.badge {
    position: absolute; top: 0.75rem; left: 0.75rem;
    display: inline-flex; align-items: center; height: 1.25rem; padding: 0.125rem 0.5rem;
    border-radius: 999px; background: var(--card); color: var(--card-foreground);
    font-size: 0.75rem; font-weight: 500; white-space: nowrap;
}
.trip-card__body { display: flex; flex: 1; flex-direction: column; gap: 1rem; padding: 1.25rem; }
.trip-card__text { display: flex; flex-direction: column; gap: 0.375rem; }
.trip-card__city { display: flex; align-items: center; gap: 0.25rem; font-size: 0.875rem; color: var(--muted-foreground); }
.trip-card__title { font-size: 1.125rem; line-height: 1.375; }
.trip-card__description {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    font-size: 0.875rem; line-height: 1.625; color: var(--muted-foreground);
}
.trip-card__meta { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; font-size: 0.875rem; }
.trip-card__meta > div { display: flex; align-items: center; gap: 0.375rem; }
.progress { height: 0.375rem; overflow: hidden; border-radius: 999px; background: var(--secondary); }
.progress__bar { height: 100%; border-radius: 999px; background: var(--primary); transition: width .3s; }
.trip-card__footer { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: auto; padding-top: 0.25rem; }
.trip-card .icon-check { display: none; }
.trip-card[data-is-joined="1"] .icon-check { display: block; }

/* ===== Подвал ===== */
.site-footer { border-top: 1px solid var(--border); }
.site-footer__inner {
    display: flex; flex-direction: column; gap: 0.5rem; padding-block: 2rem;
    font-size: 0.875rem; color: var(--muted-foreground);
}
@media (min-width: 640px) { .site-footer__inner { flex-direction: row; justify-content: space-between; } }

/* ===== Диалог ===== */
.dialog {
    width: calc(100% - 2rem); max-width: 32rem; max-height: 90vh; margin: auto;
    border-radius: calc(var(--radius) * 1.4); background: var(--background); color: var(--foreground);
    box-shadow: 0 0 0 1px color-mix(in oklch, var(--foreground) 10%, transparent);
}
.dialog::backdrop { background: rgb(0 0 0 / 0.1); backdrop-filter: blur(4px); }
.dialog[open] { animation: dialog-in .15s ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: scale(.95); } }
.dialog__body { position: relative; display: flex; flex-direction: column; gap: 1rem; padding: 1.5rem; }
.dialog__header { display: flex; flex-direction: column; gap: 0.5rem; padding-right: 2rem; }
.dialog__header p { font-size: 0.875rem; }
.dialog__close {
    position: absolute; top: 0.75rem; right: 0.75rem;
    display: flex; padding: 0.375rem; border-radius: calc(var(--radius) * 0.6);
    background: transparent; cursor: pointer; opacity: 0.7;
}
.dialog__close:hover { opacity: 1; background: var(--muted); }
.dialog__footer {
    display: flex; flex-direction: column-reverse; gap: 0.5rem;
    margin: 0.5rem -1.5rem -1.5rem; padding: 1rem 1.5rem;
    border-top: 1px solid var(--border); background: color-mix(in oklch, var(--muted) 50%, transparent);
}
@media (min-width: 640px) { .dialog__footer { flex-direction: row; justify-content: flex-end; } }
.form-error { font-size: 0.875rem; color: var(--destructive); }
