/* ═══════════════════════════════════════════
   BABETTE BIG IN JAPAN – Web Stylesheet
   Maps booklet CSS classes to responsive web design
   ═══════════════════════════════════════════ */

:root {
    --warm: #8b7355;
    --accent: #c4533a;
    --accent-light: #d4735e;
    --bg: #ffffff;
    --bg-warm: #faf6f0;
    --bg-dark: #2d2418;
    --text: #2d2418;
    --text-light: #5a4d3f;
    --soft: #e8d5c4;
    --border: #d4c4b0;
    --serif: 'Cormorant Garamond', Georgia, serif;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 70px; }

body {
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-light); }
table { border-collapse: collapse; width: 100%; }
td { vertical-align: top; }
hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ── Navigation ── */
.nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}
.nav.scrolled {
    background: rgba(250, 246, 240, 0.96);
    backdrop-filter: blur(12px);
    box-shadow: 0 1px 20px rgba(0,0,0,0.08);
}
.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-logo {
    font-family: var(--serif);
    font-size: 24px;
    font-weight: 700;
    color: white;
    text-decoration: none;
    transition: color 0.3s;
}
.nav.scrolled .nav-logo { color: var(--text); }
.nav-links {
    list-style: none;
    display: flex;
    gap: 22px;
}
.nav-links a {
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.8px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    text-transform: uppercase;
    transition: color 0.2s;
}
.nav.scrolled .nav-links a { color: var(--text-light); }
.nav-links a:hover { color: var(--accent); }
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
    padding: 4px;
}
.nav-toggle span {
    display: block; width: 24px; height: 2px;
    background: white; transition: background 0.3s;
}
.nav.scrolled .nav-toggle span { background: var(--text); }

/* ── Cover / Hero ── */
.cover-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    overflow: hidden;
    background: linear-gradient(160deg, #2d2418 0%, #4a3728 40%, #6b5240 100%);
    /* Override print styles */
    page-break-after: unset;
    width: 100%;
    height: auto;
}
.cover-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('https://images.unsplash.com/photo-1522383225653-ed111181a951?w=1600&q=80') center/cover no-repeat;
    opacity: 0.25;
    filter: blur(1px);
}
.cover-content {
    position: relative;
    z-index: 1;
    padding: 40px 24px;
    max-width: 700px;
}
.cover-kanji {
    font-family: var(--serif);
    font-size: 80px;
    letter-spacing: 16px;
    color: var(--soft);
    margin-bottom: 12px;
    font-weight: 300;
}
.cover-line {
    width: 60px;
    height: 2px;
    background: var(--accent);
    margin: 18px auto;
}
.cover-title {
    font-family: var(--serif);
    font-size: 44px;
    font-weight: 700;
    color: white;
    letter-spacing: 4px;
    margin-bottom: 8px;
}
.cover-subtitle {
    font-family: var(--sans);
    font-size: 16px;
    color: var(--soft);
    letter-spacing: 2px;
}
.cover-from {
    margin-top: 48px;
    font-family: var(--serif);
    font-size: 16px;
    color: #b8a896;
    font-style: italic;
    line-height: 1.8;
}

/* ── Intro section ── */
.intro {
    padding: 80px 24px;
    background: var(--bg-warm);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}
.intro.visible { opacity: 1; transform: translateY(0); }

/* ── Chapter sections ── */
.chapter {
    padding: 80px 24px;
    max-width: 800px;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
    /* Override print styles */
    page-break-before: unset;
}
.chapter.visible { opacity: 1; transform: translateY(0); }

/* All chapters white background */
.chapter { background: var(--bg); }

/* Make chapters full-width for background */
.chapter {
    max-width: none;
    padding-left: 24px;
    padding-right: 24px;
}
.chapter > *, .intro > * {
    max-width: 740px;
    margin-left: auto;
    margin-right: auto;
}
.chapter > img, .chapter > table {
    max-width: 800px;
}

