/* Local Font Definitions */
@font-face {
    font-family: 'Red Hat Display';
    src: url('fonts/RedHatDisplay-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Red Hat Display';
    src: url('fonts/RedHatDisplay-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Red Hat Display';
    src: url('fonts/RedHatDisplay-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Red Hat Display';
    src: url('fonts/RedHatDisplay-SemiBold.ttf') format('truetype');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Red Hat Display';
    src: url('fonts/RedHatDisplay-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Red Hat Display';
    src: url('fonts/RedHatDisplay-ExtraBold.ttf') format('truetype');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Red Hat Display';
    src: url('fonts/RedHatDisplay-Black.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Red Hat Display';
    src: url('fonts/RedHatDisplay-LightItalic.ttf') format('truetype');
    font-weight: 300;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Red Hat Display';
    src: url('fonts/RedHatDisplay-Italic.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Red Hat Display';
    src: url('fonts/RedHatDisplay-MediumItalic.ttf') format('truetype');
    font-weight: 500;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Red Hat Display';
    src: url('fonts/RedHatDisplay-SemiBoldItalic.ttf') format('truetype');
    font-weight: 600;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Red Hat Display';
    src: url('fonts/RedHatDisplay-BoldItalic.ttf') format('truetype');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Red Hat Display';
    src: url('fonts/RedHatDisplay-ExtraBoldItalic.ttf') format('truetype');
    font-weight: 800;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'Red Hat Display';
    src: url('fonts/RedHatDisplay-BlackItalic.ttf') format('truetype');
    font-weight: 900;
    font-style: italic;
    font-display: swap;
}

/* Index Page Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #7B2429;
    --secondary-color: #718b5e !important;
    --secondary-color-rgb: 113, 139, 94; /* RGB values for rgba() usage */;
    --accent-color: #A1BBAC;
    --bg-color: #DDE5DB;
    --surface-color: #7B24291a;
    --border-color: #7B242933;
    --text-color: #7B2429;
    --hero-x-offset: 0px; /* keep hero elements centered by default */
    --green-text-color-rgb: 114, 140, 97;

    /* Normalized z-index scale (higher = closer to user) */
     /* z-index stacking (maximize headroom so runtime inline z-index for boxes doesn't break ordering)
        Priority: higher value = closer to user (on top) */
     --z-loading: 220;          /* top-most overlay */
     --z-cookie: 210;           /* cookie banner above header */
     --z-sidebar: 207;          /* left sidebar (text-box-nav) - above expanded modal for clickability */
     --z-textbox-expanded: 206; /* expanded text-box modal */
     --z-header: 200;           /* main app header (keep highest app-level header) */
     --z-mobile-nav: 180;       /* mobile nav panel sits under header but above interactive boxes */
     --z-secondary-header: 175; /* mobile-only secondary header (below mobile nav, above progress) */
     --z-scroll-progress: 150;  /* thin progress bar */
     --z-scroll-hint: 140;      /* "scroll to learn more" hint */
     --z-logo: 50;              /* hero logo */
    --z-site-credit: 30;       /* desktop credit */
}

/* Allow native scrolling for scroll-driven animation */
html, body {
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
}

/* Mobile devices: lock body and use scroll container to prevent address bar toggle */
html.is-mobile {
    height: 100%;
    overflow: hidden;
}
html.is-mobile body {
    height: 100%;
    overflow: hidden;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
}
html.is-mobile .scroll-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
}

/* Non-mobile: scroll wrapper is transparent */
html:not(.is-mobile) .scroll-wrapper {
    display: contents;
}

/* Index-only scrollbar (thicker) */
/* Firefox */
html { 
    scrollbar-width: auto; /* wider than thin */
    scrollbar-color: rgba(0, 0, 0, 0.35) rgba(0, 0, 0, 0.05);
}
/* WebKit */
html::-webkit-scrollbar { 
    width: 14px; 
    height: 14px; 
}
html::-webkit-scrollbar-track { 
    background: rgba(0, 0, 0, 0.05); 
    border-radius: 50%; 
}
html::-webkit-scrollbar-thumb { 
    background: rgba(0, 0, 0, 0.35); 
    border-radius: 50%; 
    min-height: 120px;
}
html::-webkit-scrollbar-thumb:hover { 
    background: rgba(0, 0, 0, 0.5); 
}

/* Safari: hide scrollbars entirely (triggered by .is-safari class added via JS) */
html.is-safari, html.is-safari body, html.is-safari * { scrollbar-width: none !important; }
html.is-safari::-webkit-scrollbar,
html.is-safari body::-webkit-scrollbar,
html.is-safari *::-webkit-scrollbar { width: 0 !important; height: 0 !important; display: none !important; background: transparent !important; }
html.is-safari::-webkit-scrollbar-track,
html.is-safari body::-webkit-scrollbar-track,
html.is-safari *::-webkit-scrollbar-track { background: transparent !important; }
html.is-safari::-webkit-scrollbar-thumb,
html.is-safari body::-webkit-scrollbar-thumb,
html.is-safari *::-webkit-scrollbar-thumb { background: transparent !important; border-radius: 0 !important; min-height: 0 !important; }

html {
    background-color: var(--bg-color);
}

body {
    font-family: 'Red Hat Display', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
}
/* Make most links use the secondary brand color; exclude nav, mobile nav, and button-style anchors */
a:where(:not(.nav-link):not(.nav-dropdown-link):not(.mobile-nav-link):not(.app-header-button):not(.button):not(.btn):not(.cta-button):not(.text-nav-link):not(.text-box-cta):not(.text-box-dropdown-item)),
a:where(:not(.nav-link):not(.nav-dropdown-link):not(.mobile-nav-link):not(.app-header-button):not(.button):not(.btn):not(.cta-button):not(.text-nav-link):not(.text-box-cta):not(.text-box-dropdown-item)):visited {
    color: var(--secondary-color);
}

a:where(:not(.nav-link):not(.nav-dropdown-link):not(.mobile-nav-link):not(.app-header-button):not(.button):not(.btn):not(.cta-button):not(.text-nav-link):not(.text-box-cta):not(.text-box-dropdown-item)):hover,
a:where(:not(.nav-link):not(.nav-dropdown-link):not(.mobile-nav-link):not(.app-header-button):not(.button):not(.btn):not(.cta-button):not(.text-nav-link):not(.text-box-cta):not(.text-box-dropdown-item)):focus {
    color: var(--primary-color);
}

/* Keep text-box links and CTA buttons consistent even when visited.
   The global a:visited rule is more specific than some component rules. */
.text-box-cta:visited {
    color: var(--primary-color);
}

.text-box-dropdown-item:visited {
    color: var(--primary-color);
}

.text-box-description a,
.text-box-description a:visited {
    color: var(--primary-color);
}

.text-box-description a:hover,
.text-box-description a:focus {
    color: var(--primary-color);
}
/* Disable page scroll when overlays are open */
body.menu-open,
body.modal-open { overflow: hidden; }

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999; /* Ensure it's above everything including header */
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Fixed glass sidebar (text-box-nav) */
.text-box-nav {
    position: fixed;
    width: 17vw;
    top: 9.3vh;
    margin-left: 1.4vh;  /* consistent horizontal inset */
    z-index: var(--z-sidebar);  /* above header to overlap seamlessly */
    border-radius: 0 0 0.6vw 0.6vw; /* only bottom corners rounded - top overlaps header */
    box-shadow: none; /* no shadow to blend seamlessly with header */
    overflow: hidden; /* glass layers clipped */
    height: 88vh;
}

/* Inner flex container for nav links inside glass sidebar */
.text-box-nav-inner {
    position: relative;
    z-index: 5;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* allow custom ordering + spacers to control layout */
    align-items: stretch;
    gap: 2vh;
    width: 100%;
    height: 100%;
    padding: 1.7vh 0;
}

/* Sidebar layout: pin app-header buttons to top, keep other items centered */
.text-box-nav-inner > * { order: 3; }
.text-box-nav-inner::before,
.text-box-nav-inner::after {
    content: '';
    display: block;
    flex: 1 1 0;
}
.text-box-nav-inner::before { order: 2; }
.text-box-nav-inner::after { order: 4; }

/* Highlight state for Regions link when journey finished */
#regionsLink.highlight {
    color: rgb(var(--green-text-color-rgb));
    opacity: 1;
}

#regionsLink.highlight::after {
    width: 100%;
}

/* Keep underline hidden while the label is fading out */
#regionsLink.fading-out::after {
    width: 0 !important;
}

/* Smooth label fade for Regions link */
#regionsLink .label {
    display: inline-block;
    transition: opacity 260ms cubic-bezier(0.4, 0, 0.2, 1), transform 260ms cubic-bezier(0.4, 0, 0.2, 1);
    white-space: normal;
    text-align: center;
    line-height: 1.1;
    max-width: 14ch; /* constrain width so long label wraps nicely */
}

