/* ========================================
   bada.coffee - Styles
   Artisan Futurism: Leather + Sci-fi HUD
   ======================================== */

/* CSS Custom Properties */
:root {
    --espresso-black: #1C1410;
    --roasted-umber: #3A2A1E;
    --aged-brass: #C8A96E;
    --oxidized-copper: #4A7C7B;
    --parchment-cream: #D4C4A8;
    --dark-saddle: #8B6B4A;
    --sienna: #A0522D;
    --char: #0E0B08;

    --text-weight: 350;
    --ripple-progress: 0;
    --column-width: 720px;
    --section-brightness: 1;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--char);
    color: var(--parchment-cream);
    font-family: 'Literata', serif;
    font-variation-settings: 'opsz' 14, 'wght' var(--text-weight);
    font-size: 18px;
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* SVG Filters (hidden) */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
}

/* ========================================
   Leather Texture Background
   ======================================== */
#leather-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-color: var(--espresso-black);
    background-image:
        radial-gradient(circle 2px at 20% 30%, var(--roasted-umber) 0%, transparent 100%),
        radial-gradient(circle 4px at 60% 70%, var(--roasted-umber) 0%, transparent 100%),
        radial-gradient(circle 8px at 40% 50%, var(--roasted-umber) 0%, transparent 100%),
        radial-gradient(circle 3px at 80% 20%, var(--roasted-umber) 0%, transparent 100%),
        radial-gradient(circle 6px at 10% 80%, var(--roasted-umber) 0%, transparent 100%),
        radial-gradient(circle 2px at 90% 45%, var(--roasted-umber) 0%, transparent 100%),
        radial-gradient(circle 5px at 35% 90%, var(--roasted-umber) 0%, transparent 100%),
        radial-gradient(circle 1px at 50% 15%, var(--roasted-umber) 0%, transparent 100%),
        radial-gradient(circle 3px at 75% 55%, var(--roasted-umber) 0%, transparent 100%);
    background-size:
        80px 80px,
        120px 120px,
        200px 200px,
        100px 100px,
        150px 150px,
        90px 90px,
        160px 160px,
        60px 60px,
        130px 130px;
    opacity: 0;
    transition: opacity 1200ms ease-in;
    filter: url(#leather-noise);
}

#leather-bg.visible {
    opacity: 1;
}

/* ========================================
   Narrative Sections
   ======================================== */
.narrative-section {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    filter: brightness(var(--section-brightness, 1));
}

.section-content {
    width: 100%;
    max-width: var(--column-width);
    margin: 0 auto;
    padding: 80px 24px;
}

/* Section spacing */
.narrative-section + .hud-scanline {
    margin: 40px auto;
}

/* ========================================
   Section 1: Origin
   ======================================== */
#origin {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.origin-content {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 0;
}

#reticle-container {
    position: relative;
    width: 340px;
    height: 340px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#reticle {
    width: 100%;
    height: 100%;
    animation: reticle-rotate 50s linear infinite;
    animation-play-state: paused;
}

#reticle.spinning {
    animation-play-state: running;
}

@keyframes reticle-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.bracket {
    stroke: var(--oxidized-copper);
    stroke-width: 1;
    fill: none;
    stroke-dasharray: 80;
    stroke-dashoffset: 80;
    transition: stroke-dashoffset 800ms ease-out;
}

.bracket.drawn {
    stroke-dashoffset: 0;
}

.reticle-ring {
    stroke: var(--oxidized-copper);
    stroke-width: 0.5;
    fill: none;
    opacity: 0;
    transition: opacity 400ms ease-in;
}

.reticle-ring.visible {
    opacity: 0.6;
}

.crosshair {
    stroke: var(--oxidized-copper);
    stroke-width: 0.5;
    opacity: 0;
    transition: opacity 400ms ease-in;
}

.crosshair.visible {
    opacity: 0.4;
}

#domain-name {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--oxidized-copper);
    white-space: nowrap;
}

