/* graphers.dev - The Grapher's Workshop */

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

:root {
    --vellum: #F7F3ED;
    --graphite: #3D3D3D;
    --plotter-ink: #2B5F8A;
    --terracotta: #C2663B;
    --lichen: #6B8F71;
    --compass-rose: #D4A843;
    --sextant-black: #1E1E24;
    --faded-grid: #D6D0C4;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', sans-serif;
    background-color: var(--vellum);
    color: var(--graphite);
    overflow-x: hidden;
    line-height: 1.7;
}

/* Grid Paper Texture */
#grid-paper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(var(--faded-grid) 0.5px, transparent 0.5px),
        linear-gradient(90deg, var(--faded-grid) 0.5px, transparent 0.5px);
    background-size: 20px 20px;
    opacity: 0.4;
    transition: opacity 0.5s ease;
}

/* Plotter Line */
#plotter-line {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

#plotter-path {
    stroke-dasharray: 5000;
    stroke-dashoffset: 5000;
    transition: stroke-dashoffset 0.1s linear;
}

/* ==================== HERO SECTION ==================== */
.hero-section {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    padding: 40px 20px;
}

.hex-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.hex-row {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.hex-row-offset {
    margin-left: 0;
}

.hex-cell {
    width: 160px;
    height: 140px;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    background: var(--vellum);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    opacity: 0;
    transform: scale(0.8);
    transition: transform 0.3s ease-out;
    cursor: pointer;
}

.hex-cell::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    background: linear-gradient(135deg, rgba(214,208,196,0.3), rgba(214,208,196,0.1));
    border: 1px solid var(--faded-grid);
    z-index: -1;
}

.hex-cell.visible {
    opacity: 1;
    transform: scale(1);
}

.hex-cell:hover {
    transform: scale(1.08);
}

.hex-content {
    width: 70%;
    height: 70%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hex-center .hex-content {
    width: 80%;
    height: 80%;
}

.graph-specimen {
    width: 100%;
    height: 100%;
}

.draw-line {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 1.2s ease-in-out;
}

.hex-cell.visible .draw-line {
    stroke-dashoffset: 0;
}

.hero-title {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-style: italic;
    font-size: 22px;
    color: var(--graphite);
    letter-spacing: -0.02em;
    text-align: center;
    white-space: nowrap;
}

.hero-subtitle {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: 13px;
    color: var(--plotter-ink);
    text-align: center;
    opacity: 0;
    transition: opacity 0.8s ease;
    margin-top: 4px;
}

.hero-subtitle.visible {
    opacity: 1;
}

.scroll-indicator {
    position: absolute;
    bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
    animation: fadeInUp 1s ease 3s forwards;
}

.scroll-indicator span {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: var(--graphite);
    opacity: 0.6;
    letter-spacing: 0.05em;
}

.scroll-indicator svg {
    animation: bounceDown 2s ease-in-out infinite;
}

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

@keyframes bounceDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

/* ==================== PORTFOLIO SECTION ==================== */
.portfolio-section {
    position: relative;
    z-index: 2;
    padding: 80px 20px;
}

.section-divider {
    display: flex;
    justify-content: center;
    margin-bottom: 60px;
}

.hex-divider {
    width: 300px;
    height: 20px;
    opacity: 0.6;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.graph-card {
    background: var(--vellum);
    border: 1px solid var(--graphite);
    aspect-ratio: 2 / 3;
    padding: 24px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    filter: blur(8px);
    transform: translateY(20px);
    transition: opacity 0.6s ease, filter 0.6s ease, transform 0.6s ease, box-shadow 0.3s ease-out;
}

.graph-card.visible {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
}

.graph-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.card-graph {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
}

.card-graph svg {
    width: 100%;
    height: 100%;
}

.graph-card.visible .draw-line {
    stroke-dashoffset: 0;
}

.card-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: var(--graphite);
    letter-spacing: -0.02em;
    margin-top: 12px;
}

.card-provenance {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    color: var(--graphite);
    opacity: 0.5;
    margin-top: 4px;
}

/* ==================== INTERLUDES ==================== */
.interlude {
    padding: 120px 20px;
    max-width: 800px;
    margin: 60px auto;
    text-align: center;
}

.interlude-graph {
    margin-bottom: 40px;
}

.interlude-graph svg {
    width: 100%;
    max-width: 800px;
}

.interlude-line {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 3s ease-in-out;
}

.interlude.visible .interlude-line {
    stroke-dashoffset: 0;
}

.interlude-text {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    color: var(--graphite);
    line-height: 1.8;
    min-height: 3em;
}

/* Brass Instrument Accent */
.brass-accent {
    display: flex;
    justify-content: center;
    padding: 40px 0;
}

.brass-compass {
    animation: slowRotate 60s linear infinite;
    opacity: 0.7;
}

@keyframes slowRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==================== INVITATION SECTION ==================== */
.invitation-section {
    position: relative;
    z-index: 2;
    background: var(--sextant-black);
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
}

.invitation-content {
    text-align: center;
    max-width: 600px;
}

.invitation-quote {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    color: var(--vellum);
    line-height: 1.5;
    margin-bottom: 48px;
    letter-spacing: -0.02em;
}

.invitation-form {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.invitation-input {
    font-family: 'DM Sans', sans-serif;
    font-size: 16px;
    padding: 14px 20px;
    border: 1px solid var(--faded-grid);
    background: transparent;
    color: var(--vellum);
    outline: none;
    width: 280px;
    caret-color: var(--plotter-ink);
    transition: border-color 0.3s ease;
}

.invitation-input::placeholder {
    color: var(--faded-grid);
    opacity: 0.6;
}

.invitation-input:focus {
    border-color: var(--plotter-ink);
}

.invitation-button {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 14px;
    padding: 14px 28px;
    border: 1px solid var(--plotter-ink);
    background: var(--plotter-ink);
    color: var(--vellum);
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
    letter-spacing: 0.02em;
}

.invitation-button:hover {
    background: transparent;
    transform: translateY(-2px);
}

/* ==================== COLOPHON (FOOTER) ==================== */
.colophon {
    position: relative;
    z-index: 2;
    background: var(--sextant-black);
    padding: 60px 20px 40px;
    text-align: center;
}

.colophon-border {
    max-width: 800px;
    margin: 0 auto 40px;
}

.colophon-border svg {
    width: 100%;
    height: 4px;
}

.colophon-content {
    max-width: 500px;
    margin: 0 auto;
}

.colophon-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 14px;
    color: var(--compass-rose);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 16px;
}

.colophon-detail {
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    color: var(--faded-grid);
    line-height: 1.8;
    opacity: 0.7;
}

.colophon-year {
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    color: var(--faded-grid);
    margin-top: 24px;
    opacity: 0.5;
}

.mono {
    font-family: 'IBM Plex Mono', monospace;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 900px) {
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .hex-row {
        gap: 6px;
    }

    .hex-cell {
        width: 110px;
        height: 96px;
    }

    .hero-title {
        font-size: 16px;
    }

    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .graph-card {
        aspect-ratio: 3 / 4;
    }

    .interlude {
        padding: 80px 20px;
    }

    .invitation-form {
        flex-direction: column;
        align-items: center;
    }

    .invitation-input {
        width: 100%;
        max-width: 280px;
    }
}
