/* ============================================================
   yamichika.net — Stylesheet
   Aesthetic: light-academia × edgy-rebellious
   Palette: sunset-warm meets academic dust (paper-aged)
   Typography: Courier Prime + Space Mono" — Google Fonts
   Design: tension between scholarly warmth and alienated tone.
   The cold precision of tech-mono keeps the reader alert.
   friction between systems creates the deliberate tone.
   Column: 680px (approximately 75 characters per line)
   Interaction:** marginalia hover reveals annotation (data-active toggle)
   these systems create scholarly and alienated tone.
   ============================================================ */

/* ---------- Imports ---------- */
/* Fonts loaded via Google Fonts in <head> */

/* ---------- Custom Properties ---------- */
:root {
    /* Color Palette */
    --color-bg:           #f5e6c8;   /* Aged Parchment */
    --color-text:         #3d2b1f;   /* Ink Brown */
    --color-heading:      #2c1810;   /* Dark Umber */
    --color-h2:           #5a3a28;   /* Warm Mahogany */
    --color-accent:       #c17f3a;   /* Ochre Ink */
    --color-accent-2:     #b85c38;   /* Sunset Rust */
    --color-accent-3:     #d4944a;   /* Amber Dusk */
    --color-sienna:       #8b4513;   /* Faded Sienna */
    --color-highlight:    #f0c060;   /* Candlelight */
    --color-deep:         #1a0e08;   /* Charred Umber */
    --color-vellum:       #ede0c4;   /* Warm Vellum */
    --color-marginalia:   #a0855a;   /* Muted Tan */
    --color-blockquote:   #7a4f35;   /* Warm Sienna */

    /* Typography */
    --font-display:       'Courier Prime', 'Courier New', Courier, monospace;
    --font-body:          'Space Mono', 'Courier New', monospace;
    --font-accent:        'IM Fell English', Georgia, 'Times New Roman', serif;

    /* Spacing */
    --column-width:       680px;
    --section-padding:    96px;
    --side-left:          60px;
    --side-right:         40px;
}

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

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

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.85;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ---------- Paper Wrapper (texture layer) ---------- */
.paper-wrapper {
    position: relative;
    min-height: 100vh;
    background-color: var(--color-bg);
    filter: url(#paper-noise);
}

/* ---------- Opening Folio ---------- */
.folio {
    min-height: 100vh;
    display: flex;
    align-items: flex-end;
    padding-bottom: 80px;
    background-color: var(--color-bg);
    position: relative;
    overflow: hidden;
}

.folio::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 40% at 30% 60%, rgba(193,127,58,0.06) 0%, transparent 70%),
        radial-gradient(ellipse 40% 50% at 80% 30%, rgba(212,148,74,0.04) 0%, transparent 60%);
    pointer-events: none;
}

.folio-inner {
    max-width: var(--column-width);
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--side-right) 0 var(--side-left);
}

.folio-ornament {
    font-size: 1.2em;
    color: var(--color-accent);
    margin-bottom: 32px;
    opacity: 0.6;
}

.site-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(48px, 8vw, 80px);
    color: var(--color-heading);
    line-height: 1.05;
    letter-spacing: -0.02em;
    text-shadow: 1px 1px 3px rgba(26, 14, 8, 0.15);
    margin-bottom: 16px;
}

.title-dot {
    color: var(--color-accent);
}

.folio-tagline {
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--color-marginalia);
    letter-spacing: 0.2em;
    text-transform: lowercase;
    margin-bottom: 48px;
    opacity: 0.8;
}

.folio-rule {
    width: 100%;
    height: 1px;
    background-color: var(--color-sienna);
    opacity: 0.4;
}

/* ---------- Main Reading Column ---------- */
.reading-column {
    max-width: var(--column-width);
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--side-right) 0 var(--side-left);
    box-shadow: inset 0 0 40px rgba(139, 69, 19, 0.08);
}

/* ---------- Manuscript Sections ---------- */
.manuscript-section {
    padding: var(--section-padding) 0;
    position: relative;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

h2 {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 22px;
    color: var(--color-h2);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    text-shadow: 1px 1px 3px rgba(26, 14, 8, 0.18);
}

.section-header .pilcrow {
    color: var(--color-accent);
    opacity: 0.5;
    font-size: 1em;
}

/* ---------- Body Text & Marginalia System ---------- */
.body-text {
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.85;
    color: var(--color-text);
    margin-bottom: 1.8em;
    position: relative;
    padding-left: 0;
    transition: padding-left 300ms ease;
}

/* Marginalia annotation revealed on hover */
.body-text::before {
    content: attr(data-marginal);
    position: absolute;
    left: -168px;
    top: 0;
    width: 140px;
    font-family: var(--font-body);
    font-size: 11px;
    line-height: 1.5;
    color: var(--color-marginalia);
    opacity: 0;
    font-style: italic;
    text-align: right;
    transition: opacity 300ms ease, transform 300ms ease;
    transform: translateX(4px);
    pointer-events: none;
}

/* Marginalia left-border line revealed on hover */
.body-text::after {
    content: '';
    position: absolute;
    left: -12px;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--color-accent);
    opacity: 0;
    transition: opacity 300ms ease;
}

.body-text:hover::before,
.body-text[data-active]::before {
    opacity: 1;
    transform: translateX(0);
}

