:root {
    --bristol-green: #00491e;
    --bg: #f5f5f7;
    --bg-elevated: #ffffff;

    --border-subtle: #e0e0e5;
    --border-subtle-line: 1px solid var(--border-subtle);
    --radius: 10px;
    --shadow-soft: 0 14px 30px rgba(15, 23, 42, 0.06);

    --gap: 24px;
    --gap-small: 14px;

    --text-main: #111827;
    --text-muted: #4b5563;
    --text-soft: #6b7280;

    --info: #14532d;
    --info-soft: #dcfce7;
    --info-strong: #064e3b;

    --danger: #b91c1c;
    --danger-soft: #fee2e2;

    --warn: #f59e0b;
    --warn-soft: #fef3c7;

    --section-h2-size-base: 1.25rem;
    --section-h3-size-base: 1.12rem;
    --section-h4-size-base: 1rem;
    --section-h2-size: var(--section-h2-size-base);
    --section-h3-size: var(--section-h3-size-base);
    --section-h4-size: var(--section-h4-size-base);
    --section-h2-weight: 700;
    --section-h3-accent: var(--info);
}

.section-edit-link {
  display: none;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family:
        "Open Sans",
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        sans-serif;
    background: var(--bg);
    color: var(--text-main);
    line-height: 1.6;
    text-rendering: optimizeLegibility;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
}

.layout {
    display: flex;
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: var(--gap);
    gap: var(--gap);
    flex: 1;
    align-items: flex-start;
}

/* Main content */
main {
    min-width: 0px;
    width: 100%;
    max-width: 820px;
    margin: 0;
    transition: opacity 0.3s ease;
}

.page {
    background: var(--bg-elevated);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    border: var(--border-subtle-line);
    padding: var(--gap);
}

.section-group {
    margin: 28px 0 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.section-group-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-soft);
}

.section-group-divider {
    height: 1px;
    background: var(--border-subtle);
    width: 100%;
}

.table-scroll {
    width: 100%;
    overflow-x: auto;
}

.table-scroll table {
    width: 100%;
    table-layout: auto;
}

.table-scroll th,
.table-scroll td {
    min-width: 120px;
    max-width: 320px;
    white-space: normal;
    word-break: break-word;
    font-size: inherit;
}

