:root {
    color-scheme: light;
    --paper: #fffdf8;
    --surface: #f8f5ec;
    --ink: #272d29;
    --muted: #535d56;
    --forest: #264339;
    --deep-forest: #192c25;
    --link: #1c6252;
    --line: #dfdfd4;
    --wash: #edf2e9;
    --masthead: #f2eee2;
    --ochre: #8b6233;
    --shell-width: 74rem;
    --gutter: clamp(1.125rem, 4vw, 3rem);
    --anchor-offset: 80px;
    --body-font: "Source Sans 3", system-ui, sans-serif;
    --heading-font: "DM Serif Text", Georgia, serif;
}

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

html {
    scroll-padding-top: var(--anchor-offset);
}

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--body-font);
    font-size: clamp(1.0625rem, 1rem + 0.16vw, 1.125rem);
    line-height: 1.65;
}

a {
    color: var(--link);
    text-underline-offset: 0.18em;
    text-decoration-thickness: 0.06em;
    overflow-wrap: anywhere;
}

a:hover {
    color: var(--deep-forest);
    text-decoration-thickness: 0.1em;
}

:focus-visible {
    outline: 2px solid #307963;
    outline-offset: 3px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.icon {
    display: block;
    width: 1.125rem;
    height: 1.125rem;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-inline {
    display: inline-block;
    width: 0.9em;
    height: 0.9em;
    margin-inline-end: 0.32em;
    vertical-align: -0.12em;
}

.icon-library {
    position: absolute;
    overflow: hidden;
    pointer-events: none;
}

.skip-link {
    position: fixed;
    inset: 0.75rem auto auto var(--gutter);
    z-index: 3;
    transform: translateY(-180%);
    background: var(--surface);
    padding: 0.6rem 0.9rem;
    border-radius: 0.25rem;
    font-weight: 700;
}

.skip-link:focus {
    transform: none;
}

.main-header {
    color: var(--deep-forest);
    background: var(--masthead);
    border-block: 4px solid var(--forest);
    border-bottom: 1px solid #ded7c8;
}

.header-inner,
.guide-layout {
    width: min(100%, calc(var(--shell-width) + var(--gutter) * 2));
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: space-between;
    gap: 1.1rem 2rem;
    padding-block: clamp(1.6rem, 4.5vw, 3rem) clamp(1.4rem, 3.25vw, 2.35rem);
}

.byline {
    margin: 0 0 0.45rem;
    color: var(--ochre);
    font-size: 0.9375rem;
    font-weight: 650;
}

h1 {
    margin: 0;
    font: 400 clamp(2.125rem, 1.75rem + 2.25vw, 3.5rem) / 1.1 var(--heading-font);
    letter-spacing: -0.025em;
}

.start-link {
    display: inline-flex;
    gap: 0.65rem;
    align-items: center;
    min-height: 2.75rem;
    padding: 0.5rem 0.85rem;
    border: 1px solid var(--forest);
    border-radius: 0.3rem;
    background: var(--forest);
    color: #fffdf8;
    font-size: 1rem;
    font-weight: 650;
    text-decoration: none;
}

.start-link:hover {
    color: white;
    background: var(--deep-forest);
}

.guide-layout {
    padding-bottom: 2.75rem;
}

.toc {
    position: sticky;
    top: 0;
    z-index: 2;
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    font-size: 0.975rem;
    line-height: 1.4;
}

.toc summary {
    cursor: pointer;
    list-style: none;
}

.toc summary::-webkit-details-marker {
    display: none;
}

.toc-panel > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 3.25rem;
    color: var(--forest);
    font-size: 1.0625rem;
    font-weight: 700;
}

.contents-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.toc summary::after {
    content: "";
    display: block;
    width: 0.5rem;
    height: 0.5rem;
    flex: none;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-0.125rem) rotate(45deg);
}

.toc details[open] > summary::after {
    transform: translateY(0.125rem) rotate(225deg);
}

.toc nav {
    max-height: min(54dvh, 28rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding: 0.25rem 0.2rem 1rem;
}

.toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-chapter {
    position: relative;
    padding-block: 0.1rem;
}

.toc nav a {
    display: block;
    border-radius: 0.3rem;
    color: var(--muted);
    text-decoration: none;
}

.toc nav a:hover {
    background: var(--wash);
    color: var(--deep-forest);
}

.toc nav .chapter-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.75rem;
    padding: 0.45rem 0.65rem;
    color: var(--forest);
    font-weight: 650;
}

.chapter-link .icon {
    width: 1rem;
    height: 1rem;
}

.toc-chapter:has(.toc-group) > .chapter-link {
    margin-right: 2.65rem;
}

