/* ============================================================
   Tonton Frometon — implements DESIGN.md
   ============================================================ */

:root {
    --navy: #28367B;
    --navy-deep: #1E2A63;
    --red: #B70E0B;
    --red-deep: #8F0A08;
    --paper: #FAF6EF;
    --card: #FFFFFF;
    --ink: #22243A;
    --muted: #6B6B76;
    --line: #E7E0D3;
    --line-strong: #C9BFA8;

    --r-sm: 4px;
    --r-md: 8px;
    --shadow: 0 1px 3px rgba(34,36,58,.06), 0 4px 16px rgba(34,36,58,.05);

    --sans: 'Inter', system-ui, sans-serif;
    --serif: 'Fraunces', Georgia, serif;

    --sidebar: 244px;
    --measure: 760px;
}

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

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

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}

body {
    font-family: var(--sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-deep); }

/* ── Masthead ── */

.masthead {
    border-bottom: 1px solid var(--line-strong);
    background: var(--paper);
    padding: 22px 24px;
    text-align: center;
}

.masthead-brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    color: var(--navy);
}
.masthead-brand:hover { color: var(--navy); }

.masthead-logo {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    flex-shrink: 0;
}

.masthead-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1; }

.masthead-title {
    font-family: var(--serif);
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--navy);
    letter-spacing: -0.01em;
}

.masthead-tagline {
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--red);
    margin-top: 5px;
}

/* ── Shell ── */

.page {
    display: flex;
    align-items: flex-start;
    gap: 48px;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 32px;
    min-height: 100vh;
}

.content {
    flex: 1;
    min-width: 0;
    max-width: var(--measure);
    padding: 56px 0 120px;
}

/* ── ToC ── */

.toc {
    width: var(--sidebar);
    flex-shrink: 0;
    padding: 56px 0;
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
}

.toc::-webkit-scrollbar { width: 6px; }
.toc::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }

.toc-label {
    font-family: var(--sans);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--red);
    display: block;
    margin-bottom: 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.toc-chapter { margin-bottom: 16px; }

.toc-chapter-link {
    font-family: var(--sans);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--navy);
    display: block;
    margin-bottom: 4px;
}
.toc-chapter-link:hover { color: var(--red); }

.toc-section { margin-bottom: 8px; padding-left: 0.5em; }

.toc-section-label {
    font-family: var(--sans);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    display: block;
    margin: 6px 0 2px;
}

.toc ol, .toc ul { list-style: none; }

.toc-recipe-list { padding-left: 0.8em; }

.toc-recipe-list a {
    font-family: var(--sans);
    font-size: 0.78rem;
    font-weight: 400;
    color: var(--muted);
    display: block;
    line-height: 1.75;
    border-left: 2px solid transparent;
    padding-left: 8px;
    margin-left: -10px;
}

.toc-recipe-list a:hover { color: var(--navy); }
.toc-recipe-list a.active {
    color: var(--red);
    font-weight: 500;
    border-left-color: var(--red);
}

/* ── Hero / frontispiece ── */

.frontispiece {
    margin-bottom: 56px;
    padding-bottom: 28px;
    border-bottom: 2px solid var(--navy);
}

.fp-title {
    font-family: var(--serif);
    font-size: 2.4rem;
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--navy);
}

.fp-sub {
    font-family: var(--sans);
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--muted);
    margin-top: 8px;
}

/* ── Chapter heading ── */

.chapter { margin-bottom: 72px; }

.chapter-title {
    font-family: var(--sans);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--navy);
    padding-bottom: 10px;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--line-strong);
    position: relative;
}
.chapter-title::after {
    content: '';
    position: absolute;
    left: 0; bottom: -1px;
    width: 48px; height: 3px;
    background: var(--red);
}

.subsection { margin-bottom: 48px; }

.subsection-title {
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--red);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 24px;
}

