/* ==========================================================
   paragram.dev — Styles
   Mid-century warmth meets liquid typography
   ========================================================== */

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

:root {
    --aged-linen: #F5ECD7;
    --linen-white: #FAF3E8;
    --espresso-depth: #1E120A;
    --deep-cork: #3D2B1A;
    --burnt-teak: #5C3D1A;
    --clay-brown: #7A5C3A;
    --warm-umber: #8B6914;
    --amber-honey: #D4A017;
    --terracotta-fire: #C8553A;
    --bubble-fill: rgba(212, 160, 23, 0.12);
    --bubble-rim: #F5D78E;
    --depth-bottom: #E8D5B0;
}

html {
    scroll-behavior: smooth;
}

body {
    background: linear-gradient(to bottom, var(--aged-linen) 0%, var(--aged-linen) 70%, var(--depth-bottom) 85%, var(--espresso-depth) 95%);
    color: var(--deep-cork);
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw + 0.4rem, 1.15rem);
    line-height: 1.72;
    overflow-x: hidden;
    min-height: 600vh;
    position: relative;
}

/* --- Paper Grain Texture --- */
#paper-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg width='4' height='4' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='0' y='0' width='1' height='1' fill='%233D2B1A' opacity='0.5'/%3E%3Crect x='2' y='1' width='1' height='1' fill='%235C3D1A' opacity='0.3'/%3E%3Crect x='1' y='3' width='1' height='1' fill='%237A5C3A' opacity='0.4'/%3E%3Crect x='3' y='2' width='1' height='1' fill='%233D2B1A' opacity='0.2'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* --- Bubble Canvas --- */
#bubble-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* --- Flowing SVG Curves --- */
#svg-curves-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

#flowing-curves {
    width: 100%;
    height: 100%;
}

.flow-curve {
    fill: none;
    stroke: var(--warm-umber);
    stroke-width: 1.5;
    opacity: 0.18;
}

/* --- Kinetic Letter Animation --- */
@keyframes letterBob {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-3px);
    }
}

.kinetic-letter {
    display: inline-block;
    animation: letterBob 3.5s ease-in-out infinite;
}

/* --- General Section Styling --- */
.viewport-section {
    position: relative;
    z-index: 2;
}

/* --- Hero Section --- */
#hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.hero-title {
    position: relative;
}

#hero-heading {
    font-family: 'DM Serif Display', Georgia, serif;
    font-weight: 400;
    color: var(--burnt-teak);
    font-size: clamp(3rem, 10vw + 0.5rem, 8rem);
    line-height: 1.1;
    letter-spacing: -0.02em;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

#paragram-word {
    display: inline-flex;
}

#paragram-word .kinetic-letter {
    animation-name: letterBob;
}

.hero-tld {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: 0.4em;
    color: var(--clay-brown);
    letter-spacing: 0.08em;
    margin-top: -0.1em;
}

/* --- Modular Grid System --- */
.modular-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 32px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 40px;
}

/* --- Content Blocks --- */
.content-block {
    position: relative;
}

.primary-block {
    background: rgba(250, 243, 232, 0.95);
    border: 1px solid var(--warm-umber);
    padding: 40px 36px;
    border-radius: 2px;
    box-shadow: 0 4px 24px rgba(93, 61, 26, 0.08);
}

.block-label {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--warm-umber);
    display: block;
    margin-bottom: 16px;
}

.section-heading {
    font-family: 'DM Serif Display', Georgia, serif;
    font-weight: 400;
    font-size: clamp(2.5rem, 6vw + 0.5rem, 5.5rem);
    color: var(--burnt-teak);
    line-height: 1.15;
    margin-bottom: 24px;
}

.section-heading .kinetic-letter {
    display: inline-block;
}

.body-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw + 0.4rem, 1.15rem);
    line-height: 1.72;
    color: var(--deep-cork);
    margin-bottom: 16px;
}

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

.body-text em {
    font-style: italic;
    color: var(--burnt-teak);
}

.body-text code {
    font-family: 'Space Mono', monospace;
    font-size: 0.88em;
    color: var(--warm-umber);
    background: rgba(212, 160, 23, 0.08);
    padding: 2px 6px;
    border-radius: 2px;
}

/* --- Pull Quote --- */
.pull-quote {
    font-family: 'DM Serif Display', Georgia, serif;
    font-weight: 400;
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: var(--burnt-teak);
    line-height: 1.2;
    margin-bottom: 24px;
    display: block;
}

.pull-quote .kinetic-letter {
    display: inline-block;
}

.pull-quote .pq-of {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: 0.5em;
    color: var(--clay-brown);
    vertical-align: middle;
    margin: 0 4px;
}

