:root {
    --ink-900: #10243d;
    --ink-700: #294866;
    --ink-600: #3f5f7d;
    --paper: #fffdfa;
    --mist: #eef4f8;
    --accent: #0a8c6b;
    --accent-dark: #076950;
    --gold: #edb83c;
    --rose: #f9ecec;
    --sky: #eaf7ff;
    --line: #d4e0ea;
    --shadow: 0 10px 30px rgba(22, 44, 73, 0.12);
    --radius: 18px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: linear-gradient(140deg, #f5fbff 0%, #fff9ef 55%, #f5fff9 100%);
    color: var(--ink-900);
    font-family: 'Source Sans 3', sans-serif;
    line-height: 1.55;
}

h1,
h2,
h3,
h4 {
    font-family: 'Bree Serif', serif;
    margin-top: 0;
    color: var(--ink-900);
    line-height: 1.25;
}

p,
li,
summary,
label,
th,
td {
    font-size: 1.04rem;
}

a {
    color: var(--accent-dark);
}

code {
    background: #eff4f8;
    border-radius: 6px;
    padding: 0.12rem 0.35rem;
    font-size: 0.95em;
}

.background-shape {
    position: fixed;
    border-radius: 999px;
    filter: blur(2px);
    opacity: 0.35;
    z-index: -1;
}

.background-shape-one {
    width: 340px;
    height: 340px;
    top: -110px;
    left: -90px;
    background: radial-gradient(circle at 40% 40%, #f7d885, #f5f7c0);
}

.background-shape-two {
    width: 420px;
    height: 420px;
    right: -160px;
    top: 140px;
    background: radial-gradient(circle at 50% 50%, #9fd8c7, #d2f3ff);
}

.hero {
    padding: 2.4rem 1.25rem 1.75rem;
}

.hero-content {
    max-width: 1100px;
    margin: 0 auto;
    border: 1px solid var(--line);
    border-radius: calc(var(--radius) + 6px);
    padding: 2.1rem;
    background: linear-gradient(125deg, #ffffff 0%, #f2faf7 100%);
    box-shadow: var(--shadow);
}

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
    color: var(--ink-600);
    font-weight: 700;
}

.hero h1 {
    margin-top: 0.55rem;
    margin-bottom: 0.85rem;
    font-size: clamp(1.9rem, 4vw, 2.7rem);
}

.hero-subtitle {
    margin-bottom: 1.4rem;
    max-width: 72ch;
}

.hero-actions {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
}

.layout {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 1.25rem 2.2rem;
    display: grid;
    gap: 1.2rem;
    grid-template-columns: 280px minmax(0, 1fr);
}

.toc {
    position: sticky;
    top: 1rem;
    align-self: start;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    box-shadow: 0 8px 24px rgba(16, 36, 61, 0.08);
}

.toc h2 {
    margin-bottom: 0.8rem;
    font-size: 1.25rem;
}

.toc nav {
    display: grid;
    gap: 0.3rem;
}

.toc-link {
    display: block;
    padding: 0.4rem 0.5rem;
    border-radius: 8px;
    color: var(--ink-700);
    text-decoration: none;
    transition: background-color 160ms ease, transform 160ms ease;
}

.toc-link:hover,
.toc-link:focus-visible {
    background: var(--mist);
    transform: translateX(3px);
}

.toc-link.active {
    background: #e4f7f0;
    color: var(--accent-dark);
    font-weight: 700;
}

.progress-card {
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--line);
}

.progress-label {
    font-size: 0.92rem;
    margin: 0 0 0.45rem;
    color: var(--ink-600);
}

.progress-track {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: #e6edf3;
    overflow: hidden;
}

.progress-fill {
    width: 0%;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--gold), var(--accent));
    transition: width 220ms ease;
}

.progress-text {
    margin: 0.45rem 0 0;
    font-size: 0.92rem;
    color: var(--ink-700);
}

.content {
    display: grid;
    gap: 1.1rem;
}

.panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.35rem;
    background: var(--paper);
    box-shadow: 0 8px 24px rgba(16, 36, 61, 0.08);
}

.panel h2 {
    margin-bottom: 0.95rem;
    font-size: clamp(1.45rem, 2.8vw, 2rem);
}

.summary-grid,
.three-col {
    display: grid;
    gap: 0.85rem;
    margin-bottom: 0.95rem;
}

.summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-col {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tile {
    border: 1px solid #d5e5ef;
    border-radius: var(--radius-sm);
    padding: 0.95rem;
    background: #fcfeff;
}

.tile h3 {
    margin-bottom: 0.55rem;
    font-size: 1.18rem;
}

.analogy-card {
    border: 2px solid #88c6b3;
    background: linear-gradient(145deg, #f5fffb 0%, #f6fcff 100%);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-top: 0.8rem;
}

.callout {
    margin: 0 0 1rem;
    border-left: 6px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 0.85rem 1rem;
    background: #ecfbf5;
}

.callout p {
    margin: 0;
}

.callout-phone {
    border-left-color: #c67b00;
    background: #fff6e5;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 650px;
}

th,
td {
    border: 1px solid #d6e2eb;
    padding: 0.65rem;
    vertical-align: top;
}

th {
    background: #eff6fd;
    text-align: left;
}

.faq-list {
    display: grid;
    gap: 0.65rem;
}

details {
    border: 1px solid #d4e2ec;
    border-radius: 10px;
    background: #fdfefe;
    padding: 0.6rem 0.8rem;
}

summary {
    font-weight: 700;
    cursor: pointer;
}

.sequence {
    border-left: 4px solid var(--accent-dark);
    background: var(--sky);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 0.7rem 0.8rem;
}

.steps {
    margin-top: 0.8rem;
    display: grid;
    gap: 0.7rem;
}

.step-card {
    border: 1px solid #d8e4ec;
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    background: #ffffff;
}

.step-card h3 {
    margin-bottom: 0.45rem;
    font-size: 1.12rem;
}

.step-card h3 span {
    display: inline-block;
    margin-right: 0.45rem;
    font-family: 'Source Sans 3', sans-serif;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ink-600);
}

.visual-cue {
    margin-bottom: 0;
    background: #f5f7ff;
    border-radius: 8px;
    padding: 0.45rem 0.55rem;
}

.rank-list li {
    margin-bottom: 0.55rem;
}

.security-key-card {
    margin-bottom: 0.95rem;
}

.small-note {
    font-size: 0.92rem;
    color: var(--ink-600);
}

.quiz-form {
    display: grid;
    gap: 0.8rem;
}

fieldset {
    border: 1px solid #d9e6ef;
    border-radius: 10px;
    padding: 0.7rem;
    background: #fcfeff;
}

legend {
    font-weight: 700;
    padding: 0 0.35rem;
}

fieldset label {
    display: block;
    margin: 0.35rem 0;
}

.quiz-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.quiz-result {
    min-height: 1.4rem;
    margin: 0.2rem 0 0;
    font-weight: 700;
    color: var(--ink-700);
}

.answer-key {
    margin-top: 0.8rem;
}

.answer-key summary {
    font-family: 'Bree Serif', serif;
}

.analogy-reminder {
    border-left: 6px solid var(--gold);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    padding: 0.7rem 0.9rem;
    background: #fff7e3;
}

.checklist {
    columns: 2;
    column-gap: 1.4rem;
}

.help-line {
    border-top: 1px dashed #b9cad8;
    padding-top: 0.7rem;
}

.button {
    border: none;
    border-radius: 10px;
    padding: 0.63rem 0.95rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.button:hover,
.button:focus-visible {
    transform: translateY(-1px);
}

.button.primary {
    background: linear-gradient(115deg, var(--accent), var(--accent-dark));
    color: #fff;
    box-shadow: 0 6px 20px rgba(7, 105, 80, 0.25);
}

.button.secondary {
    background: #edf2f7;
    color: var(--ink-900);
}

.reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 350ms ease, transform 350ms ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 1050px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .toc {
        position: static;
    }

    .toc nav {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.4rem;
    }
}

@media (max-width: 850px) {
    .summary-grid,
    .three-col {
        grid-template-columns: 1fr;
    }

    .checklist {
        columns: 1;
    }
}

@media (max-width: 620px) {
    body {
        line-height: 1.45;
    }

    p,
    li,
    summary,
    label,
    th,
    td {
        font-size: 1rem;
    }

    .hero {
        padding: 1.1rem 0.75rem 1rem;
    }

    .hero-content {
        padding: 1.2rem;
    }

    .layout {
        padding: 0 0.75rem 1.5rem;
    }

    .panel {
        padding: 1rem;
    }

    .toc nav {
        grid-template-columns: 1fr;
    }
}

@media print {
    body {
        background: #fff;
    }

    .background-shape {
        display: none;
    }

    body.print-guide .hero,
    body.print-guide .toc,
    body.print-guide .panel:not(#quick-guide) {
        display: none !important;
    }

    body.print-guide .layout {
        display: block;
        max-width: 100%;
        padding: 0;
    }

    body.print-guide #quick-guide {
        box-shadow: none;
        border: 1px solid #999;
        margin: 0;
        border-radius: 0;
    }

    body.print-guide #printGuideBtnBottom {
        display: none;
    }
}

/* ---------- Portfolio demo additions (not part of the original module) ---------- */

.demo-banner {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--ink-900);
    color: #fff;
    font-size: 0.92rem;
    line-height: 1.35;
    padding: 0.55rem 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.9rem;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.demo-banner a {
    color: #ffe08f;
    font-weight: 700;
}

.demo-banner a:focus-visible,
.button:focus-visible,
.toc-link:focus-visible,
summary:focus-visible,
input:focus-visible {
    outline: 3px solid #1a73e8;
    outline-offset: 2px;
}

.demo-banner a:focus-visible {
    outline-color: #ffe08f;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0.5rem;
    background: #fff;
    color: var(--ink-900);
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    z-index: 60;
}

.skip-link:focus {
    left: 0.5rem;
}

.toc {
    top: 3.5rem;
}

.section-anchor {
    scroll-margin-top: 3.5rem;
}

@media (max-width: 1050px) {
    .toc {
        top: auto;
    }

    /* Original used 1fr here, which let the wide table push the whole page sideways. */
    .layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

.content > * {
    min-width: 0;
}

/* Browsers draw a legend on the fieldset's top border, so the question sat half
   outside its card. Floating it moves it inside, above the answer choices. */
fieldset {
    margin: 0;
    padding: 0.9rem 1rem 0.6rem;
}

legend {
    float: left;
    width: 100%;
    padding: 0;
    margin-bottom: 0.4rem;
    line-height: 1.4;
}

legend + label {
    clear: both;
}

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

    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .toc-link,
    .button,
    .progress-fill {
        transition: none;
    }
}

@media print {
    .demo-banner,
    .skip-link {
        display: none !important;
    }
}
