/* ============================================
   lunge.dev — Skeuomorphic Fencing Salle
   ============================================ */

@property --gauge-val {
    syntax: '<number>';
    inherits: false;
    initial-value: 0;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: #1c1410;
    color: #e8dcc8;
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- Wood Grain Background --- */
.wood-background {
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0;
    transition: opacity 800ms ease;
    background:
        repeating-linear-gradient(
            2deg,
            transparent,
            transparent 3px,
            rgba(46, 26, 20, 0.15) 3px,
            rgba(46, 26, 20, 0.15) 4px
        ),
        repeating-linear-gradient(
            178deg,
            transparent,
            transparent 7px,
            rgba(160, 136, 86, 0.05) 7px,
            rgba(160, 136, 86, 0.05) 8px
        ),
        repeating-linear-gradient(
            1deg,
            transparent,
            transparent 20px,
            rgba(46, 26, 20, 0.08) 20px,
            rgba(46, 26, 20, 0.08) 22px
        ),
        radial-gradient(ellipse 120% 80% at 40% 30%, rgba(62, 38, 24, 0.6), transparent),
        radial-gradient(ellipse 80% 60% at 70% 70%, rgba(42, 24, 16, 0.4), transparent),
        linear-gradient(180deg, #1c1410, #231a14, #1c1410);
}

body.loaded .wood-background {
    opacity: 1;
}

/* --- Vignette --- */
.vignette {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(ellipse 70% 60% at 50% 50%, transparent 40%, rgba(10, 6, 4, 0.7) 100%);
}

body.loaded .vignette {
    animation: vignetteIntensify 1.2s ease-out forwards;
}

@keyframes vignetteIntensify {
    from { opacity: 0.3; }
    to { opacity: 1; }
}

/* --- Compass Rose Navigation --- */
.compass-rose {
    position: fixed;
    top: 24px;
    left: 24px;
    width: 100px;
    height: 100px;
    z-index: 30;
    opacity: 0;
    cursor: pointer;
}

body.loaded .compass-rose {
    animation: compassFadeIn 1s 600ms ease-out forwards;
}

@keyframes compassFadeIn {
    to { opacity: 1; }
}

.compass-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.6));
}

.compass-bezel-outer {
    fill: none;
    stroke: #c9a84c;
    stroke-width: 3;
}

.compass-bezel-inner {
    fill: #2e1a14;
    stroke: #a08856;
    stroke-width: 1.5;
}

.compass-glass {
    fill: radial-gradient(circle, rgba(201,168,76,0.05), transparent);
    fill: rgba(28, 20, 16, 0.8);
}

.compass-ticks line {
    stroke: #c9a84c;
    stroke-width: 1.5;
}

.compass-label {
    fill: #a08856;
    font-family: 'Archivo Narrow', sans-serif;
    font-size: 10px;
    font-weight: 700;
    text-anchor: middle;
    dominant-baseline: central;
    letter-spacing: 0.08em;
    cursor: pointer;
}

.compass-label:hover {
    fill: #c9a84c;
}

