/* ============================================
   lunchbox.dev - Editorial Flow Design
   Maritime Navy + Aged Paper rhythm
   ============================================ */

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

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

body {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 400;
    font-size: clamp(14px, 1vw, 17px);
    line-height: 1.75;
    color: #2A2420;
    background-color: #0C2340;
    overflow-x: hidden;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: 'Libre Baskerville', 'Georgia', serif;
}

.logotype {
    font-family: 'Libre Baskerville', 'Georgia', serif;
    font-weight: 700;
    font-size: clamp(32px, 5vw, 64px);
    color: #F5ECD8;
    letter-spacing: 0.02em;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 800ms ease, transform 800ms ease;
}

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

.section-headline {
    font-family: 'Libre Baskerville', 'Georgia', serif;
    font-weight: 700;
    font-size: clamp(24px, 3.5vw, 48px);
    line-height: 1.25;
    color: #2A2420;
    margin-bottom: 1.5rem;
}

.light-headline {
    color: #F5ECD8;
}

.light-text {
    color: #F5ECD8;
}

code {
    font-family: 'Inconsolata', monospace;
    font-size: 0.9em;
    background: rgba(42, 36, 32, 0.06);
    padding: 0.15em 0.4em;
    border-radius: 3px;
}

.section-dark code {
    background: rgba(245, 236, 216, 0.1);
    color: #F5ECD8;
}

/* --- Sections --- */
.section-dark {
    background-color: #0C2340;
    color: #F5ECD8;
    position: relative;
}

.section-paper {
    background-color: #F0E8D8;
    color: #2A2420;
    position: relative;
}

/* --- Hero Section --- */
#hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-inner {
    position: relative;
    z-index: 2;
    padding: 2rem;
}

.hero-subtitle {
    font-family: 'Source Sans 3', sans-serif;
    font-size: clamp(14px, 1.5vw, 20px);
    color: #F5ECD8;
    opacity: 0.75;
    margin-top: 1rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 600ms ease 400ms, transform 600ms ease 400ms;
}

.hero-subtitle.visible {
    opacity: 0.75;
    transform: translateY(0);
}

.paper-edge-vignette {
    position: absolute;
    inset: 0;
    pointer-events: none;
    box-shadow: inset 0 0 150px rgba(12, 35, 64, 0.5);
    z-index: 1;
}

/* --- Gold Horizontal Rule (Hero) --- */
.gold-rule {
    border: none;
    height: 2px;
    background: #C8A050;
    margin: 2rem auto 0;
    width: 0%;
    max-width: 200px;
    transition: width 1s ease-in-out 600ms;
}

.gold-rule.drawn {
    width: 100%;
}

/* --- Maritime Horizontal Rules --- */
.maritime-rule {
    border: none;
    position: relative;
    height: 12px;
    margin: 2.5rem 0;
}

.maritime-rule::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(200, 160, 80, 0.4);
}

.maritime-rule::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(200, 160, 80, 0.4);
}

/* Diamond ornament center */
.maritime-rule .diamond,
.maritime-rule::before {
    /* We use a pseudo-element trick -- but since we used ::before and ::after for lines,
       we add the diamond via a background on the rule itself */
}

/* Diamond on the maritime rule via background image */
.maritime-rule {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Crect x='2' y='2' width='6' height='6' fill='%23C8A050' opacity='0.6' transform='rotate(45 5 5)'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 10px 10px;
}

/* --- Editorial Grid --- */
.editorial-grid {
    display: grid;
    grid-template-columns: 10% 55% 5% 30%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 5rem 2rem;
    gap: 0;
}

.editorial-grid.wide-primary .primary-column.primary-wide {
    grid-column: 2 / 4;
}

.editorial-marker {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    justify-content: center;
    padding-top: 0.5rem;
}

.section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1.5px solid #C8A050;
    border-radius: 50%;
    font-family: 'Libre Baskerville', serif;
    font-size: 14px;
    font-weight: 700;
    color: #C8A050;
}

.primary-column {
    grid-column: 2;
    grid-row: 1;
}

.primary-column p {
    margin-bottom: 1.25rem;
}

.primary-column p:last-child {
    margin-bottom: 0;
}

.gutter-icons {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 0.75rem;
}

.secondary-column {
    grid-column: 4;
    grid-row: 1;
    padding-left: 1rem;
}

/* --- Pull Quotes --- */
.pull-quote {
    font-family: 'Libre Baskerville', 'Georgia', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(16px, 1.8vw, 22px);
    line-height: 1.55;
    color: #C8A050;
    border-left: 3px solid #C8A050;
    padding-left: 1.25rem;
    margin-bottom: 2rem;
    transform: translate(var(--mag-x, 0px), var(--mag-y, 0px));
    transition: transform 0.2s ease-out;
}