#regionsLink.fading-out .label {
    opacity: 0;
    transform: translateY(4px);
}

#regionsLink.fading-in .label {
    opacity: 1;
    transform: translateY(0);
}

.text-nav-link {
    position: relative;
    display: block;
    background: rgba(var(--secondary-color-rgb), 0.15);
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 0.6vw;
    text-align: center;
    font-family: 'Red Hat Display', sans-serif;
    font-weight: 500;
    font-size: 1.4vw;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    width: 100%;
    line-height: 1.4;
    padding: 0.5vw;
}

/* Sidebar link variant: same sizing as nav links, but CTA styling like the text-box dropdown trigger (no arrow). */
.text-nav-link.text-nav-link-cta {
    background: rgba(var(--secondary-color-rgb), 0.2);
    border: 2px solid rgba(var(--secondary-color-rgb), 0.35);
    font-weight: 700;
}

.text-nav-link.text-nav-link-cta:hover,
.text-nav-link.text-nav-link-cta:focus {
    background: rgba(var(--secondary-color-rgb), 0.3);
    color: var(--primary-color);
    box-shadow: none;
}

.text-nav-link:hover,
.text-nav-link.active {
    background: var(--secondary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(145, 174, 126, 0.3);
}

/* Secondary CTA header hidden by default (desktop). Mobile overrides in mobile.css */
.secondary-header { 
    display: none !important;
    visibility: hidden !important;
}

@media (max-width: 768px) {
    .secondary-header {
        display: flex !important;
        visibility: visible !important;
    }
}

/* Hero Section */
.hero-section {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.logo-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: var(--z-logo);
    transition: all 0.3s ease;
    height: 70vh;
    aspect-ratio: 1;
}
.logo-container.is-back { z-index: 1; }

.logo {
    width: 100%;
    height: 100%;
    background-color: #fff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 50px rgba(107, 59, 41, 0.2);
    overflow: hidden;
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

/* Text Boxes */
.text-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}
.text-container.is-front { z-index: 89; }
/* When a modal is open, ensure its stacking context sits above the scroll hint */
.text-container.modal-layer { z-index: var(--z-textbox-expanded); pointer-events: auto; }

.text-box {
    position: fixed;
    background: rgba(255, 255, 255);
    border: 2px solid var(--border-color);
    border-radius: 0.6vw;
    padding: 3vh;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    opacity: 0;
    transform-origin: center;
    transition: none;
    pointer-events: none;
    left: 50%;
    top: 50%;
    transform: translate3d(-50%, -50%, 0);
    cursor: pointer;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-shadow: 0 4px 20px rgba(107, 59, 41, 0.1);
    will-change: transform, opacity;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}
/* Safari/iOS: disable backdrop-filter and will-change to reduce scroll jitter */
html.is-safari .text-box {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    will-change: auto;
    -webkit-transform: translate3d(-50%, -50%, 0);
    transform: translate3d(-50%, -50%, 0);
}
/* Safari/iOS: stabilize text container layer */
html.is-safari .text-container {
    -webkit-perspective: 1000px;
    perspective: 1000px;
}
.text-box.interactable { pointer-events: auto; }
.text-box.is-front { z-index: var(--z-textbox-expanded); }
.text-box.is-glow { box-shadow: 0 0 40px rgba(255,255,255,0.3); background-color: rgba(255,255,255,0.15); }

/* Click indicator popup */
.click-indicator {
    position: absolute;
    top: -4.5vh;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--secondary-color) !important;
    color: white;
    padding: 1vh;
    border-radius: 0.6vw;
    font-size: 1.5vh;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(145, 174, 126, 0.3);
}

