/* Extraordinary — Interactive Presentation
   Palette and type drawn from the Extraordinary / Mabula / Hamiltons brand guide. */

@font-face {
    font-family: 'Playfair Display';
    src: url('../fonts/PlayfairDisplay.woff2') format('woff2');
    font-weight: 400 900; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Playfair Display';
    src: url('../fonts/PlayfairDisplay-Italic.woff2') format('woff2');
    font-weight: 400 900; font-style: italic; font-display: swap;
}
@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/Montserrat.woff2') format('woff2');
    font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/Montserrat-Italic.woff2') format('woff2');
    font-weight: 100 900; font-style: italic; font-display: swap;
}

:root {
    --ivory: #F3EFE6;
    --paper: #EDE7D8;
    --ink: #2E2A25;
    --night: #17150F;
    --gold: #B98F58;
    --sage: #8B9A83;
    --teal: #00AEA9;
    --accent: var(--gold);
    --serif: 'Playfair Display', Georgia, serif;
    --sans: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
    --ease-out: cubic-bezier(0.19, 1, 0.22, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; }
body {
    background: var(--night);
    color: var(--ivory);
    font-family: var(--sans);
    font-weight: 300;
    -webkit-font-smoothing: antialiased;
    cursor: default;
}
body.hide-cursor, body.hide-cursor * { cursor: none !important; }

/* ---------- Loader ---------- */
#loader {
    position: fixed; inset: 0; z-index: 60;
    background: var(--night);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 34px; transition: opacity 0.9s ease, visibility 0.9s;
}
body:not(.loading) #loader { opacity: 0; visibility: hidden; }
.loader-logo { width: min(320px, 56vw); opacity: 0; animation: loaderIn 1.4s var(--ease-out) 0.15s forwards; }
@keyframes loaderIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.loader-bar { width: 148px; height: 1px; background: rgba(243,239,230,0.18); overflow: hidden; }
.loader-bar span { display: block; height: 100%; width: 0; background: var(--teal); transition: width 0.35s ease; }

/* ---------- Stage & scenes ---------- */
#stage { position: fixed; inset: 0; }

.scene {
    position: absolute; inset: 0;
    opacity: 0; visibility: hidden;
    transition: opacity 1.15s ease, visibility 1.15s;
}
.scene.active { opacity: 1; visibility: visible; z-index: 2; }
.scene.leaving { z-index: 1; }

.scene-bg { position: absolute; inset: 0; overflow: hidden; }
.scene-bg img, .scene-bg video {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; transform: scale(1.02);
}
.scene.active .scene-bg img { animation: kenburns 42s ease-in-out infinite alternate; }
@keyframes kenburns {
    from { transform: scale(1.02) translate(0, 0); }
    to   { transform: scale(1.1) translate(-1.4%, 1%); }
}
.scene-bg::after {
    content: ''; position: absolute; inset: 0;
    background:
        linear-gradient(75deg, rgba(13,12,9,0.82) 0%, rgba(13,12,9,0.5) 42%, rgba(13,12,9,0.12) 75%),
        linear-gradient(to top, rgba(13,12,9,0.75) 0%, rgba(13,12,9,0) 34%);
}

/* Giant drifting watermark — straight from the brand pages */
.watermark {
    position: absolute; left: -1.5vw; bottom: -3.5vw;
    font-family: var(--sans); font-weight: 700;
    font-size: clamp(90px, 15.5vw, 260px);
    letter-spacing: 0.06em; line-height: 0.85;
    color: transparent;
    -webkit-text-stroke: 1px rgba(243,239,230,0.14);
    white-space: nowrap; pointer-events: none;
    opacity: 0; transform: translateX(3vw);
    transition: opacity 2.4s ease 0.3s, transform 2.8s var(--ease-out) 0.3s;
}
.scene.active .watermark { opacity: 1; transform: none; animation: wmDrift 60s linear 3s infinite alternate; }
@keyframes wmDrift { from { transform: translateX(0); } to { transform: translateX(-4vw); } }

