/* =================================================================
   STORIOGRAPHER.COM - STYLES
   Grainy-Textured, Broken-Grid Layout, Cool Grays Palette
   ================================================================= */

/* ===== CSS RESET AND VARIABLES ===== */

:root {
    /* Palette - Cool Grays with Warm Accents */
    --color-ash-paper: #eceae6;
    --color-charcoal: #2c2c34;
    --color-slate: #7b7b8a;
    --color-graphite: #5a5a6e;
    --color-foxed-amber: #b8956a;
    --color-dusty-rose: #a3787e;
    --color-ink-well: #1e1e28;
    --color-parchment-mist: #f5f3ef;
    --color-light-amber: #d4b088;

    /* Typography */
    --font-display: 'Cormorant Garamond', serif;
    --font-body: 'Source Serif 4', serif;
    --font-caption: 'Inter', sans-serif;

    /* Sizing & Spacing */
    --hero-title-size: clamp(2.6rem, 6.5vw, 5.2rem);
    --section-title-size: clamp(1.5rem, 3vw, 2.6rem);
    --body-text-size: clamp(1rem, 1.1vw, 1.15rem);
    --caption-size: clamp(0.7rem, 0.85vw, 0.8rem);

    /* Spacing */
    --plate-spacing: clamp(6rem, 12vh, 10rem);
    --element-offset: clamp(-1rem, -1vw, -0.5rem);

    /* Grid */
    --grid-cols: [gutter-start] 1fr [content-start] repeat(6, minmax(0, 120px)) [content-end] 1fr [gutter-end];
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-ash-paper);
    color: var(--color-charcoal);
    line-height: 1.72;
    letter-spacing: 0.01em;
    font-size: var(--body-text-size);
    position: relative;
}

/* ===== GRAIN OVERLAY - PRIMARY VISUAL IDENTITY ===== */

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"><defs><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.75" numOctaves="4" result="noise"/><feColorMatrix in="noise" type="saturate" values="0"/></filter></defs><rect width="200" height="200" fill="rgba(0,0,0,0.5)" filter="url(%23noise)"/></svg>');
    background-size: 200px 200px;
    opacity: 0.06;
    mix-blend-mode: multiply;
    z-index: 1000;
}

/* ===== PROGRESS BAR ===== */

.progress-bar {
    position: fixed;
    left: 0;
    top: 0;
    width: 2px;
    height: 0%;
    background-color: var(--color-graphite);
    z-index: 999;
    transition: height 0.1s linear;
}

/* ===== NAVIGATION ===== */

.site-nav {
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: 100;
    font-family: var(--font-caption);
    letter-spacing: 0.08em;
}

.domain-name {
    font-size: clamp(0.6rem, 0.8vw, 0.75rem);
    color: var(--color-graphite);
    text-transform: uppercase;
    font-weight: 500;
}

/* ===== HERO SECTION ===== */

.hero {
    height: 100vh;
    position: relative;
    display: grid;
    grid-template-columns: var(--grid-cols);
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    overflow: hidden;
}

.hero-content {
    grid-column: gutter-start / content-end;
    position: relative;
    z-index: 10;
}

.hero-title {
    font-family: var(--font-display);
    font-size: var(--hero-title-size);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: 0.12em;
    color: var(--color-charcoal);
    margin-bottom: 1rem;
    opacity: 0;
    transform: translateY(12px);
    animation: fadeInDrift 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 400ms;
}

.hero-subtitle {
    font-family: var(--font-caption);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-slate);
    opacity: 0;
    transform: translateY(12px);
    animation: fadeInDrift 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 600ms;
}

.hero-image {
    grid-column: content-end / gutter-end;
    position: relative;
    height: 80vh;
    overflow: hidden;
    animation: fadeInDrift 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 2500ms;
}

.story-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: rotate(-1.5deg);
    position: relative;
}

.hero-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"><defs><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.75" numOctaves="4" result="noise"/><feColorMatrix in="noise" type="saturate" values="0"/></filter></defs><rect width="200" height="200" fill="rgba(0,0,0,0.5)" filter="url(%23noise)"/></svg>');
    background-size: 200px 200px;
    opacity: 0.12;
    mix-blend-mode: multiply;
    pointer-events: none;
    z-index: 5;
}

.hero-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    clip-path: polygon(
        0 2px, 2px 0, 98% 0, 100% 2px, 100% 98%, 98% 100%, 2% 100%, 0 98%,
        0.5% 3%, 3% 0.5%, 97% 0.5%, 99.5% 3%, 99.5% 97%, 97% 99.5%, 3% 99.5%, 0.5% 97%
    );
    border: 1px solid transparent;
    pointer-events: none;
}

/* ===== STORY PLATES ===== */

.story-plate {
    position: relative;
    padding: 6rem 2rem;
    display: grid;
    grid-template-columns: var(--grid-cols);
    gap: 2rem;
    min-height: 80vh;
    align-content: center;
}