.body-text:hover::after,
.body-text[data-active]::after {
    opacity: 0.7;
}

/* ---------- Block Quotes ---------- */
.pull-quote {
    margin: 2.5em 0;
    padding: 24px 32px;
    border-left: 3px solid var(--color-accent);
    position: relative;
}

.pull-quote .ornament {
    display: block;
    font-size: 1.3em;
    color: var(--color-accent);
    margin-bottom: 12px;
    opacity: 0.6;
}

.pull-quote p {
    font-family: var(--font-accent);
    font-style: italic;
    font-size: 20px;
    line-height: 1.6;
    color: var(--color-blockquote);
    margin-bottom: 12px;
}

.pull-quote cite {
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--color-marginalia);
    font-style: normal;
    letter-spacing: 0.1em;
    opacity: 0.8;
}

/* ---------- Section Breaks ---------- */
.section-break {
    text-align: center;
    font-family: var(--font-body);
    font-size: 16px;
    color: var(--color-accent);
    opacity: 0.5;
    margin-top: 2em;
    letter-spacing: 0.3em;
}

/* ---------- Ornaments ---------- */
.ornament {
    font-family: Georgia, serif;
    color: var(--color-accent);
    font-size: 1.2em;
}

/* ---------- Foxing Spots (aged paper oxidation) ---------- */
.foxing-cluster {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: visible;
}

.foxing-spot {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(ellipse, rgba(237,224,196,0.7) 0%, rgba(193,127,58,0.08) 70%, transparent 100%);
    mix-blend-mode: multiply;
}

/* ---------- Ink Splat ---------- */
.ink-splat-ornament {
    display: flex;
    justify-content: center;
    margin: 16px 0 24px;
    opacity: 0.6;
}

/* ---------- Archive / Index List ---------- */
.archive-list {
    list-style: none;
    margin-top: 8px;
}

.archive-entry {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(139, 69, 19, 0.15);
    cursor: default;
    position: relative;
    transition: background-color 200ms ease;
}

.archive-entry:last-child {
    border-bottom: none;
}

.archive-date {
    font-family: var(--font-body);
    font-size: 12px;
    color: var(--color-marginalia);
    letter-spacing: 0.1em;
    min-width: 72px;
    flex-shrink: 0;
}

.archive-ornament {
    font-size: 0.7em;
    opacity: 0.4;
    flex-shrink: 0;
}

.archive-title {
    font-family: var(--font-display);
    font-size: 16px;
    color: var(--color-heading);
    font-weight: 400;
    position: relative;
    transition: color 200ms ease;
}

/* Marginalia on archive items */
.archive-title::after {
    content: attr(data-marginal);
    position: absolute;
    right: 0;
    top: 0;
    font-family: var(--font-body);
    font-size: 10px;
    font-style: italic;
    color: var(--color-marginalia);
    opacity: 0;
    transition: opacity 300ms ease;
    white-space: nowrap;
}

.archive-entry:hover .archive-title {
    color: var(--color-accent-2);
}

.archive-entry:hover .archive-title::after {
    opacity: 0.8;
}

/* ---------- Colophon / Footer ---------- */
.colophon {
    background-color: var(--color-bg);
    padding: 80px 0 64px;
}

.colophon-inner {
    max-width: var(--column-width);
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--side-right) 0 var(--side-left);
    text-align: center;
}

.hairline-rule {
    width: 200px;
    height: 1px;
    background-color: var(--color-sienna);
    opacity: 0.3;
    margin: 0 auto 48px;
}

.candle-wrap {
    width: 32px;
    margin: 0 auto 24px;
    position: relative;
    min-height: 48px;
}

.candle-fallback {
    display: none;
    width: 32px;
    height: 48px;
}

.colophon-text {
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--color-h2);
    letter-spacing: 0.25em;
    text-transform: lowercase;
    margin-bottom: 12px;
}

.colophon-sub {
    font-family: var(--font-accent);
    font-style: italic;
    font-size: 13px;
    color: var(--color-marginalia);
    margin-bottom: 6px;
    opacity: 0.75;
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
    lottie-player {
        display: none;
    }
    .candle-fallback {
        display: block;
    }
    .body-text::before,
    .body-text::after {
        transition: none;
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    :root {
        --side-left: 40px;
        --side-right: 40px;
    }

    /* Hide marginalia on smaller screens — not enough room */
    .body-text::before {
        display: none;
    }
}

@media (max-width: 767px) {
    :root {
        --side-left: 32px;
        --side-right: 32px;
        --section-padding: 64px;
    }

    .site-title {
        font-size: clamp(36px, 10vw, 60px);
    }

    h2 {
        font-size: 18px;
    }

    .body-text {
        font-size: 16px;
    }

    .pull-quote p {
        font-size: 18px;
    }

    .folio {
        padding-bottom: 60px;
    }
}

@media (max-width: 480px) {
    :root {
        --side-left: 20px;
        --side-right: 20px;
        --section-padding: 48px;
    }

    .archive-entry {
        flex-wrap: wrap;
        gap: 6px;
    }

    .archive-title::after {
        display: none;
    }
}

/* ---------- Selection Styling ---------- */
::selection {
    background-color: rgba(240, 192, 96, 0.35);
    color: var(--color-heading);
}

/* ---------- Scrollbar (webkit) ---------- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
    background-color: rgba(139, 69, 19, 0.25);
    border-radius: 3px;
}
