@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@500;600;700&family=Source+Serif+4:ital,wght@0,400;0,600;1,400&display=swap');

:root {
    --bg-main: #ebe4d9;
    --bg-alt: #ddd4c8;
    --text-primary: #1f1a16;
    --accent: #7d5e3f;
    --accent-hover: #5c442c;
    --white: #faf7f2;
    --border: #4a3e35;
    --shadow: rgba(31, 26, 22, 0.12);
    --radius: 12px;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --hero-photo: url('../image/picture.jpg');
}

body.page-philosophy { --hero-photo: url('../image/picture4.jpg'); }
body.page-gear { --hero-photo: url('../image/picture6.jpg'); }
body.page-science { --hero-photo: url('../image/picture8.jpg'); }
body.page-routes { --hero-photo: url('../image/picture10.jpg'); }
body.page-contact { --hero-photo: url('../image/picture12.jpg'); }
body.page-success { --hero-photo: url('../image/picture13.jpg'); }
body.page-privacy { --hero-photo: url('../image/picture14.jpg'); }
body.page-cookies { --hero-photo: url('../image/picture15.jpg'); }
body.page-terms { --hero-photo: url('../image/picture16.jpg'); }

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Serif 4', Georgia, serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-x: hidden;
}

h1, h2, h3, .menu a, .btn {
    font-family: 'Outfit', system-ui, sans-serif;
}

header {
    background: color-mix(in srgb, var(--white) 92%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid color-mix(in srgb, var(--border) 18%, transparent);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: box-shadow 0.35s var(--ease-out);
}

header.header--scrolled {
    box-shadow: 0 10px 32px var(--shadow);
}

nav {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.9rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-link {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: transform 0.3s var(--ease-out);
}

.logo-link:hover {
    transform: scale(1.03);
}

.logo-link img {
    display: block;
    border-radius: 10px;
    box-shadow: 0 4px 14px var(--shadow);
}

.menu {
    display: flex;
    list-style: none;
    gap: 10px 22px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.menu a {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.3rem 0;
    position: relative;
}

.menu a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.35s var(--ease-out);
}

.menu a:hover::after,
.menu a:focus-visible::after {
    transform: scaleX(1);
    transform-origin: left;
}

.menu a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
    border-radius: 2px;
}

.burger {
    display: none;
    font-size: 2rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    line-height: 1;
}

.burger:hover {
    background: color-mix(in srgb, var(--accent) 12%, transparent);
}

@media (max-width: 768px) {
    .menu {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: var(--white);
        padding: 16px 20px 22px;
        border-bottom: 2px solid color-mix(in srgb, var(--border) 15%, transparent);
        box-shadow: 0 16px 36px var(--shadow);
        gap: 6px;
    }

    .menu.active {
        display: flex;
    }

    .burger {
        display: block;
    }
}

/* Hero: фон з --hero-photo + затемнення */
.hero {
    position: relative;
    isolation: isolate;
    height: 100vh;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--white);
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(135deg, rgba(28, 22, 18, 0.72) 0%, rgba(45, 36, 28, 0.48) 50%, rgba(28, 22, 18, 0.78) 100%),
        var(--hero-photo);
    background-size: cover;
    background-position: center;
    transform: scale(1);
}

@media (prefers-reduced-motion: no-preference) {
    .hero::before {
        animation: heroKen 26s ease-in-out infinite alternate;
    }
}

@keyframes heroKen {
    from { transform: scale(1) translate3d(0, 0, 0); }
    to { transform: scale(1.06) translate3d(-1%, 0.5%, 0); }
}

.hero--sub {
    height: auto;
    min-height: 42vh;
    padding: 3.5rem 1.25rem;
}

.hero--sub .hero-content h1 {
    font-size: clamp(1.65rem, 4vw, 2.65rem);
}

.hero--sub .hero-content p {
    max-width: 38rem;
    margin-left: auto;
    margin-right: auto;
}

.hero-content {
    position: relative;
    z-index: 1;
    padding: 2rem 1.25rem;
    max-width: 48rem;
}

.hero-content h1 {
    font-size: clamp(1.85rem, 5vw, 3.1rem);
    margin-bottom: 1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    border-top: 2px solid color-mix(in srgb, var(--white) 55%, transparent);
    border-bottom: 2px solid color-mix(in srgb, var(--white) 55%, transparent);
    padding: 12px 8px;
}

.hero-content p {
    font-size: 1.08rem;
    opacity: 0.95;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.hero form {
    margin-top: 28px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    align-items: center;
}

.hero input {
    padding: 14px 18px;
    min-width: 200px;
    width: min(300px, 100%);
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.hero input:focus {
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--white) 65%, transparent), 0 10px 28px rgba(0, 0, 0, 0.25);
}