.story-plate + .story-plate {
    margin-top: var(--plate-spacing);
}

.story-plate::before {
    content: '';
    position: absolute;
    top: calc(-1 * var(--plate-spacing) / 2);
    left: 0;
    right: 0;
    height: var(--plate-spacing);
    background: linear-gradient(to bottom, transparent, var(--color-ash-paper));
    background-image:
        url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"><defs><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.75" numOctaves="4" result="noise"/><feColorMatrix in="noise" type="saturate" values="0"/></filter></defs><rect width="200" height="200" fill="rgba(0,0,0,0.5)" filter="url(%23noise)"/></svg>');
    background-size: 200px 200px;
    opacity: 0.04;
    mix-blend-mode: multiply;
    pointer-events: none;
    z-index: 0;
}

.light-plate {
    background-color: var(--color-ash-paper);
    color: var(--color-charcoal);
}

.dark-plate {
    background-color: var(--color-ink-well);
    color: var(--color-parchment-mist);
    position: relative;
}

.dark-plate::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"><defs><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.75" numOctaves="4" result="noise"/><feColorMatrix in="noise" type="saturate" values="0"/></filter></defs><rect width="200" height="200" fill="rgba(255,255,255,0.5)" filter="url(%23noise)"/></svg>');
    background-size: 200px 200px;
    opacity: 0.08;
    mix-blend-mode: screen;
    pointer-events: none;
    z-index: 1;
}

.plate-grid {
    grid-column: gutter-start / gutter-end;
    display: grid;
    grid-template-columns: inherit;
    gap: 2rem;
    position: relative;
    z-index: 2;
}

/* ===== STORY BLOCKS & CONTENT ===== */

.story-block {
    grid-column: content-start / span 4;
    opacity: 0;
    transform: translateY(30px);
}

.story-block-centered {
    grid-column: content-start / span 6;
    text-align: center;
}

.story-text-centered {
    max-width: 38em;
    margin-left: auto;
    margin-right: auto;
}

