/* ============================================
   lunch.quest — Dark-Academia Lunch Journal
   ============================================ */

/* Paper noise texture as inline SVG data URI */
:root {
    --parchment: #fff3e0;
    --linen: #f5ead6;
    --linen-edge: #f0e0c8;
    --espresso: #2c1810;
    --dark-umber: #3d2e22;
    --charcoal: #1a1612;
    --scholar-teal: #1b4d4f;
    --verdigris: #6ba3a0;
    --amber: #c78c3a;
    --khaki: #8b7355;
    --mid-brown: #5a4a3a;
    --scroll-y: 0;
    --noise-url: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.9' numOctaves='4' type='fractalNoise'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    color: var(--dark-umber);
    background: linear-gradient(135deg, var(--linen) 0%, var(--parchment) 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: var(--noise-url);
    background-repeat: repeat;
    pointer-events: none;
    z-index: 0;
}

/* ============================================
   Foyer (Hero)
   ============================================ */

#foyer {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 1;
}

.foyer-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(26,22,18,0.4) 100%);
    pointer-events: none;
    z-index: 2;
}

.watermark-crest {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300px;
    height: 350px;
    opacity: 0.03;
    color: var(--espresso);
    pointer-events: none;
    z-index: 1;
}

.coffee-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(139,115,85,0.12);
    pointer-events: none;
    z-index: 1;
}

.coffee-ring-1 {
    width: 80px;
    height: 80px;
    top: 15%;
    right: 12%;
}

.coffee-ring-2 {
    width: 65px;
    height: 65px;
    bottom: 25%;
    left: 8%;
}

#foyer-title {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 5rem);
    color: var(--espresso);
    letter-spacing: 0.03em;
    position: relative;
    z-index: 3;
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 1.2s ease-out, transform 1.2s ease-out;
    margin-top: 61.8%;
    margin-top: calc(61.8vh - 50vh);
}

#foyer-title.visible {
    opacity: 1;
    transform: scale(1);
}

#foyer-subtitle {
    font-family: 'Source Serif 4', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.3vw, 1.2rem);
    color: var(--mid-brown);
    position: relative;
    z-index: 3;
    margin-top: 1.5rem;
    min-height: 2em;
    text-align: center;
    max-width: 600px;
    padding: 0 2rem;
}

#foyer-subtitle .char {
    opacity: 0;
    transform: translateX(1px);
    display: inline-block;
    transition: opacity 0.15s ease-out, transform 0.15s ease-out;
    white-space: pre;
}

#foyer-subtitle .char.visible {
    opacity: 1;
    transform: translateX(0);
}

#foyer-mountain {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.8s ease-out;
}

#foyer-mountain.visible {
    opacity: 1;
}

#foyer-mountain svg {
    display: block;
    width: 100%;
    height: auto;
}

.mountain-bg {
    transform: translateY(calc(var(--scroll-y) * -0.01px));
}

.mountain-mid {
    transform: translateY(calc(var(--scroll-y) * -0.005px));
}

/* ============================================
   Navigation Index Ribbon
   ============================================ */

#index-ribbon {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--linen);
    background-image: var(--noise-url);
    padding: 0;
    transition: box-shadow 0.3s ease, border-bottom-color 0.3s ease;
    border-bottom: 1px solid transparent;
}

#index-ribbon.stuck {
    border-bottom-color: rgba(139,115,85,0.2);
    box-shadow: 0 2px 12px rgba(26,22,18,0.06);
}

.nav-tabs {
    display: flex;
    justify-content: center;
    gap: 0;
    max-width: 800px;
    margin: 0 auto;
}

.nav-tab {
    font-family: 'Zilla Slab', serif;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--mid-brown);
    text-decoration: none;
    padding: 0.8rem 1.5rem;
    background: var(--linen);
    border-radius: 8px 8px 0 0;
    position: relative;
    transition: transform 0.3s ease, color 0.3s ease, background 0.3s ease;
}

.nav-tab::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--scholar-teal);
    transition: width 0.3s ease, left 0.3s ease;
}

.nav-tab:hover {
    transform: translateY(-3px);
    color: var(--espresso);
}

.nav-tab:hover::after,
.nav-tab.active::after {
    width: 100%;
    left: 0;
}

.nav-tab.active {
    background: var(--linen-edge);
    color: var(--espresso);
}

