/* =====================================================================
   Reading styles for the blog and FRCS study-guide pages.
   Linked after each page's own <style> block, so it only overrides it;
   removing the <link> puts a page back exactly as it was.
     1. Type and spacing   one typeface, lining figures, ~75ch lines,
                           16px body on phones, tidier tables and links
     2. Panels             white sections float on the colour bands
     3. Contents           rail (wide screens) / section bar (phones),
                           built by reading-nav.js
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. Type and spacing
   --------------------------------------------------------------------- */
:root {
    --ink: #26353d;            /* body text: blue-black that sits with #2e667d */
    --ink-strong: #17252c;
    --ink-soft: #55656e;
    --rule: #dbe7ec;
    --tint: #f3f8fa;
    --read-font: "Raleway", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

/* One typeface. Each page's `* { font-family: Arial }` reset beats inheritance,
   so bold words, list items and table cells were rendering in Arial inside
   Raleway paragraphs. The sans fallback also stops β/α dropping to Times. */
html body {
    font-family: var(--read-font);
    color: var(--ink);
    font-variant-numeric: lining-nums;   /* old-style figures: "Part 1" read as "Part ı" */
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
html body * {
    font-family: inherit !important;
}

/* ---------- Header ---------- */
.header h1 {
    letter-spacing: -0.015em;
}
.breadcrumb {
    font-size: 0.85rem;
}
.post-meta {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.78);
}

/* ---------- Intro bar ---------- */
.intro-bar .content-text {
    line-height: 1.7;
}
/* Line the intro text up with the body text below it (beats the inline padding) */
.intro-bar .content-section {
    padding: 0 3.25rem !important;
}

/* ---------- Reading column ---------- */
/* ~75 characters per line instead of ~100 */
.section-wrapper > .content-section {
    max-width: 760px;
    padding: 3rem 3.25rem;
}
.intro-bar .content-section {
    max-width: 760px;
}

.content-text,
.content-list {
    font-size: 1.0625rem;
    line-height: 1.75;
    font-weight: 500;
    color: var(--ink);
}
.content-text {
    margin-bottom: 1.15em;
}
.content-list {
    margin: 0 0 1.3em 1.35em;
}
.content-list li {
    margin-bottom: 0.45em;
    padding-left: 0.2em;
}
.content-list li::marker {
    color: var(--primary-blue);
    font-weight: 700;
}
.content-text strong,
.content-list strong {
    font-weight: 700;
    color: var(--ink-strong);
}

.content-text a,
.content-list a {
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    text-decoration-color: rgba(46, 102, 125, 0.45);
}
.content-text a:hover,
.content-list a:hover {
    text-decoration-color: currentColor;
}

/* ---------- Headings ---------- */
.section-title {
    font-size: 1.85rem;
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin-bottom: 1.4rem;
    padding-bottom: 0.45rem;
}
.content-subtitle,
.subsection-title {
    font-size: 1.3rem;
    line-height: 1.3;
    letter-spacing: -0.005em;
    margin: 2.25rem 0 0.7rem;
}

/* ---------- Callouts ---------- */
.highlight-box {
    padding: 1.4rem 1.6rem;
    border-radius: 0 8px 8px 0;
}
.highlight-box .content-text:last-child,
.highlight-box .content-list:last-child {
    margin-bottom: 0;
}

/* ---------- Tables ---------- */
.table-scroll {
    border: 1px solid var(--rule);
    border-radius: 8px;
}
.grade-table,
.info-table,
.comparison-table {
    font-variant-numeric: lining-nums tabular-nums;
}
.grade-table {
    font-size: 0.95rem;
}
.grade-table th {
    font-size: 0.82rem;
    letter-spacing: 0.01em;
    padding: 0.75rem 1rem;
}
.grade-table td {
    font-weight: 500;
    color: var(--ink);
}
.grade-table th[scope="row"] {
    font-weight: 700;
}
.grade-table tbody tr:last-child td,
.grade-table tbody tr:last-child th {
    border-bottom: 0;
}

/* ---------- Blog index ---------- */
.content-section-wrapper .content-section {
    max-width: 820px;
}
.blog-posts-grid {
    gap: 1.25rem;
}
.blog-post-card {
    padding: 1.6rem 1.85rem;
}
.post-title {
    font-size: 1.45rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
}
.post-excerpt {
    font-size: 1rem;
    line-height: 1.65;
    color: var(--ink-soft);
    margin-bottom: 0.85rem;
}
.post-date {
    font-size: 0.85rem;
    color: var(--ink-soft);
}

/* ---------- Guide cards ---------- */
.guide-card-description {
    color: var(--ink-soft);
}

/* ---------- CTA ---------- */
.cta-text {
    max-width: 38em;
    margin-left: auto;
    margin-right: auto;
}

/* ---------- Phones ---------- */
@media (max-width: 768px) {
    .header-logo {
        max-width: 170px;
        margin-bottom: 0.6rem;
    }
    .breadcrumb {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }
    .post-meta {
        font-size: 0.78rem;
        line-height: 1.5;
        margin-bottom: 0.75rem;
    }
    .header h1 {
        font-size: 1.6rem;
    }

    .intro-bar {
        padding: 1.25rem 1.75rem;   /* same inset as the body text in its panel */
    }
    .intro-bar .content-section {
        padding: 0 !important;
    }
    .intro-bar .content-text {
        font-size: 1rem;
        line-height: 1.6;
    }

    /* 16px body instead of 14px */
    .section-wrapper > .content-section {
        padding: 1.5rem 1.15rem;
    }
    .content-text,
    .content-list {
        font-size: 1rem;
        line-height: 1.65;
    }
    .content-text {
        margin-bottom: 1em;
    }
    .content-list {
        margin-left: 1.2em;
    }

    .section-title {
        font-size: 1.35rem;
        margin-bottom: 1rem;
    }
    .content-subtitle,
    .subsection-title {
        font-size: 1.1rem;
        margin: 1.6rem 0 0.5rem;
    }

    .highlight-box {
        padding: 1rem 1.1rem;
    }

    .grade-table {
        font-size: 0.875rem;
    }
    .grade-table th {
        font-size: 0.78rem;
    }
    .grade-table th[scope="row"] {
        font-size: 0.875rem;
    }

    .blog-post-card {
        padding: 1.1rem 1.15rem;
    }
    .post-title {
        font-size: 1.15rem;
    }
    .post-excerpt {
        font-size: 0.92rem;
        line-height: 1.55;
    }
    .post-date {
        font-size: 0.78rem;
    }

    .guide-card-title {
        font-size: 1rem;
    }
    .guide-card-description {
        font-size: 0.88rem;
        line-height: 1.5;
    }

    .cta-text {
        font-size: 0.95rem;
    }
}


/* ---------------------------------------------------------------------
   2. Panels: each white section floats on its colour band
   --------------------------------------------------------------------- */
.section-wrapper {
    padding: 1rem 1rem;
}
.section-wrapper > .content-section {
    border-radius: 14px;
}
.intro-bar + .section-wrapper {
    padding-top: 2rem;
}
.section-wrapper:has(+ :not(.section-wrapper)) {
    padding-bottom: 2rem;
}

/* Inner blocks pick up the same softer corner */
.highlight-box,
.guide-card,
.book-item,
.question-type-box,
details.trial-card {
    border-radius: 0 10px 10px 0;
}
details.trial-card > summary {
    border-radius: 0 10px 10px 0;
}
.toc,
.study-week {
    border-radius: 10px;
}

/* Blog index cards: flatter shadow, no jump on hover */
.blog-post-card {
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(46, 102, 125, 0.08), 0 6px 20px rgba(46, 102, 125, 0.08);
    border: 1px solid transparent;
}
.blog-post-card:hover {
    transform: none;
    border-color: var(--primary-blue);
    box-shadow: 0 1px 2px rgba(46, 102, 125, 0.08), 0 6px 20px rgba(46, 102, 125, 0.12);
}

.btn-large,
.btn-secondary,
.btn-back {
    border-radius: 10px;
}

@media (min-width: 992px) {
    .section-wrapper {
        padding: 1.25rem 2rem;
    }
    .intro-bar + .section-wrapper {
        padding-top: 2.5rem;
    }
    .section-wrapper:has(+ :not(.section-wrapper)) {
        padding-bottom: 2.5rem;
    }
}

@media (max-width: 768px) {
    .section-wrapper {
        padding: 0.45rem 0.6rem;
    }
    .intro-bar + .section-wrapper {
        padding-top: 0.75rem;
    }
    .section-wrapper:has(+ :not(.section-wrapper)) {
        padding-bottom: 0.75rem;
    }
    .section-wrapper > .content-section {
        border-radius: 12px;
    }
}


/* ---------------------------------------------------------------------
   3. Contents rail and section bar (markup added by reading-nav.js)
   --------------------------------------------------------------------- */
/* Anchor targets (titles, stations, references) land clear of the section bar */
.section-wrapper[id],
.section-wrapper [id] {
    scroll-margin-top: 4.5rem;
}
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

.contents-rail,
.section-bar {
    display: none;
}
.contents-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ---------- Desktop: rail in the left margin ---------- */
@media (min-width: 1240px) {
    .contents-rail {
        display: block;
        position: fixed;
        top: 1.5rem;
        left: calc(50% - 380px - 1.75rem - 12.5rem);
        width: 12.5rem;
        max-height: calc(100vh - 3rem);
        overflow-y: auto;
        z-index: 5;
        padding: 1rem 1rem 1rem 0.35rem;
        background-color: white;
        border-radius: 12px;
        box-shadow: 0 6px 22px rgba(0, 0, 0, 0.14);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s, visibility 0.2s;
    }
    .contents-rail.is-visible {
        opacity: 1;
        visibility: visible;
    }
}
.contents-rail-title {
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--primary-blue);
    margin: 0 0 0.55rem 0.95rem;
}
.contents-rail .contents-list {
    border-left: 2px solid var(--rule);
}
.contents-rail .contents-list a {
    display: block;
    margin-left: -2px;
    padding: 0.4rem 0 0.4rem 0.95rem;
    border-left: 3px solid transparent;
    font-size: 0.84rem;
    line-height: 1.35;
    font-weight: 600;
    color: var(--ink-soft);
    text-decoration: none;
    transition: color 0.15s, border-color 0.15s;
}
.contents-rail .contents-list a:hover {
    color: var(--primary-blue);
}
.contents-rail .contents-list a[aria-current="true"] {
    color: var(--primary-blue);
    font-weight: 800;
    border-left-color: var(--primary-yellow);
}
.contents-rail a:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* ---------- Phones and tablets: bar that drops in under the header ---------- */
@media (max-width: 1239.98px) {
    .section-bar {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 20;
        background-color: var(--primary-blue);
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
        transform: translateY(-110%);
        transition: transform 0.2s ease;
    }
    .section-bar.is-visible {
        transform: none;
    }
}
@media (prefers-reduced-motion: reduce) {
    .section-bar,
    .contents-rail {
        transition: none;
    }
}
.section-bar-toggle {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    min-height: 46px;
    padding: 0.55rem 1.15rem;
    background: none;
    border: 0;
    color: white;
    font-size: 0.92rem;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
}
.section-bar-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.section-bar-count {
    flex-shrink: 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
}
.section-bar-toggle svg {
    flex-shrink: 0;
    width: 1.1rem;
    height: 1.1rem;
    transition: transform 0.2s;
}
.section-bar-toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
}
.section-bar-toggle:focus-visible {
    outline: 2px solid var(--primary-yellow);
    outline-offset: -4px;
}
.section-bar-progress {
    height: 3px;
    background-color: rgba(255, 255, 255, 0.18);
}
.section-bar-progress span {
    display: block;
    height: 100%;
    width: 0;
    background-color: var(--primary-yellow);
}
.section-bar-menu {
    background-color: white;
    max-height: 65vh;
    overflow-y: auto;
    padding: 0.35rem 0;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
}
.section-bar-menu a {
    display: block;
    padding: 0.7rem 1.15rem 0.7rem 1rem;
    border-left: 3px solid transparent;
    color: var(--ink);
    font-size: 0.95rem;
    line-height: 1.35;
    font-weight: 600;
    text-decoration: none;
}
.section-bar-menu a[aria-current="true"] {
    color: var(--primary-blue);
    font-weight: 800;
    border-left-color: var(--primary-yellow);
    background-color: var(--tint);
}
.section-bar-menu a:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: -2px;
}
