/* ================================================
   mechanic.monster - styles.css
   Heritage Workshop Manual / Bento-Box Grid
   ================================================ */

:root {
    /* Palette from DESIGN.md */
    --primary-gold: #D4A843;
    --deep-black: #0E0C08;
    --workshop-dark: #1A1610;
    --patina-bronze: #8B7D5E;
    --kraft-cream: #C8B89A;
    --rust-accent: #A0522D;
    --gutter-black: #121008;
    --highlight-gold: #F2C94C;
    --dark-leather: #2A2418;
    --workshop-brown: #3D3528;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Serif 4', serif;
    background-color: var(--gutter-black);
    color: var(--kraft-cream);
    line-height: 1.65;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Page grain overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ================================================
   BENTO GRID SYSTEM
   ================================================ */

.bento-cluster {
    display: grid;
    gap: 2px;
    max-width: 1100px;
    margin: 2px auto;
    padding: 0;
    background: var(--gutter-black);
}

/* ── Hero Cluster: 4-column bento ── */
.hero-cluster {
    grid-template-columns: 3fr 1fr 1fr 1fr;
    grid-template-rows: auto auto auto;
}

.hero-title-cell {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 50vh;
    padding: 3rem;
}

.hero-component-cell {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.2rem;
}

.hero-info-cell {
    grid-column: 2 / 4;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--dark-leather);
}

.hero-intro-cell {
    grid-column: 4 / 5;
    grid-row: 3 / 4;
    padding: 1.5rem;
}

/* ── Inventory Cluster: 5-column bento ── */
.inventory-cluster {
    grid-template-columns: repeat(5, 1fr);
}

/* ── Divider Cluster: 3-column ── */
.divider-cluster {
    grid-template-columns: repeat(3, 1fr);
}

/* ── Panorama Cluster: single wide cell ── */
.panorama-cluster {
    grid-template-columns: 1fr;
}

/* ── Notes Cluster: 3-column with mixed sizes ── */
.notes-cluster {
    grid-template-columns: 2fr 1fr 2fr;
    grid-template-rows: auto auto;
}

.notes-text-wide {
    grid-column: 1 / 3;
}

/* ── Gallery Cluster: 4-column ── */
.gallery-cluster {
    grid-template-columns: repeat(4, 1fr);
}

.gallery-cell-wide {
    grid-column: span 2;
}

/* ── Closing Cluster: 4-column ── */
.closing-cluster {
    grid-template-columns: 2fr 2fr 1fr 1fr;
    margin-bottom: 2px;
}

.closing-engine-cell {
    grid-row: span 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.closing-stamp-cell {
    grid-column: 3 / 5;
    text-align: center;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* ================================================
   BENTO CELL BASE
   ================================================ */

.bento-cell {
    background: var(--deep-black);
    padding: 1.8rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    border: 1px solid var(--dark-leather);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    /* Scale-hover transition */
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                border-color 0.3s ease;
    transform-origin: center center;
}

/* Layered depth: bottom-right edge highlight */
.bento-cell::before {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border-right: 1px solid var(--workshop-brown);
    border-bottom: 1px solid var(--workshop-brown);
    pointer-events: none;
}

/* Grain overlay on cells */
.bento-cell::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.08;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
}

/* Scale-hover interaction */
.bento-cell:hover {
    transform: scale(1.06);
    border-color: var(--primary-gold);
    z-index: 10;
}

/* ================================================
   TYPOGRAPHY
   ================================================ */

/* Headlines / Display - Archivo Black */
.hero-title {
    font-family: 'Archivo Black', sans-serif;
    font-size: clamp(2rem, 5vw, 4.5rem);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--kraft-cream);
    line-height: 1.1;
    /* Debossed metal stamp effect */
    text-shadow:
        0 -1px 1px rgba(0, 0, 0, 0.8),
        0 1px 0 rgba(200, 184, 154, 0.15);
}

.hero-title-sub {
    font-size: clamp(1.5rem, 4vw, 3.5rem);
    color: var(--primary-gold);
    margin-top: 0.1em;
}

.section-heading {
    font-family: 'Archivo Black', sans-serif;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--primary-gold);
    margin-bottom: 1rem;
    text-shadow:
        0 -1px 1px rgba(0, 0, 0, 0.6),
        0 1px 0 rgba(212, 168, 67, 0.1);
}

/* Body / Reading - Source Serif 4 */
.body-text {
    font-family: 'Source Serif 4', serif;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    font-weight: 400;
    color: var(--kraft-cream);
    line-height: 1.65;
}

/* Labels / Annotations - IBM Plex Mono */
.mono-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    font-weight: 400;
    color: var(--patina-bronze);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.mono-value {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    font-weight: 500;
    color: var(--highlight-gold);
    letter-spacing: 0.05em;
}

/* SVG Callout text */
.svg-callout {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    fill: var(--patina-bronze);
    letter-spacing: 0.05em;
}