/* --- Bubble Viewport Blocks --- */
.bubble-viewport-block {
    aspect-ratio: 4 / 3;
    background: transparent;
    border: 1px solid rgba(139, 105, 20, 0.2);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

/* --- Scroll Reveal --- */
.reveal-block {
    opacity: 0.3;
    transform: translateY(40px);
    transition: opacity 900ms cubic-bezier(0.22, 1, 0.36, 1), transform 900ms cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-block.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* --- Specimen Showcase --- */
#specimen-showcase {
    padding: 120px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.specimen-block {
    margin-bottom: 80px;
    padding: 60px 48px;
    border-radius: 2px;
    position: relative;
}

.specimen-block .block-label {
    margin-bottom: 20px;
}

.specimen-left {
    text-align: left;
    background: rgba(245, 236, 215, 0.6);
    margin-right: 20%;
}

.specimen-center {
    text-align: center;
    background: rgba(250, 243, 232, 0.5);
    margin-left: 10%;
    margin-right: 10%;
}

.specimen-right {
    text-align: right;
    background: rgba(232, 213, 176, 0.4);
    margin-left: 20%;
}

.specimen-text {
    font-family: 'DM Serif Display', Georgia, serif;
    font-weight: 400;
    font-size: clamp(4rem, 12vw, 9rem);
    color: var(--burnt-teak);
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.specimen-text .kinetic-letter {
    display: inline-block;
}

/* --- Pattern Gallery --- */
#pattern-gallery {
    padding: 80px 40px 120px;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-heading {
    margin-bottom: 60px;
    padding-left: 20px;
}

.pattern-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

.image-echo-block {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 2px;
    position: relative;
    overflow: hidden;
    transition: transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
    cursor: default;
}

.image-echo-block:hover {
    transform: scale(1.04);
}

/* Concentric Circles */
.pattern-concentric {
    background: var(--aged-linen);
}

.pattern-concentric::before,
.pattern-concentric::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.pattern-concentric::before {
    width: 80%;
    height: 80%;
    border: 3px solid rgba(200, 85, 58, 0.2);
    box-shadow:
        inset 0 0 0 20px transparent,
        inset 0 0 0 23px rgba(139, 105, 20, 0.2),
        inset 0 0 0 46px transparent,
        inset 0 0 0 49px rgba(200, 85, 58, 0.15),
        inset 0 0 0 72px transparent,
        inset 0 0 0 75px rgba(139, 105, 20, 0.15);
}

.pattern-concentric::after {
    width: 20%;
    height: 20%;
    background: rgba(200, 85, 58, 0.15);
}

/* Tessellated Diamonds */
.pattern-diamonds {
    background:
        linear-gradient(45deg, rgba(212, 160, 23, 0.12) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(212, 160, 23, 0.12) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(122, 92, 58, 0.1) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(122, 92, 58, 0.1) 75%);
    background-size: 40px 40px;
    background-position: 0 0, 0 20px, 20px -20px, -20px 0px;
    background-color: var(--aged-linen);
}

/* Intersecting Arcs */
.pattern-arcs {
    background: var(--aged-linen);
    overflow: hidden;
}

.pattern-arcs::before {
    content: '';
    position: absolute;
    width: 150%;
    height: 150%;
    top: -25%;
    left: -25%;
    background:
        radial-gradient(circle at 30% 30%, transparent 20%, rgba(139, 105, 20, 0.12) 20%, rgba(139, 105, 20, 0.12) 21%, transparent 21%),
        radial-gradient(circle at 70% 70%, transparent 25%, rgba(200, 85, 58, 0.1) 25%, rgba(200, 85, 58, 0.1) 26%, transparent 26%),
        radial-gradient(circle at 50% 10%, transparent 30%, rgba(212, 160, 23, 0.08) 30%, rgba(212, 160, 23, 0.08) 31%, transparent 31%);
}

.pattern-arcs::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60%;
    height: 60%;
    border-top-left-radius: 100%;
    border: 2px solid rgba(139, 105, 20, 0.15);
    border-right: none;
    border-bottom: none;
}

/* Concentric Alt */
.pattern-concentric-alt {
    background: rgba(232, 213, 176, 0.5);
}

.pattern-concentric-alt::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 10%;
    width: 80%;
    height: 80%;
    border-radius: 50%;
    border: 2px solid rgba(212, 160, 23, 0.2);
    box-shadow:
        inset 0 0 0 15px transparent,
        inset 0 0 0 17px rgba(200, 85, 58, 0.12),
        inset 0 0 0 32px transparent,
        inset 0 0 0 34px rgba(212, 160, 23, 0.1),
        inset 0 0 0 49px transparent,
        inset 0 0 0 51px rgba(122, 92, 58, 0.12);
}

.pattern-concentric-alt::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 15%;
    height: 15%;
    background: rgba(212, 160, 23, 0.2);
    border-radius: 50%;
}

