/* =========================================================
   PPUZZL.works — Cottagecore Glitch Botanical Archive
   Palette: #F2F4F5 #B8C4CC #6E8491 #2D3E47 #0F1C22 #E83547 #2B5CE8 #C8D9D0 #8A9BA8 #E8EDEF
   Type: Space Mono / IBM Plex Mono / Roboto Mono
   ========================================================= */

/* === Custom Properties === */
:root {
    --fog-white:     #F2F4F5;
    --pewter:        #B8C4CC;
    --slate:         #6E8491;
    --gunmetal:      #2D3E47;
    --deep-shadow:   #0F1C22;
    --glitch-red:    #E83547;
    --glitch-blue:   #2B5CE8;
    --bot-mist:      #C8D9D0;
    --mid-gray:      #8A9BA8;
    --light-hero:    #E8EDEF;

    --font-display:  'Space Mono', monospace;
    --font-body:     'IBM Plex Mono', monospace;
    --font-accent:   'Roboto Mono', monospace;

    --grid-gap:      24px;
    --grid-cols:     3;
}

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

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

body {
    background-color: var(--fog-white);
    color: var(--gunmetal);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.7;
    overflow-x: hidden;
}

/* === Noise Background Layer === */
.noise-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    opacity: 1;
    animation: noise-shift 8s linear infinite;
}

@keyframes noise-shift {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(1px, 0); }
    50%  { transform: translate(1px, 1px); }
    75%  { transform: translate(0, 1px); }
    100% { transform: translate(0, 0); }
}

/* === Navigation === */
.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 48px;
    border-bottom: 1px solid var(--pewter);
    background: transparent;
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 32px;
}

.nav-wordmark {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.12em;
    color: var(--gunmetal);
    text-transform: uppercase;
    transition: text-shadow 0.3s ease;
}

.nav-wordmark:hover {
    text-shadow: -2px 0 0 var(--glitch-red), 2px 0 0 var(--glitch-blue);
}

.nav-links {
    display: flex;
    gap: 32px;
    align-items: center;
}

.nav-link {
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: 12px;
    letter-spacing: 0.2em;
    color: var(--slate);
    text-decoration: none;
    text-transform: uppercase;
    transition: color 0.2s ease, text-shadow 0.3s ease;
}

.nav-link:hover {
    color: var(--gunmetal);
    text-shadow: -2px 0 0 var(--glitch-red), 2px 0 0 var(--glitch-blue);
}

/* === Hero === */
.hero {
    position: relative;
    width: 100vw;
    height: 70vh;
    min-height: 400px;
    background-color: var(--light-hero);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-top: 48px; /* nav height */
    overflow: hidden;
}

/* Hero noise grain */
.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1;
}

.hero-inner {
    position: relative;
    z-index: 2;
    padding: 0 48px;
    width: 100%;
}

/* Hero title — starts invisible for JS glitch-reveal */
.hero-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(10rem, 18vw, 22rem);
    line-height: 0.85;
    letter-spacing: -0.02em;
    color: transparent;
    text-transform: uppercase;
    display: block;
    user-select: none;
}

/* Glitch reveal states */
.hero-title.glitch-red {
    color: transparent;
    text-shadow: -6px 0 0 rgba(232, 53, 71, 0.7), 6px 0 0 rgba(43, 92, 232, 0.1);
}

.hero-title.glitch-blue {
    color: transparent;
    text-shadow: -6px 0 0 rgba(232, 53, 71, 0.4), 6px 0 0 rgba(43, 92, 232, 0.7);
}

.hero-title.revealed {
    color: var(--deep-shadow);
    text-shadow: -6px 0 0 rgba(232, 53, 71, 0.7), 6px 0 0 rgba(43, 92, 232, 0.7);
}

/* Hairline rule under hero title */
.hero-rule {
    height: 1px;
    background: var(--pewter);
    margin-top: 24px;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 400ms ease;
}

.hero-rule.expanded {
    transform: scaleX(1);
}

.hero-meta {
    display: flex;
    gap: 48px;
    margin-top: 20px;
}

.hero-label {
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: 11px;
    letter-spacing: 0.2em;
    color: var(--slate);
    text-transform: uppercase;
}

/* === Section Rules === */
.section-rule {
    width: 100%;
    height: 1px;
    background: var(--mid-gray);
    margin: 64px 0;
}

/* === Portfolio Grid === */
.portfolio-section {
    padding: 0 32px;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-cols), 1fr);
    gap: var(--grid-gap);
}

/* === Grid Cell === */
.grid-cell {
    position: relative;
    aspect-ratio: 4 / 3;
    outline: 1px solid var(--pewter);
    overflow: hidden;
    cursor: pointer;
    transition: outline 0.2s ease;
    /* Initial state for glitch reveal */
    opacity: 0;
}

