/* ── IELTS Writing Samples — clean, print-friendly ── */

:root {
    --text: #1a1a1a;
    --muted: #5f6b7a;
    --border: #e2e6eb;
    --accent: #2563eb;
    --accent-light: #eff6ff;
    --bg: #f8f9fb;
    --card-bg: #fff;
    --font-serif: Georgia, "Times New Roman", "Noto Serif SC", serif;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
}

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

body {
    font-family: var(--font-sans);
    color: var(--text);
    line-height: 1.7;
    background: var(--bg);
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem 2rem 5rem;
}

/* ── Navigation ── */
.breadcrumb {
    font-size: 0.85rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.breadcrumb a {
    color: var(--accent);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.breadcrumb a:hover { text-decoration: underline; }

/* ── Essay header ── */
.essay-header {
    margin-bottom: 2.5rem;
}
.essay-header .meta {
    font-size: 0.8rem;
    color: var(--muted);
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}
.essay-header h1 {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    margin-bottom: 0.75rem;
}
.essay-header .type-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--accent-light);
    color: var(--accent);
    padding: 4px 12px;
    border-radius: 20px;
}

/* ── Question callout ── */
.question-callout {
    background: var(--accent-light);
    border-left: 3px solid var(--accent);
    padding: 1.25rem 1.5rem;
    margin: 2rem 0;
    border-radius: 0 6px 6px 0;
}
.question-callout h2 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.75rem;
}
.question-callout p {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    line-height: 1.65;
    color: var(--text);
}

/* ── Images ── */
.chart-images {
    margin: 2rem 0;
    text-align: center;
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.chart-images img {
    max-width: 100%;
    height: auto;
    max-height: 420px;
    border-radius: 4px;
}
.chart-images .caption {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.75rem;
    font-style: italic;
}

/* ── Essay body ── */
.essay-body {
    font-family: var(--font-serif);
    font-size: 1.08rem;
    line-height: 1.85;
    margin: 2.5rem 0;
    color: #1a1a1a;
}
.essay-body p {
    margin-bottom: 1.3rem;
}

/* ── Section cards ── */
.section {
    margin-top: 2.5rem;
    padding: 1.5rem 1.5rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}
.section h3 {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
}
.section h4 {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin: 1rem 0 0.5rem;
}
.section p {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 0.8rem;
}
.section ul, .section ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}
.section li {
    font-family: var(--font-serif);
    font-size: 0.93rem;
    line-height: 1.65;
    margin-bottom: 0.35rem;
}

/* ── Tables ── */
.section table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.9rem;
    font-family: var(--font-sans);
}
.section th {
    background: var(--bg);
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    padding: 0.6rem 0.8rem;
    border-bottom: 2px solid var(--border);
}
.section td {
    padding: 0.5rem 0.8rem;
    border-bottom: 1px solid var(--border);
    font-family: var(--font-serif);
}
.section tr:last-child td { border-bottom: none; }

/* ── Inline code ── */
.section code {
    background: #f1f3f5;
    color: #c7254e;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.88em;
    font-family: "SF Mono", "Fira Code", monospace;
}

/* ── Index page ── */
.index-header {
    text-align: center;
    margin-bottom: 3rem;
}
.index-header h1 {
    font-family: var(--font-serif);
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.index-header p {
    color: var(--muted);
    margin-top: 0.4rem;
    font-size: 0.95rem;
}
.test-group {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.test-group h2 {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}
.essay-list { list-style: none; }
.essay-list li {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 0.6rem 0;
}
.essay-list li:last-child { padding-bottom: 0; }
.essay-list a {
    font-family: var(--font-serif);
    font-size: 1rem;
    color: var(--text);
    text-decoration: none;
    flex: 1;
}
.essay-list a:hover { color: var(--accent); }
.essay-list .badge {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--bg);
    color: var(--muted);
    padding: 3px 10px;
    border-radius: 12px;
    white-space: nowrap;
}
.speaking-badge {
    background: #f0fdf4 !important;
    color: #166534 !important;
}
.category-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0.8rem 0 0.4rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border);
}
.category-label:first-of-type { margin-top: 0; }

/* ── Speaking Detail Page ── */

/* Q&A Cards (Part 1 & Part 3) */
.speaking-qa-cards {
    margin: 2rem 0;
}
.qa-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.15s ease;
}
.qa-card:last-child { margin-bottom: 0; }
.qa-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }

.qa-question {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}
.qa-answer {
    font-family: var(--font-serif);
    font-size: 1.02rem;
    line-height: 1.8;
    color: var(--text);
}
.qa-answer p {
    margin-bottom: 0.8rem;
}
.qa-answer p:last-child { margin-bottom: 0; }

/* Part 1: conversational feel — thinner border, slightly lighter */
.part1-cards .qa-card {
    border-left: 3px solid var(--accent);
    border-radius: 0 8px 8px 0;
}
.part1-cards .qa-question {
    color: var(--text);
    font-weight: 700;
    font-size: 0.82rem;
}

/* Part 3: more formal — full border, slightly larger */
.part3-cards .qa-card {
    border: 1px solid var(--border);
    border-left: 3px solid #5f6b7a;
    border-radius: 0 8px 8px 0;
    padding: 1.35rem 1.5rem;
}
.part3-cards .qa-question {
    font-size: 0.85rem;
    color: var(--muted);
    border-bottom-style: dashed;
}
.part3-cards .qa-answer {
    font-size: 0.98rem;
}

/* Topic group headings (Part 3) */
.topic-group-heading {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 2rem 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--border);
}

