/*
 * Phase 2 chrome — sticky header, modern nav, full-screen mobile menu, real
 * footer grid. Loaded after the legacy styles.css so its rules win for the
 * elements covered here. Page-body and component styles still come from
 * styles.css until later phases migrate them.
 */


/* ------------------------------------------------------------------ */
/*  Skip link (accessibility)                                          */
/* ------------------------------------------------------------------ */

.skip-link {
    position: absolute;
    top: -100px;
    left: var(--sp-4);
    background: var(--gray-900);
    color: #fff;
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--radius);
    z-index: 1000;
    font-weight: var(--fw-medium);
    transition: top var(--t-fast);
}
.skip-link:focus {
    top: var(--sp-3);
}


/* ------------------------------------------------------------------ */
/*  Site header                                                        */
/* ------------------------------------------------------------------ */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgb(255 255 255 / 0.92);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.03);
    /* No backdrop-filter / transform here: those create a containing block
       for fixed-position descendants and would trap the mobile overlay nav
       inside the header instead of covering the viewport. */
}
.site-header__inner {
    max-width: var(--container-wide);
    margin: 0 auto;
    padding: var(--sp-2) var(--sp-5);
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: var(--sp-6);
}

/* Brand / logo. Override legacy #logo absolute sizing. */
.site-header__brand,
.site-header #logo {
    width: auto;
    min-width: 0;
    height: auto;
    margin: 0;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.site-header__brand img,
.site-header #logo > a > img,
.site-header #logo img {
    width: auto;
    max-height: 56px;
    display: block;
}

/* Right-side stack: contact bar on top, nav below. Override legacy
   absolute positioning of #header-bar. */
.site-header__bar,
.site-header #header-bar {
    position: static;
    width: auto;
    max-width: none;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--sp-1);
}


/* ------------------------------------------------------------------ */
/*  Contact bar — address + phone, right-aligned                       */
/* ------------------------------------------------------------------ */

.site-header__contact,
.site-header #header-bar-top {
    background: none;
    background-image: none;
    padding: 0 0 var(--sp-2);
    margin-bottom: var(--sp-2);
    border-bottom: 1px solid var(--color-border);
    height: auto;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: var(--sp-5);
    font-size: var(--fs-xs);
    letter-spacing: 0.01em;
    color: var(--color-text-muted);
}
.site-header__contact .address,
.site-header__contact .tel {
    display: inline-flex;
    align-items: center;
    padding: 0 0 0 22px;
    background-size: 14px;
    background-position: 0 50%;
    line-height: 1;
}
.site-header__contact .tel a {
    color: var(--color-text);
    font-weight: var(--fw-medium);
    transition: color var(--t-fast);
}
.site-header__contact .tel a:hover {
    color: var(--basic-color);
}


/* ------------------------------------------------------------------ */
/*  Navigation — desktop                                               */
/* ------------------------------------------------------------------ */

.site-nav {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: var(--sp-1);
    background: none;
    background-image: none;
    overflow: visible;
    padding: 0;
}
.site-nav a {
    float: none;
    display: inline-flex;
    align-items: center;
    padding: var(--sp-2) var(--sp-4);
    color: var(--color-text-muted);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    text-decoration: none;
    border-radius: var(--radius);
    transition: background var(--t-fast), color var(--t-fast);
    text-transform: none;
    letter-spacing: 0.005em;
}
.site-nav a:hover {
    background: transparent;
    color: var(--color-text);
}
.site-nav a.active {
    background: color-mix(in srgb, var(--basic-color) 12%, transparent);
    color: var(--basic-color);
    box-shadow: none;
    border-radius: var(--radius);
}


/* ------------------------------------------------------------------ */
/*  Burger toggle (hidden on desktop)                                  */
/* ------------------------------------------------------------------ */

.site-nav__toggle {
    display: none;
    position: relative;
    width: 44px;
    height: 44px;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    z-index: 110;
    border-radius: var(--radius);
}
.site-nav__toggle:hover {
    background: var(--color-bg-muted);
}
.site-nav__toggle-bar {
    display: block;
    position: absolute;
    left: 10px;
    width: 24px;
    height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: transform var(--t-base), opacity var(--t-fast), top var(--t-base);
}
.site-nav__toggle-bar:nth-child(1) { top: 14px; }
.site-nav__toggle-bar:nth-child(2) { top: 21px; }
.site-nav__toggle-bar:nth-child(3) { top: 28px; }