/* Three-phase glitch reveal states */
.grid-cell.glitch-red {
    opacity: 1;
    filter: url(#glitch-aberration) saturate(0.3) hue-rotate(0deg);
}

.grid-cell.glitch-blue {
    opacity: 1;
    filter: url(#glitch-aberration) saturate(0.3) hue-rotate(180deg);
}

.grid-cell.revealed {
    opacity: 1;
    filter: none;
    outline: 1px solid var(--pewter);
}

.grid-cell:hover {
    outline: 2px solid var(--glitch-blue);
}

.grid-cell:hover .cell-image {
    filter: hue-rotate(20deg);
    transition: filter 300ms ease;
}

.grid-cell:hover .cell-title {
    transform: translateX(-2px);
    text-shadow: 2px 0 0 var(--glitch-red), -2px 0 0 var(--glitch-blue);
}

/* === Cell Image === */
.cell-image-wrap {
    position: absolute;
    inset: 0;
}

.cell-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 300ms ease;
}

/* Botanical image CSS — generate visuals since no actual images */
.botanical-01 {
    background:
        radial-gradient(ellipse 40% 60% at 30% 50%, rgba(180, 200, 170, 0.9) 0%, transparent 70%),
        radial-gradient(ellipse 20% 35% at 55% 30%, rgba(140, 170, 150, 0.7) 0%, transparent 60%),
        radial-gradient(ellipse 15% 25% at 70% 70%, rgba(160, 190, 160, 0.6) 0%, transparent 60%),
        linear-gradient(135deg, #D8E5DC 0%, #C0CECC 40%, #A8BEBC 100%);
}

.botanical-02 {
    background:
        radial-gradient(circle 40% at 50% 40%, rgba(130, 155, 140, 0.8) 0%, transparent 70%),
        radial-gradient(ellipse 60% 40% at 20% 80%, rgba(160, 180, 165, 0.6) 0%, transparent 60%),
        radial-gradient(circle 25% at 80% 20%, rgba(150, 170, 155, 0.5) 0%, transparent 55%),
        linear-gradient(160deg, #C8D4D0 0%, #B0C0BC 50%, #98AEAD 100%);
}

.botanical-03 {
    background:
        radial-gradient(ellipse 70% 30% at 50% 65%, rgba(120, 150, 130, 0.85) 0%, transparent 65%),
        radial-gradient(circle 20% at 25% 25%, rgba(180, 200, 180, 0.6) 0%, transparent 50%),
        radial-gradient(circle 15% at 75% 35%, rgba(140, 165, 145, 0.5) 0%, transparent 50%),
        linear-gradient(200deg, #D0D8D4 0%, #B8C8C4 45%, #A0B4B0 100%);
}

.botanical-04 {
    background:
        radial-gradient(ellipse 30% 70% at 60% 50%, rgba(100, 130, 110, 0.8) 0%, transparent 65%),
        radial-gradient(ellipse 50% 20% at 30% 25%, rgba(155, 178, 163, 0.6) 0%, transparent 55%),
        radial-gradient(circle 18% at 15% 70%, rgba(170, 192, 175, 0.55) 0%, transparent 50%),
        linear-gradient(45deg, #C5D5CE 0%, #AABFBA 50%, #94ADAB 100%);
}

.botanical-05 {
    background:
        radial-gradient(circle 55% at 45% 45%, rgba(165, 188, 170, 0.75) 0%, transparent 70%),
        radial-gradient(ellipse 25% 50% at 80% 60%, rgba(130, 156, 138, 0.6) 0%, transparent 60%),
        radial-gradient(circle 12% at 20% 80%, rgba(155, 175, 160, 0.5) 0%, transparent 45%),
        linear-gradient(330deg, #D4E0DA 0%, #BDD0CB 42%, #A6BFBC 100%);
}

.botanical-06 {
    background:
        radial-gradient(ellipse 45% 55% at 35% 55%, rgba(110, 138, 118, 0.8) 0%, transparent 68%),
        radial-gradient(circle 30% at 70% 30%, rgba(148, 170, 153, 0.65) 0%, transparent 58%),
        radial-gradient(ellipse 20% 30% at 85% 75%, rgba(135, 158, 142, 0.5) 0%, transparent 50%),
        linear-gradient(110deg, #CCDBD5 0%, #B5C8C4 48%, #9FBAB7 100%);
}

.botanical-07 {
    background:
        radial-gradient(ellipse 60% 25% at 50% 35%, rgba(125, 148, 128, 0.82) 0%, transparent 62%),
        radial-gradient(circle 22% at 15% 55%, rgba(165, 182, 167, 0.65) 0%, transparent 55%),
        radial-gradient(circle 28% at 80% 70%, rgba(140, 163, 145, 0.58) 0%, transparent 58%),
        linear-gradient(250deg, #CAD8D3 0%, #B2C5C0 46%, #9AB6B2 100%);
}

.botanical-08 {
    background:
        radial-gradient(circle 35% at 40% 40%, rgba(145, 166, 148, 0.78) 0%, transparent 66%),
        radial-gradient(ellipse 55% 35% at 65% 70%, rgba(118, 142, 123, 0.7) 0%, transparent 62%),
        radial-gradient(circle 16% at 20% 20%, rgba(172, 192, 175, 0.55) 0%, transparent 48%),
        linear-gradient(70deg, #D2DEDA 0%, #BBCDC8 44%, #A4BDC0 100%);
}

.botanical-09 {
    background:
        radial-gradient(ellipse 50% 65% at 55% 45%, rgba(135, 158, 140, 0.8) 0%, transparent 68%),
        radial-gradient(circle 25% at 20% 30%, rgba(158, 178, 162, 0.62) 0%, transparent 55%),
        radial-gradient(ellipse 30% 22% at 75% 80%, rgba(120, 146, 128, 0.6) 0%, transparent 52%),
        linear-gradient(175deg, #C8D8D3 0%, #B0C2C0 45%, #98B4B5 100%);
}

/* Botanical Mist overlay tint */
.cell-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(200, 217, 208, 0.15);
    pointer-events: none;
}

/* Scanline overlay */
.scanline-overlay {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 1px,
        rgba(0, 0, 0, 0.04) 1px,
        rgba(0, 0, 0, 0.04) 2px
    );
    pointer-events: none;
    z-index: 2;
}

/* Cross-stitch ornament */
.cross-stitch-ornament {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 3;
    pointer-events: none;
}

/* === Cell Overlay (title strip) === */
.cell-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: rgba(15, 28, 34, 0.8);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    z-index: 4;
}

.cell-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.12em;
    color: var(--fog-white);
    text-transform: uppercase;
    transition: transform 0.3s ease, text-shadow 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%;
}

.cell-year {
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: 11px;
    letter-spacing: 0.2em;
    color: var(--pewter);
    flex-shrink: 0;
}

/* === About Section === */
.about-section {
    padding: 0 32px;
}

.about-inner {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: var(--grid-gap);
    align-items: start;
    outline: 1px solid var(--pewter);
    padding: 48px;
}

.about-label-col {
    padding-top: 4px;
}

.section-label {
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: 11px;
    letter-spacing: 0.2em;
    color: var(--slate);
    text-transform: uppercase;
}

.about-text-col {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.about-body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 15px;
    line-height: 1.7;
    color: var(--slate);
}

.about-meta-row {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.about-meta-item {
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: 12px;
    letter-spacing: 0.2em;
    color: var(--mid-gray);
    text-transform: uppercase;
}

/* === Contact Section === */
.contact-section {
    padding: 0 32px;
}

.contact-inner {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: var(--grid-gap);
    align-items: start;
    outline: 1px solid var(--pewter);
    padding: 48px;
}

.contact-label-col {
    padding-top: 4px;
}

.contact-text-col {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.contact-body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 15px;
    line-height: 1.7;
    color: var(--slate);
}

.contact-addresses {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.contact-address {
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: 12px;
    letter-spacing: 0.2em;
    color: var(--gunmetal);
    text-transform: uppercase;
    transition: text-shadow 0.3s ease;
    cursor: default;
}

.contact-address:hover {
    text-shadow: -2px 0 0 var(--glitch-red), 2px 0 0 var(--glitch-blue);
}

/* === Footer === */
.site-footer {
    margin-top: 64px;
    border-top: 1px solid var(--pewter);
    padding: 32px;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-mark {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.12em;
    color: var(--gunmetal);
    text-transform: uppercase;
}

.footer-meta {
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: 11px;
    letter-spacing: 0.2em;
    color: var(--mid-gray);
    text-transform: uppercase;
}

/* === Glitch Text Micro-animation on nav links === */
.nav-link:hover,
.cell-title:hover {
    transform: translateX(-2px);
    text-shadow: 2px 0 0 var(--glitch-red), -2px 0 0 var(--glitch-blue);
}

/* === Responsive — Tablet === */
@media (max-width: 900px) {
    :root {
        --grid-cols: 2;
    }

    .hero-title {
        font-size: clamp(6rem, 15vw, 12rem);
    }

    .about-inner,
    .contact-inner {
        grid-template-columns: 1fr;
        padding: 32px;
    }
}

/* === Responsive — Mobile === */
@media (max-width: 600px) {
    :root {
        --grid-cols: 1;
        --grid-gap: 16px;
    }

    .hero-title {
        font-size: clamp(5rem, 20vw, 9rem);
    }

    .hero-inner {
        padding: 0 24px;
    }

    .portfolio-section {
        padding: 0 16px;
    }

    .about-section,
    .contact-section {
        padding: 0 16px;
    }

    .nav-inner {
        padding: 0 20px;
    }

    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
    }
}
