@view-transition {
    navigation: auto;
}

::view-transition-old(root) {
    animation: page-fade-out 0.35s ease-in both;
}

::view-transition-new(root) {
    animation: page-fade-in 0.35s ease-out both;
}

@keyframes page-fade-out {
    from { opacity: 1; }
    to   { opacity: 0; }
}

@keyframes page-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@font-face {
    font-family: 'RelaisExtraBold';
    src: url('../fonts/RelaisDisplay-ExtraBold.otf') format('opentype');
    font-weight: 800;
    font-display: swap;
}

@font-face {
    font-family: 'RelaisItalic';
    src: url('../fonts/RelaisDisplay-MediumItalic.otf') format('opentype');
    font-style: italic;
    font-weight: 500;
    font-display: swap;
}

:root {
    --cream: #f6eee3;
    --brown: #48251a;
    --brown-deep: #2a1710;
    --gold: #c39244;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--brown-deep);
    color: var(--brown);
    -webkit-tap-highlight-color: transparent;
}

body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.stage {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    overflow: hidden;
    background-color: var(--cream);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    container-type: inline-size;
    container-name: stage;
}

.stage--welcome { background-image: url('../images/FRAME-1.webp'); cursor: pointer; }
.stage--start    { background-image: url('../images/FRAME-2.webp'); }
.stage--play     { background-image: url('../images/FRAME-2.webp'); }
.stage--finish   { background-image: url('../images/FRAME-7.webp'); }

/* Desktop / tablet: letterbox the portrait creative as a centered card */
@media (min-width: 700px) {
    body { padding: 3vh 0; }

    .stage {
        width: auto;
        height: min(94vh, 960px);
        aspect-ratio: 9 / 16;
        max-width: 92vw;
        border-radius: 22px;
        box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    }
}

/* Landscape phones/tablets: keep the portrait card intact rather than stretching it */
@media (orientation: landscape) and (max-width: 699.98px) {
    .stage {
        width: auto;
        height: 100vh;
        aspect-ratio: 9 / 16;
        max-width: 100vw;
    }
}

