:root {
    color-scheme: dark;
    --control-size: 44px;
    --night: #0A1720;
    --ink: #EDF7FA;
    --body: #AAC3CC;
    --accent: #79CBE7;
    --header-accent: var(--accent);
    --header-muted: var(--body);
    --rule: #17465A;
    --gutter: clamp(1.05rem, 5vw, 4rem);
    --mast: 3.75rem;
    scroll-padding-block-start: var(--mast);
    --control-ink: var(--ink);
    --control-bg: #102B38;
    --control-border: #4C8094;
    --control-focus: var(--accent);
    --control-hover: #17465A;
    --mast-bg: #0D202C;
    --alternate: #0D202C;
    --cover: #102B38;
    --community-bg: #0E302F;
    --accent-teal: #40C9A2;
    --button-bg: #2E94BD;
    --button-ink: #071521;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--night); color: var(--ink); font: 1rem/1.62 Inter, 'Segoe UI', system-ui, sans-serif; }
h1, h2, p, figure { margin: 0; }
a { color: inherit; text-underline-offset: .24em; }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--control-focus); outline-offset: 3px; }
.wrap { width: min(68rem, calc(100% - 2 * var(--gutter))); margin-inline: auto; }
.skip { position: fixed; top: .45rem; left: 1rem; padding: .4rem .8rem; background: var(--control-hover); transform: translateY(-180%); z-index: 300; }
.skip:focus { transform: none; }
.mast { position: sticky; top: 0; height: var(--mast); z-index: 100; background: var(--mast-bg); border-bottom: 1px solid var(--rule); }
.mast-inner { height: 100%; display: flex; align-items: center; }
.story-name { font: inherit; }
.story-tools { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; }
.byline { color: var(--body); font-size: .86rem; border-right: 1px solid var(--rule); padding-right: .9rem; }
.chapters { display: flex; align-items: center; gap: .2rem; }
.chapters > span, .dateline, figcaption { font: 500 .76rem/1.4 'IBM Plex Mono', ui-monospace, monospace; }
.chapters > span { color: var(--body); margin-right: .4rem; }
.chapters a { min-width: 2rem; min-height: 2rem; display: grid; place-content: center; border-bottom: 2px solid transparent; color: var(--body); font: .82rem ui-monospace, monospace; text-decoration: none; }
.chapters a[aria-current], .chapters a:hover { color: var(--accent); border-color: currentColor; background: var(--control-hover); }
.chapter { background: var(--night); border-bottom: 1px solid var(--rule); }
/* Deep Navy is the default. Chapters 2/5/8 and 3/6 complete the repeating cycle. */
#first-course, #first-aws-role, #today { background: var(--alternate); }
#first-pipeline, #community-builder { background: var(--community-bg); }
.chapter-inner { display: grid; grid-template-columns: minmax(7rem, 1fr) minmax(0, 3.5fr); align-content: center; column-gap: clamp(1.8rem, 5vw, 5rem); padding-block: clamp(2.1rem, 5.5vh, 3.8rem); min-height: min(43svh, 25rem); }
.dateline { align-self: start; color: var(--accent); letter-spacing: .06em; text-transform: uppercase; padding-top: .55rem; display: flex; align-items: center; gap: .75rem; }
.dateline::before { content: ''; flex: 0 0 1.9rem; height: 1px; background: var(--accent-teal); }
.chapter-copy { max-width: 44rem; }
h2 { font-family: 'Iowan Old Style', Georgia, serif; font-weight: 400; letter-spacing: -.045em; text-wrap: balance; }
h2 { font-size: clamp(2.35rem, 4.9vw, 4.5rem); line-height: 1.07; margin-bottom: 1rem; }
.chapter-copy p { max-width: 63ch; font-size: clamp(1rem, 1.4vw, 1.15rem); color: var(--body); }
.chapter-copy p + p { margin-top: .7rem; }
.illustrated .chapter-inner { grid-template-columns: minmax(0, 1.6fr) minmax(0, .9fr); align-items: center; gap: 1rem clamp(2rem, 7vw, 6rem); }
.illustrated .dateline { grid-column: 1; }
.illustrated .chapter-copy { grid-column: 1; }
.story-figure { grid-column: 2; grid-row: 1 / 3; align-self: center; }
.story-figure img { display: block; width: 100%; height: auto; max-width: 21rem; margin-inline: auto; }
figcaption { margin-top: .65rem; color: var(--body); }
#community-builder figcaption { text-align: center; }
#today .chapter-copy p:last-child { color: var(--ink); }
footer { padding-block: 1.5rem; color: var(--accent); font-size: .92rem; }
@media (max-width: 54rem) {
    :root { --mast: 5.4rem; }
    .mast .experience-bar {
        grid-template-areas: "brand . actions" "tools tools tools";
        grid-template-rows: 44px auto;
    }
    .story-tools { justify-content: flex-start; }
    .byline { display: none; }
    .chapters a { min-width: 1.8rem; }
}
@media (max-width: 48rem) {
    .chapter-inner, .illustrated .chapter-inner { grid-template-columns: 1fr; gap: .8rem; min-height: 0; }
    .story-figure { grid-row: auto; grid-column: 1; width: min(100%, 23rem); margin-top: .7rem; }
    .story-figure img { max-width: 15rem; }
    .dateline { padding: 0; }
}
@media (max-width: 25rem) {
    .chapters > span { display: none; }
    .chapters { gap: .22rem; }
    .chapters a { min-width: 1.8rem; }
}