/* X when open. */
.site-nav__toggle[aria-expanded="true"] .site-nav__toggle-bar:nth-child(1) {
    top: 21px;
    transform: rotate(45deg);
}
.site-nav__toggle[aria-expanded="true"] .site-nav__toggle-bar:nth-child(2) {
    opacity: 0;
}
.site-nav__toggle[aria-expanded="true"] .site-nav__toggle-bar:nth-child(3) {
    top: 21px;
    transform: rotate(-45deg);
}


/* ------------------------------------------------------------------ */
/*  Hero                                                               */
/* ------------------------------------------------------------------ */

.hero {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: var(--color-bg-muted);
    aspect-ratio: 16 / 7;
    /* Cap on huge displays so the hero doesn't dominate the page.
       The image inside (object-fit: cover) crops to fit. */
    max-height: min(640px, 78vh);
}
.hero--small {
    aspect-ratio: 16 / 5;
    max-height: min(420px, 55vh);
}
.hero picture {
    display: block;
    width: 100%;
    height: 100%;
}
.hero__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Multi-slide hero — pure CSS crossfade between two images, no JS.
   The first <picture> is the always-visible base layer. The second is
   absolutely overlaid on top and fades in/out on a 12s cycle. */
.hero--slides picture {
    position: absolute;
    inset: 0;
}
.hero--slides picture:first-of-type {
    position: relative;
    opacity: 1;
}
.hero--slides picture:not(:first-of-type) {
    opacity: 0;
    animation: hero-fade-in-out 12s ease-in-out infinite;
    animation-delay: 4s; /* hold the first image for 4s before the first crossfade */
}

/* Captions follow the same crossfade cycle as their image. The first
   caption is the always-visible base layer; subsequent captions sit on
   top and fade in/out together with their slide. */
.hero--slides .hero__caption:not(:first-of-type) {
    opacity: 0;
    animation: hero-fade-in-out 12s ease-in-out infinite;
    animation-delay: 4s;
}
@keyframes hero-fade-in-out {
      0% { opacity: 0; }
      8% { opacity: 1; }
     50% { opacity: 1; }
     58% { opacity: 0; }
    100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .hero--slides picture:not(:first-of-type),
    .hero--slides .hero__caption:not(:first-of-type) { animation: none; }
}
.hero__caption {
    position: absolute;
    left: clamp(var(--sp-5), 6vw, var(--sp-16));
    bottom: clamp(var(--sp-5), 5vw, var(--sp-12));
    max-width: min(720px, 85vw);
    padding: var(--sp-3) var(--sp-5);
    background: rgb(0 0 0 / 0.55);
    color: #fff;
    font-size: clamp(var(--fs-md), 1.6vw, var(--fs-lg));
    font-weight: var(--fw-medium);
    line-height: var(--lh-snug);
    border-radius: var(--radius);
    backdrop-filter: blur(4px);
    animation: hero-caption-in 600ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes hero-caption-in {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}


/* ------------------------------------------------------------------ */
/*  Main content container                                             */
/* ------------------------------------------------------------------ */

#content {
    max-width: var(--container-wide);
    margin: var(--sp-12) auto var(--sp-16);
    padding: 0 var(--sp-5);
}


/* ------------------------------------------------------------------ */
/*  Footer                                                             */
/* ------------------------------------------------------------------ */

.site-footer {
    background:
        linear-gradient(180deg, rgb(255 255 255 / 0.02), transparent 200px),
        var(--gray-900);
    color: var(--gray-400);
    padding: var(--sp-16) 0 var(--sp-6);
    margin-top: var(--sp-20);
    position: relative;
}
.site-footer::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--basic-color) 20%,
        var(--basic-color) 80%,
        transparent 100%
    );
    opacity: 0.6;
}
.site-footer #footer-container {
    max-width: var(--container-wide);
    margin: 0 auto;
    padding: 0 var(--sp-5);
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    gap: var(--sp-12) var(--sp-8);
}
.site-footer .footer-elem {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    width: auto;
    min-width: 0;
    font-size: var(--fs-sm);
    line-height: var(--lh-base);
}
.site-footer .footer-elem__heading {
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gray-500);
    margin: 0 0 var(--sp-2);
}
.site-footer address {
    font-style: normal;
    line-height: var(--lh-base);
    color: var(--gray-400);
}
.site-footer address span {
    color: #fff;
    font-weight: var(--fw-semibold);
    font-size: var(--fs-md);
    letter-spacing: -0.005em;
    display: block;
    margin-bottom: var(--sp-3);
}
.site-footer #footer-container a {
    color: var(--gray-400);
    padding: 0;
    transition: color var(--t-fast);
    width: max-content;
}
.site-footer #footer-container a:hover {
    color: #fff;
}
.site-footer address a {
    color: var(--gray-300);
}
.site-footer .copyright {
    grid-column: 1 / -1;
    margin: var(--sp-8) 0 0;
    padding: var(--sp-5) 0 0;
    border-top: 1px solid rgb(255 255 255 / 0.06);
    color: var(--gray-500);
    font-size: var(--fs-xs);
    letter-spacing: 0.01em;
}

