:root {
    --background: #cfdaea;
    --text: #192e25;
    --primary: #0b402a;
    --accent: #733b1b;
    --paper: #e8eef6;
}

html {
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

html:has(dialog:modal) {
    overflow: hidden;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 24px;
    background: var(--background);
    color: var(--text);
    font-size: 20px;
    font-weight: 400;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

button {
    color: inherit;
    font-size: inherit;
    font-weight: 400;
    line-height: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button {
    cursor: pointer;
}

:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 4px;
}

h1,
h2,
h3,
p {
    margin: 0;
}

h1,
h2,
h3 {
    font-weight: 400;
}

strong,
b {
    font-weight: 700;
}

svg {
    display: block;
    flex-shrink: 0;
}

img {
    display: block;
    max-width: 100%;
}

.content-frame {
    width: calc(100% - 44px);
    max-width: 1424px;
    margin-inline: auto;
    padding-inline: 0;
    min-width: 0;
}

.masthead {
    position: static;
    min-height: 68px;
    display: flex;
    align-items: center;
    gap: 24px;
    padding-block: 10px;
}

.jump {
    position: absolute;
    top: 10px;
    left: 22px;
    z-index: 10;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.jump:focus {
    width: auto;
    height: auto;
    max-width: calc(100% - 44px);
    padding: 12px 18px;
    overflow: visible;
    clip-path: inset(0);
    white-space: normal;
    background: var(--primary);
    color: var(--paper);
    border-radius: 12px;
}

.site-title {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 56px;
    height: 44px;
    background: var(--primary);
    color: var(--background);
    border-radius: 14px;
    box-shadow: 3px 3px 0 var(--accent);
    font-size: 30px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.06em;
}

.masthead > #navigation {
    flex: 1;
    min-width: 0;
    margin-left: auto;
}

.menu-list,
.topic-list,
.story-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.menu-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    font-size: 16px;
}

.menu-list li {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.menu-list a {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
    padding-block: 6px;
}

.menu-list a > span:last-child {
    min-width: 0;
}

.separator {
    flex-shrink: 0;
    color: var(--accent);
}

.active-mark {
    flex-shrink: 0;
    color: var(--accent);
    visibility: hidden;
}

a[aria-current="page"] .active-mark {
    visibility: visible;
}

.nav-button,
.menu-close {
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 16px;
    border: 0;
    border-radius: 14px;
    background: var(--primary);
    color: var(--paper);
    font-size: 18px;
}

.nav-button {
    display: none;
    margin-left: auto;
}

.nav-button[hidden] {
    display: none;
}

.nav-button svg,
.menu-close svg {
    width: 18px;
    height: 18px;
}

.menu-dialog {
    margin: 0;
    padding: 0;
    border: 0;
    background: var(--background);
    color: var(--text);
}

.menu-dialog::backdrop {
    background: var(--primary);
}

.menu-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 4px double var(--primary);
}

.menu-head h2 {
    font-size: 20px;
    font-weight: 700;
}

.menu-close {
    display: inline-flex;
}

main.content-frame {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.lead h1 {
    max-width: 24ch;
    color: var(--primary);
    font-size: 56px;
    font-weight: 400;
    line-height: 1.12;
    letter-spacing: -0.035em;
}

.topics {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding-block: 16px;
    border-top: 4px double var(--primary);
    border-bottom: 4px double var(--primary);
}

.topics h2 {
    font-size: 18px;
    font-weight: 700;
}

.topic-list {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
}

.topic-list li {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topic-list svg,
.duration svg {
    width: 18px;
    height: 18px;
    padding: 2px;
    border-radius: 50%;
    background: var(--background);
    color: var(--primary);
    stroke-width: 1;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.topic-list svg {
    background: var(--primary);
    color: var(--background);
}

.collection {
    display: grid;
    gap: 24px;
    min-width: 0;
}

.collection > h2 {
    font-size: 30px;
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.story-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
}

.story-list > li {
    min-width: 0;
}

.story {
    display: grid;
    grid-template-columns: 184px minmax(0, 1fr);
    gap: 16px;
    width: 100%;
    padding: 22px;
    border-radius: 20px;
    background: var(--paper);
    box-shadow: 4px 4px 0 var(--primary);
    text-align: right;
}

.preview {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    display: block;
    width: 184px;
    max-width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 12px;
    background: var(--background);
}

.preview img {
    width: 100%;
    height: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    border-radius: inherit;
}

.story-copy {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    min-width: 0;
}

.story-list > li:nth-child(even) .story {
    grid-template-columns: minmax(0, 1fr) 184px;
}

.story-list > li:nth-child(even) .preview {
    grid-column: 2;
}

.story-list > li:nth-child(even) .story-copy {
    grid-column: 1;
}

.story-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 14px;
    line-height: 1.4;
}

.story .story-meta {
    justify-content: flex-end;
}

.story-label {
    color: var(--accent);
    font-size: 14px;
    font-weight: 700;
}

.story-meta time {
    white-space: nowrap;
}

.duration {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.story h3 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    max-width: 100%;
    color: var(--primary);
    font-size: 30px;
    font-weight: 400;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

.summary {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
    max-width: 100%;
}

.more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-end;
    min-height: 44px;
    margin-top: auto;
    padding: 10px 22px;
    border-radius: 24px;
    background: var(--accent);
    color: var(--paper);
    font-size: 16px;
    font-weight: 700;
}

.story-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
    max-width: 770px;
    min-width: 0;
    margin-left: auto;
    margin-right: 0;
}

.story-top {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-bottom: 24px;
    border-bottom: 4px double var(--primary);
}

.story-top h1 {
    color: var(--primary);
    font-size: 56px;
    font-weight: 400;
    line-height: 1.12;
    letter-spacing: -0.035em;
}

.reading {
    display: flow-root;
    min-width: 0;
    max-width: 100%;
}

.reading > * {
    margin: 0;
}

.reading > * + * {
    margin-top: 24px;
}

.reading h2 {
    color: var(--primary);
    font-size: 30px;
    font-weight: 700;
    line-height: 1.25;
}

.reading h3 {
    color: var(--primary);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
}

.reading p {
    line-height: 1.4;
}

.reading a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
}

.reading blockquote {
    padding: 22px;
    border-radius: 16px;
    background: var(--paper);
    box-shadow: 4px 4px 0 var(--primary);
}

.reading blockquote > * {
    margin: 0;
}

.reading blockquote > * + * {
    margin-top: 12px;
}

.reading cite {
    display: block;
    margin-top: 12px;
    color: var(--accent);
    font-size: 18px;
    font-weight: 400;
    font-style: italic;
}

.reading ul,
.reading ol {
    padding-left: 30px;
    list-style-type: decimal;
}

.reading li + li {
    margin-top: 8px;
}

.reading li::marker {
    color: var(--accent);
    font-weight: 700;
}

.reading li > ul,
.reading li > ol {
    margin-top: 12px;
}

.reading table {
    width: 100%;
    border-collapse: collapse;
    font-size: 18px;
    line-height: 1.4;
}

.reading caption {
    padding-bottom: 12px;
    color: var(--primary);
    font-weight: 700;
    text-align: left;
    caption-side: top;
}

.reading th,
.reading td {
    padding: 12px;
    border: 1px solid var(--primary);
    text-align: left;
    vertical-align: top;
}

.reading th {
    background: var(--primary);
    color: var(--paper);
    font-weight: 700;
}

.reading td {
    background: var(--paper);
}

.reading hr {
    height: 0;
    border: 0;
    border-top: 4px double var(--primary);
}

.story-links {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding-top: 24px;
    border-top: 4px double var(--primary);
}

.story-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    max-width: 100%;
    padding: 12px 22px;
    border-radius: 24px;
    background: var(--primary);
    color: var(--paper);
    font-size: 16px;
    text-align: center;
}