#today .chapter-inner { min-height: 54svh; }

#first-course .chapter-inner { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
#first-course .story-figure img { width: auto; max-width: 100%; max-height: min(60svh, 33rem); object-fit: contain; }
#first-course .story-figure { width: fit-content; justify-self: center; }
.reader-footer { border-top: 1px solid var(--rule); background: var(--mast-bg); }
.reader-controls { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.reader-controls[hidden], .reader .fallback-start, .reader .chapter[hidden] { display: none; }
.reader-position { display: grid; gap: .4rem; width: clamp(5rem, 17vw, 12rem); font: .78rem/1.2 ui-monospace, monospace; color: var(--body); }
.reader-position progress { width: 100%; height: 3px; appearance: none; border: 0; background: var(--rule); color: var(--accent); }
.reader-position progress::-webkit-progress-bar { background: var(--rule); }
.reader-position progress::-webkit-progress-value { background: var(--accent-teal); }
.reader-position progress::-moz-progress-bar { background: var(--accent-teal); }
.reader-actions { display: flex; gap: .5rem; }
.reader-actions button { padding: .45rem .9rem; min-height: 44px; border: 1px solid var(--control-border); border-radius: .4rem; background: var(--control-bg); color: var(--ink); font: 550 .88rem/1.25 system-ui, sans-serif; cursor: pointer; }
.reader-actions button:hover:enabled { background: var(--control-hover); }
.reader-actions button:disabled { cursor: default; border-color: var(--rule); color: var(--body); opacity: .65; }
.reader-actions button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.reader { display: grid; grid-template-rows: var(--mast) minmax(0, 1fr) auto; height: 100vh; height: 100dvh; overflow: hidden; }
.reader #story { overflow-y: auto; overscroll-behavior-y: contain; min-height: 0; }
.reader #story:focus-visible { outline: 2px solid var(--control-focus); outline-offset: -3px; }
.reader .chapter { min-height: 100%; display: grid; align-content: center; border: 0; }
.reader .chapter .chapter-inner { min-height: 0; }
.reader .reader-footer { padding-block: .65rem max(.65rem, env(safe-area-inset-bottom)); }
@media (prefers-reduced-motion: no-preference) {
    .reader .chapter:not([hidden]) .chapter-inner { animation: chapter-enter 190ms ease-out; }
    @keyframes chapter-enter { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}
@media (max-width: 48rem) {
    #first-course .chapter-inner { grid-template-columns: 1fr; }
    #first-course .story-figure { justify-self: start; max-width: 100%; }
    #first-course .story-figure img { max-height: 25rem; width: auto; margin-inline: 0; }
    .reader .chapter-inner { padding-block: 1.6rem; }
}
@media (max-width: 25rem) {
    .reader-actions { gap: .35rem; }
    .reader-actions button { padding-inline: .6rem; }
}

.intro-inner { grid-template-columns: minmax(0, .84fr) minmax(0, 1.16fr); align-items: center; gap: clamp(1.5rem, 4vw, 4rem); }
#intro { background: var(--cover); }
.intro-copy h2 { font-size: clamp(2.65rem, 4.25vw, 4.4rem); max-width: 16ch; line-height: 1.03; }
.intro-copy p { color: var(--body); max-width: 36ch; }
.intro-actions { display: flex; flex-wrap: wrap; gap: .45rem 1.25rem; align-items: center; margin-top: 1.25rem; }
.intro-actions a { display: inline-flex; align-items: center; min-height: 44px; font-size: .92rem; }
.intro-actions .start-journey { padding: .6rem 1rem; gap: .75rem; color: var(--button-ink); background: var(--button-bg); border-radius: .4rem; font-weight: 650; text-decoration: none; }
.intro-media { position: relative; }
.film-frame { width: 100%; aspect-ratio: 16 / 9; background: var(--night); border: 1px solid var(--control-border); overflow: hidden; border-radius: .45rem; }
.film-frame video, .film-frame img { width: 100%; height: 100%; display: block; object-fit: contain; }
.film-frame video[hidden] { display: none; }
.film-controls { position: absolute; inset: auto .5rem .5rem; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; }
.film-controls button { padding: .4rem .7rem; min-height: 44px; border: 1px solid var(--control-border); border-radius: .4rem; background: var(--control-bg); color: var(--control-ink); font: 600 .78rem/1.2 system-ui, sans-serif; cursor: pointer; }
.film-controls button:focus-visible { outline: 2px solid var(--control-focus); outline-offset: 2px; }
.photo-placeholder { width: 100%; min-height: clamp(8rem, 16vh, 12rem); display: grid; place-content: center; padding: 1.25rem; border: 1px dashed var(--control-border); border-radius: .3rem; text-align: center; }
.photo-placeholder figcaption { margin: 0; }
.photo-placeholder figcaption span { display: block; color: var(--accent); margin-bottom: .35rem; }
.story-figure img { object-fit: contain; }
@media (max-width: 48rem) {
    .intro-inner { grid-template-columns: 1fr; }
    .intro-media { grid-row: 1; width: min(100%, 29rem); }
    .intro-copy h2 { font-size: clamp(2.1rem, 7vw, 3.25rem); max-width: 19ch; margin-bottom: .55rem; }
    .intro-actions { margin-top: .6rem; }
    .photo-placeholder { min-height: 0; width: auto; justify-self: start; place-content: start; padding: .55rem .85rem; text-align: start; }
    .photo-placeholder figcaption span { display: inline; margin: 0 .55rem 0 0; }
    #first-course .story-figure img { max-height: min(45svh, 21rem); }
    .reader #intro .chapter-inner { padding-block: 1rem; }
}

@media (max-width: 25rem) and (max-height: 40rem) {
    .reader #intro .chapter-inner { gap: .5rem; padding-block: .5rem; }
    .intro-actions { margin-top: .3rem; }
}

.illustrated.with-achievement .chapter-inner {
    grid-template-columns: minmax(0, 1.13fr) minmax(0, 1fr);
    column-gap: clamp(2rem, 4.5vw, 4rem);
}
.story-visuals {
    grid-area: 1 / 2 / span 2;
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(5.5rem, 11.5vw, 9rem);
    gap: clamp(.7rem, 1.8vw, 1.5rem);
    align-items: center;
}
.story-visuals .story-figure { grid-area: auto; width: 100%; margin: 0; }
.story-achievement { text-align: center; }
.story-achievement img { display: block; width: 100%; height: auto; object-fit: contain; }
.story-achievement figcaption { margin-top: .5rem; font: 600 .8rem/1.35 system-ui, sans-serif; }
@media (max-width: 48rem) {
    .illustrated.with-achievement .chapter-inner { grid-template-columns: minmax(0, 1fr); }
    .story-visuals {
        grid-area: auto;
        width: min(100%, 28rem);
        grid-template-columns: minmax(0, 1fr) clamp(6rem, 28vw, 8rem);
    }
}
