:root {
    --color-bg: #f5e4bc;
    --color-surface: #fff8e8;
    --color-surface-strong: #fffdf7;
    --color-ink: #342f28;
    --color-muted: #6f6357;
    --color-accent: #e03618;
    --color-accent-dark: #aa2d1f;
    --color-sand: #d2ab82;
    --color-sand-soft: #ead2ad;
    --color-teal: #8fb8b4;
    --color-teal-dark: #416d68;
    --border-soft: rgba(70, 52, 31, 0.18);
    --shadow-soft: 0 14px 34px rgba(84, 57, 28, 0.12);
    --focus-ring: rgba(65, 109, 104, 0.38);
    --scrollbar-thumb: rgba(52, 47, 40, 0.36);
    --scrollbar-track: rgba(255, 248, 232, 0.8);
}

.notch-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: env(safe-area-inset-top);
    background-color: var(--color-accent);
    z-index: 9999;
    pointer-events: none;
}

*,
*:after,
*:before {
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

html {
    font-size: 12px;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    font-size: 1.4rem;
    color: var(--color-ink);
    padding: 0;
    margin: 0;
    animation: fadein 280ms ease-out;
    background:
        linear-gradient(180deg, rgba(255, 253, 247, 0.24), rgba(255, 253, 247, 0) 240px),
        var(--color-bg);
}

@keyframes fadein {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
}

#map {
    height: min(68vh, 560px);
    min-height: 360px;
    width: 100%;
}

#filters {
    width: min(calc(100% - 2rem), 1180px);
    margin: 1.3rem auto;
    padding: 0 0.2rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.55rem;
}

#app {
    width: min(calc(100% - 2rem), 1120px);
    margin: 1.6rem auto 4rem;
}

#place-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
    gap: 1rem;
}

.item {
    min-width: 0;
    color: var(--color-ink);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background-color: rgba(255, 253, 247, 0.54);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
    overflow: hidden;
}

ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
header {
    color: var(--color-surface);
    padding: clamp(1.35rem, 3vw, 2.6rem) 1rem;
    background-color: var(--color-accent);
    border-bottom: 6px solid var(--color-sand);
}

img {
    width: 100%;
}

.place {
    min-height: 100%;
    font-size: 1rem;
    line-height: 1.5;
    margin: 0;
    padding: 1.25rem 1.3rem 1.15rem;
    background-color: var(--color-surface);
    border-left: 0.55rem solid var(--color-sand);
    transition:
        background-color 180ms ease,
        border-color 180ms ease,
        box-shadow 180ms ease,
        transform 180ms ease;
}

.place:hover {
    background-color: var(--color-surface-strong);
    border-left-color: var(--color-accent);
    box-shadow: var(--shadow-soft);
    transform: translateY(-2px);
}

.place br {
    display: none;
}

.place h2 {
    margin: 0 0 0.7rem;
    color: var(--color-ink);
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(1.45rem, 1.2vw + 1rem, 2rem);
    line-height: 1.16;
}

.place p {
    color: var(--color-muted);
    font-size: 1rem;
    line-height: 1.45;
}

.place p + p {
    margin-top: 0.9rem;
}

.place .hashtag, .leaflet-popup-content .hashtag {
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    font-size: 0.84rem;
    line-height: 1;
    border-radius: 5px;
    padding: 0.42rem 0.56rem;
    margin: 0.25rem 0.3rem 0.25rem 0;
    color: var(--color-surface);
    background-color: var(--color-accent);
    transition:
        background-color 160ms ease,
        transform 160ms ease,
        opacity 160ms ease;
}

.place .hashtag:hover {
    cursor: pointer;
    background-color: var(--color-accent-dark);
    transform: translateY(-1px);
} 


.tag-label {
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    min-height: 2.45rem;
    padding: 0.45rem 0.78rem;
    color: var(--color-ink);
    background-color: var(--color-sand-soft);
    border: 1px solid rgba(70, 52, 31, 0.12);
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
    font-size: 1rem;
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
    transition:
        background-color 160ms ease,
        color 160ms ease,
        border-color 160ms ease,
        transform 160ms ease;
}