.btn {
    background: linear-gradient(145deg, var(--accent) 0%, var(--accent-hover) 100%);
    color: #fff;
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    transition: transform 0.25s var(--ease-out), box-shadow 0.25s, filter 0.25s;
}

.btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}

.btn:active {
    transform: translateY(0);
}

section {
    padding: clamp(3rem, 7vw, 5rem) 20px;
    max-width: 1100px;
    margin: 0 auto;
}

/* Legal policy pages (privacy, cookies, terms) */
main.legal-doc {
    max-width: 52rem;
}

main.legal-doc .legal-meta {
    font-size: 0.92rem;
    color: color-mix(in srgb, var(--text-primary) 72%, var(--border));
    margin-bottom: 1.25rem;
}

main.legal-doc h2 {
    font-size: 1.12rem;
    text-align: left;
    margin: 2rem 0 0.6rem;
    text-transform: none;
    letter-spacing: 0.02em;
    font-weight: 700;
}

main.legal-doc h2:first-of-type {
    margin-top: 1.25rem;
}

main.legal-doc h3 {
    font-size: 1rem;
    margin: 1.35rem 0 0.4rem;
    font-weight: 700;
}

main.legal-doc p {
    margin: 0 0 0.85rem;
}

main.legal-doc ul,
main.legal-doc ol {
    margin: 0 0 1rem 1.35rem;
}

main.legal-doc li {
    margin-bottom: 0.4rem;
}

main.legal-doc a {
    color: var(--accent);
    font-weight: 600;
}

main.legal-doc a:hover {
    text-decoration: underline;
}

.alt-section {
    background: linear-gradient(180deg, var(--bg-alt) 0%, color-mix(in srgb, var(--bg-alt) 90%, var(--bg-main)) 100%);
    max-width: 100%;
    border-top: 1px solid color-mix(in srgb, var(--border) 14%, transparent);
    border-bottom: 1px solid color-mix(in srgb, var(--border) 14%, transparent);
}

.section-inner {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

.alt-section .section-inner > h2 + p {
    max-width: 52rem;
    margin-left: auto;
    margin-right: auto;
}

.alt-section .section-inner .photo-grid {
    margin: 0;
}

/* Довгі тематичні секції: кікер, двоколонковий текст + бічна панель */
.section-kicker {
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--accent);
    text-align: center;
    margin: 0 0 0.6rem;
}

.section-rich h2 {
    margin-bottom: 1.35rem;
}

.rich-stack {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
    gap: clamp(1.35rem, 4vw, 2.75rem);
    align-items: start;
}

@media (max-width: 900px) {
    .rich-stack {
        grid-template-columns: 1fr;
    }
}

.rich-columns {
    display: flex;
    flex-direction: column;
    gap: 1.05rem;
}

.rich-columns > p {
    font-size: 1.04rem;
    margin: 0;
    text-align: left;
    line-height: 1.75;
}

.rich-lead {
    font-size: 1.12rem;
    font-weight: 600;
    color: color-mix(in srgb, var(--text-primary) 92%, var(--accent));
}

.side-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.side-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.2rem 1.35rem;
    border: 1px solid color-mix(in srgb, var(--border) 20%, transparent);
    box-shadow: 0 10px 32px var(--shadow);
}

.alt-section .side-card {
    background: color-mix(in srgb, var(--white) 90%, var(--bg-main));
}

.side-card h3 {
    font-size: 0.82rem;
    margin: 0 0 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--accent);
}

.side-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: 0.82rem;
    line-height: 1.45;
}

.side-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 14%, transparent);
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
}

.side-list li:last-child {
    border-bottom: none;
}

.side-list i {
    color: var(--accent);
    margin-top: 0.12rem;
    flex-shrink: 0;
}

h2 {
    font-size: clamp(1.65rem, 3.5vw, 2.25rem);
    text-align: center;
    margin-bottom: 2rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

h3 {
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: clamp(1.25rem, 3vw, 2rem);
}

.classic-card {
    background: var(--white);
    padding: clamp(1.25rem, 3vw, 1.75rem);
    border: 1px solid color-mix(in srgb, var(--border) 22%, transparent);
    border-radius: var(--radius);
    box-shadow: 0 4px 0 color-mix(in srgb, var(--border) 35%, transparent), 0 14px 36px var(--shadow);
    transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out);
}

.classic-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 2px 0 color-mix(in srgb, var(--border) 45%, transparent), 0 20px 44px rgba(31, 26, 22, 0.15);
}

