/* ============================
   tanso.day - CSS
   Mid-century Japanese carbon chemistry journal aesthetic
   ============================ */

/* --- Custom Properties --- */
:root {
    --color-vellum: #F5F0E6;
    --color-parchment: #EDE4D3;
    --color-carbon: #2C2A26;
    --color-soot: #5C5850;
    --color-fern: #4A6741;
    --color-amber: #C4873B;
    --color-charcoal: #3B3833;
    --color-cream: #D9CEBC;
    --color-gold: #B8963E;
    --color-ink: #1A1916;
}

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

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

body {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    color: var(--color-carbon);
    background-color: var(--color-vellum);
    overflow-x: hidden;
    position: relative;
}

/* --- Paper grain overlay --- */
.paper-grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
}

/* --- SVG Defs (hidden) --- */
.svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Hexagonal molecular watermarks --- */
.hex-watermark {
    position: absolute;
    opacity: 0.05;
    pointer-events: none;
    z-index: 0;
}

.hex-watermark--hero {
    width: 400px;
    height: 400px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.hex-watermark--section2 {
    width: 500px;
    height: 500px;
    top: 10%;
    right: -5%;
}

/* --- Section number background --- */
.section-number {
    font-family: 'Roboto Slab', serif;
    font-weight: 900;
    font-size: 12rem;
    opacity: 0.08;
    color: var(--color-carbon);
    position: absolute;
    top: 5%;
    left: -2%;
    line-height: 1;
    pointer-events: none;
    z-index: 0;
    user-select: none;
}

/* --- Section divider (amber glow) --- */
.section-divider {
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--color-ink) 0%, var(--color-amber) 50%, var(--color-ink) 100%);
    margin: 0;
}

/* --- Tapered horizontal rule --- */
.tapered-rule {
    display: block;
    width: 80%;
    max-width: 600px;
    height: 6px;
    margin: 2rem auto;
}

/* --- Floral rosette --- */
.floral-rosette {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin: 1.5rem 0;
    position: relative;
}

.floral-rosette::before {
    content: '';
    display: block;
    width: 16px;
    height: 16px;
    border: 1px solid var(--color-gold);
    border-radius: 50%;
    background: radial-gradient(circle, var(--color-gold) 25%, transparent 25%);
}

/* --- Typography --- */
.site-title {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: 0.02em;
    color: var(--color-vellum);
    line-height: 1.1;
    position: relative;
    z-index: 2;
}

.section-heading {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: clamp(2.4rem, 5.5vw, 4.8rem);
    letter-spacing: 0.02em;
    color: var(--color-carbon);
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 2;
}

.section-heading--centered {
    text-align: center;
}

.section-subtitle {
    font-family: 'Source Serif 4', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    color: var(--color-soot);
    text-align: center;
    margin-bottom: 4rem;
    max-width: 58ch;
    margin-left: auto;
    margin-right: auto;
}

.epigraph {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    color: var(--color-cream);
    margin-top: 2rem;
    position: relative;
    z-index: 2;
    line-height: 1.6;
}

.epigraph__jp {
    font-style: normal;
    font-family: 'Source Serif 4', serif;
    font-size: 0.9em;
    display: block;
    margin-bottom: 0.5rem;
    opacity: 0.7;
}

.body-text {
    font-family: 'Source Serif 4', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    color: var(--color-carbon);
    max-width: 58ch;
    margin-bottom: 1rem;
    position: relative;
    z-index: 2;
}

.body-text em {
    font-weight: 600;
    font-style: italic;
}

.annotation {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    color: var(--color-soot);
    display: block;
    margin-top: 2rem;
    position: relative;
    z-index: 2;
}

/* ========================
   ROW 1: OPENING (0-100vh)
   ======================== */
.row-1 {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--color-charcoal) 0%, var(--color-soot) 40%, var(--color-cream) 100%);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.row-1__content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "left right";
    max-width: 1140px;
    width: 100%;
    margin: 0 auto;
    padding: 8vh 0;
    padding-left: 8%;
    padding-right: 12%;
    gap: 3rem;
    align-items: center;
    min-height: 80vh;
}

.row-1__left {
    grid-area: left;
    position: relative;
    z-index: 2;
}

.row-1__right {
    grid-area: right;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 2;
}

.row-1 .section-number {
    color: var(--color-vellum);
    opacity: 0.06;
    font-size: 18rem;
    top: -10%;
    left: -5%;
}

/* Botanical leaf SVG */
.botanical-leaf {
    width: 100%;
    max-width: 300px;
    height: auto;
}

/* SVG path drawing animation */
.leaf-draw .leaf-outline {
    stroke-dasharray: 1500;
    stroke-dashoffset: 1500;
    transition: stroke-dashoffset 2.5s ease-out;
}

.leaf-draw .leaf-vein-main {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 2s ease-out 0.5s;
}

.leaf-draw .leaf-vein {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 1.8s ease-out 1s;
}

.leaf-draw.animate .leaf-outline {
    stroke-dashoffset: 0;
}

.leaf-draw.animate .leaf-vein-main {
    stroke-dashoffset: 0;
}

.leaf-draw.animate .leaf-vein {
    stroke-dashoffset: 0;
}

/* ========================
   ROW 2: FIRST Z-SWEEP (100vh-200vh)
   ======================== */
.row-2 {
    min-height: 100vh;
    background: radial-gradient(ellipse at 30% 20%, var(--color-vellum) 0%, var(--color-parchment) 100%);
    position: relative;
    padding: 8vh 0;
    overflow: hidden;
}