/* Скрываем стандартный checkbox */
.tag-filter {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Стили для выбранного состояния */
.tag-filter:checked+.tag-label {
    color: var(--color-surface);
    cursor: pointer;
    background-color: var(--color-accent);
    border-color: var(--color-accent);
}

.tag-filter:focus-visible+.tag-label {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
}

.tag-label:hover {
    border-color: rgba(70, 52, 31, 0.28);
    transform: translateY(-1px);
}

.hashtag {
    font-weight: bold;
    font-size: 0.84rem;
    border-radius: 5px;
    padding: 0.4rem 0.6rem;
    margin-right: 0.35rem;
    color: var(--color-surface);
    transition:
        background-color 160ms ease,
        opacity 160ms ease;
}

.hashtag:hover {
    cursor: pointer;
}

hr {
    margin: 2rem 0rem;
    border: none;
    background-color: rgba(70, 52, 31, 0.12);
    height: 2px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 1.4rem;
    margin-bottom: 1.6rem;
    line-height: 2.4rem;
}

h1 {
    font-size: clamp(2rem, 4vw, 3.4rem);
}

h2 {
    font-size: 1.8rem;
}

h3 {
    font-size: 1.6rem;
}

h4 {
    font-size: 1.4rem;
}

h5 {
    font-size: 1.2rem;
}

h6 {
    font-size: 1rem;
}

p {
    font-size: 1.4rem;
    line-height: 1.6rem;
    margin: 0rem;
}

blockquote {
    padding: 10px;
    margin: 0px;
    background: var(--color-surface-strong);
    border-left: 5px solid var(--color-sand);
}

/*------------------------------------*\
		#HEADER
\*------------------------------------*/

header {
    text-align: center;
}

header h1 {
    margin: 0;
    font-weight: 800;
    line-height: 1.05;
}

/*------------------------------------*\
		#FOOTER
\*------------------------------------*/

footer {
    text-align: center;
}

.wrapper {
    margin: 20px auto;
    padding: 40px;
    max-width: 1400px;
    display: block;
}

main {
    display: block;
    max-width: 1200px;
    margin: 2% auto;
    padding: 2%;
    background-color: white;
}

a {
    font-size: 1.4rem;
    color: var(--color-accent);
    transition: opacity 160ms ease;
}

a:hover {
    opacity: 0.7;
}

/*------------------------------------*\
		#FORMS
\*------------------------------------*/

button {
    padding: 5px 10px;
    background: white;
    border-radius: 4px;
    border: solid 1px lightgray;
    text-align: center;
    color: gray;
    text-decoration: none;
    transition:
        border-color 160ms ease,
        color 160ms ease,
        opacity 160ms ease;
    -webkit-appearance: none;
}

button:hover {
    opacity: 0.75;
}

.f input,
.f textarea,
.f select {
    font-size: 1rem;
    width: 100%;
    display: block;
    color: gray;
    border-radius: 4px;
    border: solid 1px silver;
    padding: 10px;
    margin: 10px 0px;
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease;
}

.f input:hover,
.f textarea:hover,
.f select:hover {
    border: solid 1px seagreen;
    transition: border-color 160ms ease;
}

.f input:focus,
.f textarea:focus,
.f select:focus {
    border: solid 1px seagreen;
    box-shadow: 0 0 0 3px var(--focus-ring);
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease;
}

.f input:active,
.f textarea:active,
.f select:active {
    border: solid 1px seagreen;
    transition: border-color 160ms ease;
}

/* .category {
		margin-left: 5px;
	}
	.subcategory {
		margin-left: 20px;
	} */

/*------------------------------------*\
    #Leaflet
\*------------------------------------*/     

.leaflet-popup-content {
    width: min(72vw, 600px) !important;
}

.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    background: #23241f;
    color: #e6db74;
    box-shadow: none;
}
/*------------------------------------*\
    #DETAILS & #SUMMARY 
\*------------------------------------*/

details {
    margin: 0;
}

.map-wrapper {
    width: min(calc(100% - 2rem), 1120px);
    margin: 1rem auto 0;
    overflow: hidden;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background: var(--color-surface);
    box-shadow: var(--shadow-soft);
}

.summary-map {
    font-weight: bold;
    text-align: center;
    display: block;
    font-size: 1rem;
    line-height: 1;
    padding: 1rem;
    margin-bottom: 0;
    color: var(--color-surface-strong);
    background-color: var(--color-teal);
    transition:
        background-color 160ms ease,
        color 160ms ease;
}

.summary-map:hover,
details[open] .summary-map {
    background-color: var(--color-teal-dark);
}

details summary {
    list-style: none;
    /* Убираем стандартную стрелку */
    display: inline-block;
    /* Сохраняем возможность кликать */
    cursor: pointer;
    font-weight: bold;
}

/* Дополнительно убираем стрелку в Safari */
details summary::-webkit-details-marker {
    display: none;
}

/*------------------------------------*\
    #CODE & #PRE
\*------------------------------------*/

code {
    font-size: 1.2rem !important;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    color: #e6db74;
    background-color: #23241f;
    border-radius: 10px;
}

pre {
    font-size: 1.2rem !important;
    color: #e6db74;
    background-color: #23241f;
    padding: 10px;
 
    border-radius: 10px;
}

@media screen and (max-width: 1000px) {
    .map-wrapper:not(.is-active) * {
        pointer-events: none;
    }
}

@media screen and (max-width: 700px) {
    body {
        font-size: 1.25rem;
    }

    header {
        padding: 1.35rem 1rem;
    }

    #filters {
        width: 100%;
        margin: 0;
        padding: 0.9rem 1rem 1rem;
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
        border-bottom: 1px solid rgba(70, 52, 31, 0.12);
    }

    .tag-label {
        flex: 0 0 auto;
        scroll-snap-align: start;
    }

    #app {
        width: min(calc(100% - 1.5rem), 1120px);
        margin-top: 1rem;
    }

    #place-list {
        gap: 0.8rem;
    }

    .place {
        padding: 1rem 1rem 0.95rem;
        border-left-width: 0.42rem;
    }

    .map-wrapper {
        width: min(calc(100% - 1.5rem), 1120px);
    }

    #map {
        height: 54vh;
        min-height: 300px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *:before,
    *:after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