.section-dark .pull-quote {
    color: #C8A050;
}

.pull-quote p {
    margin: 0;
}

/* --- Sidebar Notes --- */
.sidebar-note {
    font-family: 'Inconsolata', monospace;
    font-size: 12px;
    line-height: 1.6;
    color: #2A2420;
    padding: 1rem;
    border-top: 1px solid rgba(42, 36, 32, 0.15);
}

.sidebar-note p {
    margin-top: 0.5rem;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 13px;
}

.light-sidebar {
    border-top-color: rgba(245, 236, 216, 0.2);
}

.meta-label {
    font-family: 'Inconsolata', monospace;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #4A7868;
}

.light-meta {
    color: #4A7868;
}

.light-sidebar p {
    color: #F5ECD8;
}

/* --- Culture Icons (SVG in gutter) --- */
.culture-icon {
    stroke: #4A7868;
    stroke-width: 1.5;
    fill: none;
    opacity: 0.7;
}

/* --- Paper Aged Texture --- */
.paper-texture {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(circle at 30% 70%, rgba(139, 107, 74, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 70% 20%, rgba(139, 107, 74, 0.03) 0%, transparent 45%),
        radial-gradient(circle at 15% 30%, rgba(139, 107, 74, 0.035) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(139, 107, 74, 0.025) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(139, 107, 74, 0.02) 0%, transparent 60%),
        radial-gradient(circle at 90% 40%, rgba(139, 107, 74, 0.03) 0%, transparent 35%);
    box-shadow: inset 0 0 100px rgba(42, 36, 32, 0.08);
}

.section-paper {
    position: relative;
}

.section-paper > .editorial-grid,
.section-paper > .footer-inner {
    position: relative;
    z-index: 1;
}

/* --- Scroll Animations --- */
.editorial-section .primary-column,
.editorial-section .secondary-column {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 400ms ease, transform 400ms ease;
}

.editorial-section.in-view .primary-column,
.editorial-section.in-view .secondary-column {
    opacity: 1;
    transform: translateY(0);
}

.editorial-section .secondary-column {
    transition-delay: 150ms;
}

/* --- Footer --- */
#footer {
    position: relative;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem 3rem;
    text-align: center;
    position: relative;
    z-index: 1;
}

.footer-logotype {
    font-family: 'Libre Baskerville', 'Georgia', serif;
    font-weight: 700;
    font-size: clamp(20px, 2.5vw, 32px);
    color: #2A2420;
    margin-bottom: 0.5rem;
}

.footer-tagline {
    font-family: 'Libre Baskerville', 'Georgia', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(14px, 1.2vw, 18px);
    color: #C8A050;
    margin-bottom: 2rem;
}

.footer-meta {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.footer-meta .meta-label {
    color: #2A6478;
    cursor: pointer;
    transition: color 0.2s ease;
}

.footer-meta .meta-label:hover {
    color: #C8A050;
}

.footer-copyright {
    font-family: 'Inconsolata', monospace;
    font-size: 11px;
    color: #2A2420;
    opacity: 0.5;
}

/* --- Responsive (Mobile) --- */
@media (max-width: 768px) {
    .editorial-grid {
        grid-template-columns: 1fr;
        padding: 3rem 1.5rem;
        gap: 1.5rem;
    }

    .editorial-marker {
        grid-column: 1;
        justify-content: flex-start;
    }

    .primary-column,
    .primary-column.primary-wide {
        grid-column: 1;
    }

    .gutter-icons {
        grid-column: 1;
        justify-content: flex-start;
        padding-top: 0;
    }

    .secondary-column {
        grid-column: 1;
        padding-left: 0;
    }

    .editorial-grid.wide-primary .primary-column.primary-wide {
        grid-column: 1;
    }

    .pull-quote {
        font-size: clamp(15px, 4vw, 20px);
    }

    .footer-meta {
        gap: 1rem;
    }
}

/* --- Link Styling (for future use) --- */
a {
    color: #C8A050;
    text-decoration: none;
    border-bottom: 1px solid rgba(200, 160, 80, 0.3);
    transition: border-color 0.2s ease, color 0.2s ease;
}

a:hover {
    border-bottom-color: #C8A050;
}

.section-dark a {
    color: #C8A050;
}

/* --- Selection Color --- */
::selection {
    background: rgba(200, 160, 80, 0.3);
    color: #2A2420;
}

.section-dark ::selection {
    background: rgba(200, 160, 80, 0.3);
    color: #F5ECD8;
}