/* Lodge logo, top-right of scene */
.scene-logo {
    position: absolute; top: clamp(20px, 4vh, 44px); right: clamp(24px, 4vw, 56px);
    height: clamp(58px, 11vh, 118px); width: auto;
    opacity: 0; transform: translateY(-10px);
    transition: opacity 1.3s ease 0.5s, transform 1.3s var(--ease-out) 0.5s;
    filter: drop-shadow(0 2px 14px rgba(0,0,0,0.35));
}
.scene.active .scene-logo { opacity: 1; transform: none; }

/* ---------- Content block ---------- */
.content {
    position: absolute;
    left: clamp(28px, 6vw, 110px);
    bottom: clamp(96px, 15vh, 160px);
    width: min(680px, 62vw);
    max-height: 74vh;
    display: flex; flex-direction: column; gap: clamp(14px, 2.4vh, 26px);
}

.beat { display: none; }
.beat.shown { display: block; }

/* Eyebrow */
.beat-eyebrow {
    font-size: clamp(10px, 1.15vw, 13px);
    font-weight: 500; text-transform: uppercase;
    letter-spacing: 0.42em; color: var(--accent);
}
.beat-eyebrow .word { display: inline-block; }

/* Headline: per-word masked rise */
.beat-headline {
    font-family: var(--serif); font-weight: 500;
    font-size: clamp(34px, 4.6vw, 66px);
    line-height: 1.08; letter-spacing: 0.005em;
    text-wrap: balance;
}
.mask { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.mask .word { display: inline-block; transform: translateY(112%); }
.beat.shown .mask .word { animation: riseUp 1.1s var(--ease-out) forwards; animation-delay: var(--d, 0s); }
@keyframes riseUp { to { transform: translateY(0); } }

/* Body text: blur-fade rise */
.beat-text {
    font-size: clamp(14.5px, 1.32vw, 17.5px);
    line-height: 1.85; font-weight: 300;
    color: rgba(243,239,230,0.92);
    max-width: 58ch;
    opacity: 0; filter: blur(7px); transform: translateY(22px);
}
.beat.shown.beat-text, .beat.shown .beat-text {
    animation: blurIn 1.25s var(--ease-out) forwards;
}
@keyframes blurIn { to { opacity: 1; filter: blur(0); transform: none; } }

/* Quote */
.beat-quote {
    font-family: var(--serif); font-style: italic; font-weight: 400;
    font-size: clamp(19px, 2.1vw, 27px);
    line-height: 1.5; color: var(--ivory);
    padding-left: 22px; border-left: 1px solid var(--accent);
    max-width: 46ch;
    opacity: 0; transform: translateY(16px); letter-spacing: 0.06em;
}
.beat.shown.beat-quote { animation: quoteIn 1.6s var(--ease-out) forwards; }
@keyframes quoteIn { to { opacity: 1; transform: none; letter-spacing: 0.005em; } }

/* Stats */
.beat-stats { display: flex; gap: clamp(28px, 4vw, 60px); flex-wrap: wrap; }
.stat { opacity: 0; transform: translateY(18px); }
.beat.shown .stat { animation: blurIn 1s var(--ease-out) forwards; animation-delay: var(--d, 0s); }
.stat b {
    display: block; font-family: var(--serif); font-weight: 500;
    font-size: clamp(34px, 3.8vw, 56px); line-height: 1; color: var(--ivory);
}
.stat b .suffix { font-size: 0.5em; color: var(--accent); font-style: italic; }
.stat small {
    display: block; margin-top: 8px;
    font-size: clamp(10px, 1vw, 12px); font-weight: 500;
    letter-spacing: 0.24em; text-transform: uppercase;
    color: rgba(243,239,230,0.6);
}

/* Table */
.beat-table { opacity: 0; transform: translateY(20px); }
.beat.shown.beat-table { animation: blurIn 1s var(--ease-out) forwards; }
.beat-table table {
    border-collapse: collapse; width: 100%; max-width: 560px;
    font-size: clamp(12.5px, 1.15vw, 15px);
    background: rgba(23,21,15,0.55);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(243,239,230,0.14);
}
.beat-table th, .beat-table td { padding: 12px 18px; text-align: left; }
.beat-table th {
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.16em;
    font-size: 0.72em; color: var(--accent);
    border-bottom: 1px solid rgba(243,239,230,0.18);
}
.beat-table td { border-bottom: 1px solid rgba(243,239,230,0.07); color: rgba(243,239,230,0.9); }
.beat-table tr:last-child td { border-bottom: 0; }
.beat-table tbody tr { opacity: 0; }
.beat.shown .beat-table tbody tr, .beat.shown.beat-table tbody tr { animation: rowIn 0.8s var(--ease-out) forwards; animation-delay: var(--d, 0s); }
@keyframes rowIn { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }

/* Beat progress dots under content */
.beat-dots { display: flex; gap: 9px; margin-top: clamp(4px, 1vh, 10px); }
.beat-dots i {
    width: 5px; height: 5px; transform: rotate(45deg);
    background: transparent; border: 1px solid rgba(243,239,230,0.35);
    transition: background 0.5s, border-color 0.5s;
}
.beat-dots i.on { background: var(--accent); border-color: var(--accent); }

/* ---------- Chrome ---------- */
#chrome-top {
    position: fixed; top: 0; left: 0; right: 0; z-index: 10;
    display: flex; justify-content: space-between; align-items: flex-start;
    padding: clamp(18px, 3.4vh, 36px) clamp(24px, 4vw, 56px);
    pointer-events: none;
    opacity: 0; transition: opacity 1.2s ease 0.4s;
}
body:not(.loading) #chrome-top { opacity: 1; }
#brandmark { height: clamp(30px, 5vh, 46px); filter: drop-shadow(0 1px 10px rgba(0,0,0,0.4)); }
.top-actions { display: flex; gap: 10px; pointer-events: auto; }
.chrome-btn {
    width: 38px; height: 38px; display: grid; place-items: center;
    background: rgba(23,21,15,0.4); color: rgba(243,239,230,0.75);
    border: 1px solid rgba(243,239,230,0.22); border-radius: 50%;
    cursor: pointer; transition: all 0.35s ease; backdrop-filter: blur(4px);
}
.chrome-btn:hover, .chrome-btn:focus-visible { color: var(--ivory); border-color: var(--ivory); }
.chrome-btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.chrome-btn.live { border-color: var(--teal); color: var(--teal); }

