/* rinji.dev - A temporary collection of permanent things */
/* Palette: Aged Vellum #FAF6EF, Pressed Linen #F0EAD6, Walnut Ink #3B2F2F,
   Dried Rose #B56B6F, Sage Pressed #7D8E6D, Golden Hour #D4A843,
   Thread Line #C8BDA8, Faded Sepia #7A6B5D */

:root {
    --bg-body: #FAF6EF;
    --bg-margin: #F0EAD6;
    --text-primary: #3B2F2F;
    --text-secondary: #7A6B5D;
    --accent-rose: #B56B6F;
    --accent-sage: #7D8E6D;
    --accent-gold: #D4A843;
    --border-thread: #C8BDA8;
    --code-bg: #F5F0E8;

    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'Lora', Georgia, serif;
    --font-margin: 'EB Garamond', Georgia, serif;
    --font-mono: 'DM Mono', monospace;

    --reveal-duration: 600ms;
    --stagger-delay: 120ms;
    --bloom-duration: 1200ms;
    --ease-reveal: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --ease-bloom: cubic-bezier(0.68, -0.55, 0.265, 1.55);

    --margin-width: 38vw;
    --body-width: 62vw;
}

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

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

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.008em;
    overflow-x: hidden;
    /* Paper grain texture via generative CSS */
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(59,47,47,0.015) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(59,47,47,0.01) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 80%, rgba(59,47,47,0.02) 0%, transparent 60%),
        radial-gradient(circle at 30% 30%, rgba(180,160,130,0.02) 0%, transparent 30%),
        radial-gradient(circle at 70% 70%, rgba(180,160,130,0.015) 0%, transparent 25%);
}

/* Split-screen architecture */
.split-screen {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Left Margin Panel */
.margin-panel {
    width: var(--margin-width);
    background-color: var(--bg-margin);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow: hidden;
    border-right: 1px solid var(--border-thread);
    z-index: 10;
    opacity: 0;
    animation: fadeInPanel var(--reveal-duration) var(--ease-reveal) 200ms forwards;
}

.margin-inner {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1.5rem;
}

/* Decorative vine */
.margin-vine {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 100%;
    opacity: 0.6;
    z-index: 0;
}

.vine-path {
    stroke-dasharray: 2200;
    stroke-dashoffset: 2200;
    transition: stroke-dashoffset 0.1s linear;
}

/* Navigation glyphs */
.margin-nav {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    margin-top: 15vh;
}

.nav-glyph {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    cursor: pointer;
    transition: transform var(--bloom-duration) var(--ease-bloom);
}

.nav-glyph .floral-glyph {
    width: 36px;
    height: 36px;
    transform: scale(0.8);
    opacity: 0.6;
    transition: transform var(--bloom-duration) var(--ease-bloom),
                opacity var(--reveal-duration) var(--ease-reveal);
}

.nav-glyph.active .floral-glyph {
    transform: scale(1.2);
    opacity: 1;
}

.nav-glyph .floral-glyph circle,
.nav-glyph .floral-glyph ellipse,
.nav-glyph .floral-glyph line,
.nav-glyph .floral-glyph path {
    transition: stroke var(--reveal-duration) var(--ease-reveal);
}

.nav-glyph.active .floral-glyph circle,
.nav-glyph.active .floral-glyph ellipse,
.nav-glyph.active .floral-glyph line,
.nav-glyph.active .floral-glyph path {
    stroke: var(--accent-rose);
}

.nav-glyph:hover .floral-glyph {
    transform: scale(1.1);
    opacity: 0.9;
}

.glyph-label {
    font-family: var(--font-margin);
    font-style: italic;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--text-secondary);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity var(--reveal-duration) var(--ease-reveal),
                transform var(--reveal-duration) var(--ease-reveal);
}

.nav-glyph.active .glyph-label {
    opacity: 1;
    transform: translateY(0);
    color: var(--accent-rose);
}

.nav-glyph:hover .glyph-label {
    opacity: 0.8;
    transform: translateY(0);
}

