/* ============================================================
   cafe-sweets.xyz — Confectionery Technique Archive
   Design: Glassmorphism × Patisserie Technical Archive
   ============================================================ */

/* --- Custom Properties --- */
:root {
    --sapphire: #1B2A5C;
    --ice-white: #F0F4FF;
    --amethyst: #7B3FA0;
    --emerald: #0F4C35;
    --cool-gray: #CBD5E1;
    --teal: #147B82;
    --amber: #C8880A;

    --glass-bg: rgba(240, 244, 255, 0.12);
    --glass-border: rgba(240, 244, 255, 0.22);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.12);

    --font-display: 'Jost', sans-serif;
    --font-panel: 'DM Sans', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
    --font-editorial: 'Cormorant Garamond', serif;
}

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

html {
    scroll-behavior: smooth;
    scroll-snap-type: y mandatory;
}

body {
    font-family: var(--font-panel);
    background-color: var(--sapphire);
    color: var(--ice-white);
    overflow-x: hidden;
    line-height: 1.6;
}

/* --- Grain Canvas Overlay --- */
#grain-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.045;
}

/* --- Navigation --- */
#site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 48px;
    background: rgba(27, 42, 92, 0.7);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-bottom: 1px solid rgba(240, 244, 255, 0.1);
}

.nav-logo {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-logo-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.18em;
    color: var(--ice-white);
    text-transform: uppercase;
}

.nav-logo-sub {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.12em;
    color: rgba(240, 244, 255, 0.4);
    text-transform: uppercase;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 32px;
}

.nav-links a {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    color: rgba(240, 244, 255, 0.55);
    text-decoration: none;
    text-transform: uppercase;
    transition: color 0.25s ease;
}

.nav-links a:hover {
    color: var(--ice-white);
}

/* --- Spreads (Sections) --- */
.spread {
    position: relative;
    width: 100%;
    min-height: 100vh;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    overflow: hidden;
}

/* --- Bokeh Field --- */
.bokeh-field {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bokeh-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.55;
}

.bokeh-sapphire  { background: var(--sapphire); }
.bokeh-amethyst  { background: var(--amethyst); }
.bokeh-emerald   { background: var(--emerald); }
.bokeh-teal      { background: var(--teal); }
.bokeh-amber     { background: var(--amber); }

/* --- Spread Backgrounds --- */
.spread-counter      { background: var(--sapphire); }
.spread-laminage     { background: #0d1f30; }
.spread-tempering    { background: #13112a; }
.spread-cristallisation { background: #1a1208; }
.spread-service      { background: #0e1a2c; }

/* --- Spread Grid Base --- */
.spread-grid {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 96px 48px 48px;
    display: grid;
    gap: 20px;
}

/* --- Glass Panel --- */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    box-shadow: var(--glass-shadow);
    padding: 32px;
    position: relative;
    overflow: hidden;
}

/* Glass panel hover shimmer */
.glass-panel::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, transparent 50%, rgba(255,255,255,0.02) 100%);
    pointer-events: none;
    border-radius: 4px;
}

/* --- Spread I: The Counter --- */
.spread-counter-grid {
    grid-template-columns: 1.6fr 1fr 0.8fr;
    grid-template-rows: auto;
    align-items: start;
    min-height: calc(100vh - 96px);
}

.panel-hero {
    grid-column: 1;
    grid-row: 1;
    padding: 48px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-self: center;
}

.panel-intro {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
}

.panel-specimen {
    grid-column: 3;
    grid-row: 1;
    align-self: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

/* --- Spread II: Laminage --- */
.spread-laminage-grid {
    grid-template-columns: 0.8fr 1.4fr 0.8fr;
    align-items: start;
}

/* --- Spread III: Tempering --- */
.spread-tempering-grid {
    grid-template-columns: 0.7fr 1.2fr 1fr;
    align-items: start;
}

/* --- Spread IV: Cristallisation --- */
.spread-cristallisation-grid {
    grid-template-columns: 0.7fr 1.6fr 0.8fr;
    align-items: start;
}

/* --- Spread V: Service --- */
.spread-service-grid {
    grid-template-columns: 1fr 1.2fr 1fr;
    align-items: start;
}

/* --- Spread Number (Roman Numeral Background) --- */
.spread-number {
    position: absolute;
    bottom: -0.15em;
    right: 40px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(120px, 18vw, 240px);
    color: transparent;
    -webkit-text-stroke: 1px rgba(240, 244, 255, 0.06);
    letter-spacing: -0.02em;
    line-height: 1;
    z-index: 1;
    pointer-events: none;
    user-select: none;
}

/* --- Typography --- */
.spread-headline {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(60px, 8vw, 100px);
    line-height: 0.9;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ice-white);
}

.spread-headline--sm {
    font-size: clamp(48px, 6vw, 80px);
}

.panel-subtitle {
    font-family: var(--font-editorial);
    font-size: 18px;
    font-style: italic;
    color: rgba(240, 244, 255, 0.65);
    line-height: 1.4;
}

.panel-title {
    font-family: var(--font-panel);
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.04em;
    color: var(--ice-white);
    text-transform: uppercase;
    margin-bottom: 16px;
}

.panel-body-text {
    font-family: var(--font-panel);
    font-size: 13px;
    line-height: 1.75;
    color: rgba(240, 244, 255, 0.7);
    margin-bottom: 16px;
}

.panel-label {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.15em;
    color: rgba(240, 244, 255, 0.35);
    text-transform: uppercase;
    margin-bottom: 12px;
}

/* --- Ornaments --- */
.ornament-top { margin-bottom: 20px; }
.ornament-bottom { margin-top: 20px; }
.ornament-svg { width: 100%; height: auto; display: block; }

/* --- Technique Index (Spread I) --- */
.technique-index {
    margin-top: 24px;
    border-top: 1px solid rgba(240, 244, 255, 0.12);
    padding-top: 20px;
}

.technique-index-label {
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 0.2em;
    color: rgba(240, 244, 255, 0.3);
    text-transform: uppercase;
    margin-bottom: 14px;
}

.technique-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.technique-item {
    display: flex;
    align-items: baseline;
    gap: 14px;
}

.technique-num {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--teal);
    min-width: 20px;
}