/* Pull quotes */
.pull-quote {
    font-family: 'Archivo Black', sans-serif;
    font-size: clamp(1rem, 1.8vw, 1.4rem);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--primary-gold);
    line-height: 1.4;
    border: none;
    padding: 0;
    margin: 0;
    quotes: none;
}

/* ================================================
   INVENTORY CELLS
   ================================================ */

.inventory-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 1.5rem 1rem;
    text-align: center;
}

.inventory-icon {
    width: 48px;
    height: 48px;
}

.inventory-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.65rem, 0.8vw, 0.78rem);
    font-weight: 500;
    color: var(--kraft-cream);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.inventory-count {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.6rem;
    color: var(--patina-bronze);
    letter-spacing: 0.08em;
}

/* ================================================
   DIVIDER / CHAIN CELLS
   ================================================ */

.chain-cell {
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--workshop-dark);
}

.chain-svg {
    width: 100%;
    height: 40px;
}

/* ================================================
   PANORAMA SECTION
   ================================================ */

.panorama-cell {
    padding: 2rem;
    overflow-x: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panorama-svg {
    width: 100%;
    max-width: 900px;
    height: auto;
}

/* Panorama labels start hidden for scroll animation */
.panorama-label {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.panorama-label.label-visible {
    opacity: 1;
}

/* ================================================
   NOTES SECTION
   ================================================ */

.notes-text-cell {
    padding: 2rem;
}

.notes-quote-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    background: var(--workshop-dark);
}

/* ================================================
   GALLERY SECTION
   ================================================ */

.gallery-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.gallery-svg {
    width: 100%;
    height: auto;
}

.component-svg {
    width: 100%;
    height: auto;
    max-width: 160px;
}

/* ================================================
   CLOSING SECTION
   ================================================ */

.closing-svg {
    width: 100%;
    max-width: 260px;
    height: auto;
}

.closing-text-cell {
    padding: 2.5rem 2rem;
}

.closing-meta-cell {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    justify-content: center;
    background: var(--dark-leather);
}

.meta-row {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.closing-stamp {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    color: var(--patina-bronze);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.closing-tagline {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: var(--primary-gold);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-top: 0.8rem;
    opacity: 0.8;
}

/* ================================================
   SCROLL REVEAL ANIMATION
   ================================================ */

.bento-cell {
    opacity: 0;
    transform: translateY(12px) scale(1);
    transition: opacity 0.4s ease,
                transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                border-color 0.3s ease;
}

.bento-cell.cell-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.bento-cell.cell-visible:hover {
    transform: scale(1.06);
    border-color: var(--primary-gold);
}

/* ================================================
   RESPONSIVE
   ================================================ */

@media (max-width: 900px) {
    .hero-cluster {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }

    .hero-title-cell {
        grid-column: 1 / 3;
        grid-row: auto;
        min-height: 30vh;
    }

    .hero-component-cell {
        aspect-ratio: 1 / 1;
    }

    .hero-info-cell {
        grid-column: 1 / 3;
    }

    .hero-intro-cell {
        grid-column: 1 / 3;
    }

    .inventory-cluster {
        grid-template-columns: repeat(3, 1fr);
    }

    .notes-cluster {
        grid-template-columns: 1fr 1fr;
    }

    .notes-text-wide {
        grid-column: 1 / 3;
    }

    .gallery-cluster {
        grid-template-columns: repeat(2, 1fr);
    }

    .gallery-cell-wide {
        grid-column: span 2;
    }

    .closing-cluster {
        grid-template-columns: 1fr 1fr;
    }

    .closing-engine-cell {
        grid-row: span 1;
    }

    .closing-stamp-cell {
        grid-column: 1 / 3;
    }
}

@media (max-width: 600px) {
    .hero-cluster {
        grid-template-columns: 1fr;
    }

    .hero-title-cell {
        grid-column: 1;
        min-height: 25vh;
    }

    .hero-component-cell {
        aspect-ratio: auto;
        padding: 2rem;
    }

    .hero-info-cell {
        grid-column: 1;
        flex-direction: column;
        align-items: flex-start;
    }

    .hero-intro-cell {
        grid-column: 1;
    }

    .inventory-cluster {
        grid-template-columns: 1fr 1fr;
    }

    .divider-cluster {
        grid-template-columns: 1fr;
    }

    .panorama-cell {
        padding: 1rem;
    }

    .notes-cluster {
        grid-template-columns: 1fr;
    }

    .notes-text-wide {
        grid-column: 1;
    }

    .gallery-cluster {
        grid-template-columns: 1fr;
    }

    .gallery-cell-wide {
        grid-column: span 1;
    }

    .closing-cluster {
        grid-template-columns: 1fr;
    }

    .closing-engine-cell {
        grid-row: auto;
    }

    .closing-stamp-cell {
        grid-column: 1;
    }

    .bento-cell {
        padding: 1.2rem;
    }

    .component-svg {
        max-width: 120px;
    }
}
