/* ============================================================
   THE TREQ — Horizon shell (shared across pages)
   Sky, grain, HUD, type, buttons, footer. No Three.js.
   ============================================================ */

:root {
    --ochre:        #d4a55a;
    --ochre-light:  #e8c078;
    --rust:         #c45c3e;
    --deep:         #0d1a12;
    --forest:       #1a2f23;
    --rain:         #3d5c52;
    --fog:          #8fa5a0;
    --mist:         #c4d4cf;
    --off-white:    #f5f2eb;
    --violet:       #6b5a8e;

    --font-display: 'Climate Crisis', cursive;
    --font-body:    'Inter', sans-serif;
    --font-mono:    'IBM Plex Mono', 'SFMono-Regular', Consolas, 'Cascadia Mono', monospace;

    --hud-pad: clamp(1rem, 3vw, 2.25rem);
    --panel-pad: clamp(4rem, 10vh, 8rem);
}

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

html {
    scroll-behavior: smooth;
    /* clip (not hidden): hidden boxes are still programmatically scrollable
       on Android — Samsung pans them sideways. clip forbids it outright. */
    overflow-x: hidden;
    overflow-x: clip;
    max-width: 100%;
}

body {
    font-family: var(--font-body);
    color: var(--mist);
    background: var(--deep);
    overflow-x: hidden;
    overflow-x: clip;
    max-width: 100%;
    min-height: 100vh;
    position: relative;
}

::selection { background: rgba(212, 165, 90, 0.35); color: var(--off-white); }

:focus-visible {
    outline: 2px solid var(--ochre-light);
    outline-offset: 3px;
}
:focus:not(:focus-visible) { outline: none; }

/* ---------- sky + grain ---------- */