.click-indicator::after {
    content: '';
    position: absolute;
    bottom: -0.4vh;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 0.6vh solid transparent;
    border-right: 0.6vh solid transparent;
    border-top: 0.6vh solid var(--secondary-color);
}

.text-box.clickable .click-indicator {
    opacity: 1;
    animation: floatIndicator 2s ease-in-out infinite;
}

@keyframes floatIndicator {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-5px); }
}

/* Keep hover subtle to not fight during scripted transforms */
.text-box:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 8px 30px rgba(107, 59, 41, 0.2);
}

.text-box-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1000;
}

/* Fade the entire modal content right before it collapses back to the small text box */
.text-box.closing.content-fade-out .text-box-content {
    opacity: 0;
    transition: opacity 160ms ease;
}

.text-box.expanded {
    /* Fully opaque background to prevent underlying content (logo) from showing through */
    background: rgba(255, 255, 255, 1);
    opacity: 1;
    border: 2px solid var(--primary-color);
    /* keep z-index via variable (no need for !important) */
    z-index: var(--z-textbox-expanded);
    pointer-events: auto;
    /* ensure transform/size animate smoothly */
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                background-color 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                border-color 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    /* disable backdrop blur on expanded modal to ensure full opacity */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: 0 25px 100px rgba(107, 59, 41, 0.3);
    transform: translate(-50%, -50%) scale(1);
    padding: 0;
    border-radius: 0.6vw;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: hidden;
    transform-origin: center;
    cursor: default;
}