/* ── Section headers ── */
.chapter-number {
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 600;
    color: var(--warm);
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.chapter-title {
    font-family: var(--serif);
    font-size: 38px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: 6px;
}
.chapter-tagline {
    font-family: var(--serif);
    font-size: 17px;
    color: var(--text-light);
    font-style: italic;
    margin-bottom: 14px;
}
.intro-title {
    font-family: var(--serif);
    font-size: 34px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
    line-height: 1.2;
}

.divider {
    width: 40px;
    height: 2px;
    background: var(--accent);
    margin: 16px 0 28px 0;
}

/* ── Content ── */
p {
    margin-bottom: 16px;
    line-height: 1.75;
}

h3 {
    font-family: var(--serif);
    font-size: 24px;
    font-weight: 600;
    color: var(--warm);
    margin-top: 36px;
    margin-bottom: 14px;
}

/* ── Hero images ── */
.chapter-hero {
    width: 100%;
    height: 340px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 32px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    max-width: 800px !important;
}

/* ── Spot cards ── */
.spot {
    margin: 16px 0;
    padding: 0;
}
.spot-name {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 19px;
    color: var(--text);
    margin-bottom: 4px;
}
.spot-desc {
    font-size: 15px;
    color: var(--text-light);
    line-height: 1.7;
    padding-left: 16px;
    border-left: 3px solid var(--border);
    margin-bottom: 8px;
    transition: border-color 0.2s;
}
.spot-desc:hover { border-color: var(--accent); }

/* ── Highlight box ── */
.highlight-box {
    background: var(--bg-warm);
    border-left: 3px solid var(--accent);
    padding: 20px 24px;
    margin: 28px 0;
    border-radius: 0 6px 6px 0;
    font-size: 15px;
    line-height: 1.7;
}
.highlight-box strong { color: var(--accent); }

/* ── Tip ── */
.tip {
    background: #f0ebe3;
    border-radius: 6px;
    padding: 16px 20px 16px 36px;
    margin: 20px 0;
    font-size: 15px;
    color: var(--text-light);
    position: relative;
}
.tip::before {
    content: '\00BB';
    position: absolute;
    left: 16px;
    color: var(--accent);
    font-weight: bold;
    font-size: 18px;
}

/* ── Rules ── */
.rule {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin: 18px 0;
    padding-bottom: 18px;
    border-bottom: 1px solid #eee;
}
.rule:last-child { border-bottom: none; }
.rule-num {
    font-family: var(--serif);
    font-size: 34px;
    font-weight: 700;
    color: var(--accent);
    min-width: 36px;
    line-height: 1;
    padding-top: 4px;
}
.rule-text {
    font-size: 15px;
    color: var(--text-light);
    line-height: 1.65;
}
.rule-text strong {
    display: block;
    font-family: var(--serif);
    font-size: 17px;
    color: var(--text);
    margin-bottom: 4px;
}

/* ── Inline images in content ── */
.chapter img:not(.chapter-hero) {
    border-radius: 6px;
    margin: 8px 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

/* Tables (used for side-by-side images + text) */
.chapter table {
    margin: 20px auto;
    table-layout: fixed;
}
.chapter td {
    padding: 10px;
    vertical-align: top;
}
.chapter td img {
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    width: 100%;
    height: auto;
}

/* ── Footer ── */
.site-footer {
    background: var(--bg-dark);
    color: var(--soft);
    padding: 60px 24px;
    text-align: center;
}
.footer-kanji {
    font-family: var(--serif);
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}
.footer-sub {
    font-size: 14px;
    color: var(--warm);
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */
@media (max-width: 768px) {
    .cover-kanji { font-size: 52px; letter-spacing: 10px; }
    .cover-title { font-size: 28px; letter-spacing: 2px; }
    .cover-subtitle { font-size: 14px; }

    .chapter, .intro { padding: 56px 20px; }
    .chapter-title { font-size: 28px; }
    .intro-title { font-size: 26px; }
    h3 { font-size: 20px; }

    .chapter-hero { height: 200px; }

    /* Stack table cells vertically on mobile, keep image+text pairs together */
    .chapter table {
        display: block;
        width: 100%;
    }
    .chapter tbody { display: block; }
    .chapter tr {
        display: flex;
        flex-direction: column;
        gap: 16px;
        margin-bottom: 20px;
    }
    .chapter td {
        display: block;
        width: 100% !important;
        padding: 0;
    }
    /* Ensure images inside table cells scale properly */
    .chapter td img {
        width: 100%;
        height: auto;
        margin-bottom: 8px;
    }
    /* Keep spot-name and spot-desc together with their preceding image */
    .chapter td .spot-name,
    .chapter td .spot-desc {
        margin-top: 0;
    }

    /* Mobile nav */
    .nav-toggle { display: flex; }
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0; right: 0;
        background: rgba(250, 246, 240, 0.98);
        backdrop-filter: blur(10px);
        flex-direction: column;
        padding: 20px 24px;
        gap: 16px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    }
    .nav-links.open { display: flex; }
    .nav-links a { color: var(--text-light) !important; font-size: 14px; }
}

@media (max-width: 480px) {
    .cover-kanji { font-size: 40px; }
    .cover-title { font-size: 22px; }
    .chapter-title { font-size: 24px; }
    .rule-num { font-size: 28px; min-width: 30px; }
}

/* ── Print: hide nav/footer, page breaks before main sections ── */
@media print {
    .nav, .site-footer { display: none; }
    .chapter, .intro { opacity: 1; transform: none; }

    /* Page break before each main section */
    .chapter { page-break-before: always; }

    /* Avoid breaking inside content blocks */
    .spot, .rule, .highlight-box, .tip, .snack-card, .principle {
        page-break-inside: avoid;
    }

    /* Keep images with their captions */
    img { page-break-inside: avoid; page-break-after: avoid; }
    .spot-name { page-break-after: avoid; }

    /* Cover page should be its own page */
    .cover-page { page-break-after: always; min-height: 100vh; }

    /* Don't break inside tables */
    table, tr, td { page-break-inside: avoid; }
}