/* Diamonds Alt */
.pattern-diamonds-alt {
    background:
        linear-gradient(60deg, rgba(200, 85, 58, 0.08) 25%, transparent 25%),
        linear-gradient(-60deg, rgba(200, 85, 58, 0.08) 25%, transparent 25%),
        linear-gradient(60deg, transparent 75%, rgba(212, 160, 23, 0.1) 75%),
        linear-gradient(-60deg, transparent 75%, rgba(212, 160, 23, 0.1) 75%);
    background-size: 48px 48px;
    background-position: 0 0, 0 24px, 24px -24px, -24px 0px;
    background-color: rgba(250, 243, 232, 0.8);
}

/* Arcs Alt */
.pattern-arcs-alt {
    background: rgba(245, 236, 215, 0.7);
    overflow: hidden;
}

.pattern-arcs-alt::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 50%;
    height: 50%;
    border-bottom-right-radius: 100%;
    border: 2px solid rgba(200, 85, 58, 0.15);
    border-left: none;
    border-top: none;
}

.pattern-arcs-alt::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 70%;
    height: 70%;
    border-top-left-radius: 100%;
    border: 2px solid rgba(139, 105, 20, 0.12);
    border-right: none;
    border-bottom: none;
}

/* --- Closing Section --- */
#closing {
    padding: 120px 40px 80px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.closing-content {
    text-align: center;
    max-width: 640px;
}

.colophon-block {
    background: rgba(30, 18, 10, 0.8);
    border: 1px solid rgba(245, 215, 142, 0.2);
    padding: 48px 40px;
    border-radius: 2px;
    margin-bottom: 80px;
}

.colophon-block .block-label {
    color: var(--bubble-rim);
}

.colophon-text {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    line-height: 1.7;
    color: var(--bubble-rim);
    margin-bottom: 24px;
}

.colophon-colors {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.color-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(245, 215, 142, 0.3);
    display: inline-block;
}

.fin-word {
    font-family: 'DM Serif Display', Georgia, serif;
    font-weight: 400;
    font-size: clamp(3rem, 8vw, 6rem);
    color: var(--bubble-rim);
    letter-spacing: -0.02em;
}

.fin-word .kinetic-letter {
    display: inline-block;
}

/* --- Bubble Navigation --- */
#nav-bubble {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(139, 105, 20, 0.6);
    border: 1.5px solid rgba(245, 215, 142, 0.4);
    cursor: pointer;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 300ms ease, transform 300ms ease;
    box-shadow: 0 4px 24px rgba(93, 61, 26, 0.15);
    overflow: hidden;
}

#nav-bubble:hover {
    background: rgba(139, 105, 20, 0.8);
    transform: scale(1.08);
}

.nav-bubble-highlight {
    position: absolute;
    top: 6px;
    left: 8px;
    width: 16px;
    height: 10px;
    border-radius: 50%;
    background: rgba(245, 215, 142, 0.35);
    transform: rotate(-30deg);
}

#nav-radial {
    position: fixed;
    bottom: 90px;
    right: 24px;
    z-index: 899;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-end;
    transition: opacity 300ms ease, transform 300ms ease;
}

#nav-radial.nav-hidden {
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
}

#nav-radial.nav-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.nav-anchor {
    font-family: 'DM Serif Display', Georgia, serif;
    font-size: 14px;
    color: var(--burnt-teak);
    text-decoration: none;
    background: rgba(250, 243, 232, 0.92);
    padding: 8px 16px;
    border-radius: 24px;
    border: 1px solid rgba(139, 105, 20, 0.25);
    transition: background 200ms ease, color 200ms ease;
    box-shadow: 0 2px 12px rgba(93, 61, 26, 0.1);
}

.nav-anchor:hover {
    background: var(--amber-honey);
    color: var(--linen-white);
}

/* --- prefers-reduced-motion --- */
@media (prefers-reduced-motion: reduce) {
    .kinetic-letter {
        animation: none;
    }
    .reveal-block {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .flow-curve {
        animation: none;
    }
    #bubble-canvas {
        display: none;
    }
}

/* --- Responsive: Tablet --- */
@media (max-width: 1200px) {
    .modular-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
        padding: 60px 32px;
    }

    .content-block,
    .bubble-viewport-block {
        grid-column: auto !important;
        grid-row: auto !important;
    }

    .pattern-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }

    .specimen-left,
    .specimen-center,
    .specimen-right {
        margin-left: 0;
        margin-right: 0;
    }
}

/* --- Responsive: Mobile --- */
@media (max-width: 768px) {
    .modular-grid {
        grid-template-columns: 1fr;
        padding: 40px 20px;
    }

    #specimen-showcase {
        padding: 60px 20px;
    }

    .specimen-block {
        padding: 40px 24px;
        margin-bottom: 48px;
    }

    .specimen-text {
        font-size: clamp(2.5rem, 14vw, 5rem);
    }

    .pattern-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    #pattern-gallery {
        padding: 40px 20px 80px;
    }

    #closing {
        padding: 80px 20px 60px;
    }

    .colophon-block {
        padding: 32px 24px;
    }

    #nav-bubble {
        bottom: 20px;
        right: 20px;
    }

    #nav-radial {
        bottom: 78px;
        right: 16px;
    }
}