/* Smooth collapse (applied briefly after removing .expanded) */
.text-box.closing {
    /* Animate size/visual appearance AND transform back to orbital state */
    transition: width 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                height 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                padding 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                border-radius 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                background-color 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.text-box.closing .text-box-description {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.text-box.closing .close-button {
    opacity: 0;
    transition: opacity 0.25s ease;
    /* Lock colors during close to avoid hover-driven flashes */
    background: var(--bg-color);
    color: var(--primary-color);
    pointer-events: none; /* disable hover/click while closing */
}

.text-box.expanded .click-indicator {
    display: none;
}

/* Also hide hint while closing and right after to avoid flicker */
.text-box.closing .click-indicator,
.text-box.recently-closed .click-indicator { display: none !important; }

.text-box.expanded .text-box-content {
    justify-content: flex-start;
    align-items: flex-start;
    padding: 5vh;
    width: 100%;
    height: 100%;
}

.text-box.expanded .text-box-description {
    display: block;
    font-size: 2.1vh;
    line-height: 1.7;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s;
    flex: 1;
    width: 100%;
    align-self: stretch;
    overflow: auto;
    padding-right: 2.5vh;
    scrollbar-gutter: stable;
    overscroll-behavior: contain; /* prevent scroll chaining to page */
    touch-action: pan-y; /* allow vertical touch scrolling inside modal */
    text-align: left;
    font-weight: 400;
    color: var(--text-color);
}

.text-box.expanded .text-box-title {
    font-size: 2.5vw;
    margin-bottom: 4vh;
    font-weight: 800;
    text-align: left;
    color: var(--primary-color);
    letter-spacing: -1px;
    line-height: 1.1;
    width: 100%;
    align-self: stretch;
    /* avoid title size transitions causing reflow flicker */
    transition: color 0.3s ease, letter-spacing 0.3s ease;
}

.text-box-title {
    font-size: 3vh;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--primary-color);
    text-align: center;
    transition: color 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
}

.text-box-description {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-color);
    display: none;
    text-align: center;
    max-width: 100%;
    flex: 1;
    overflow-y: auto;
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 0;
    transform: translateY(20px);
    font-weight: 400;
}

.text-box-description p {
    font-size: 2.5vh;
    font-weight: 700;
}

.text-box-description h2 {
    font-size: max(23px, 3vh);
    font-weight: 700;
    margin: 2vh 0 1vh 0;
    color: var(--primary-color);
}

.text-box-description b {
    font-weight: 700;
}

/* Section divider inside the expanded text-box modal */
.text-box-divider {
    display: flex;
    align-items: center;
    gap: 1.4vh;
    margin: 2.2vh 0;
    width: 100%;
    user-select: none;
    -webkit-user-select: none;
}