/* ============================================
   Mountain Dividers
   ============================================ */

.mountain-divider {
    position: relative;
    z-index: 1;
    margin: -1px 0;
    line-height: 0;
}

.mountain-divider svg {
    display: block;
    width: 100%;
    height: auto;
}

/* ============================================
   Content Sections
   ============================================ */

.content-section {
    position: relative;
    z-index: 1;
    padding: 4rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.section-heading {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: var(--espresso);
    letter-spacing: 0.03em;
    text-align: center;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.ink-splatter {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: var(--espresso);
    border-radius: 50%;
    opacity: 0.15;
    box-shadow:
        3px 2px 0 1px rgba(44,24,16,0.1),
        -2px 3px 0 0px rgba(44,24,16,0.08),
        4px -1px 0 0px rgba(44,24,16,0.06);
}

.section-intro {
    font-style: italic;
    color: var(--mid-brown);
    text-align: center;
    max-width: 700px;
    margin: 0 auto 3rem;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
}

/* ============================================
   Specimen Grid
   ============================================ */

.specimen-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
}

.specimen-card {
    background: radial-gradient(ellipse at center, var(--parchment) 30%, var(--linen-edge) 100%);
    background-image: var(--noise-url), radial-gradient(ellipse at center, var(--parchment) 30%, var(--linen-edge) 100%);
    padding: 1.8rem 1.5rem 1.2rem;
    position: relative;
    clip-path: polygon(0 4%, 3% 1%, 7% 3%, 12% 0, 18% 2%, 25% 1%, 33% 3%, 40% 0, 48% 2%, 55% 1%, 62% 3%, 70% 0, 78% 2%, 85% 1%, 92% 3%, 97% 0, 100% 2%, 100% 100%, 0 100%);
    box-shadow: 0 2px 8px rgba(26,22,18,0.08);
    cursor: pointer;
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
    /* fade-reveal initial state */
    opacity: 0;
    transform: translateY(24px);
    /* ruled lines */
    background-image:
        var(--noise-url),
        repeating-linear-gradient(transparent, transparent 1.7rem, rgba(139,115,85,0.08) 1.7rem, rgba(139,115,85,0.08) calc(1.7rem + 1px)),
        radial-gradient(ellipse at center, var(--parchment) 30%, var(--linen-edge) 100%);
}

.specimen-card.revealed {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out, box-shadow 0.3s ease-in-out;
}

.specimen-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(26,22,18,0.15);
}

.specimen-card.revealed:hover {
    transform: translateY(-4px);
}

.card-flourish {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease-in-out;
}

.specimen-card:hover .card-flourish {
    transform: rotate(15deg);
}

.card-label {
    font-family: 'Inconsolata', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--khaki);
    display: block;
    margin-bottom: 0.6rem;
}

.card-title {
    font-family: 'Zilla Slab', serif;
    font-weight: 600;
    font-size: clamp(1.1rem, 1.5vw, 1.4rem);
    color: var(--espresso);
    letter-spacing: 0.02em;
    margin-bottom: 0.6rem;
    line-height: 1.3;
}

.card-body {
    color: var(--dark-umber);
    font-size: clamp(0.9rem, 1.1vw, 1rem);
    line-height: 1.72;
    margin-bottom: 0.8rem;
}

.card-meta {
    font-family: 'Inconsolata', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: var(--amber);
    display: block;
}

/* ============================================
   Field Notes
   ============================================ */

.field-notes-entries {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.field-note-entry {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.field-note-entry.revealed {
    opacity: 1;
    transform: translateY(0);
}

.compass-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    margin-top: 0.3rem;
}

.compass-icon svg {
    width: 100%;
    height: 100%;
}

.note-content {
    flex: 1;
}

.note-date {
    font-family: 'Inconsolata', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--khaki);
    display: block;
    margin-bottom: 0.4rem;
}

.note-content h3 {
    font-family: 'Zilla Slab', serif;
    font-weight: 600;
    font-size: clamp(1.1rem, 1.5vw, 1.3rem);
    color: var(--espresso);
    margin-bottom: 0.5rem;
}

.note-content p {
    color: var(--dark-umber);
    line-height: 1.72;
}

/* ============================================
   Provisions
   ============================================ */