#chrome-bottom {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
    display: flex; justify-content: space-between; align-items: flex-end;
    padding: 0 clamp(24px, 4vw, 56px) clamp(20px, 3.6vh, 38px);
    pointer-events: none;
    opacity: 0; transition: opacity 1.2s ease 0.6s;
}
body:not(.loading) #chrome-bottom { opacity: 1; }

#tabs { display: flex; gap: 10px; pointer-events: auto; flex-wrap: wrap; }
.tab {
    font-family: var(--sans); font-size: clamp(10px, 1vw, 12px);
    font-weight: 500; letter-spacing: 0.26em; text-transform: uppercase;
    color: rgba(243,239,230,0.78);
    background: rgba(23,21,15,0.38); backdrop-filter: blur(4px);
    border: 1px solid rgba(243,239,230,0.25);
    padding: 11px 22px; cursor: pointer;
    transition: all 0.4s ease;
}
.tab:hover, .tab:focus-visible { color: var(--night); background: var(--ivory); border-color: var(--ivory); }
.tab:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.tab.current { color: var(--night); background: var(--accent); border-color: var(--accent); }
.tab[disabled] { opacity: 0.35; cursor: default; }
.tab[disabled]:hover { color: rgba(243,239,230,0.78); background: rgba(23,21,15,0.38); border-color: rgba(243,239,230,0.25); }