.toc-group > summary {
    position: absolute;
    top: 0.1rem;
    right: 0;
    display: grid;
    place-items: center;
    width: 2.65rem;
    height: 2.75rem;
    border-radius: 0.3rem;
    color: var(--forest);
}

.toc-group > summary:hover {
    background: var(--wash);
}

.toc-group ul {
    margin: 0.2rem 0 0.45rem 0.65rem;
    padding-left: 0.55rem;
    border-left: 1px solid var(--line);
}

.toc .toc-group a {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 0.4rem;
    padding: 0.48rem 0.55rem;
}

.toc-group .icon {
    width: 0.875rem;
    height: 0.875rem;
    margin-top: 0.12em;
    color: var(--link);
}

.toc nav a[aria-current="location"] {
    background: var(--wash);
    box-shadow: inset 2px 0 var(--link);
    color: var(--deep-forest);
    font-weight: 700;
}

.toc-chapter:has(.toc-group a[aria-current]) > .chapter-link {
    color: var(--link);
}

main,
.main-footer {
    width: 100%;
    max-width: 72ch;
    margin-inline: auto;
}

main {
    padding-top: clamp(1.75rem, 4vw, 3.375rem);
    min-width: 0;
    overflow-wrap: anywhere;
}

main:focus-visible {
    outline-offset: 0.5rem;
}

main section + section {
    margin-top: clamp(2.8rem, 6vw, 4.5rem);
}

main h2,
main h3,
main h4,
main h5 {
    color: var(--forest);
    line-height: 1.24;
}

main h2 {
    margin: 0 0 1.2rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--line);
    font: 400 clamp(1.8125rem, 1.6rem + 1vw, 2.375rem) / 1.17 var(--heading-font);
    letter-spacing: -0.015em;
}

main h3 {
    margin: 1.75rem 0 0.65rem;
    font-size: clamp(1.375rem, 1.25rem + 0.35vw, 1.6rem);
    font-weight: 700;
}

main :is(h2, h3, h4, h5):has(> .icon) {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    column-gap: 0.55rem;
}

main h2:has(> .icon) {
    column-gap: clamp(0.55rem, 1.5vw, 0.85rem);
}

main h2 > .icon {
    width: 0.95em;
    height: 0.95em;
    padding: 0.45rem;
    margin-top: 0.07em;
    border-radius: 0.35rem;
    background: var(--wash);
    color: var(--forest);
}

main :is(h3, h4, h5) > .icon {
    margin-top: 0.12em;
    color: var(--link);
}

main h5 > .icon,
.guide-entry > h4 > .icon {
    width: 1rem;
    height: 1rem;
}

main :is(h3, h4) > .icon:has(use:is([href="#icon-warning"], [href="#icon-minus"])) {
    color: var(--ochre);
}

main h4 {
    margin: 1.15rem 0 0.45rem;
    font-size: 1.21875rem;
    font-weight: 700;
}

main h5 {
    margin: 0 0 0.38rem;
    font-size: 1.15625rem;
    font-weight: 700;
}

main p,
main ul,
main ol {
    margin: 0 0 0.8rem;
}

main ul,
main ol {
    padding-inline-start: clamp(1.15rem, 2.7vw, 1.55rem);
}

main li + li {
    margin-top: 0.42rem;
}

main li::marker {
    color: var(--link);
}

main ul ul {
    list-style-type: circle;
}

main ul ul ul {
    list-style-type: square;
}

main li > ul,
main li > ol {
    margin-top: 0.3rem;
    margin-bottom: 0.5rem;
}

main strong {
    font-weight: 700;
}

main code {
    padding: 0.1em 0.33em;
    border: 1px solid #d5dfd2;
    border-radius: 0.2em;
    background: var(--wash);
    color: var(--deep-forest);
    font: 0.9em ui-monospace, monospace;
}

.guide-topics,
.important-note,
.race-note,
.starter-combinations > .note,
.area-intro,
.equipment-source {
    margin-block: 1.35rem;
    padding: 1rem clamp(1rem, 3vw, 1.45rem);
    border-left: 3px solid #688a72;
    border-radius: 0 0.35rem 0.35rem 0;
    background: var(--wash);
}

:where(.guide-topics, .important-note, .race-note, .note, .area-intro, .equipment-source) > :first-child {
    margin-top: 0;
}

:where(.guide-topics, .important-note, .race-note, .note, .area-intro, .equipment-source) > :last-child {
    margin-bottom: 0;
}

main .warning {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.65rem;
    margin-block: 0.85rem;
    padding: 0.75rem 0.9rem;
    border-radius: 0.3rem;
    background: #f5eddb;
    color: #523718;
}