/* Part 3 overview block */
.part3-overview {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0 2rem;
    font-family: var(--font-serif);
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--muted);
}
.part3-overview p { margin-bottom: 0.7rem; }
.part3-overview p:last-child { margin-bottom: 0; }
.part3-overview strong { color: var(--text); }

/* ── Part 2 Monologue (Speech Bubble) ── */
.speaking-monologue {
    margin: 2rem 0;
}
.monologue-bubble {
    position: relative;
    background: var(--accent-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.75rem 2rem;
    /* Quotation mark decoration */
}
.monologue-bubble::before {
    content: "\201C";
    position: absolute;
    top: -0.5rem;
    left: 1.25rem;
    font-family: var(--font-serif);
    font-size: 4rem;
    line-height: 1;
    color: var(--accent);
    opacity: 0.25;
    pointer-events: none;
}
.monologue-content {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    line-height: 1.9;
    color: var(--text);
}
.monologue-content p {
    margin-bottom: 1.1rem;
    text-indent: 0;
}
.monologue-content p:last-child { margin-bottom: 0; }
.monologue-content strong { color: var(--text); }

/* ── Print ── */
@media print {
    @page {
        size: A4;
        margin: 14mm 18mm 14mm 15mm;
    }
    :root { --bg: #fff; --card-bg: #fff; }
    body {
        max-width: 100%;
        padding: 0;
        font-size: 10.5pt;
        background: #fff;
    }
    .breadcrumb, .no-print, .print-cover { display: none; }
    .essay-header h1 { font-size: 1.4rem; }
    .essay-body { font-size: 10.5pt; line-height: 1.7; }
    .section {
        page-break-inside: avoid;
        border: none;
        padding: 0.5rem 0;
        background: none;
    }
    .section h3 { border-bottom-width: 1px; }
    .chart-images {
        border: none;
        background: none;
        padding: 0.5rem 0;
    }
    .chart-images img { max-height: 2.8in; border: 0.5px solid #ccc; }
    .question-callout { background: #fafafa; }
    .test-group { border: none; background: none; padding: 0.5rem 0; }
    a { color: var(--text); text-decoration: none; }

    /* Page break before each essay */
    .essay-page {
        page-break-before: always;
    }
    .essay-page:first-of-type { page-break-before: avoid; }
    .page-break { page-break-before: always; }

    .analysis-heading {
        font-family: var(--font-sans);
        font-size: 11pt;
        font-weight: 600;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 0.2in;
    }

    /* Stacked full-width analysis — one dimension per row */
    .analysis-grid {
        display: flex;
        flex-direction: column;
        gap: 0.3in;
        margin-top: 0.3in;
    }
    .analysis-cell {
        break-inside: avoid;
        font-size: 8.5pt;
        line-height: 1.45;
        max-width: 100%;
        min-height: 4.2in;
    }
    .analysis-cell:nth-child(2) {
        page-break-after: always;
    }
    .analysis-cell h3 {
        font-size: 7.5pt;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--muted);
        border-bottom: 1px solid #ccc;
        padding-bottom: 3px;
        margin-bottom: 4px;
    }
    .analysis-cell p, .analysis-cell li {
        font-size: 8pt;
        line-height: 1.45;
        margin-bottom: 2px;
    }
    .analysis-cell ul { padding-left: 12px; }
    .analysis-cell code { font-size: 7pt; }

    /* Speaking detail print styles */
    .qa-card {
        page-break-inside: avoid;
        border: none;
        border-left: 2px solid #ccc;
        border-radius: 0;
        padding: 0.4rem 0 0.4rem 0.6rem;
        margin-bottom: 0.4rem;
        background: none;
    }
    .qa-card:hover { box-shadow: none; }
    .qa-question {
        font-size: 8pt;
        border-bottom: 0.5px solid #ddd;
        padding-bottom: 2px;
        margin-bottom: 3px;
    }
    .qa-answer { font-size: 9pt; line-height: 1.55; }
    .qa-answer p { margin-bottom: 3px; }
    .part1-cards .qa-card { border-left-color: #999; }
    .part3-cards .qa-card { border-left-color: #666; }
    .part3-cards .qa-question { border-bottom-style: solid; }

    .topic-group-heading {
        font-size: 8.5pt;
        margin: 0.5rem 0 0.3rem;
        border-bottom-width: 1px;
    }
    .part3-overview {
        font-size: 9pt;
        background: #fafafa;
        border: none;
        padding: 0.3rem 0;
    }

    .monologue-bubble {
        background: #fafafa;
        border: 1px solid #ddd;
        padding: 0.6rem 0.8rem;
        page-break-inside: avoid;
    }
    .monologue-bubble::before { opacity: 0.15; font-size: 3rem; }
    .monologue-content { font-size: 10pt; line-height: 1.65; }
    .monologue-content p { margin-bottom: 0.5rem; }
}

/* Screen-only: analysis stacked full-width */
@media screen and (min-width: 700px) {
    .analysis-grid {
        display: flex;
        flex-direction: column;
        gap: 1.25rem;
        margin-top: 1rem;
    }
    .analysis-cell {
        background: var(--card-bg);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 1.25rem;
    }
    .analysis-cell h3 {
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        border-bottom: 1px solid var(--border);
        padding-bottom: 0.5rem;
        margin-bottom: 0.75rem;
    }
}

/* Print-cover bar */
.print-cover {
    text-align: center;
    padding: 2rem;
    margin-bottom: 1rem;
    background: var(--accent-light);
    border-radius: 8px;
    border: 1px solid var(--border);
}
.print-cover h1 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
}
.print-cover p { margin-top: 0.3rem; }

.print-all-link {
    display: inline-block;
    background: var(--accent);
    color: #fff !important;
    padding: 10px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
}
.print-all-link:hover { opacity: 0.9; }