.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.block {
    position: absolute;
    left: 8%;
    width: 84%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.heading {
    font-family: 'RelaisExtraBold', 'Arial Black', sans-serif;
    font-weight: 800;
    color: var(--gold);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 0;
    line-height: 1.12;
    font-size: 6.2cqi;
}

.heading--hero {
    font-size: 14cqi;
    line-height: 1.05;
    color: #d3a04c;
}

.subtitle {
    font-family: 'RelaisItalic', Georgia, serif;
    font-style: italic;
    font-weight: 500;
    color: var(--brown);
    margin: 0;
    line-height: 1.28;
    font-size: 5.4cqi;
}

.subtitle--hero {
    font-size: 12cqi;
    line-height: 1;
}

.logo-img {
    width: 66%;
    height: auto;
    display: block;
}

@property --border-angle {
    syntax: '<angle>';
    inherits: false;
    initial-value: 0deg;
}

.btn-wrap {
    position: relative;
    display: inline-block;
}

.btn-ring {
    position: absolute;
    inset: -3px;
    border-radius: 999px;
    --border-angle: 0deg;
    background: conic-gradient(from var(--border-angle), transparent 0deg, transparent 325deg, #e8a33d 336deg, #ffe9b0 348deg, #e8a33d 356deg, transparent 360deg);
    animation: border-sweep 3.5s linear infinite;
    pointer-events: none;
}

@keyframes border-sweep {
    to { --border-angle: 360deg; }
}

.pill-btn {
    position: relative;
    font-family: 'RelaisExtraBold', 'Arial Black', sans-serif;
    font-weight: 800;
    font-size: 6cqi;
    letter-spacing: 0.06em;
    color: var(--gold);
    background: #3e1f16;
    border: none;
    border-radius: 999px;
    padding: 4.2cqi 11cqi;
    text-transform: uppercase;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(30, 14, 8, 0.35);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.pill-btn:active {
    transform: scale(0.96);
    box-shadow: 0 6px 14px rgba(30, 14, 8, 0.35);
}

/* --- Welcome page --- */
.stage--welcome .block--logo   { top: 20%;   height: 30%; }
.stage--welcome .block--logo .logo-img { width: 120%; margin-top: 22cqi; }
.stage--welcome .block--heading{ top: 52%;   height: 18%; }
.stage--welcome .block--heading .heading { margin-top: 4cqi; }
.stage--welcome .block--sub    { top: 70%;   height: 10%; }
.stage--welcome .block--sub .dashed-italic { margin-bottom: 2cqi; }

/* --- Start page --- */
.stage--start .block--title  { top: 28%; height: 32%; justify-content: flex-start; }
.stage--start .block--title .subtitle--hero { margin-top: 3cqi; }
.stage--start .block--action { top: 60%; height: 12%; }
.stage--start .block--action .pill-btn { font-size: 10.5cqi; line-height: 1; padding: 2.5cqi 13.5cqi; background: #4f2a1a; color: #d3a04c; }

/* --- Countdown (play) page --- */
.stage--play .block--number { top: 22%;   height: 40%; }
.stage--play .block--heading{ top: 65%;   height: 9%; }
.stage--play .block--heading .heading { font-size: 10cqi; }
.stage--play .block--sub    { top: 73%;   height: 14%; }
.stage--play .block--sub .subtitle { white-space: pre-line; font-size: 6.3cqi; }

.circle-img {
    position: absolute;
    top: 50%;
    left: 50%;
    translate: -50% -50%;
    width: 103%;
    height: auto;
    z-index: 0;
    animation: circle-spin 12s linear infinite;
    will-change: transform;
    backface-visibility: hidden;
}

.circle-img.approach-in {
    animation: circle-spin 12s linear infinite, approach-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes circle-spin {
    from { rotate: 0deg; }
    to   { rotate: 360deg; }
}

.number {
    font-family: 'RelaisExtraBold', 'Arial Black', sans-serif;
    font-weight: 800;
    color: var(--brown);
    font-size: 40cqi;
    line-height: 1;
    margin: 0;
    position: relative;
    z-index: 1;
}

.number.approach-in {
    animation: approach-in 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes approach-in {
    from { scale: 0.15; opacity: 0; }
    to   { scale: 1; opacity: 1; }
}

.step-in {
    animation: step-in 0.5s ease-out both;
}

@keyframes step-in {
    from { opacity: 0; transform: translateY(10cqi); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Finish page --- */
.stage--finish .block--quote    { top: 18%; height: 12%; }
.stage--finish .subtitle        { font-size: 6.5cqi; }
.stage--finish .block--your     { top: 32%; height: 6%; left: 2%; width: 96%; }
.stage--finish .eyebrow         { font-size: 7.4cqi; white-space: nowrap; }
.stage--finish .eyebrow::before, .stage--finish .eyebrow::after { color: var(--brown); margin: 0 2.7em; }
.stage--finish .block--logo     { top: 35%; height: 20%; }
.stage--finish .block--logo .logo-img { width: 120%; }
.stage--finish .block--heading  { top: 53%; height: 7%; }
.stage--finish .block--heading .heading { font-size: 7.5cqi; }
.stage--finish .block--sub      { top: 63%; height: 10%; }
.stage--finish .block--action   { top: 76%; height: 12%; }
.stage--finish .block--action .pill-btn { font-size: 6.8cqi; line-height: 1; padding: 3cqi 6.5cqi; }

.eyebrow {
    font-family: 'RelaisExtraBold', 'Arial Black', sans-serif;
    font-weight: 800;
    color: var(--gold);
    text-transform: uppercase;
    font-size: 4cqi;
    margin: 0;
}

.eyebrow::before, .eyebrow::after {
    content: '\2014';
    margin: 0 0.4em;
    letter-spacing: 0;
}

.dashed-italic {
    font-family: 'RelaisItalic', Georgia, serif;
    font-style: italic;
    font-weight: 500;
    color: var(--brown);
    font-size: 7.5cqi;
    margin: 0;
}

.dashed-italic::before, .dashed-italic::after {
    content: '\2014';
    margin: 0 0.5em;
}

.tap-hint {
    position: absolute;
    bottom: 3%;
    left: 0;
    right: 0;
    text-align: center;
    font-family: 'RelaisItalic', Georgia, serif;
    font-style: italic;
    font-size: 3.2cqi;
    color: var(--brown);
    opacity: 0.55;
}