.story-block.visible {
    animation: liftIn 700ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.story-title {
    font-family: var(--font-display);
    font-size: var(--section-title-size);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: 0.02em;
    color: var(--color-charcoal);
    margin-bottom: 1.5rem;
    position: relative;
}

.dark-plate .story-title {
    color: var(--color-parchment-mist);
}

.story-text {
    max-width: 38em;
    margin-bottom: 1.5rem;
    line-height: 1.72;
}

.story-text.visible {
    animation: inherit;
}

/* ===== PULL QUOTES ===== */

.pull-quote {
    position: relative;
    margin: 3rem 0;
    padding: 2rem;
    background-color: var(--color-parchment-mist);
    border-left: 4px solid var(--color-graphite);
    max-width: 38em;
}

.dark-plate .pull-quote {
    background-color: rgba(44, 44, 52, 0.3);
    border-left-color: var(--color-light-amber);
}

.pull-quote::before {
    content: '"';
    position: absolute;
    font-family: var(--font-display);
    font-size: 8rem;
    color: var(--color-foxed-amber);
    opacity: 0.15;
    top: -1rem;
    left: -1rem;
    line-height: 1;
}

.pull-quote p {
    font-size: var(--section-title-size);
    line-height: 1.4;
    margin-bottom: 1rem;
    font-style: italic;
}

.quote-attribution {
    display: block;
    font-family: var(--font-caption);
    font-size: var(--caption-size);
    color: var(--color-slate);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.dark-plate .quote-attribution {
    color: var(--color-light-amber);
}

/* ===== IMAGE BLOCKS ===== */

.story-image-block {
    grid-column: span 3;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.image-container {
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.97);
    border-radius: 2px;
}

.image-container.visible {
    animation: imageResolve 900ms cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.image-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"><defs><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.75" numOctaves="4" result="noise"/><feColorMatrix in="noise" type="saturate" values="0"/></filter></defs><rect width="200" height="200" fill="rgba(0,0,0,0.5)" filter="url(%23noise)"/></svg>');
    background-size: 200px 200px;
    opacity: 0.12;
    mix-blend-mode: multiply;
    pointer-events: none;
    z-index: 3;
}

.image-container.with-frame {
    border: 0.5px solid var(--color-graphite);
    box-shadow: inset 6px 6px 0 0 transparent;
    position: relative;
}

.image-container.with-frame::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    bottom: 6px;
    border: 0.5px solid var(--color-graphite);
    pointer-events: none;
    z-index: 2;
}

.image-container:hover {
    cursor: pointer;
}

.image-container:hover::before {
    opacity: 0.04;
    transition: opacity 800ms ease;
}

.story-photo {
    width: 100%;
    display: block;
}

figcaption {
    font-family: var(--font-caption);
    font-size: var(--caption-size);
    color: var(--color-slate);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
}

.dark-plate figcaption {
    color: var(--color-light-amber);
}

/* ===== IMAGE SCATTER ===== */

.image-scatter {
    grid-column: span 2;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
}

.scattered-image {
    margin: 0;
    opacity: 0;
    transform: scale(0.95) rotate(-3deg);
}

.scattered-image:nth-child(1) {
    animation: liftIn 700ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 100ms;
}

.scattered-image:nth-child(2) {
    animation: liftIn 700ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 200ms;
}

.scattered-image .story-photo.small {
    width: 100%;
    aspect-ratio: 1;
}

.scattered-image::before {
    display: none;
}

/* ===== DIVIDER SECTION ===== */

.divider-section {
    padding: 4rem 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: auto;
}

.section-divider {
    width: 40%;
    height: 40px;
    color: var(--color-graphite);
    opacity: 0;
    animation: drawIn 1.5s ease-out forwards;
    animation-delay: 300ms;
}

.dark-plate + .divider-section {
    background: linear-gradient(to bottom, var(--color-ink-well), var(--color-ash-paper));
}

/* ===== UTILITY CLASSES ===== */

.final-plate {
    padding-bottom: 10rem;
}

.closing-line {
    font-style: italic;
    color: var(--color-foxed-amber);
    margin-top: 2rem;
}

.dark-plate .closing-line {
    color: var(--color-light-amber);
}

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

@keyframes fadeInDrift {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes liftIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes imageResolve {
    from {
        opacity: 0;
        transform: scale(0.97);
    }
    to {
        opacity: 1;
        transform: scale(1.0);
    }
}

@keyframes drawIn {
    from {
        opacity: 0;
        stroke-dasharray: 500;
        stroke-dashoffset: 500;
    }
    to {
        opacity: 1;
        stroke-dasharray: 500;
        stroke-dashoffset: 0;
    }
}

/* ===== HOVER EFFECTS ===== */

.story-block {
    transition: all 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

.story-block:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 24px rgba(44, 44, 52, 0.08);
}

a {
    color: var(--color-foxed-amber);
    text-decoration: none;
    position: relative;
    transition: all 500ms cubic-bezier(0.22, 1, 0.36, 1);
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--color-foxed-amber);
    transition: width 400ms ease;
}

a:hover::after {
    width: 100%;
}

.dark-plate a {
    color: var(--color-light-amber);
}

.dark-plate a::after {
    background-color: var(--color-light-amber);
}

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

@media (max-width: 1200px) {
    :root {
        --grid-cols: [gutter-start] 0.5fr [content-start] repeat(6, 1fr) [content-end] 0.5fr [gutter-end];
    }

    .hero {
        flex-direction: column;
        grid-template-columns: 1fr;
        height: auto;
        min-height: 100vh;
    }

    .hero-content {
        grid-column: 1;
        padding: 4rem 0 0 0;
    }

    .hero-image {
        grid-column: 1;
        height: 60vh;
        margin-top: 2rem;
    }

    .story-image-block {
        grid-column: span 6;
    }

    .image-scatter {
        grid-column: span 6;
        flex-direction: row;
    }

    .scattered-image {
        flex: 1;
    }
}

@media (max-width: 768px) {
    :root {
        --hero-title-size: clamp(1.8rem, 5vw, 2.8rem);
        --section-title-size: clamp(1.2rem, 2.5vw, 1.8rem);
        --body-text-size: clamp(0.95rem, 1vw, 1rem);
        --plate-spacing: clamp(4rem, 10vh, 6rem);
    }

    .site-nav {
        top: 1rem;
        left: 1rem;
    }

    .story-plate {
        padding: 4rem 1.5rem;
        grid-template-columns: 1fr;
    }

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

    .story-block {
        grid-column: 1 !important;
    }

    .story-image-block {
        grid-column: 1 !important;
    }

    .image-scatter {
        grid-column: 1 !important;
        flex-direction: column;
    }

    .pull-quote {
        padding: 1.5rem;
        margin: 2rem 0;
    }

    .pull-quote::before {
        font-size: 4rem;
        top: -0.5rem;
        left: -0.5rem;
    }

    .section-divider {
        width: 60%;
    }

    .hero-title {
        text-align: center;
    }

    .hero-subtitle {
        text-align: center;
    }
}

@media (max-width: 480px) {
    :root {
        --hero-title-size: clamp(1.4rem, 4vw, 2rem);
        --section-title-size: clamp(1rem, 2vw, 1.4rem);
        --body-text-size: clamp(0.9rem, 0.95vw, 0.95rem);
    }

    .site-nav {
        display: none;
    }

    .story-plate {
        padding: 2rem 1rem;
    }

    .pull-quote {
        padding: 1rem;
        margin: 1.5rem 0;
    }

    .pull-quote p {
        font-size: var(--section-title-size);
    }

    .section-divider {
        width: 80%;
    }
}

/* ===== PRINT STYLES ===== */

@media print {
    body::after {
        display: none;
    }

    .progress-bar,
    .site-nav {
        display: none;
    }

    .story-plate {
        page-break-inside: avoid;
        break-inside: avoid;
    }
}