.origin-coords {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    opacity: 0;
    transition: opacity 800ms ease-in;
    color: var(--oxidized-copper);
    letter-spacing: 0.15em;
}

.origin-coords.visible {
    opacity: 0.4;
}

/* ========================================
   HUD Scan-lines
   ======================================== */
.hud-scanline {
    width: 100%;
    max-width: var(--column-width);
    margin: 0 auto;
    height: 1px;
    background-color: var(--oxidized-copper);
    opacity: 0;
    transition: opacity 600ms ease-in;
}

.hud-scanline.pulsed {
    opacity: 0.3;
    animation: scanline-pulse 2s ease-in-out;
}

@keyframes scanline-pulse {
    0% { opacity: 0; }
    30% { opacity: 0.5; }
    100% { opacity: 0.3; }
}

/* ========================================
   HUD Text Styles
   ======================================== */
.hud-text {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--oxidized-copper);
}

.hud-value {
    color: var(--aged-brass);
}

.hud-readout {
    padding: 16px 0;
    border-top: 1px solid rgba(74, 124, 123, 0.2);
    border-bottom: 1px solid rgba(74, 124, 123, 0.2);
    margin: 40px 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hud-readout-sub {
    font-size: 10px;
    opacity: 0.6;
}

/* ========================================
   Section Headings
   ======================================== */
.section-heading {
    font-family: 'Literata', serif;
    font-variation-settings: 'opsz' 72, 'wght' 700;
    font-size: 56px;
    line-height: 1.1;
    color: var(--aged-brass);
    margin-bottom: 60px;
}

/* ========================================
   Body Text
   ======================================== */
.body-text {
    font-family: 'Literata', serif;
    font-variation-settings: 'opsz' 14, 'wght' var(--text-weight);
    font-size: 18px;
    line-height: 1.7;
    color: var(--parchment-cream);
    margin-bottom: 40px;
}

.body-text:last-child {
    margin-bottom: 0;
}

/* ========================================
   Ripple Blocks
   ======================================== */
.ripple-block {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms ease-out, transform 600ms ease-out, filter 600ms ease-out;
}

.ripple-block.revealed {
    opacity: 1;
    transform: translateY(0);
    filter: none;
}

.ripple-block.rippling {
    opacity: 0.7;
    transform: translateY(10px);
    filter: url(#ripple-distort);
}

/* ========================================
   Section 2: Roast
   ======================================== */
#roast {
    min-height: 120vh;
}

.roast-content {
    max-width: 640px;
}

/* Temperature Gauge */
#temp-gauge-container {
    position: fixed;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 400ms ease;
    z-index: 10;
    pointer-events: none;
}

#temp-gauge-container.visible {
    opacity: 1;
}

#temp-gauge {
    width: 20px;
    height: 320px;
}

.gauge-track {
    fill: var(--roasted-umber);
}

.gauge-fill {
    fill: var(--aged-brass);
    filter: drop-shadow(0 0 2px var(--aged-brass));
    transition: height 100ms linear, y 100ms linear;
}

.gauge-tick {
    stroke: var(--oxidized-copper);
    stroke-width: 0.5;
    opacity: 0.5;
}

.gauge-label {
    font-size: 10px;
    margin-top: 4px;
}

.gauge-value {
    font-size: 11px;
    color: var(--aged-brass);
}

/* ========================================
   Section 3: Brew
   ======================================== */
#brew {
    min-height: 120vh;
}

.brew-content {
    max-width: var(--column-width);
}

/* Ring Gauges */
.ring-gauges {
    display: flex;
    justify-content: center;
    margin: 60px 0;
}

.ring-gauge-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.ring-gauge {
    width: 200px;
    height: 200px;
}

.ring-bg {
    fill: none;
    stroke: var(--roasted-umber);
    stroke-width: 2;
}

.ring-arc {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dashoffset 300ms ease-out;
}

.ring-outer-arc {
    stroke: var(--oxidized-copper);
    stroke-dasharray: 502.65;
    stroke-dashoffset: 502.65;
}