/* ── Chips (time / yield / difficulty) ── */

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.chip {
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 500;
    color: var(--navy);
    background: #EEF0F7;
    border-radius: var(--r-sm);
    padding: 3px 10px;
    white-space: nowrap;
}
.chip--accent { color: #fff; background: var(--red); }

/* ── Recipe card ── */

.recipe {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: var(--shadow);
    padding: 28px 30px;
    margin-bottom: 28px;
}
.recipe:last-child { margin-bottom: 0; }

.recipe-header { margin-bottom: 18px; }

.recipe-title-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

.recipe-title {
    font-family: var(--serif);
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--navy);
}
.recipe-title a { color: inherit; }
.recipe-title a:hover { color: var(--red); }

.recipe-detail-btn {
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--navy);
    border: 1px solid var(--navy);
    border-radius: var(--r-sm);
    padding: 7px 16px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background .15s, color .15s;
}
.recipe-detail-btn:hover { background: var(--navy); color: #fff; }

.recipe-meta {
    font-family: var(--sans);
    font-size: 0.82rem;
    font-weight: 400;
    color: var(--muted);
    margin-top: 6px;
}

/* Two-column body */
.recipe-body {
    display: grid;
    grid-template-columns: 1fr 1.9fr;
    gap: 0 40px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

/* Ingredients */
.col-ingredients { font-size: 0.9rem; line-height: 1.5; }

.ingredient-group { margin-bottom: 16px; }
.ingredient-group:last-child { margin-bottom: 0; }

.ingredient-group-title {
    font-family: var(--sans);
    font-size: 0.66rem;
    font-weight: 600;
    color: var(--red);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.ingredient-list { list-style: none; }

.ingredient-list li {
    display: flex;
    align-items: baseline;
    gap: 10px;
    border-bottom: 1px solid var(--line);
    padding: 5px 0;
}
.ingredient-list li:last-child { border-bottom: none; }

.qty {
    font-family: var(--sans);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--navy);
    white-space: nowrap;
    min-width: 52px;
    flex-shrink: 0;
}

/* Method */
.col-method { font-size: 0.95rem; line-height: 1.65; }

.recipe-intro { margin-bottom: 16px; color: var(--ink); }
.recipe-intro p { margin-bottom: 0.6em; }
.recipe-intro p:last-child { margin-bottom: 0; }

.method-step { margin-bottom: 20px; }
.method-step:last-child { margin-bottom: 0; }

.step-title {
    font-family: var(--sans);
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--navy);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 5px;
}

.method-list { margin-left: 1.2em; line-height: 1.65; }
.method-list li { margin-bottom: 5px; }

/* Notes block */
.recipe-notes {
    grid-column: 1 / -1;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--ink);
}

.notes-label {
    font-family: var(--sans);
    font-size: 0.66rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--red);
    margin-bottom: 8px;
    display: block;
}

.notes-list { list-style: none; }
.notes-list li { margin-bottom: 4px; padding-left: 1em; position: relative; }
.notes-list li::before { content: '—'; position: absolute; left: 0; color: var(--line-strong); }
.notes-list strong { color: var(--navy); font-style: normal; }

.storage-text { margin-top: 8px; font-style: italic; color: var(--muted); }

.recipe-detail-link {
    display: inline-block;
    margin-top: 18px;
    font-family: var(--sans);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--navy);
    border-bottom: 1px solid var(--navy);
    padding-bottom: 1px;
}
.recipe-detail-link:hover { color: var(--red); border-color: var(--red); }

.base-ref {
    font-family: var(--sans);
    font-size: 0.75rem;
    color: var(--muted);
    border-bottom: 1px solid var(--line-strong);
}
.base-ref:hover { color: var(--navy); border-color: var(--navy); }

.coming-soon {
    font-family: var(--sans);
    font-size: 0.82rem;
    color: var(--muted);
    font-style: italic;
}

/* ── Footer ── */

.site-footer {
    margin-top: 64px;
    padding: 24px 0;
    border-top: 2px solid var(--navy);
    font-family: var(--sans);
    font-size: 0.8rem;
    color: var(--muted);
    text-align: center;
}
.site-footer em { color: var(--navy); font-style: normal; font-weight: 600; }

/* ── Burger / mobile ToC ── */