/* Margin annotations */
.margin-annotations {
    position: absolute;
    bottom: 3rem;
    left: 1.5rem;
    right: 1.5rem;
    z-index: 2;
}

.annotation {
    font-family: var(--font-margin);
    font-style: italic;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 1rem;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity var(--reveal-duration) var(--ease-reveal),
                transform var(--reveal-duration) var(--ease-reveal);
}

.annotation.visible {
    opacity: 1;
    transform: translateY(0);
}

.annotation-marker {
    color: var(--accent-gold);
    font-style: normal;
    margin-right: 0.4em;
}

/* Right Body Panel */
.body-panel {
    width: var(--body-width);
    margin-left: var(--margin-width);
    min-height: 100vh;
    opacity: 0;
    animation: fadeInPanel var(--reveal-duration) var(--ease-reveal) 400ms forwards;
}

/* Content sections */
.content-section {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    padding: 8rem 3rem 4rem;
}

.section-inner {
    max-width: 42rem;
    width: 100%;
}

/* Opening Section */
#opening {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
}

.opening-content {
    text-align: left;
}

.site-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(2.8rem, 6vw, 5rem);
    letter-spacing: -0.015em;
    line-height: 1.15;
    color: var(--text-primary);
    opacity: 0;
    transform: translateY(20px);
    animation: revealUp var(--reveal-duration) var(--ease-reveal) 800ms forwards;
}

.site-subtitle {
    font-family: var(--font-margin);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.1rem, 1.8vw, 1.5rem);
    color: var(--text-secondary);
    margin-top: 1rem;
    letter-spacing: 0.02em;
}

.site-subtitle .word {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
}

.opening-ornament {
    margin: 2.5rem 0;
    opacity: 0;
    animation: fadeIn var(--reveal-duration) var(--ease-reveal) 2000ms forwards;
}

.section-divider-svg {
    width: 200px;
    height: 24px;
}

.opening-epigraph {
    font-family: var(--font-margin);
    font-style: italic;
    font-weight: 400;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.7;
    opacity: 0;
    transform: translateY(10px);
    animation: revealUp var(--reveal-duration) var(--ease-reveal) 2400ms forwards;
}

/* Section headings */
.section-heading {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(2rem, 4.5vw, 3.6rem);
    letter-spacing: -0.015em;
    line-height: 1.15;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.section-divider {
    margin-bottom: 3rem;
}

/* Project cards - pressed specimen style */
.project-card {
    position: relative;
    margin-bottom: 2.5rem;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: inset 0 0 12px rgba(59,47,47,0.04);
    background: rgba(250,246,239,0.5);
}

.card-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.card-border-svg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.card-rect {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 1.2s var(--ease-reveal);
}

.project-card.revealed .card-rect {
    stroke-dashoffset: 0;
}

.card-content {
    position: relative;
    z-index: 1;
}

.project-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.3rem, 2.2vw, 1.6rem);
    letter-spacing: -0.01em;
    line-height: 1.25;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.project-description {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.65;
    color: var(--text-primary);
    margin-bottom: 1rem;
    opacity: 0.9;
}

.project-meta {
    font-family: var(--font-margin);
    font-style: italic;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.meta-separator {
    margin: 0 0.5em;
    color: var(--border-thread);
}

.meta-tech {
    font-family: var(--font-mono);
    font-style: normal;
    font-size: 0.82rem;
    background: var(--code-bg);
    padding: 0.1em 0.4em;
    border-radius: 1px;
}

/* Writing section */
.essay-entry {
    margin-bottom: 3rem;
}

.essay-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.3rem, 2vw, 1.5rem);
    letter-spacing: -0.01em;
    line-height: 1.25;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.essay-excerpt {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.essay-date {
    font-family: var(--font-margin);
    font-style: italic;
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Pull quotes */
.pull-quote {
    margin: 3rem 0;
    padding: 2rem 0 2rem 2rem;
    border-left: 2px solid var(--accent-rose);
}

.pull-quote-text {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.15rem, 1.6vw, 1.35rem);
    line-height: 1.6;
    color: var(--text-primary);
    opacity: 0.85;
}

/* Colophon section */
.colophon-content {
    max-width: 38rem;
}

.colophon-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 1.72;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.colophon-text em {
    font-family: var(--font-display);
    font-style: italic;
    color: var(--accent-rose);
}

.color-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    vertical-align: middle;
    margin: 0 0.2em;
    border: 1px solid var(--border-thread);
}