.compass-needle {
    transform-origin: 60px 60px;
    transition: transform 1.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.needle-north {
    fill: #c9a84c;
}

.needle-south {
    fill: #8b2020;
}

.needle-pivot {
    fill: #c9a84c;
    stroke: #a08856;
    stroke-width: 1;
}

.compass-reflection {
    fill: #c8d0d80f;
}

.compass-tooltip {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Archivo Narrow', sans-serif;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #a08856;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.compass-rose:hover .compass-tooltip {
    opacity: 1;
}

/* --- Mercury Column Scroll Indicator --- */
.mercury-column {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
}

body.loaded .mercury-column {
    animation: compassFadeIn 1s 1s ease-out forwards;
}

.mercury-tube {
    width: 10px;
    height: 200px;
    background: linear-gradient(90deg, #4a6a7a26, #4a6a7a0d, #4a6a7a26);
    border: 1px solid rgba(201, 168, 76, 0.3);
    border-radius: 5px 5px 0 0;
    position: relative;
    overflow: hidden;
    box-shadow:
        inset 0 0 4px rgba(0,0,0,0.4),
        0 0 8px rgba(0,0,0,0.3);
}

.mercury-level {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0%;
    background: linear-gradient(180deg, #8b2020, #6a1818);
    border-radius: 3px 3px 0 0;
    transition: height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 -2px 6px rgba(139, 32, 32, 0.4);
}

.mercury-bulb {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 16px;
    background: radial-gradient(circle at 40% 40%, #a03030, #8b2020, #6a1818);
    border-radius: 50%;
    border: 1px solid rgba(201, 168, 76, 0.3);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.mercury-ticks {
    display: flex;
    flex-direction: column-reverse;
    justify-content: space-between;
    height: 200px;
    position: relative;
}

.mercury-ticks span {
    font-family: 'Archivo Narrow', sans-serif;
    font-size: 0.6rem;
    font-weight: 500;
    color: #a08856;
    letter-spacing: 0.1em;
    position: absolute;
}

/* --- Content Stack --- */
.content-stack {
    position: relative;
    z-index: 20;
    padding: 120px 0 200px;
}

/* --- Leather Panel --- */
.leather-panel {
    max-width: 720px;
    margin: 0 auto 80px;
    margin-left: clamp(40px, 10vw, 15%);
    position: relative;
    opacity: 0;
    transform: translateY(60px) scale(0.97);
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.leather-panel.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.leather-panel.receding {
    opacity: 0.7;
    transform: scale(0.97);
    filter: blur(2px);
}

.panel-inner {
    position: relative;
    padding: clamp(40px, 5vw, 72px);
    overflow: hidden;
    /* Leather texture */
    background:
        radial-gradient(ellipse 3px 3px at 20% 30%, rgba(0,0,0,0.15), transparent),
        radial-gradient(ellipse 4px 2px at 60% 70%, rgba(0,0,0,0.1), transparent),
        radial-gradient(ellipse 2px 4px at 80% 20%, rgba(0,0,0,0.12), transparent),
        repeating-linear-gradient(
            92deg,
            transparent,
            transparent 4px,
            rgba(0,0,0,0.03) 4px,
            rgba(0,0,0,0.03) 5px
        ),
        repeating-linear-gradient(
            88deg,
            transparent,
            transparent 8px,
            rgba(160,136,86,0.04) 8px,
            rgba(160,136,86,0.04) 9px
        ),
        linear-gradient(170deg, #35211a, #2e1a14, #281812);
    /* Triple border: outer gold, dark gap, inner gold */
    border: 2px solid #c9a84c;
    outline: 3px solid #1c1410;
    box-shadow:
        inset 0 0 0 6px #2e1a14,
        inset 0 0 0 7px rgba(201, 168, 76, 0.3),
        0 8px 32px rgba(0,0,0,0.5),
        0 2px 8px rgba(0,0,0,0.3),
        0 16px 48px rgba(0,0,0,0.3),
        0 32px 64px rgba(0,0,0,0.2),
        0 1px 0 rgba(201, 168, 76, 0.1);
    transition: box-shadow 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.leather-panel:hover .panel-inner {
    transform: translateY(-2px);
    box-shadow:
        inset 0 0 0 6px #2e1a14,
        inset 0 0 0 7px rgba(201, 168, 76, 0.3),
        0 12px 36px rgba(0,0,0,0.55),
        0 4px 12px rgba(0,0,0,0.35),
        0 20px 52px rgba(0,0,0,0.35),
        0 36px 68px rgba(0,0,0,0.25),
        0 1px 0 rgba(201, 168, 76, 0.15);
}

.leather-panel:hover .panel-inner::after {
    opacity: 0.05;
}

.panel-inner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: white;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s;
}

/* --- Fencing Watermark --- */
.fencing-watermark {
    position: absolute;
    top: 0;
    right: -40px;
    width: 320px;
    height: 400px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.leather-panel.visible .fencing-watermark {
    opacity: 1;
}

/* --- Typography --- */
.site-title {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(2.8rem, 6vw, 5.5rem);
    color: #c9a84c;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.title-letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
}

body.loaded .title-letter {
    animation: letterReveal 0.6s ease-out forwards;
}

@keyframes letterReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: #c9a84c;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 20px;
}

.body-text {
    color: #e8dcc8;
    margin-bottom: 20px;
    position: relative;
    z-index: 2;
}

.body-text.secondary {
    color: #b8a88c;
    font-weight: 400;
}

/* --- Section Rule --- */
.section-rule {
    display: flex;
    align-items: center;
    gap: 0;
    margin: 24px 0;
    position: relative;
    height: 20px;
}

.section-rule::before,
.section-rule::after {
    content: '';
    flex: 1;
    height: 0.5px;
    background: #c9a84c;
}

.rule-diamond {
    width: 8px;
    height: 8px;
    background: #c9a84c;
    transform: rotate(45deg);
    margin: 0 16px;
    flex-shrink: 0;
}

/* --- Heraldic Divider --- */
.heraldic-divider {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 0;
    opacity: 0.6;
}

.crest-icon {
    width: 64px;
    height: 64px;
}

/* --- Gauge Row --- */
.gauge-row {
    display: flex;
    gap: 24px;
    margin: 32px 0;
    flex-wrap: wrap;
    position: relative;
    z-index: 2;
}

.brass-gauge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.gauge-svg {
    width: 120px;
    height: 120px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.4));
}

.gauge-bezel {
    fill: none;
    stroke: #c9a84c;
    stroke-width: 2.5;
}

.gauge-face {
    fill: #1c1410;
    stroke: #a08856;
    stroke-width: 1;
}

.gauge-needle {
    stroke: #c9a84c;
    stroke-width: 2;
    stroke-linecap: round;
    transform-origin: 70px 70px;
    transform: rotate(-135deg);
    transition: transform 2.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gauge-needle.animated {
    /* Set via JS */
}

.gauge-pivot {
    fill: #c9a84c;
    stroke: #a08856;
    stroke-width: 1;
}

.gauge-glass {
    fill: rgba(200, 208, 216, 0.05);
}

.gauge-value {
    fill: #e8dcc8;
    font-family: 'Archivo Narrow', sans-serif;
    font-size: 14px;
    font-weight: 700;
    text-anchor: middle;
    letter-spacing: 0.05em;
}

.gauge-label {
    font-family: 'Archivo Narrow', sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    color: #a08856;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

/* --- Discipline List --- */
.discipline-list {
    margin: 28px 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    z-index: 2;
}

.discipline-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.discipline-marker {
    width: 10px;
    height: 10px;
    border: 1.5px solid #c9a84c;
    transform: rotate(45deg);
    flex-shrink: 0;
    margin-top: 8px;
}

.discipline-title {
    font-family: 'Archivo Narrow', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    color: #c9a84c;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.discipline-desc {
    color: #b8a88c;
    font-size: 0.95rem;
    line-height: 1.65;
}

/* --- Patina Bubbles --- */
.patina-bubbles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.bubble {
    position: absolute;
    left: var(--bx);
    top: var(--by);
    width: var(--bs);
    height: var(--bs);
    border-radius: 50%;
    background: radial-gradient(circle at 40% 40%, rgba(46, 26, 20, 0.1), rgba(28, 20, 16, 0.3));
    border: 0.5px solid rgba(46, 26, 20, 0.2);
    animation: bubblePulse var(--bd) ease-in-out infinite;
}

.patina-verdigris .bubble {
    background: radial-gradient(circle at 40% 40%, #6a8a5a14, #6a8a5a26);
    border-color: #6a8a5a1a;
}

@keyframes bubblePulse {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

/* --- Brass Buttons --- */
.brass-button-group {
    display: flex;
    gap: 16px;
    margin-top: 32px;
    flex-wrap: wrap;
    position: relative;
    z-index: 2;
}

.brass-button {
    font-family: 'Archivo Narrow', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #1c1410;
    background: linear-gradient(160deg, #d4b85c, #c9a84c, #a08856);
    border: none;
    padding: 14px 32px;
    cursor: pointer;
    position: relative;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.2),
        inset 0 -1px 0 rgba(0,0,0,0.2),
        0 3px 8px rgba(0,0,0,0.4),
        0 1px 2px rgba(0,0,0,0.3);
    transition: all 0.15s ease;
    overflow: hidden;
}

.brass-button:hover {
    background: linear-gradient(160deg, #dcc46a, #d4b85c, #b09060);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.3),
        inset 0 -1px 0 rgba(0,0,0,0.2),
        0 4px 12px rgba(0,0,0,0.45),
        0 1px 3px rgba(0,0,0,0.3),
        0 0 16px rgba(201, 168, 76, 0.2);
}

.brass-button:active {
    box-shadow:
        inset 0 -1px 0 rgba(255,255,255,0.15),
        inset 0 1px 0 rgba(0,0,0,0.2),
        0 1px 4px rgba(0,0,0,0.4);
    transform: translate(1px, 1px);
}

.brass-button .button-text {
    position: relative;
    z-index: 1;
}

.brass-button.secondary-btn {
    background: transparent;
    color: #c9a84c;
    border: 1.5px solid #c9a84c;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.brass-button.secondary-btn:hover {
    background: rgba(201, 168, 76, 0.08);
    box-shadow: 0 3px 10px rgba(0,0,0,0.35);
}

.brass-button.secondary-btn:active {
    transform: translate(1px, 1px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Ring pulse on click */
.brass-button .ring-pulse {
    position: absolute;
    border-radius: 50%;
    border: 2px solid #c9a84c;
    animation: ringExpand 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes ringExpand {
    from {
        width: 0;
        height: 0;
        opacity: 1;
    }
    to {
        width: 200px;
        height: 200px;
        opacity: 0;
        margin-left: -100px;
        margin-top: -100px;
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .leather-panel {
        margin-left: 20px;
        margin-right: 20px;
        max-width: calc(100% - 40px);
    }

    .compass-rose {
        width: 70px;
        height: 70px;
        top: 12px;
        left: 12px;
    }

    .mercury-column {
        display: none;
    }

    .gauge-row {
        justify-content: center;
    }

    .panel-inner {
        padding: clamp(24px, 4vw, 48px);
    }

    .fencing-watermark {
        width: 200px;
        height: 250px;
        right: -20px;
    }
}

@media (max-width: 480px) {
    .brass-button-group {
        flex-direction: column;
    }

    .compass-rose {
        width: 56px;
        height: 56px;
    }

    .compass-label {
        font-size: 8px;
    }
}