/* Сітка 2 фото в ряд (головна) */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(1rem, 2.5vw, 1.5rem);
    max-width: 1100px;
    margin: 0 auto;
}

@media (max-width: 640px) {
    .photo-grid {
        grid-template-columns: 1fr;
    }
}

.media-frame {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--border);
    box-shadow: 0 16px 40px rgba(31, 26, 22, 0.18);
    aspect-ratio: 4 / 3;
}

.media-frame::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--white) 28%, transparent);
    pointer-events: none;
    z-index: 1;
}

.media-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.55s var(--ease-out);
}

.media-frame:hover img {
    transform: scale(1.04);
}

.media-frame--wide {
    aspect-ratio: 21 / 9;
}

@media (max-width: 768px) {
    .media-frame--wide {
        aspect-ratio: 16 / 10;
    }
}

.reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.55s var(--ease-out), transform 0.55s var(--ease-out);
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.photo-grid .reveal:nth-child(2) {
    transition-delay: 0.1s;
}

/* Фолбек, якщо зображення тимчасово відсутнє */
.media-placeholder {
    width: 100%;
    min-height: clamp(200px, 32vw, 320px);
    border-radius: var(--radius);
    border: 2px solid color-mix(in srgb, var(--border) 25%, transparent);
    background:
        linear-gradient(165deg, color-mix(in srgb, var(--white) 40%, var(--accent)) 0%, transparent 55%),
        repeating-linear-gradient(
            -12deg,
            color-mix(in srgb, var(--border) 8%, transparent) 0 2px,
            transparent 2px 14px
        ),
        linear-gradient(180deg, var(--bg-alt), var(--bg-main));
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--white) 35%, transparent);
}

.disclaimer {
    font-size: 0.85rem;
    padding: clamp(1rem, 3vw, 1.35rem) 20px;
    text-align: center;
    border-top: 1px solid color-mix(in srgb, var(--border) 12%, transparent);
    background: color-mix(in srgb, var(--white) 70%, var(--bg-alt));
    max-width: 56rem;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.65;
}

.disclaimer p {
    margin: 0 auto 0.65rem;
    max-width: 52rem;
    text-align: center;
}

.disclaimer p:last-child {
    margin-bottom: 0;
}

.disclaimer a {
    color: var(--accent);
    font-weight: 600;
}

.disclaimer a:hover {
    text-decoration: underline;
}

footer {
    background: linear-gradient(180deg, var(--text-primary) 0%, #151210 100%);
    color: var(--white);
    padding: clamp(2.5rem, 6vw, 3.25rem) 20px;
    text-align: center;
}

footer a {
    color: color-mix(in srgb, var(--bg-main) 95%, var(--white));
    text-decoration: none;
    margin: 0 10px;
    transition: color 0.2s;
}

footer a:hover {
    color: #fff;
}

/* Cookie banner */
#cookie-banner {
    position: fixed;
    bottom: max(16px, env(safe-area-inset-bottom));
    left: max(16px, env(safe-area-inset-left));
    right: max(16px, env(safe-area-inset-right));
    max-width: 560px;
    margin: 0 auto;
    z-index: 9999;
    display: none;
    flex-direction: column;
    gap: 14px;
    padding: 20px 22px;
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--white) 96%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid color-mix(in srgb, var(--border) 22%, transparent);
    box-shadow: 0 20px 50px rgba(20, 16, 12, 0.28);
}

#cookie-banner p {
    font-size: 0.95rem;
    margin: 0;
}

#cookie-banner a {
    color: var(--accent);
    font-weight: 600;
    text-decoration: underline;
}

#cookie-banner a:hover {
    color: var(--accent-hover);
}

.hero-form-note {
    margin-top: 1rem;
    font-size: 0.82rem;
    opacity: 0.92;
    max-width: 26rem;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.45;
}

.hero-form-note a {
    color: color-mix(in srgb, var(--white) 92%, var(--accent));
    font-weight: 600;
    text-decoration: underline;
}

.cookie-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

#cookie-banner small {
    display: block;
    margin-top: 8px;
    font-size: 0.8rem;
    opacity: 0.9;
}

#cookie-banner .btn {
    padding: 10px 18px;
    font-size: 0.72rem;
}

@media (max-width: 480px) {
    #cookie-banner .cookie-actions .btn {
        flex: 1;
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .hero::before {
        animation: none !important;
    }

    .logo-link,
    .btn,
    .classic-card,
    .media-frame img,
    .reveal {
        transition: none;
    }

    .classic-card:hover {
        transform: none;
    }

    .media-frame:hover img {
        transform: none;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}