header.page-header {
    border-bottom: var(--border-subtle-line);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.page-title {
    margin: 0;
    font-size: 2.5rem;
    letter-spacing: 0.01em;
    color: var(--info);
}

.page-subtitle {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.96rem;
}

.page-subtitle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.section {
    margin: 0;
    max-width: 100%;
    border: var(--border-subtle-line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

#sections-container {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    margin: var(--gap) 0;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    border: 0;
    padding: 12px 16px;
    background: var(--bg);
    color: inherit;
    cursor: pointer;
    font: inherit;
    text-align: left;
    user-select: none;
    transition: background 0.1s;
    border-bottom: var(--border-subtle-line);
}

.section-header-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.section-header-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.section-header:hover {
    background: #ececf1;
}

.section-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    transition: transform 0.1s;
    font-size: 1rem;
}

.section.collapsed .section-toggle {
    transform: rotate(-90deg);
}

.section h2,
.toc-search-result-title-section,
.toc-search-result[search-heading-level="2"] .toc-search-result-title-heading,
.toc-search-result[search-kind="content"][search-heading-level="2"] .toc-search-result-title-text {
    font-size: var(--section-h2-size);
    font-weight: var(--section-h2-weight);
    color: var(--text-main);
}

.section h2 {
    margin: 0;
    scroll-margin-top: 90px;
}

.section-content {
    padding: var(--gap);
    background: var(--bg-elevated);
    transition:
        max-height 0.1s ease,
        padding 0.1s ease,
        opacity 0.1s ease;
    opacity: 1;
}

.section-content > :first-child {
    margin-top: 0;
}

.section.collapsed .section-content {
    max-height: 0;
    padding: 0 26px;
    opacity: 0;
    overflow: hidden;
}

.section h3,
.toc-search-result[search-heading-level="3"] .toc-search-result-title-heading,
.toc-search-result[search-kind="content"][search-heading-level="3"] .toc-search-result-title-text {
    font-size: var(--section-h3-size);
    font-weight: 600;
    color: var(--section-h3-accent);
}

.section h3 {
    margin: 24px 0 12px;
    scroll-margin-top: 90px;
    border-bottom: 3px solid var(--section-h3-accent);
    padding-bottom: 8px;
    display: block;
}

.section h4,
.toc-search-result[search-heading-level="4"] .toc-search-result-title-heading,
.toc-search-result[search-heading-level="5"] .toc-search-result-title-heading,
.toc-search-result[search-heading-level="6"] .toc-search-result-title-heading,
.toc-search-result[search-kind="content"][search-heading-level="4"] .toc-search-result-title-text,
.toc-search-result[search-kind="content"][search-heading-level="5"] .toc-search-result-title-text,
.toc-search-result[search-kind="content"][search-heading-level="6"] .toc-search-result-title-text {
    font-size: var(--section-h4-size);
    font-weight: 600;
    color: var(--text-main);
    text-transform: none;
}

.section h4 {
    margin: 14px 0;
}

p {
    margin: 0 0 10px;
    color: var(--text-main);
    text-align: justify;
}

strong {
    font-weight: 600;
}

em {
    font-style: italic;
}

a {
    color: var(--info);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:hover {
    color: var(--info-strong);
}

a:focus-visible,
.section-header:focus-visible,
.procedure-header:focus-visible,
.youtube-embed__button:focus-visible {
    outline: 2px solid var(--info);
    outline-offset: 2px;
}

ul,
ol {
    padding-left: 1.2rem;
    margin: 6px 0 10px;
}

li {
    margin-bottom: 4px;
}

/* Callouts & Procedures - Shared Styles */
blockquote,
.procedure {
    font-size: 0.9rem;
    overflow: hidden;
    margin: var(--gap-small) 0;
}

blockquote {
    padding: var(--gap-small);
    border-left: 4px solid var(--border-subtle);
    background: var(--bg-elevated);
    color: var(--text-main);
}

blockquote p {
    margin: 0;
}

.callout-title,
.procedure-title {
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.callout-title {
    margin-bottom: 8px;
}

.callout-title svg {
    width: 16px;
    height: 17px;
    flex-shrink: 0;
    display: block;
}

.callout--info {
    border-left-color: var(--info);
}

.callout--info .callout-title {
    color: var(--info);
}

.callout--danger {
    border-left-color: var(--danger);
}

.callout--danger .callout-title {
    color: var(--danger);
}

.callout--warn {
    border-left-color: var(--warn);
}

.callout--warn .callout-title {
    color: var(--warn);
}

/* Procedures - Unique Styles */
.procedure {
    border: var(--border-subtle-line);
    border-radius: var(--radius);
}

.procedure-description {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    font-style: italic;
    margin: 0 0 10px 0;
    padding-bottom: 10px;
    border-bottom: var(--border-subtle-line);
}

.procedure-header {
    display: block;
    width: 100%;
    border: 0;
    background: var(--bg);
    padding: 12px 16px;
    border-bottom: var(--border-subtle-line);
    color: inherit;
    cursor: pointer;
    font: inherit;
    text-align: left;
    user-select: none;
    transition: background 0.1s;
}

.procedure-header:hover {
    background: #ececf1;
}

.procedure-title {
    font-size: 1rem;
}

.procedure-title {
    align-items: center;
}

.procedure-title-icon {
    flex: 0 0 auto;
    line-height: 1;
}

.procedure-title-content {
    flex: 1;
    min-width: 0;
    display: flow-root;
}

.procedure-title-text {
    display: inline;
}

.procedure-title .procedure-skill-badge {
    float: right;
    margin-left: 10px;
    margin-right: 0;
    line-height: inherit;
}

@supports (shape-outside: inset(0 0 1px 0)) {
    .procedure-title .procedure-skill-badge {
        /* Reserve only one line for wrapping; let later lines run full width */
        shape-outside: inset(0 0 calc(100% - 1lh) 0);
        shape-margin: 6px;
    }
}

.procedure-skill-badge {
    background: var(--bg-elevated);
    color: var(--text-muted);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border: var(--border-subtle-line);
    margin-left: auto;
    white-space: nowrap;
    min-width: 110px;
    text-align: center;
    display: inline-flex;
    justify-content: center;
}

.procedure-skill-badge[data-skill="beginner"] {
    border-color: var(--info);
    color: var(--info);
}

.procedure-skill-badge[data-skill="intermediate"] {
    border-color: var(--warn);
    color: var(--warn);
}

.procedure-skill-badge[data-skill="advanced"] {
    border-color: var(--danger);
    color: var(--danger);
}

.intro-skill-levels {
    display: grid;
    gap: 10px;
}

.intro-skill-level {
    display: grid;
    grid-template-columns: max-content 1fr;
    align-items: center;
    column-gap: 10px;
}

.procedure[data-skill="beginner"] {
    border-left-color: var(--info);
}

.procedure[data-skill="intermediate"] {
    border-left-color: var(--warn);
}

.procedure[data-skill="advanced"] {
    border-left-color: var(--danger);
}

.procedure-content {
    padding: var(--gap-small);
    transition:
        max-height 0.1s ease,
        padding 0.1s ease;
}

.procedure.collapsed .procedure-content {
    max-height: 0;
    padding: 0 26px;
    overflow: hidden;
}

/* Tables */
table {
    width: 100%;
    margin: 10px 0 14px;
    font-size: 0.88rem;
    overflow: hidden;
    border: solid 1px var(--border-subtle);
    border-collapse: separate;
    border-left: 0;
    border-radius: var(--radius);
    border-spacing: 0px;
}

thead {
    background: #f3f4f6;
    display: table-header-group;
    vertical-align: middle;
    border-color: inherit;
    border-collapse: separate;
}
tr {
    display: table-row;
    vertical-align: inherit;
    border-color: inherit;
}
th,
td {
    border-left: var(--border-subtle-line);
    border-top: var(--border-subtle-line);
    padding: 4px 6px;
    vertical-align: top;
    word-break: break-word;
}
td > img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 15dvh;
    border-radius: var(--radius);
    overflow: hidden;
    border: var(--border-subtle-line);
    box-shadow: var(--shadow-soft);
    background: #fff;
    margin-inline: 0px;
}
th {
    text-align: left;
    font-weight: 600;
}
thead:first-child tr:first-child th:first-child,
tbody:first-child tr:first-child td:first-child {
    border-radius: var(--radius) 0 0 0;
}
thead:last-child tr:last-child th:first-child,
tbody:last-child tr:last-child td:first-child {
    border-radius: 0 0 0 var(--radius);
}
tbody tr:nth-child(even) {
    background: #fafafa;
}

.subtle {
    color: var(--text-soft);
    font-size: 0.88rem;
    text-align: center;
}

code {
    font-family:
        ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
        "Liberation Mono", "Courier New", monospace;
    font-size: 0.88em;
    background: #f3f4f6;
    padding: 2px 4px;
    border-radius: 4px;
    white-space: pre-wrap;
}

hr {
    border: none;
    border-top: 1px dashed var(--border-subtle);
    margin: var(--gap) 0;
}

/* Figures / images */
.figure {
    margin: 0px 0px 14px;
    border-radius: var(--radius);
    overflow: hidden;
    border: var(--border-subtle-line);
    max-width: 100%;
    box-shadow: var(--shadow-soft);
    background: #fff;
}

.figure-float-right {
    float: right;
    max-width: 50%;
    margin-left: 14px;
}

.figure-float-left {
    float: left;
    max-width: 50%;
    margin-right: 14px;
}

.figure img {
    display: block;
    width: 100%;
    height: auto;
}

.figure-body {
    padding: 10px 14px 12px;
}

.figure-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 4px;
}
.centered {
    text-align: center;
}

.figure-caption {
    font-size: 0.85rem;
    color: var(--text-soft);
    margin: 0;
}

.figure-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--gap);
    margin: 0px 0 0px;
}

.video-wrapper,
.youtube-embed {
    position: relative;
    aspect-ratio: 16 / 9;
    margin-bottom: 16px;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
}

.video-wrapper iframe,
.youtube-embed iframe {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 0;
    pointer-events: none;
}

.youtube-embed__button {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    padding: 0;
    border: 0;
    cursor: pointer;
    z-index: 1;
}

.youtube-embed__button img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.youtube-embed__icon {
    position: absolute;
    width: 68px;
}

.youtube-embed.is-playing .youtube-embed__button {
    display: none;
}

.youtube-embed.is-playing iframe {
    pointer-events: auto;
}
@media (max-width: 860px) {
    :root {
        --gap: 10px;
    }
    .layout {
        max-width: none;
        gap: 10px;
        padding: 6px 6px calc(74px + env(safe-area-inset-bottom));
    }

    main {
        max-width: none;
    }

    .page {
        padding: 12px;
    }

    #sections-container {
        margin: 12px 0;
        gap: 12px;
    }

    .section-content {
        padding: 16px 14px;
    }

    .table-scroll table {
        width: 860px;
    }
}