#progress { display: flex; gap: 10px; pointer-events: auto; padding-bottom: 4px; }
#progress i {
    width: 26px; height: 2px; background: rgba(243,239,230,0.22);
    cursor: pointer; transition: background 0.4s;
}
#progress i.on { background: var(--ivory); }
#progress i:hover { background: var(--accent); }

/* ---------- Pairing overlay ---------- */
.overlay {
    position: fixed; inset: 0; z-index: 40;
    background: rgba(13,12,9,0.78); backdrop-filter: blur(8px);
    display: grid; place-items: center;
}
.overlay-card {
    background: var(--paper); color: var(--ink);
    padding: clamp(30px, 5vw, 52px) clamp(34px, 5.5vw, 62px);
    text-align: center; max-width: 420px; width: calc(100vw - 48px);
    box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
.overlay-eyebrow {
    font-size: 10px; font-weight: 600; letter-spacing: 0.4em;
    text-transform: uppercase; color: var(--gold); margin-bottom: 10px;
}
.overlay-title { font-family: var(--serif); font-weight: 500; font-size: 30px; margin-bottom: 22px; }
#qr { display: grid; place-items: center; min-height: 140px; margin-bottom: 18px; }
#qr img, #qr canvas { border: 10px solid #fff; box-shadow: 0 4px 20px rgba(0,0,0,0.12); }
.pair-code { font-size: 15px; letter-spacing: 0.06em; }
.pair-code strong { font-family: var(--serif); font-size: 30px; letter-spacing: 0.28em; margin-left: 4px; }
.pair-url { font-size: 12.5px; color: rgba(46,42,37,0.65); margin-top: 6px; word-break: break-all; }
.pair-status { margin-top: 18px; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: rgba(46,42,37,0.55); }
.pair-status.ok { color: #2C6E49; }
.overlay-close {
    margin-top: 24px; font-family: var(--sans); font-size: 11px; font-weight: 600;
    letter-spacing: 0.28em; text-transform: uppercase;
    background: var(--ink); color: var(--ivory); border: 0;
    padding: 13px 30px; cursor: pointer; transition: background 0.3s;
}
.overlay-close:hover { background: #000; }

#blackout { position: fixed; inset: 0; z-index: 50; background: #000; }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
    .content { width: calc(100vw - 56px); bottom: 120px; max-height: 66vh; overflow: hidden; }
    .beat-text { font-size: 14px; line-height: 1.7; }
    .scene-logo { height: 52px; }
    #progress { display: none; }
    .watermark { font-size: 21vw; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; transition-duration: 0.15s !important; }
    .scene.active .scene-bg img { animation: none; }
}

/* ---------- Music ---------- */
#musicPop {
    position: fixed; top: clamp(66px, 11vh, 96px); right: clamp(24px, 4vw, 56px);
    z-index: 30; width: 230px;
    background: rgba(23,21,15,0.85); backdrop-filter: blur(10px);
    border: 1px solid rgba(243,239,230,0.18);
    padding: 14px;
}
.music-head { display: flex; align-items: center; gap: 11px; margin-bottom: 10px; }
#musicToggle {
    width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center;
    background: var(--gold); color: var(--night); border: 0; border-radius: 50%; cursor: pointer;
}
#musicNow {
    font-size: 10.5px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase;
    color: rgba(243,239,230,0.85); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#musicTracks { display: flex; flex-direction: column; gap: 4px; }
.music-track {
    text-align: left; background: transparent; border: 0; cursor: pointer;
    font-family: var(--sans); font-size: 12px; font-weight: 400;
    color: rgba(243,239,230,0.7); padding: 8px 9px;
    transition: background 0.25s, color 0.25s;
}
.music-track:hover { background: rgba(243,239,230,0.08); color: var(--ivory); }
.music-track.on { color: var(--gold); }
.music-track.on::before { content: '▸ '; }