.row-2__content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "left right";
    max-width: 1140px;
    width: 100%;
    margin: 0 auto;
    padding-left: 8%;
    padding-right: 12%;
    gap: 4rem;
    align-items: start;
}

.row-2__left {
    grid-area: left;
    position: relative;
    z-index: 2;
}

.row-2__right {
    grid-area: right;
    position: relative;
    z-index: 2;
}

/* Vintage photograph treatment */
.vintage-photo {
    position: relative;
    border-radius: 4px;
    border: 1px solid var(--color-gold);
    box-shadow: 2px 4px 12px rgba(26, 25, 22, 0.15);
    overflow: hidden;
    background: var(--color-charcoal);
}

.vintage-photo__image {
    filter: sepia(0.3) saturate(0.85) contrast(1.05);
    display: block;
}

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

.vintage-photo__halftone {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-radial-gradient(circle, var(--color-carbon) 0.5px, transparent 0.5px);
    background-size: 3px 3px;
    opacity: 0.08;
    z-index: 1;
    pointer-events: none;
}

.vintage-photo__caption {
    display: block;
    padding: 0.75rem 1rem;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    color: var(--color-soot);
    background: var(--color-vellum);
    border-top: 1px solid var(--color-gold);
}

/* ========================
   ROW 3: SPECIMEN GALLERY (200vh-300vh)
   ======================== */
.row-3 {
    min-height: 100vh;
    background: var(--color-vellum);
    position: relative;
    padding: 8vh 0;
    overflow: hidden;
}

.row-3 .section-heading {
    padding-top: 2rem;
}

.specimen-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
    max-width: 1140px;
    width: 100%;
    margin: 0 auto;
    padding-left: 8%;
    padding-right: 12%;
}

.specimen-card {
    background: radial-gradient(ellipse at 30% 20%, var(--color-vellum) 0%, var(--color-parchment) 100%);
    border: 1px solid var(--color-gold);
    border-radius: 4px;
    padding: 2rem 1.5rem;
    box-shadow: 2px 4px 12px rgba(26, 25, 22, 0.10);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: default;
    position: relative;
    z-index: 2;
}

.specimen-card:hover {
    transform: translateY(-6px);
    box-shadow: 4px 8px 20px rgba(26, 25, 22, 0.20);
}

.specimen-card__illustration {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
}

.specimen-card__illustration svg {
    width: 120px;
    height: auto;
}

.specimen-card__info {
    text-align: center;
}

.specimen-card__number {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: var(--color-gold);
    display: block;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.specimen-card__name {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--color-carbon);
    margin-bottom: 0.3rem;
    letter-spacing: 0.01em;
}

.specimen-card__detail {
    font-family: 'Source Serif 4', serif;
    font-style: italic;
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--color-soot);
    display: block;
    margin-bottom: 0.5rem;
}

.specimen-card__carbon {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--color-fern);
    display: block;
}

/* ========================
   ROW 4: CLOSING STUDY (300vh-end)
   ======================== */
.row-4 {
    min-height: 80vh;
    background: var(--color-charcoal);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.row-4__content {
    max-width: 1140px;
    width: 100%;
    margin: 0 auto;
    padding: 8vh 8% 8vh 8%;
    text-align: center;
    position: relative;
}

.botanical-leaf--closing {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 250px;
    opacity: 0.08;
    pointer-events: none;
}

.closing-text {
    position: relative;
    z-index: 2;
    max-width: 58ch;
    margin: 0 auto 3rem;
}

.closing-heading {
    font-family: 'Roboto Slab', serif;
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3.5rem);
    letter-spacing: 0.02em;
    color: var(--color-vellum);
    margin-bottom: 2rem;
}

.closing-body {
    font-family: 'Source Serif 4', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    color: var(--color-cream);
    margin-bottom: 1.5rem;
}

.closing-body em {
    font-weight: 600;
    font-style: italic;
    color: var(--color-gold);
}

.colophon {
    position: relative;
    z-index: 2;
    padding-top: 3rem;
    border-top: 1px solid rgba(217, 206, 188, 0.15);
}

.colophon__line {
    display: block;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--color-soot);
    line-height: 2;
}

/* ========================
   ANIMATIONS
   ======================== */

/* Fade-in on scroll */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ========================
   RESPONSIVE
   ======================== */
@media (max-width: 900px) {
    .row-1__content {
        grid-template-columns: 1fr;
        grid-template-areas:
            "left"
            "right";
        padding-left: 6%;
        padding-right: 6%;
        min-height: auto;
        padding-top: 12vh;
        padding-bottom: 6vh;
    }

    .row-1__right {
        max-width: 200px;
        margin: 0 auto;
    }

    .row-2__content {
        grid-template-columns: 1fr;
        grid-template-areas:
            "left"
            "right";
        padding-left: 6%;
        padding-right: 6%;
        gap: 2.5rem;
    }

    .specimen-grid {
        grid-template-columns: 1fr;
        padding-left: 6%;
        padding-right: 6%;
    }

    .section-number {
        font-size: 6rem;
    }

    .row-1 .section-number {
        font-size: 10rem;
    }

    .hex-watermark--hero {
        width: 250px;
        height: 250px;
    }

    .hex-watermark--section2 {
        width: 300px;
        height: 300px;
    }
}

@media (max-width: 600px) {
    .site-title {
        font-size: clamp(2.5rem, 12vw, 4rem);
    }

    .epigraph {
        font-size: clamp(1.1rem, 4vw, 1.5rem);
    }

    .section-heading {
        font-size: clamp(1.8rem, 6vw, 2.8rem);
    }

    .row-4__content {
        padding: 6vh 6%;
    }
}