.text-box-divider::before,
.text-box-divider::after {
    content: '';
    flex: 1 1 auto;
    height: 2px;
    background: var(--border-color);
    border-radius: 999px;
}

.text-box-divider-leaf {
    width: 4.4vh;
    height: 4.4vh;
    background: #d0dbcc;
    border: 1px solid var(--accent-color);
    border-top-left-radius: 100%;
    border-bottom-right-radius: 100%;
    position: relative;
    overflow: hidden;
    display: inline-block;
    flex: 0 0 auto;
}

.text-box-divider-leaf::after {
    content: '';
    position: absolute;
    left: 5%;
    top: 50%;
    width: 90%;
    height: 1px;
    background: var(--accent-color);
    transform: translateY(-50%) rotate(-45deg);
    opacity: 0.85;
}

.text-box-cta-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1vh;
    margin: 2vh 0;
}

.text-box-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-weight: 700;
    padding: 1.2vh 1.8vh;
    border-radius: 0.6vw;
    background: rgba(var(--secondary-color-rgb), 0.2);
    border: 2px solid rgba(var(--secondary-color-rgb), 0.35);
    color: var(--primary-color);
    transition: transform 0.15s ease, background 0.15s ease;
    width: 100%;
}

.text-box-cta:hover,
.text-box-cta:focus {
    background: rgba(var(--secondary-color-rgb), 0.3);
    transform: translateY(-1px);
}

.text-box-dropdown {
    position: relative;
    display: inline-block;
}

/* In the scrollable modal content, keep the dropdown menu in-flow so it pushes content down */
.text-box-description .text-box-dropdown {
    display: block;
    width: 100%;
}

/* Allow the dropdown trigger to look/behave like a real button */
.text-box-dropdown > summary.text-box-cta {
    position: relative;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    padding-right: 4.2vh; /* room for arrow */
    appearance: none;
    -webkit-appearance: none;
    /* Ensure summary matches anchor button styling exactly */
    background: rgba(var(--secondary-color-rgb), 0.2);
    border: 2px solid rgba(var(--secondary-color-rgb), 0.35);
    color: var(--primary-color);
}

/* Arrow indicator on the dropdown trigger */
.text-box-dropdown > summary.text-box-cta::after {
    content: '▸';
    position: absolute;
    right: 1.4vh;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
    transition: transform 0.15s ease;
    font-weight: 800;
    line-height: 1;
}

.text-box-dropdown[open] > summary.text-box-cta::after {
    transform: translateY(-50%) rotate(90deg);
}

.text-box-dropdown > summary {
    list-style: none;
}
.text-box-dropdown > summary::-webkit-details-marker {
    display: none;
}

.text-box-dropdown-menu {
    display: none;
    position: absolute;
    min-width: 0;
    width: 100%;
    background: rgba(var(--secondary-color-rgb), 0.08);
    border: 2px solid rgba(var(--secondary-color-rgb), 0.35);
    border-top: 0;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 16px 44px rgba(107, 59, 41, 0.16);
    padding: 0;
    overflow: hidden;
    z-index: 5;
}

.text-box-description .text-box-dropdown-menu {
    position: static;
    margin-top: 0;
    box-shadow: none;
    z-index: auto;
}

/* Open only when toggled via <details> */
.text-box-dropdown[open] .text-box-dropdown-menu {
    display: block;
}

/* Visually connect menu to the trigger */
.text-box-dropdown[open] > summary.text-box-cta {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-width: 0;
}

/* Nudge menu up slightly to avoid any hairline gap */
.text-box-dropdown[open] .text-box-dropdown-menu {
    margin-top: -1px;
}

.text-box-dropdown-item {
    display: block;
    text-decoration: none;
    font-weight: 700;
    padding: 1.1vh 1.4vh;
    border-radius: 0;
    color: var(--primary-color);
    margin: 0 !important;
    border-radius: 0 !important;
}

.text-box-dropdown-item + .text-box-dropdown-item {
    border-top: 1px solid rgba(var(--secondary-color-rgb), 0.22);
}

.text-box-dropdown-item:hover,
.text-box-dropdown-item:focus {
    background: rgba(var(--secondary-color-rgb), 0.18);
}