.technique-name {
    font-family: var(--font-editorial);
    font-size: 13px;
    color: rgba(240, 244, 255, 0.65);
    font-style: italic;
}

/* --- Specimen SVG --- */
.specimen-cross-section {
    width: 100%;
    display: flex;
    justify-content: center;
}

.specimen-svg {
    width: 100%;
    max-width: 200px;
    height: auto;
}

/* --- Technique Meta (Spread II) --- */
.technique-meta {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid rgba(240, 244, 255, 0.1);
    padding-top: 20px;
}

.meta-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(240, 244, 255, 0.06);
}

.meta-key {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.12em;
    color: rgba(240, 244, 255, 0.35);
    text-transform: uppercase;
}

.meta-val {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--cool-gray);
}

/* --- Diagram SVG --- */
.diagram-svg {
    width: 100%;
    height: auto;
    display: block;
}

/* --- Method Steps (Spread III) --- */
.method-steps {
    list-style: none;
    counter-reset: steps;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.step-item {
    counter-increment: steps;
    position: relative;
    padding: 20px 20px 20px 60px;
    border-bottom: 1px solid rgba(240, 244, 255, 0.08);
    transition: background 0.25s ease;
}

.step-item:last-child {
    border-bottom: none;
}

.step-item::before {
    content: counter(steps, decimal-leading-zero);
    position: absolute;
    left: -10px;
    top: -15px;
    font-size: 80px;
    opacity: 0.08;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--ice-white);
    line-height: 1;
    pointer-events: none;
}

.step-item::after {
    content: counter(steps, decimal-leading-zero);
    position: absolute;
    left: 20px;
    top: 22px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--teal);
    letter-spacing: 0.05em;
}

.step-item:hover {
    background: rgba(240, 244, 255, 0.04);
}

.step-title {
    font-family: var(--font-panel);
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.04em;
    color: var(--ice-white);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.step-desc {
    font-family: var(--font-panel);
    font-size: 12px;
    line-height: 1.65;
    color: rgba(240, 244, 255, 0.6);
    margin-bottom: 8px;
}

.step-spec {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--amber);
    letter-spacing: 0.06em;
}

/* --- Crystal Diagram (Spread III) --- */
.crystal-diagram {
    margin-top: 20px;
}

.crystal-svg {
    width: 100%;
    height: auto;
    display: block;
}

/* --- Ingredients Grid (Spread IV) --- */
.ingredients-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 4px;
}

.ingredient-card {
    background: rgba(240, 244, 255, 0.06);
    border: 1px solid rgba(240, 244, 255, 0.1);
    border-radius: 3px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: background 0.25s ease, border-color 0.25s ease;
}

.ingredient-card:hover {
    background: rgba(240, 244, 255, 0.1);
    border-color: rgba(240, 244, 255, 0.2);
}

.ingredient-name {
    font-family: var(--font-panel);
    font-weight: 600;
    font-size: 12px;
    color: var(--ice-white);
    letter-spacing: 0.03em;
}

.ingredient-formula {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--teal);
    letter-spacing: 0.05em;
}