/* ---------- Photo gallery — framed, uncropped ---------- */
#gallery {
    position: fixed; z-index: 6;
    top: 50%; right: clamp(28px, 4.5vw, 90px);
    transform: translateY(-50%) translateX(40px);
    width: min(42vw, 740px, calc((100vh - 300px) * 1.5));
    opacity: 0; visibility: hidden;
    transition: opacity 0.9s ease, transform 1s var(--ease-out), visibility 0.9s;
}
body.gallery-open #gallery { opacity: 1; visibility: visible; transform: translateY(-50%); }

.g-frame {
    background: var(--paper);
    padding: clamp(10px, 1.1vw, 18px);
    border: 1px solid rgba(185,143,88,0.75);
    box-shadow: 0 24px 70px rgba(0,0,0,0.55);
}
.g-stage {
    position: relative; width: 100%;
    aspect-ratio: 3 / 2;
    background: var(--paper);
    overflow: hidden;
}
.g-stage img.g-img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: contain;                 /* whole photo, never cropped */
    opacity: 0; transition: opacity 0.8s ease;
}
.g-stage img.g-img.on { opacity: 1; }

.g-meta {
    display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
    padding: 12px 4px 2px;
}
.g-caption {
    font-family: var(--serif); font-style: italic;
    font-size: clamp(14px, 1.35vw, 18px); color: var(--ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.g-count {
    font-family: var(--sans); font-size: 10px; font-weight: 600;
    letter-spacing: 0.3em; color: var(--gold); flex: 0 0 auto;
}

.g-nav {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
    width: 40px; height: 40px; display: grid; place-items: center;
    background: rgba(23,21,15,0.55); color: rgba(243,239,230,0.85);
    border: 1px solid rgba(243,239,230,0.3); border-radius: 50%;
    cursor: pointer; transition: all 0.3s ease; backdrop-filter: blur(4px);
}
.g-nav:hover { color: var(--night); background: var(--ivory); }
#gPrev { left: -20px; }
#gNext { right: -20px; }

body.gallery-open .scene-logo { opacity: 0 !important; }
@media (min-width: 761px) {
    body.gallery-open .content { width: min(620px, 50vw); }
}
@media (max-width: 760px) {
    #gallery { width: 88vw; right: 6vw; }
    #gPrev { left: -12px; } #gNext { right: -12px; }
}

/* ---------- Scene navigator ---------- */
#tabsWrap { display: flex; gap: 10px; align-items: center; pointer-events: auto; flex-wrap: wrap; }
.tab-menu { display: inline-flex; align-items: center; }
.nav-card {
    background: rgba(23,21,15,0.92); backdrop-filter: blur(12px);
    border: 1px solid rgba(243,239,230,0.16);
    color: var(--ivory);
    padding: clamp(30px, 4.5vw, 52px) clamp(34px, 5vw, 64px);
    max-width: 860px; width: calc(100vw - 48px);
    max-height: 84vh; overflow-y: auto;
    box-shadow: 0 30px 80px rgba(0,0,0,0.55);
    text-align: left;
}
.nav-title { font-family: var(--serif); font-weight: 500; font-size: clamp(24px, 2.6vw, 32px); margin: 4px 0 26px; }
.nav-group { margin-bottom: 24px; }
.nav-group h3 {
    font-family: var(--sans); font-size: 10px; font-weight: 600;
    letter-spacing: 0.4em; text-transform: uppercase;
    color: var(--gold); margin-bottom: 12px;
}
.nav-scenes { display: flex; flex-wrap: wrap; gap: 10px; }
.nav-scene {
    font-family: var(--sans); font-size: clamp(11px, 1vw, 12.5px);
    font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase;
    color: rgba(243,239,230,0.82);
    background: rgba(243,239,230,0.05);
    border: 1px solid rgba(243,239,230,0.22);
    padding: 12px 20px; cursor: pointer; transition: all 0.35s ease;
}
.nav-scene:hover { color: var(--night); background: var(--ivory); border-color: var(--ivory); }
.nav-scene.cur { color: var(--night); background: var(--gold); border-color: var(--gold); }
.nav-card .overlay-close { background: var(--ivory); color: var(--ink); margin-top: 6px; }
.nav-card .overlay-close:hover { background: #fff; }
