/* 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: #718e60;
    --secondary-color-rgb: 113, 142, 96; /* 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 */

    /* 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-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-textbox-expanded: 160; /* expanded text-box modal (below mobile nav) */
     --z-scroll-progress: 150;  /* thin progress bar */
     --z-scroll-hint: 140;      /* “scroll to learn more” hint */
     --z-logo: 50;              /* hero logo */
    --z-sidebar: 205;          /* left sidebar (text-box-nav) - above header to overlap seamlessly */
    --z-site-credit: 30;       /* desktop credit */
}

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

/* 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);
    scrollbar-gutter: stable both-edges;
}
/* 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); 
}

body {
    font-family: 'Red Hat Display', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-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: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: var(--z-loading);
    /* Remove fade-out to hide instantly on load */
    transition: none;
}

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

.loader {
    width: 60px;
    height: 60px;
    border: 3px solid var(--accent-color);
    border-top: 3px solid var(--secondary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 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: var(--secondary-color);
    opacity: 1;
}

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

/* Smooth label fade for Regions link */
#regionsLink .label {
    display: inline-block;
    transition: opacity 180ms ease, transform 180ms ease;
}

#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;
}

.text-nav-link:hover,
.text-nav-link.active {
    background: var(--secondary-color);
    color: white;
    transform: translateY(-2px);
    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; }

@media (min-width: 769px) {
    .secondary-header {
        display: none !important;
        visibility: hidden;
    }
}

/* 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;
}
.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: translate(-50%, -50%);
    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;
}
.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: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--secondary-color);
    color: white;
    padding: 6px 12px;
    border-radius: 0.6vw;
    font-size: 12px;
    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: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px 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;
}

.text-box.expanded {
    /* remove !important on final values to avoid jump */
    width: min(1000px, 90vw);
    height: min(600px, 80vh);
    /* 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;
}

/* 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: 50px 40px;
    width: 100%;
    height: 100%;
}

.text-box.expanded .text-box-description {
    display: block;
    font-size: 1.3vw;
    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;
    overflow: auto;
    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;
    /* 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;
}

.close-button {
    position: absolute;
    top: 25px;
    right: 25px;
    background: var(--bg-color);
    border: 1px solid var(--accent-color);
    color: var(--primary-color);
    font-size: 24px;
    cursor: pointer;
    display: none;
    width: 45px;
    height: 45px;
    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: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.close-button:hover {
    background: var(--accent-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: 10vh;
    right: 1vw;
    color: var(--primary-color);
    font-size: 2.5vh;
    letter-spacing: 1px;
    font-weight: 700;
    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: -60px;
    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;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(127, 174, 110, 0.4);
}

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

@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;
}

.logo-container.clickable:hover {
    transform: translate(-50%, -50%) scale(1.05);
}

.logo-container.clickable:hover .logo {
    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%);
    }
}