.provisions-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.provision-item {
    padding: 2rem;
    background: radial-gradient(ellipse at center, var(--parchment) 30%, var(--linen-edge) 100%);
    border-left: 3px solid var(--scholar-teal);
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

.provision-number {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: 1.8rem;
    color: var(--verdigris);
    display: block;
    margin-bottom: 0.5rem;
}

.provision-item h3 {
    font-family: 'Zilla Slab', serif;
    font-weight: 600;
    font-size: 1.15rem;
    color: var(--espresso);
    margin-bottom: 0.5rem;
}

.provision-item p {
    color: var(--dark-umber);
    line-height: 1.72;
    font-size: 0.95rem;
}

/* ============================================
   Footer (Field Station)
   ============================================ */

#field-station {
    position: relative;
    z-index: 1;
    margin-top: 2rem;
}

.footer-mountain {
    line-height: 0;
    margin-bottom: -1px;
}

.footer-mountain svg {
    display: block;
    width: 100%;
    height: auto;
}

.footer-content {
    background: var(--charcoal);
    padding: 3rem 2rem 2rem;
    text-align: center;
}

.footer-title {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: 1.8rem;
    color: var(--parchment);
    letter-spacing: 0.03em;
    text-shadow: 1px 1px 0 rgba(255,248,230,0.08), -1px -1px 0 rgba(0,0,0,0.5);
    margin-bottom: 0.3rem;
}

.footer-tagline {
    font-family: 'Source Serif 4', Georgia, serif;
    font-style: italic;
    font-size: 0.95rem;
    color: var(--khaki);
    margin-bottom: 1.5rem;
}

.footer-quote {
    font-family: 'Source Serif 4', Georgia, serif;
    font-style: italic;
    font-size: 1rem;
    color: var(--linen-edge);
    max-width: 500px;
    margin: 0 auto 0.3rem;
}

.footer-attribution {
    font-family: 'Inconsolata', monospace;
    font-size: 0.8rem;
    color: var(--khaki);
    letter-spacing: 0.06em;
    margin-bottom: 1.5rem;
}

.footer-colophon {
    font-family: 'Inconsolata', monospace;
    font-size: 0.7rem;
    color: var(--mid-brown);
    letter-spacing: 0.04em;
    opacity: 0.6;
}

/* ============================================
   Card Modal
   ============================================ */

.card-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card-modal.active {
    pointer-events: auto;
    opacity: 1;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26,22,18,0.6);
}

.modal-content {
    position: relative;
    background: var(--parchment);
    background-image: var(--noise-url), radial-gradient(ellipse at center, var(--parchment) 30%, var(--linen-edge) 100%);
    max-width: 720px;
    width: 80%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 2.5rem;
    clip-path: polygon(0 3%, 2% 0.5%, 5% 2%, 10% 0, 15% 1.5%, 22% 0.5%, 30% 2%, 38% 0, 46% 1.5%, 54% 0.5%, 62% 2%, 70% 0, 78% 1.5%, 85% 0.5%, 92% 2%, 97% 0, 100% 1.5%, 100% 100%, 0 100%);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.card-modal.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.2rem;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--mid-brown);
    cursor: pointer;
    font-family: 'Zilla Slab', serif;
    transition: color 0.2s ease;
    z-index: 10;
}

.modal-close:hover {
    color: var(--espresso);
}

.modal-body .card-label {
    margin-bottom: 0.8rem;
}

.modal-body .card-title {
    font-size: 1.6rem;
    margin-bottom: 1rem;
}

.modal-body .card-body {
    font-size: 1.05rem;
    margin-bottom: 1rem;
}

/* ============================================
   Mobile Responsive
   ============================================ */

@media (max-width: 768px) {
    .specimen-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .specimen-card {
        grid-column: span 4 !important;
        grid-row: span 1 !important;
    }

    .nav-tab {
        font-size: 0.72rem;
        padding: 0.6rem 0.8rem;
        letter-spacing: 0.05em;
    }

    .provisions-grid {
        grid-template-columns: 1fr;
    }

    .field-note-entry {
        flex-direction: column;
        gap: 0.8rem;
    }

    .content-section {
        padding: 3rem 1.2rem;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .nav-tabs {
        flex-wrap: wrap;
    }
    
    .nav-tab {
        flex: 1;
        text-align: center;
        min-width: 0;
        padding: 0.6rem 0.4rem;
        font-size: 0.65rem;
    }
}