.warning > .icon {
    margin-top: 0.2rem;
    color: var(--ochre);
}

.warning p:last-child {
    margin-bottom: 0;
}

.combo,
.suggested-areas > .area {
    margin-block: 1.5rem;
    padding: clamp(0.95rem, 2.5vw, 1.4rem);
    border: 1px solid var(--line);
    border-radius: 0.375rem;
}

.combo > h3,
.area > h4 {
    margin-top: 0;
}

.build-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.75rem), 1fr));
    gap: 0.65rem 1.15rem;
    margin-block: 0.8rem 1rem;
    padding: 0.85rem 1rem;
    border-radius: 0.25rem;
    background: var(--wash);
}

.build-facts dt {
    color: var(--muted);
    font-size: 0.9375rem;
    line-height: 1.4;
    font-weight: 700;
}

:is(.build-facts, .continent-facts) dt {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 0.38rem;
}

:is(.build-facts, .continent-facts) dt .icon {
    width: 0.95em;
    height: 0.95em;
    margin-top: 0.25em;
    color: var(--link);
}

.build-facts dd,
.continent-facts dd {
    margin: 0;
}

.continent-facts dt {
    color: var(--forest);
    font-weight: 700;
}

.continent-facts > div + div {
    margin-top: 0.7rem;
}

.combo > div:last-child > :last-child {
    margin-bottom: 0;
}

.detail-group {
    margin: -0.2rem 0 1rem;
    padding-left: 0.9rem;
    border-left: 2px solid var(--line);
    color: var(--muted);
}

.guide-entry {
    padding-block: 0.85rem;
    border-bottom: 1px solid var(--line);
}

.guide-entry:first-child {
    padding-top: 0.25rem;
}

.guide-entry:last-child {
    padding-bottom: 0.25rem;
    border-bottom: 0;
}

.guide-entry > h4 {
    margin-top: 0;
}

.guide-entry p {
    margin-bottom: 0.42rem;
}

.guide-entry > :last-child,
.detail-group > :last-child {
    margin-bottom: 0;
}

#unofficial-resources .guide-entry > p:first-of-type,
.suggested-areas > .area:last-child .guide-entry > p:last-child {
    font-size: 1rem;
}

.creation-screenshot {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    margin-block: 1rem 1.35rem;
    border: 1px solid var(--line);
    border-radius: 0.35rem;
}

.main-footer,
.quality-of-life .tip + .tip,
.leveling-advice .level-range + .level-range {
    border-top: 1px solid var(--line);
}

.quality-of-life .tip + .tip,
.leveling-advice .level-range + .level-range {
    margin-top: 1.65rem;
}

.main-footer {
    margin-top: 3rem;
    padding-top: 1.2rem;
    color: var(--muted);
    font-size: 1rem;
}

.main-footer p {
    margin-block: 0 0.45rem;
}

.main-footer p:first-child a:first-of-type {
    margin-right: 0.7rem;
}

.back-to-top {
    display: inline-block;
    margin-top: 0.5rem;
    font-weight: 650;
}

@media (min-width: 56rem) {
    :root {
        --anchor-offset: 28px;
    }

    .guide-layout {
        display: grid;
        grid-template-columns: minmax(12.25rem, 15rem) minmax(0, 1fr);
        column-gap: clamp(2rem, 5vw, 5.25rem);
        align-items: start;
        padding-top: 2.65rem;
    }

    .toc {
        grid-row: 1 / 3;
        top: 1.25rem;
        margin: 0;
        padding: 0;
        border: 0;
        border-left: 1px solid var(--line);
    }

    .toc-panel > summary {
        min-height: 2.6rem;
        padding: 0.2rem 0.9rem;
    }

    .toc nav {
        max-height: calc(100dvh - 7rem);
        padding: 0.6rem;
    }

    .toc nav .chapter-link,
    .toc-group > summary {
        min-height: 2.25rem;
    }

    .toc-group > summary {
        height: 2.25rem;
        width: 2rem;
    }

    .toc-chapter:has(.toc-group) > .chapter-link {
        margin-right: 2rem;
    }

    .toc .toc-group a {
        padding-block: 0.32rem;
    }

    main,
    .main-footer {
        margin-inline: 0;
    }

    main {
        padding-top: 0;
    }
}

@media print {
    .toc,
    .skip-link,
    .start-link,
    .back-to-top {
        display: none;
    }

    body,
    .main-header {
        background: white;
        color: black;
    }

    .guide-layout {
        display: block;
    }

    main {
        max-width: none;
    }

    h2, h3, h4 {
        break-after: avoid;
    }
}