@media (max-width: 720px) {
    .site-footer #footer-container {
        grid-template-columns: 1fr 1fr;
        gap: var(--sp-8);
    }
    .site-footer .footer-elem--brand {
        grid-column: 1 / -1;
    }
}


/* ------------------------------------------------------------------ */
/*  Third-party content notice (bottom-right toast)                    */
/*  Persists until the user clicks OK; preference stored in            */
/*  localStorage (no cookie). Hidden by default; JS reveals it.        */
/* ------------------------------------------------------------------ */

.tp-notice {
    position: fixed;
    right: var(--sp-5);
    bottom: var(--sp-5);
    max-width: 360px;
    background: var(--gray-900);
    color: var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--sp-4) var(--sp-5);
    display: flex;
    gap: var(--sp-4);
    align-items: flex-start;
    font-size: var(--fs-sm);
    line-height: var(--lh-base);
    z-index: 200;
    animation: tp-notice-in 320ms cubic-bezier(0.16, 1, 0.3, 1);
}
.tp-notice[hidden] { display: none; }
.tp-notice p {
    margin: 0;
    flex: 1;
    color: inherit;
}
.tp-notice a {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.tp-notice strong {
    color: #fff;
    font-weight: var(--fw-semibold);
}
.tp-notice__dismiss {
    flex-shrink: 0;
    background: var(--basic-color);
    color: #fff;
    border: 0;
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--radius);
    font-weight: var(--fw-medium);
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: filter var(--t-fast);
}
.tp-notice__dismiss:hover {
    filter: brightness(1.15);
}
@keyframes tp-notice-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@media (max-width: 720px) {
    .tp-notice {
        left: var(--sp-3);
        right: var(--sp-3);
        bottom: var(--sp-3);
        max-width: none;
    }
}


/* ------------------------------------------------------------------ */
/*  Mobile / responsive (≤860px)                                       */
/* ------------------------------------------------------------------ */

@media (max-width: 860px) {
    .site-header__inner {
        grid-template-columns: 1fr auto;
        padding: var(--sp-3) var(--sp-4);
        gap: var(--sp-3);
    }
    .site-header__brand img,
    .site-header #logo > a > img,
    .site-header #logo img {
        max-height: 44px;
    }
    /* Hide the desktop contact bar — it lives in the hero / footer instead. */
    .site-header__contact,
    .site-header #header-bar-top {
        display: none;
    }
    .site-header__bar,
    .site-header #header-bar {
        gap: 0;
    }

    /* Burger appears, desktop nav hides until toggled. */
    .site-nav__toggle {
        display: block;
        justify-self: end;
    }

    /* Full-screen overlay menu. */
    .site-nav {
        position: fixed;
        inset: 0;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: var(--sp-3);
        background: var(--color-bg);
        padding: var(--sp-16) var(--sp-6) var(--sp-6);
        opacity: 0;
        pointer-events: none;
        transform: translateY(-12px);
        transition: opacity var(--t-base), transform var(--t-base);
        z-index: 105;
    }
    body[data-nav-open="true"] .site-nav {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }
    /* Override legacy `.topnav a:not(:first-child) { display: none }`
       (specificity 0,2,1) — match it so source order wins. */
    .site-nav a,
    .site-nav a:not(:first-child) {
        display: inline-flex;
        font-size: var(--fs-2xl);
        font-weight: var(--fw-medium);
        padding: var(--sp-3) var(--sp-5);
    }
    .site-nav a.active {
        background: none;
        color: var(--basic-color);
        box-shadow: none;
    }
    body[data-nav-open="true"] {
        overflow: hidden;
    }

    .hero__image { aspect-ratio: 4 / 3; }
    .hero--small .hero__image { aspect-ratio: 3 / 2; }
    .hero__caption {
        font-size: var(--fs-base);
        padding: var(--sp-3) var(--sp-4);
        max-width: calc(100% - var(--sp-8));
    }

    #content {
        margin: var(--sp-8) auto var(--sp-12);
        padding: 0 var(--sp-4);
    }
}