.burger {
    display: none;
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 200;
    width: 42px;
    height: 42px;
    background: var(--navy);
    border: none;
    border-radius: var(--r-sm);
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.burger span { display: block; width: 18px; height: 2px; background: #fff; }

/* ── Detail page ── */

.detail-header {
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--navy);
}

.detail-back {
    font-family: var(--sans);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--muted);
    display: inline-block;
    margin-bottom: 20px;
}
.detail-back:hover { color: var(--red); }

.detail-title {
    font-family: var(--serif);
    font-size: 2.3rem;
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: -0.02em;
    color: var(--navy);
    margin-bottom: 8px;
}

.detail-subtitle {
    font-family: var(--sans);
    font-size: 1rem;
    font-weight: 400;
    color: var(--muted);
    margin-bottom: 4px;
}

.detail-meta { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); }

.detail-top {
    display: grid;
    grid-template-columns: 1fr 1.9fr;
    gap: 0 48px;
    margin-bottom: 56px;
}

.detail-section { margin-bottom: 56px; }

.detail-section-title {
    font-family: var(--sans);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--navy);
    padding-bottom: 8px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--line-strong);
    position: relative;
}
.detail-section-title::after {
    content: '';
    position: absolute;
    left: 0; bottom: -1px;
    width: 40px; height: 3px;
    background: var(--red);
}

.detail-method-step {
    display: grid;
    grid-template-columns: 1fr 1.9fr;
    gap: 0 48px;
    margin-bottom: 32px;
    padding-bottom: 32px;
    border-bottom: 1px solid var(--line);
}
.detail-method-step:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.detail-step-label {
    font-family: var(--sans);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--red);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-top: 3px;
}

.detail-step-content { font-size: 0.98rem; line-height: 1.7; }
.detail-step-content ol { margin-left: 1.2em; }
.detail-step-content li { margin-bottom: 6px; }
.detail-step-content p { margin-top: 12px; font-style: italic; color: var(--muted); font-size: 0.9rem; }

.detail-prose p { font-size: 0.98rem; line-height: 1.75; margin-bottom: 0.9em; }
.detail-prose p:last-child { margin-bottom: 0; }

.detail-list { list-style: none; font-size: 0.98rem; line-height: 1.7; }
.detail-list li { margin-bottom: 10px; padding-left: 1.2em; position: relative; }
.detail-list li::before { content: '—'; position: absolute; left: 0; color: var(--red); }
.detail-list strong { font-style: normal; color: var(--navy); }

.sources-list { list-style: none; font-size: 0.92rem; line-height: 1.7; }
.sources-list li { margin-bottom: 8px; padding-left: 1.2em; position: relative; }
.sources-list li::before { content: '—'; position: absolute; left: 0; color: var(--line-strong); }
.source-title { font-style: italic; color: var(--ink); }
.source-author { color: var(--muted); }

.toc-detail-section {
    margin-top: 20px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}
.toc-detail-section a {
    font-family: var(--sans);
    font-size: 0.78rem;
    color: var(--muted);
    display: block;
    line-height: 1.85;
    border-left: 2px solid transparent;
    padding-left: 8px;
    margin-left: -10px;
}
.toc-detail-section a:hover { color: var(--navy); }
.toc-detail-section a.active { color: var(--red); font-weight: 500; border-left-color: var(--red); }

/* ── Responsive ── */

@media (max-width: 820px) {
    .burger { display: flex; }

    .masthead { padding: 16px; }
    .masthead-title { font-size: 1.3rem; }

    .page { flex-direction: column; gap: 0; padding: 0 22px; }

    .toc {
        position: fixed;
        top: 0; left: 0;
        width: 84vw;
        max-width: 340px;
        height: 100vh;
        background: var(--paper);
        border-right: 1px solid var(--line-strong);
        z-index: 100;
        padding: 64px 28px 40px;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }
    .toc.is-open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.15); }

    .content { padding: 32px 0 80px; max-width: 100%; }
    .recipe { padding: 22px; }
    .recipe-body { grid-template-columns: 1fr; gap: 20px; }
    .recipe-notes { grid-column: 1; }
    .detail-top { grid-template-columns: 1fr; gap: 24px; }
    .detail-method-step { grid-template-columns: 1fr; gap: 8px; }
    .fp-title { font-size: 1.9rem; }
    .detail-title { font-size: 1.9rem; }
}