.colophon-closing {
    margin-top: 4rem;
    text-align: center;
}

.closing-ornament {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    display: block;
}

.closing-text {
    font-family: var(--font-margin);
    font-style: italic;
    font-weight: 400;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Progressive disclosure - reveal animations */
.reveal-item {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity var(--reveal-duration) var(--ease-reveal),
                transform var(--reveal-duration) var(--ease-reveal);
}

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

.reveal-child {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity var(--reveal-duration) var(--ease-reveal),
                transform var(--reveal-duration) var(--ease-reveal);
}

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

/* Stagger delays for children */
.reveal-item.revealed .reveal-child:nth-child(1) { transition-delay: 0ms; }
.reveal-item.revealed .reveal-child:nth-child(2) { transition-delay: 120ms; }
.reveal-item.revealed .reveal-child:nth-child(3) { transition-delay: 240ms; }
.reveal-item.revealed .reveal-child:nth-child(4) { transition-delay: 360ms; }
.reveal-item.revealed .reveal-child:nth-child(5) { transition-delay: 480ms; }

/* Keyframe animations */
@keyframes fadeInPanel {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Active section indicator on glyph with golden highlight */
.nav-glyph.active .floral-glyph circle:first-child,
.nav-glyph.active .floral-glyph ellipse:first-child {
    stroke: var(--accent-gold);
}

/* Hover states */
.project-card:hover {
    box-shadow: inset 0 0 16px rgba(59,47,47,0.06);
}

.project-card:hover .project-title {
    color: var(--accent-rose);
    transition: color 300ms var(--ease-reveal);
}

.essay-title {
    transition: color 300ms var(--ease-reveal);
}

.essay-entry:hover .essay-title {
    color: var(--accent-rose);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0ms !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0ms !important;
    }

    .reveal-item,
    .reveal-child,
    .site-title,
    .opening-epigraph,
    .opening-ornament,
    .site-subtitle .word {
        opacity: 1 !important;
        transform: none !important;
    }

    .vine-path {
        stroke-dashoffset: 0 !important;
    }

    .card-rect {
        stroke-dashoffset: 0 !important;
    }
}

/* Mobile breakpoint - collapse to single column */
@media (max-width: 768px) {
    :root {
        --margin-width: 100vw;
        --body-width: 100vw;
    }

    .split-screen {
        flex-direction: column;
    }

    .margin-panel {
        position: relative;
        width: 100%;
        height: auto;
        min-height: 50vh;
        border-right: none;
        border-bottom: 1px solid var(--border-thread);
    }

    .margin-inner {
        padding: 3rem 2rem;
    }

    .margin-nav {
        margin-top: 4rem;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 2rem;
    }

    .margin-vine {
        display: none;
    }

    .margin-annotations {
        display: none;
    }

    .body-panel {
        width: 100%;
        margin-left: 0;
    }

    .content-section {
        padding: 4rem 2rem 3rem;
        min-height: auto;
    }

    #opening {
        min-height: 60vh;
    }

    .section-inner {
        max-width: 100%;
    }

    .pull-quote {
        padding-left: 1.5rem;
    }
}

/* Medium screens */
@media (min-width: 769px) and (max-width: 1024px) {
    :root {
        --margin-width: 30vw;
        --body-width: 70vw;
    }

    .margin-nav {
        gap: 2rem;
        margin-top: 10vh;
    }

    .nav-glyph .floral-glyph {
        width: 28px;
        height: 28px;
    }

    .glyph-label {
        font-size: 0.75rem;
    }
}