.ring-mid-arc {
    stroke: var(--aged-brass);
    stroke-dasharray: 402.12;
    stroke-dashoffset: 402.12;
}

.ring-inner-arc {
    stroke: var(--sienna);
    stroke-dasharray: 301.59;
    stroke-dashoffset: 301.59;
}

.ring-labels {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.ring-label {
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ring-label-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot-extraction {
    background-color: var(--oxidized-copper);
}

.dot-watertemp {
    background-color: var(--aged-brass);
}

.dot-brewtime {
    background-color: var(--sienna);
}

/* ========================================
   Section 4: Pour
   ======================================== */
#pour {
    min-height: 80vh;
}

.pour-content {
    max-width: 480px;
    text-align: center;
}

.pull-quote {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 300;
    font-size: 42px;
    line-height: 1.4;
    color: var(--dark-saddle);
    margin-bottom: 60px;
}

.pour-text {
    font-variation-settings: 'opsz' 14, 'wght' 450;
}

/* ========================================
   Section 5: Rest
   ======================================== */
#rest {
    min-height: 80vh;
    position: relative;
}

.rest-content {
    max-width: var(--column-width);
    position: relative;
    z-index: 2;
}

.rest-closing {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 14px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--oxidized-copper);
    text-align: center;
    margin-top: 80px;
    opacity: 0.5;
}

/* Radar Sweep */
#radar-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 280px;
    height: 280px;
    opacity: 0.1;
    z-index: 1;
    pointer-events: none;
}

#radar-sweep {
    width: 100%;
    height: 100%;
}

.radar-ring {
    fill: none;
    stroke: var(--oxidized-copper);
    stroke-width: 0.5;
    opacity: 0.3;
}

.radar-line {
    stroke: var(--oxidized-copper);
    stroke-width: 0.5;
    opacity: 0.2;
}

#radar-wedge {
    transform-origin: 140px 140px;
    animation: radar-spin 8s linear infinite;
}

@keyframes radar-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Section fade to darkness */
.section-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 200px;
    background: linear-gradient(to bottom, transparent, var(--espresso-black));
    pointer-events: none;
    z-index: 3;
}

/* ========================================
   Selection Style
   ======================================== */
::selection {
    background-color: var(--sienna);
    color: var(--parchment-cream);
}

/* ========================================
   Mobile Responsive
   ======================================== */
@media (max-width: 768px) {
    :root {
        --column-width: calc(100vw - 32px);
    }

    .section-heading {
        font-size: 36px;
        margin-bottom: 40px;
    }

    .body-text {
        font-size: 16px;
        line-height: 1.65;
        margin-bottom: 32px;
    }

    .pull-quote {
        font-size: 28px;
        line-height: 1.35;
        margin-bottom: 40px;
    }

    #reticle-container {
        width: 260px;
        height: 260px;
    }

    #domain-name {
        font-size: 12px;
    }

    #temp-gauge-container {
        left: auto;
        right: 12px;
        top: 80px;
        transform: none;
    }

    #temp-gauge {
        width: 16px;
        height: 200px;
    }

    .roast-content {
        max-width: var(--column-width);
    }

    .pour-content {
        max-width: var(--column-width);
        padding-left: 8px;
        padding-right: 8px;
    }

    .ring-gauge {
        width: 160px;
        height: 160px;
    }

    #radar-container {
        width: 200px;
        height: 200px;
    }

    .section-content {
        padding: 60px 16px;
    }

    .hud-readout {
        margin: 32px 0;
    }

    .origin-coords {
        font-size: 9px;
        bottom: 12px;
    }

    #roast {
        min-height: 100vh;
    }

    #brew {
        min-height: 100vh;
    }
}

@media (max-width: 480px) {
    .section-heading {
        font-size: 30px;
    }

    .pull-quote {
        font-size: 24px;
    }

    .ring-gauge {
        width: 140px;
        height: 140px;
    }

    #reticle-container {
        width: 220px;
        height: 220px;
    }
}