.sky {
    position: fixed;
    inset: 0;
    z-index: -3;
    transition: background 3s ease;
    background: linear-gradient(180deg, #131f2b 0%, #23313a 42%, #4a4438 58%, #0d1a12 100%);
}
body[data-light="dawn"]  .sky,
body[data-light="dawn"]  { background: linear-gradient(180deg, #16222e 0%, #33414a 40%, #b0764a 58%, #0d1a12 100%); }
body[data-light="day"]   .sky { background: linear-gradient(180deg, #22333c 0%, #3d5c52 45%, #8fa5a0 60%, #0d1a12 100%); }
body[data-light="dusk"]  .sky { background: linear-gradient(180deg, #131f2b 0%, #2d3339 40%, #a06a3d 58%, #0d1a12 100%); }
body[data-light="night"] .sky { background: linear-gradient(180deg, #05090c 0%, #0b141a 45%, #1c2a26 60%, #060d08 100%); }

/* film grain — static grit only. Animation caused horizontal scroll thrash on Samsung. */
.grain {
    position: fixed;
    inset: 0;
    z-index: 40;
    pointer-events: none;
    opacity: 0.045;
    contain: strict;
    clip-path: inset(0);
    background-image: repeating-conic-gradient(rgba(255,255,255,0.6) 0% 0.00012%, transparent 0.00012% 0.00024%);
    background-size: 120px 120px;
}

/* ---------- HUD ---------- */

.hud { position: fixed; z-index: 50; }

.hud-top {
    top: 0; left: 0; right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: calc(var(--hud-pad) * 0.75) max(var(--hud-pad), env(safe-area-inset-right, 0px)) calc(var(--hud-pad) * 0.75) max(var(--hud-pad), env(safe-area-inset-left, 0px));
    background: linear-gradient(180deg,
        rgba(13, 26, 18, 0.97) 0%,
        rgba(13, 26, 18, 0.9) 70%,
        rgba(13, 26, 18, 0.82) 100%);
    z-index: 70;
    box-sizing: border-box;
    max-width: 100%;
}
.hud-top::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 3.5rem;
    background: linear-gradient(180deg, rgba(13, 26, 18, 0.82) 0%, rgba(13, 26, 18, 0) 100%);
    pointer-events: none;
}

.logo {
    font-family: var(--font-display);
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    line-height: 0.9;
    font-size: clamp(1.4rem, 3vw, 2rem);
    color: transparent;
    -webkit-text-stroke: 1.5px var(--ochre);
    text-shadow: 0 0 30px rgba(212,165,90,0.2), 0 0 60px rgba(212,165,90,0.1);
    animation: logo-glow 5s ease-in-out infinite;
    position: relative;
    z-index: 72;
    flex-shrink: 0;
}
/* Subpages: dark fill so outline never vanishes over photos/sky */
.logo.logo-filled {
    color: rgba(13, 26, 18, 0.6);
}
@keyframes logo-glow {
    0%, 100% { text-shadow: 0 0 30px rgba(212,165,90,0.2), 0 0 60px rgba(212,165,90,0.1); -webkit-text-stroke-color: var(--ochre); }
    50%      { text-shadow: 0 0 50px rgba(212,165,90,0.4), 0 0 100px rgba(212,165,90,0.2); -webkit-text-stroke-color: var(--ochre-light); }
}

.hud-nav {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: clamp(0.65rem, 1.8vw, 1.6rem);
}
.hud-nav a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-decoration: none;
    color: rgba(196, 212, 207, 0.85);
    text-shadow: 0 1px 6px rgba(6, 13, 8, 0.9);
    padding: 0.45rem 0.15rem;
    border-bottom: 1px solid transparent;
    transition: color 0.25s ease, border-color 0.25s ease;
    min-height: 44px;
    white-space: nowrap;
}
.hud-nav a .material-symbols-outlined {
    font-size: 1.35rem;
    color: var(--ochre);
    filter: drop-shadow(0 1px 4px rgba(6, 13, 8, 0.9));
    transition: color 0.25s ease, transform 0.25s ease;
}
.hud-nav a:hover,
.hud-nav a.is-active {
    color: var(--ochre-light);
    border-color: rgba(212,165,90,0.5);
}
.hud-nav a:hover .material-symbols-outlined,
.hud-nav a.is-active .material-symbols-outlined {
    color: var(--ochre-light);
    transform: translateY(-2px);
}

.nav-toggle {
    display: none;
    position: relative;
    z-index: 72;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(212, 165, 90, 0.35);
    background: rgba(13, 26, 18, 0.65);
    color: var(--ochre-light);
    cursor: pointer;
    flex-shrink: 0;
}
.nav-toggle .material-symbols-outlined { font-size: 1.75rem; line-height: 1; }
.nav-toggle .nav-toggle-close { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle-open { display: none; }
.nav-toggle[aria-expanded="true"] .nav-toggle-close { display: block; }
.nav-toggle:hover { border-color: rgba(212, 165, 90, 0.7); background: rgba(13, 26, 18, 0.85); }

.nav-backdrop { display: none; }

/* ---------- type primitives ---------- */

.panel {
    position: relative;
    padding: var(--panel-pad) clamp(1.25rem, 6vw, 5rem);
    max-width: 1200px;
    margin: 0 auto;
}

.kicker {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.3em;
    display: block;
    width: fit-content;
    max-width: 100%;
    margin-inline: auto;
    padding-left: 0.3em;
    text-transform: uppercase;
    color: rgba(212, 165, 90, 0.9);
    text-shadow: 0 1px 6px rgba(6, 13, 8, 0.95), 0 0 18px rgba(6, 13, 8, 0.8);
    margin-bottom: 1rem;
}

.section-head { text-align: center; margin-bottom: clamp(2.5rem, 6vh, 4.5rem); }
.section-head h2 {
    font-family: var(--font-display);
    text-transform: uppercase;
    font-size: clamp(2rem, 6vw, 3.6rem);
    line-height: 1.55;
    letter-spacing: 0.06em;
    word-spacing: 0.45em;
    color: rgba(13, 26, 18, 0.6);
    -webkit-text-stroke: 1.5px var(--ochre);
    text-shadow: 0 0 25px rgba(212,165,90,0.25), 0 4px 30px rgba(6, 13, 8, 0.8);
    display: block;
    width: fit-content;
    max-width: 100%;
    margin-inline: auto;
    padding-left: 0.06em;
    margin-bottom: 1rem;
}
.section-sub {
    max-width: 520px;
    margin: 0 auto;
    color: rgba(196, 212, 207, 0.75);
    font-weight: 300;
    line-height: 1.65;
}

.reveal {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.in-view { opacity: 1; transform: translateY(0); }

/* ---------- buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    text-decoration: none;
    padding: 0.85rem 1.4rem;
    border-radius: 0;
    cursor: pointer;
    transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
    min-height: 44px;
}
.btn-solid {
    background: var(--ochre);
    color: var(--deep);
    border: 1px solid var(--ochre);
}
.btn-solid:hover {
    background: var(--ochre-light);
    border-color: var(--ochre-light);
}
.btn-ghost {
    background: transparent;
    color: var(--mist);
    border: 1px solid rgba(196, 212, 207, 0.35);
}
.btn-ghost:hover { border-color: rgba(196, 212, 207, 0.6); color: var(--off-white); }

/* ---------- footer ---------- */

.site-foot {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 2rem clamp(1.25rem, 6vw, 5rem) 3.5rem;
    border-top: 1px solid rgba(212, 165, 90, 0.2);
    background: rgba(13, 26, 18, 0.7);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    color: rgba(196, 212, 207, 0.55);
    max-width: 100%;
    box-sizing: border-box;
}
.logo-small { font-size: 1rem; -webkit-text-stroke-width: 1px; animation: none; }
.site-foot nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.65rem 1.15rem;
    max-width: 100%;
}
.site-foot a {
    color: rgba(196, 212, 207, 0.6);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.35rem 0.1rem;
    white-space: nowrap;
}
.site-foot a:hover { color: var(--ochre-light); }

/* ---------- subpage content ---------- */

.page-main {
    position: relative;
    z-index: 1;
    padding-top: clamp(6rem, 12vh, 8rem);
    padding-bottom: clamp(3rem, 8vh, 5rem);
}

.page-hero {
    text-align: center;
    margin-bottom: clamp(2.5rem, 6vh, 4rem);
}
.page-hero .lede {
    font-size: clamp(1rem, 2.2vw, 1.15rem);
    font-weight: 300;
    line-height: 1.75;
    color: rgba(196, 212, 207, 0.85);
    max-width: 640px;
    margin: 0 auto;
}

.prose {
    max-width: 680px;
    margin: 0 auto 3rem;
}
.prose p {
    font-size: clamp(1.05rem, 2vw, 1.2rem);
    font-weight: 300;
    line-height: 1.8;
    color: rgba(196, 212, 207, 0.88);
    margin-bottom: 1.35rem;
}
.prose p:last-child { margin-bottom: 0; }

.media-frame {
    max-width: 920px;
    margin: 0 auto 3rem;
    border: 1px solid rgba(212, 165, 90, 0.3);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}
.media-frame img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    aspect-ratio: 16 / 9;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    max-width: 1000px;
    margin: 0 auto 3.5rem;
}
.shell-card {
    background: rgba(13, 26, 18, 0.55);
    border: 1px solid rgba(212, 165, 90, 0.28);
    padding: 1.75rem 1.5rem;
    backdrop-filter: blur(8px);
    transition: border-color 0.25s ease, background 0.25s ease;
}
.shell-card:hover {
    border-color: rgba(212, 165, 90, 0.55);
    background: rgba(13, 26, 18, 0.72);
}
.shell-card h3 {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ochre-light);
    margin-bottom: 0.85rem;
}
.shell-card p {
    font-size: 0.95rem;
    font-weight: 300;
    line-height: 1.65;
    color: rgba(196, 212, 207, 0.8);
}

.platform-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    max-width: 920px;
    margin: 0 auto 3rem;
}
.platform-list a {
    display: block;
    padding: 1rem 1.15rem;
    border: 1px solid rgba(212, 165, 90, 0.25);
    background: rgba(13, 26, 18, 0.5);
    color: var(--mist);
    text-decoration: none;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    transition: border-color 0.25s ease, color 0.25s ease;
}
.platform-list a:hover {
    border-color: rgba(212, 165, 90, 0.6);
    color: var(--ochre-light);
}

.cta-band {
    text-align: center;
    max-width: 720px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
    border: 1px solid rgba(212, 165, 90, 0.3);
    background: rgba(13, 26, 18, 0.55);
}
.cta-band p {
    font-weight: 300;
    line-height: 1.7;
    color: rgba(196, 212, 207, 0.85);
    margin-bottom: 1.5rem;
}
.cta-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.85rem;
    justify-content: center;
}

.legal-body {
    max-width: 720px;
    margin: 0 auto;
}
.legal-body h3 {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--ochre);
    margin: 2rem 0 0.75rem;
}
.legal-body p, .legal-body li {
    font-size: 0.95rem;
    font-weight: 300;
    line-height: 1.7;
    color: rgba(196, 212, 207, 0.8);
    margin-bottom: 0.85rem;
}
.legal-body ul { padding-left: 1.25rem; margin-bottom: 1rem; }

.error-panel {
    min-height: 70vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--panel-pad) 1.25rem;
}
.error-code {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.35em;
    padding-left: 0.35em;
    color: var(--ochre);
    margin-bottom: 1rem;
}

@media (max-width: 960px) {
    .logo { font-size: 1.2rem; -webkit-text-stroke-width: 1px; }

    .nav-toggle { display: inline-flex; }

    .nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 68;
        background: rgba(6, 13, 8, 0.62);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.28s ease;
        border: 0;
        padding: 0;
        margin: 0;
        cursor: pointer;
    }
    .nav-backdrop.is-open {
        opacity: 1;
        pointer-events: auto;
    }

    .hud-nav {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(19.5rem, 86vw);
        height: 100dvh;
        z-index: 69;
        flex-direction: column;
        flex-wrap: nowrap;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0;
        padding: 5.25rem 1.35rem 2rem;
        background: rgba(13, 26, 18, 0.98);
        border-left: 1px solid rgba(212, 165, 90, 0.28);
        box-shadow: -18px 0 48px rgba(0, 0, 0, 0.45);
        transform: translateX(0);
        transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    /* Closed: collapse to zero box. Off-canvas translate expands scrollport on Samsung. */
    .hud-nav:not(.is-open) {
        width: 0;
        min-width: 0;
        padding: 0;
        border: 0;
        box-shadow: none;
        overflow: clip;
        /* size+paint containment: collapsed drawer contents can never
           influence the viewport or be scroll-revealed */
        contain: strict;
        visibility: hidden;
        pointer-events: none;
        transform: none;
    }
    .hud-nav.is-open {
        transform: translateX(0);
        visibility: visible;
        pointer-events: auto;
    }

    .hud-nav a {
        font-size: 0.92rem;
        letter-spacing: 0.14em;
        gap: 0.85rem;
        padding: 1rem 0.65rem;
        min-height: 52px;
        border-bottom: 1px solid rgba(196, 212, 207, 0.12);
    }
    .hud-nav a .material-symbols-outlined {
        font-size: 1.55rem;
        width: 1.75rem;
        text-align: center;
    }
    .hud-nav a:hover,
    .hud-nav a.is-active {
        background: rgba(212, 165, 90, 0.08);
        border-bottom-color: rgba(212, 165, 90, 0.35);
    }

    body.nav-open {
        overflow: hidden;
        touch-action: none;
    }
    body.nav-open .hud-top::after { opacity: 0; }
}

@media (max-width: 900px) {
    .card-grid { grid-template-columns: 1fr; }
    .site-foot {
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        gap: 1.1rem;
        padding: 2rem 1rem 3.5rem;
    }
    .site-foot nav {
        width: 100%;
        max-width: 22rem;
        justify-content: center;
        gap: 0.55rem 0.95rem;
    }
    .site-foot a { letter-spacing: 0.08em; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .logo { animation: none !important; }
    .reveal { opacity: 1; transform: none; transition: none; }
    .hud-nav, .nav-backdrop { transition: none !important; }
}