.text-box-description .content-list {
    list-style: none;
    padding: 0;
    margin: 1vh 0;
    text-align: left;
}

.text-box-description .content-list li {
    padding-bottom: 1vh;
    padding-left: 2.8vh;
    position: relative;
    margin-bottom: 1vh;
}

.text-box-description .content-list .sub-list {
    list-style: circle;
    margin-top: 0.8vh;
    padding-left: 2.8vh;
}

.text-box-description .content-list .sub-list li {
    padding: 0.6vh 0;
    margin: 0.6vh 0;
    padding-left: 0;
}

.text-box-description .content-list .sub-list li::before {
    content: none;
}

.text-box-description .content-list li::before {
    content: '•';
    color: var(--primary-color);
    font-weight: 600;
    font-size: 3.2vh;
    position: absolute;
    left: 0;
    top: 0.55em;
    line-height: 0;
    margin-right: 0.5vh;
}

/* Nested lists inside the modal: render as indented subpoints */
.text-box-description .content-list .content-list {
    margin-top: 1vh;
    margin-left: 1.8em;
}

.text-box-description .content-list .content-list li::before {
    content: '◦';
    font-size: 2.2vh;
    top: 0.7em;
}

.text-box-description .content-list .sub-list :last-child {
    padding-bottom: 0;
    margin-bottom: 0;
}

.close-button {
    position: absolute;
    top: 3vh;
    right: 3vh;
    background: #d0dbcc;
    border: 1px solid var(--accent-color);
    color: var(--primary-color);
    font-size: 4vh;
    cursor: pointer;
    display: none;
    width: 7vh;
    height: 7vh;
    border-top-left-radius: 100%;
    border-bottom-right-radius: 100%;
    transition: all 0.3s ease;
    opacity: 0;
    transform: scale(0.8);
    z-index: 10;
    font-family: 'Red Hat Display', sans-serif;
    font-weight: 300;
    justify-content: center;
    align-items: center;
}

.text-box.expanded .close-button {
    display: flex;
    opacity: 1;
    transform: scale(1);
    /* Keep show-in delay for opacity/transform, but make hover colors respond immediately */
    transition:
        opacity 0.3s ease 0.4s,
        transform 0.3s ease 0.4s,
        background 0.15s ease 0s,
        color 0.15s ease 0s;
}

/* Reduce blue tap/click flash and unwanted selection on the modal container */
.text-box, .text-box * { -webkit-tap-highlight-color: transparent; }
.text-box, .text-box-title, .close-button { user-select: none; -webkit-user-select: none; }
.text-box.expanded .text-box-description { user-select: text; -webkit-user-select: text; }

/* Keep accessible focus rings for keyboard navigation only */
.text-box:focus { outline: none; }
.close-button:focus { outline: none; }
.close-button:focus-visible { outline: none; }

.close-button:hover {
    background: var(--secondary-color);
    color: white;
    transform: scale(1.1);
}

@media (min-width: 769px) {
/* Scroll Hint */
.scroll-hint {
    display: none;
}
}

.scroll-hint.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
}

/* Top right scroll hint */
.top-scroll-hint {
    position: fixed;
    top: 9.5vh;
    right: 1vw;
    color: var(--primary-color);
    font-size: 2.5vh;
    letter-spacing: 1px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 1.5vh;
    opacity: 1;
    transition: all 0.5s ease;
    z-index: var(--z-scroll-hint);
}

.top-scroll-hint.hidden {
    opacity: 0;
    transform: translateX(20px);
}

.scroll-arrow {
    font-size: 2.5vh;
    color: var(--primary-color);
    animation: arrowFloat 2s ease-in-out infinite;
}

@keyframes arrowFloat {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(8px); }
}

/* Logo click indicator */
.logo-click-indicator {
    position: absolute;
    bottom: -8vh;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: all 0.5s ease;
    pointer-events: none;
    z-index: 15;
}

.click-text {
    background: var(--secondary-color);
    color: white;
    padding: 1vh;
    border-radius: 0.6vw;
    font-size: 1.4vw;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(127, 174, 110, 0.4);
    /* Keep the indicator from changing cursor/hit-testing while hidden. */
    pointer-events: none;
    cursor: default;
}