.ingredient-notes {
    font-family: var(--font-panel);
    font-size: 11px;
    line-height: 1.6;
    color: rgba(240, 244, 255, 0.5);
    margin-top: 4px;
}

/* --- Sugar Stages (Spread IV) --- */
.sugar-stages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.stage-row {
    display: grid;
    grid-template-columns: 90px 80px 1fr;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(240, 244, 255, 0.05);
}

.stage-row--highlight {
    background: rgba(200, 136, 10, 0.08);
    border-radius: 2px;
    padding: 8px 6px;
    border-bottom-color: rgba(200, 136, 10, 0.2);
}

.stage-row--highlight .stage-temp,
.stage-row--highlight .stage-name {
    color: var(--amber);
}

.stage-temp {
    font-family: var(--font-mono);
    font-size: 10px;
    color: rgba(240, 244, 255, 0.5);
    letter-spacing: 0.04em;
}

.stage-name {
    font-family: var(--font-panel);
    font-size: 12px;
    color: rgba(240, 244, 255, 0.7);
}

.stage-bar {
    height: 3px;
    background: linear-gradient(to right, var(--teal), var(--amethyst));
    border-radius: 2px;
    opacity: 0.7;
    transition: width 0.6s ease;
}

/* --- Emulsion Diagram (Spread V) --- */
.emulsion-diagram {
    margin-top: 20px;
    border: 1px solid rgba(240, 244, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.emulsion-layer {
    padding: 16px 20px;
    display: flex;
    align-items: center;
}

.emulsion-water {
    background: rgba(20, 123, 130, 0.15);
}

.emulsion-fat {
    background: rgba(200, 136, 10, 0.12);
}

.emulsion-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    color: rgba(240, 244, 255, 0.5);
    text-transform: uppercase;
}

.emulsion-interface {
    background: rgba(27, 42, 92, 0.4);
    padding: 4px 0;
    position: relative;
}

.interface-svg {
    width: 100%;
    height: auto;
    display: block;
}

.interface-label {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 0.1em;
    color: var(--amber);
    text-transform: uppercase;
    opacity: 0.7;
}

/* --- Archive Index (Spread V) --- */
.archive-index {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 8px;
}

.archive-entry {
    display: grid;
    grid-template-columns: 72px 1fr 80px;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(240, 244, 255, 0.07);
    transition: background 0.2s ease;
}

.archive-entry:hover {
    background: rgba(240, 244, 255, 0.03);
}

.archive-entry--pending {
    opacity: 0.45;
}

.archive-code {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--teal);
    letter-spacing: 0.08em;
}

.archive-title {
    font-family: var(--font-editorial);
    font-size: 12px;
    color: rgba(240, 244, 255, 0.75);
    font-style: italic;
}

.archive-status {
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: right;
}

.archive-status--complete {
    color: var(--teal);
}

.archive-status--pending {
    color: rgba(240, 244, 255, 0.25);
}

.archive-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    margin-top: 8px;
    border-top: 1px solid rgba(240, 244, 255, 0.1);
}

.archive-footer-text {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.1em;
    color: rgba(240, 244, 255, 0.25);
    text-transform: uppercase;
}

.archive-footer-date {
    font-family: var(--font-mono);
    font-size: 9px;
    color: rgba(240, 244, 255, 0.2);
}

/* --- Panel Animations on Scroll --- */
.glass-panel {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

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

/* Stagger delays */
.glass-panel:nth-child(1) { transition-delay: 0s; }
.glass-panel:nth-child(2) { transition-delay: 0.12s; }
.glass-panel:nth-child(3) { transition-delay: 0.24s; }

/* --- Responsive Adjustments --- */
@media (max-width: 1024px) {
    .spread-counter-grid,
    .spread-laminage-grid,
    .spread-tempering-grid,
    .spread-cristallisation-grid,
    .spread-service-grid {
        grid-template-columns: 1fr 1fr;
    }

    .panel-specimen,
    .panel-steps-note,
    .panel-sugar-stages,
    .panel-archive-index {
        grid-column: 1 / -1;
    }

    #site-nav {
        padding: 16px 24px;
    }

    .nav-links {
        gap: 20px;
    }

    .spread-grid {
        padding: 88px 24px 32px;
    }
}

@media (max-width: 768px) {
    .spread-counter-grid,
    .spread-laminage-grid,
    .spread-tempering-grid,
    .spread-cristallisation-grid,
    .spread-service-grid {
        grid-template-columns: 1fr;
    }

    .spread { min-height: 100vh; }

    .spread-headline {
        font-size: clamp(48px, 12vw, 80px);
    }

    .nav-links {
        display: none;
    }

    .ingredients-grid {
        grid-template-columns: 1fr;
    }
}
