:root {
    --text: #222222;
    --heading: #ff0000;
    --box: #f3f3f3;
    --bg: #ffffff;
    --muted: #666666;
    --content-width: 760px;

    --image-width: 220px;
    --image-gap: 2rem;
    --image-right-pad: 1.25rem;
    --image-max-height: 220px;

    --sequence-thumb-size: 110px;
    --sequence-gap: 1rem;

    --code-bg: #ececec;
    --code-text: #1f1f1f;
    --button-outline: 1px solid var(--heading);

    --menu-yellow: #ffff00;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family:
        "Roboto Mono",
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        sans-serif;
    line-height: 1.6;
    margin: 0;
    background: var(--bg);
    color: var(--text);
}

body.menu-open {
    overflow: hidden;
}

/* Top buttons */
#theme-toggle,
#menu-toggle {
    position: fixed;
    top: 1rem;
    z-index: 1000;
    background: var(--box);
    color: var(--text);
    padding: 0.7rem 1rem;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    min-height: 40px;
    border-radius: 0;
}

#menu-toggle {
    left: 1rem;
    background: var(--heading);
    color: var(--bg);
    border: none;
}

#theme-toggle {
    right: 1rem;
    border: var(--button-outline);
}

/* Site menu overlay */
.site-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
}

.site-menu-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.28);
    cursor: pointer;
    pointer-events: auto;
}

.site-menu-dialog {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    pointer-events: none;
}

.site-menu-circle {
    position: relative;
    width: min(72vw, 520px);
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: var(--menu-yellow);
    display: grid;
    place-items: center;
    pointer-events: auto;
    box-shadow: 0 0 0 1px var(--heading);
}

.site-menu-ring-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.site-menu-ring-spin {
    transform-origin: 150px 150px;
    animation: spin 18s linear infinite;
}

.site-menu-ring-link {
    cursor: pointer;
}

.site-menu-ring-text {
    fill: #000000;
    font-family: "Roboto Mono", sans-serif;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: lowercase;
}

.site-menu-ring-link:hover .site-menu-ring-text,
.site-menu-ring-link:focus .site-menu-ring-text {
    opacity: 0.65;
    text-decoration: none;
}

.site-menu-close {
    appearance: none;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 72px;
    height: 72px;
    transform: translate(-50%, -50%);
    border: 0;
    background: transparent;
    color: #ff0000;
    font: inherit;
    font-size: 80px;
    line-height: 1;
    cursor: pointer;
    display: grid;
    place-items: center;
    padding: 0;
    z-index: 3;
    pointer-events: auto;
}

.hidden {
    display: none !important;
}

/* Main layout */
#content,
main,
.container,
.wrapper {
    max-width: var(--content-width);
    margin-left: auto;
    margin-right: auto;
}

#content {
    width: min(100%, var(--content-width));
    padding: 5.5rem 4.5rem 4rem;
}

/* Sequence section */
#sequence-section {
    margin-top: 2.5rem;
    margin-bottom: 0;
}

.sequence-dropdown {
    background: var(--heading);
    border: none;
    border-radius: 0;
    padding: 0.8rem 1rem;
    margin: 1rem 0;
}

.sequence-dropdown summary {
    cursor: pointer;
    list-style: none;
    font-weight: 700;
    color: var(--bg);
}

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

.sequence-dropdown summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 0.5rem;
    transition: transform 0.2s ease;
}

.sequence-dropdown[open] summary::before {
    transform: rotate(90deg);
}

.sequence-rows {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 0.9rem;
}

.sequence-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sequence-gap);
}

.sequence-pose {
    width: var(--sequence-thumb-size);
    height: var(--sequence-thumb-size);
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
}