.story-links a:last-child {
    margin-left: auto;
}

.colophon {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: 24px;
    padding-block: 24px;
    border-top: 4px double var(--primary);
}

.copyright {
    min-width: 0;
    font-size: 16px;
}

.copyright span {
    display: block;
    margin-top: 8px;
    font-size: 14px;
}

.material-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.material-links h2 {
    font-size: 16px;
    font-weight: 700;
}

@keyframes menu-slide {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

@media (max-width: 702px) {
    body {
        font-size: 18px;
    }

    .masthead {
        flex-wrap: wrap;
        gap: 16px;
    }

    .masthead > #navigation {
        order: 3;
        flex-basis: 100%;
    }

    .nav-button {
        display: inline-flex;
    }

    .menu-dialog {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100%;
        height: 100dvh;
        max-width: none;
        max-height: none;
        padding: 22px;
        overflow-y: auto;
    }

    .menu-dialog[open] {
        display: flex;
        flex-direction: column;
        gap: 24px;
    }

    .menu-dialog.slides-in[open] {
        animation: menu-slide 150ms ease-out;
    }

    .menu-dialog #navigation {
        min-width: 0;
    }

    .menu-dialog .menu-list {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
        font-size: 26px;
    }

    .menu-dialog .separator {
        display: none;
    }

    .lead h1,
    .story-top h1 {
        font-size: 36px;
    }

    .topic-list {
        gap: 12px 16px;
    }

    .collection > h2 {
        font-size: 26px;
    }

    .story,
    .story-list > li:nth-child(even) .story {
        grid-template-columns: minmax(0, 1fr);
    }

    .preview,
    .story-list > li:nth-child(even) .preview {
        grid-column: 1;
        grid-row: 1;
        justify-self: center;
    }

    .story-copy,
    .story-list > li:nth-child(even) .story-copy {
        grid-column: 1;
        grid-row: 2;
    }

    .story h3 {
        font-size: 24px;
    }

    .story-meta {
        gap: 8px 12px;
    }

    .reading h2 {
        font-size: 26px;
    }

    .reading h3 {
        font-size: 22px;
    }

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

    .colophon .menu-list {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }

    .colophon .separator {
        display: none;
    }
}

@media (max-width: 480px) {
    .content-frame {
        width: calc(100% - 32px);
    }

    .jump {
        left: 16px;
    }

    .jump:focus {
        max-width: calc(100% - 32px);
    }

    .menu-dialog {
        padding: 16px;
    }

    .lead h1,
    .story-top h1 {
        font-size: 32px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .menu-dialog.slides-in[open] {
        animation: none;
        transition: none;
        scroll-behavior: auto;
    }
}