.logo-click-indicator.show {
    opacity: 1;
    animation: logoIndicatorFloat 2s ease-in-out infinite;
    pointer-events: auto;
}

.logo-click-indicator.show .click-text {
    pointer-events: auto;
    cursor: pointer;
}

@keyframes logoIndicatorFloat {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-8px); }
}

.logo-container.clickable {
    cursor: pointer;
    transition: all 0.3s ease;
    /* Prevent the square container box from being the hover/click target.
       Only the circular logo (and indicator text) should be interactive. */
    pointer-events: none;
}

.logo-container.clickable .logo {
    pointer-events: auto;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    /* Clip hit-testing to a circle (prevents hover in transparent corners). */
    -webkit-clip-path: circle(50% at 50% 50%);
    clip-path: circle(50% at 50% 50%);
}

.logo-container.clickable .logo:hover {
    transform: scale(1.05);
    box-shadow: 0 0 60px rgba(127, 174, 110, 0.4);
}

.text-box {
    width: 35vh;
    aspect-ratio: 1.8;
}



@media (min-height: 821px) and (max-height: 900px) {
  :root { --text-box-max-travel: 360rem; }
}

@media (min-height: 701px) and (max-height: 820px) {
  :root { --text-box-max-travel: 360rem; }
}

@media (min-height: 641px) and (max-height: 700px) {
  :root { --text-box-max-travel: 340rem; }
}

@media (min-height: 581px) and (max-height: 640px) {
  :root { --text-box-max-travel: 310rem; }
}

@media (max-height: 580px) {
  :root { --text-box-max-travel: 300rem; }
}

:root { --text-box-max-travel: 400vh; }

/* Cookie popup */
.cookie-popup {
    position: fixed;
    right: 0.5vw;
    bottom: 0.5vw;
    display: flex;
    align-items: center;
    gap: 0.3vw;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid var(--border-color);
    border-radius: 0.6vw;
    padding: 0.3vw;
    box-shadow: 0 8px 32px rgba(107, 59, 41, 0.15);
    z-index: var(--z-cookie);
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.cookie-popup.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.cookie-text {
    font-size: 0.8vw;
    color: var(--text-color);
}
.cookie-link {
    color: var(--secondary-color);
    text-decoration: underline;
    font-weight: 600;
}
.cookie-link:hover { color: var(--primary-color); }
.cookie-accept {
    background: var(--secondary-color);
    color: #fff;
    border: none;
    border-radius: 0.6vw;
    padding: 0.3vw;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(127, 174, 110, 0.35);
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    font-family: 'Red Hat Display', sans-serif;
    font-size: 0.8vw;
    outline: none;
}

.cookie-accept:focus {
    background: var(--primary-color);
    box-shadow: 0 4px 16px rgba(127, 174, 110, 0.35), 0 0 0 2px rgba(255, 255, 255, 0.8), 0 0 0 4px rgba(127, 174, 110, 0.4);
}

.cookie-accept:hover {
    background: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(107, 59, 41, 0.25);
}

.cookie-accept:active { transform: translateY(0); }

/* Site trademark credit lives inside side menu on index */
.site-credit {
    /* Hide any standalone credit on index main screen */
    display: none;
}

/* Desktop site credit (visible on desktop, hidden on small screens) */
.site-credit-desktop {
    display: block; /* override base hidden state */
    position: fixed;
    left: 17px;
    bottom: 1px;
    font-size: 1.7vh;
    color: rgba(0, 0, 0, 0.55);
    background: transparent;
    border: none;
    z-index: var(--z-site-credit);
    pointer-events: none;
}

@media (min-width: 769px) {
  .text-box-nav {
    position: fixed !important;
    z-index: var(--z-sidebar);
    display: block !important;
  }
}

/* Desktop adjustments keep hero elements centered while sidebar remains fixed */
@media (min-width: 769px) {
    .logo-container { left: 50%; }
    .scroll-hint { left: calc(50% + var(--hero-x-offset)); }
    /* Adjust text boxes base centering via transform override */
    .text-box:not(.expanded) {
            /* Initial paint horizontal shift; JS will overwrite with precise animation */
            transform: translate(calc(-50% + var(--hero-x-offset)), -50%);
    }
}