.sequence-pose-media {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sequence-pose-media img,
.sequence-pose-media svg {
    max-width: 100%;
    max-height: 100%;
    display: block;
}

.sequence-pose-label {
    display: none;
}

.sequence-missing {
    color: var(--bg);
    font-size: 2.5rem;
    font-weight: 700;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6,
summary {
    color: var(--heading);
    line-height: 1.2;
}

h1 {
    font-size: 2rem;
    margin: 1.8rem 0 0.8rem;
}

h2,
.h2-dropdown summary {
    font-size: 1.18rem;
    font-weight: 700;
}

h2 {
    margin: 1.5rem 0 0.65rem;
}

h3 {
    font-size: 1rem;
    margin-top: 1rem;
    margin-bottom: 0.2rem;
}

h4,
h5,
h6 {
    margin-top: 1rem;
    margin-bottom: 0.4rem;
}

p,
li,
blockquote,
td,
th {
    color: var(--text);
}

p,
ul,
ol,
pre,
blockquote {
    margin: 0 0 1rem;
}

h3 + p {
    margin-top: 0;
}

.h1-section > h1 {
    margin-bottom: 0.75rem;
}

/* Generic dropdown blocks */
.h2-dropdown {
    background: var(--box);
    border: none;
    border-radius: 0;
    padding: 0.8rem 1rem;
    margin: 1rem 0;
}

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

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

.h2-dropdown summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 0.5rem;
    transition: transform 0.2s ease;
}

.h2-dropdown[open] summary::before {
    transform: rotate(90deg);
}

.h2-dropdown[open] > summary {
    margin-bottom: 0.9rem;
}

.h2-text {
    min-width: 0;
}

.h2-media p {
    margin: 0;
    width: 100%;
}

.h2-media img,
.h2-media svg {
    display: block;
    width: 100%;
    height: auto;
    max-height: var(--image-max-height);
    object-fit: contain;
    border-radius: 0;
}

/* default shared behavior */
.h2-body {
    display: block;
}

.h2-media {
    display: none;
}

.h2-media:not(:empty) {
    display: block;
    width: min(100%, var(--image-width));
    margin-top: 1rem;
}

/* Asana-only side SVG layout */
.page-asana .h2-body {
    display: flex;
    align-items: center;
    gap: var(--image-gap);
}

.page-asana .h2-text {
    flex: 1;
}

.page-asana .h2-media {
    display: none;
    flex: 0 0 var(--image-width);
    width: var(--image-width);
    align-items: center;
    justify-content: center;
    padding-right: var(--image-right-pad);
    margin-top: 0;
}

.page-asana .h2-media:not(:empty) {
    display: flex;
}

/* Asana SVG color */
.page-asana .h2-media svg.asana-svg {
    color: var(--heading);
}

.page-asana .h2-media svg.asana-svg [fill="currentColor"] {
    fill: currentColor !important;
}

.page-asana .h2-media svg.asana-svg [stroke="currentColor"] {
    stroke: currentColor !important;
}

.page-asana .h2-media svg.asana-svg path:not([class]):not([fill]) {
    fill: currentColor !important;
}

/* Links */
a {
    color: var(--heading);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Code */
code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9em;
    background: var(--code-bg);
    color: var(--code-text);
    padding: 0.14rem 0.38rem;
    border-radius: 0;
}

pre {
    background: var(--code-bg);
    color: var(--code-text);
    padding: 1rem 1.1rem;
    border-radius: 0;
    overflow-x: auto;
    line-height: 1.5;
    margin: 1rem 0 1.2rem;
}

pre code {
    display: block;
    background: transparent;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: 0.92rem;
    white-space: pre;
}

/* Lists */
ul,
ol {
    padding-left: 1.4rem;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

th,
td {
    text-align: left;
    padding: 0.6rem 0.4rem;
}

/* Highlight */
mark {
    background: #ffeaa7;
    color: #222222;
    padding: 0.08rem 0.25rem;
    border-radius: 0;
}

/* Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 0;
}

/* Muted */
small {
    color: var(--muted);
}

/* Dark mode */
body.dark {
    --text: #e8e8e8;
    --heading: #49a6ff;
    --box: #23262b;
    --bg: #111318;
    --muted: #a0a7b4;
    --code-bg: #1b1f26;
    --code-text: #e8e8e8;
    --button-outline: 1px solid var(--heading);
}

body.dark #theme-toggle {
    background: var(--box);
    color: var(--text);
}

body.dark #menu-toggle {
    background: var(--heading);
    color: var(--bg);
}

.site-menu-ring-link:hover,
.site-menu-ring-link:focus,
.site-menu-ring-link:hover .site-menu-ring-text,
.site-menu-ring-link:focus .site-menu-ring-text {
    text-decoration: none;
}

/* Animations */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Mobile */
@media (max-width: 720px) {
    #theme-toggle,
    #menu-toggle {
        top: 0.75rem;
        padding: 0.6rem 0.85rem;
        font-size: 0.9rem;
        line-height: 1;
        min-height: 38px;
    }

    #menu-toggle {
        left: 0.75rem;
    }

    #theme-toggle {
        right: 0.75rem;
    }

    #content {
        padding: 5rem 1rem 4rem;
    }

    h1 {
        font-size: 1.7rem;
    }

    .page-asana .h2-body {
        flex-direction: column;
        align-items: stretch;
        gap: 0.9rem;
    }

    .page-asana .h2-text {
        order: 2;
    }

    .page-asana .h2-media {
        order: 1;
        width: 100%;
        flex: none;
        justify-content: flex-start;
        padding-right: 0;
        margin-top: 0;
    }

    .page-asana .h2-media img,
    .page-asana .h2-media svg {
        width: auto;
        max-width: min(100%, 140px);
        max-height: 140px;
    }

    .sequence-pose {
        width: 90px;
        height: 90px;
    }

    .site-menu-circle {
        width: min(86vw, 420px);
    }

    .site-menu-ring-text {
        font-size: 22px;
    }

    .site-menu-close {
        width: 60px;
        height: 60px;
        font-size: 42px;
    }
}
