:root {
    --bg: #000000;
    --surface: #00000094;
    --surface-elevated: #121212;
    --border: rgba(255, 255, 255, 0.08);
    --border-active: rgba(255, 255, 255, 0.22);
    --text-primary: #f5f5f7;
    --text-secondary: #86868b;
    --text-tertiary: #48484a;
    --text-link: #2997ff;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);

    --glass-displace: 0;
    --glass-distortion: 300;
    --glass-red: -50;
    --glass-green: -50;
    --glass-blue: -50;
    --glass-brightness: 60;
    --glass-opacity: 1;
    --glass-blend: screen;
    --glass-radius: 20px;
    --glass-border-width: 0.07;
    --glass-blur: 11px;
    --glass-bg-opacity: 0;
    --glass-saturation: 1;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

html {
    scroll-behavior: auto;
}

body {
    background-color: var(--bg);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    overflow-wrap: break-word;
    word-break: break-word;
    position: relative;
}

body::before,
body::after {
    content: "";
    position: fixed;
    left: 0;
    right: 0;
    height: 80px;
    pointer-events: none;
    z-index: 90;
}

body::before {
    top: 0;
    background: linear-gradient(to bottom, var(--bg) 0%, transparent 100%);
}

body::after {
    bottom: 0;
    background: linear-gradient(to top, var(--bg) 0%, transparent 100%);
}

a {
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

a:hover {
    border-color: var(--text-primary);
}

#aurora-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.55;
}

#aurora-bg canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.top-nav,
.view-container,
.search-dock-wrapper,
.toc-sidebar,
.toc-fab,
.toc-drawer,
.modal-backdrop {
    position: relative;
    z-index: 1;
}

.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
}

.brand-mark {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pill-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    padding: 5px 12px;
    border-radius: 980px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s var(--ease);
    font-family: inherit;
}

.pill-btn:hover {
    color: var(--text-primary);
}

.view-container {
    flex: 1;
    display: none;
    width: 100%;
}

.view-container.active {
    display: flex;
}

#landing {
    min-height: 100vh;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    text-align: center;
}

.dome-wrap {
    width: 100%;
    flex: 1 0 auto;
    height: 100vh;
    min-height: 500px;
    position: relative;
}

.sphere-root {
    position: relative;
    width: 100%;
    height: 100%;
    --radius: 520px;
    --viewer-pad: 72px;
    --circ: calc(var(--radius) * 3.14);
    --rot-y: calc((360deg / var(--segments-x)) / 2);
    --rot-x: calc((360deg / var(--segments-y)) / 2);
    --item-width: calc(var(--circ) / var(--segments-x));
    --item-height: calc(var(--circ) / var(--segments-y));
}

.sphere-root * {
    box-sizing: border-box;
}

.sphere,
.item,
.item__image {
    transform-style: preserve-3d;
}

main.sphere-main {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    background: transparent;
}

.stage {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    perspective-origin: 50% 50%;
    contain: layout paint size;
}

.sphere {
    will-change: transform;
}

.sphere-root .overlay,
.sphere-root .overlay--blur {
    position: absolute;
    inset: 0;
    margin: auto;
    z-index: 3;
    pointer-events: none;
}

.sphere-root .overlay {
    background-image: radial-gradient(rgba(235, 235, 235, 0) 65%, var(--overlay-blur-color, #000000) 100%);
}

.sphere-root .overlay--blur {
    -webkit-mask-image: radial-gradient(rgba(235, 235, 235, 0) 70%, var(--overlay-blur-color, #000000) 90%);
    mask-image: radial-gradient(rgba(235, 235, 235, 0) 70%, var(--overlay-blur-color, #000000) 90%);
    backdrop-filter: blur(3px);
}

.item {
    width: calc(var(--item-width) * var(--item-size-x));
    height: calc(var(--item-height) * var(--item-size-y));
    position: absolute;
    top: -999px;
    bottom: -999px;
    left: -999px;
    right: -999px;
    margin: auto;
    transform-origin: 50% 50%;
    backface-visibility: hidden;
    transform: rotateY(calc(var(--rot-y) * (var(--offset-x) + ((var(--item-size-x) - 1) / 2)) + var(--rot-y-delta, 0deg))) rotateX(calc(var(--rot-x) * (var(--offset-y) - ((var(--item-size-y) - 1) / 2)) + var(--rot-x-delta, 0deg))) translateZ(var(--radius));
}

.item__image {
    position: absolute;
    display: block;
    inset: 0;
    border-radius: var(--tile-radius, 12px);
    background: transparent;
    overflow: hidden;
    backface-visibility: hidden;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    pointer-events: auto;
    transform: translateZ(0);
}

.item__image:focus-visible {
    outline: 2px solid var(--text-primary);
    outline-offset: 2px;
}

.item__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    backface-visibility: hidden;
    filter: var(--image-filter, none);
    opacity: 0;
    transition: opacity 300ms var(--ease);
}

.item__image.is-loaded img {
    opacity: 1;
}

.item__image-label {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 6px;
    font-size: 10px;
    font-weight: 500;
    color: #fff;
    z-index: 1;
    line-height: 1.25;
    pointer-events: none;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    opacity: 0;
    transition: opacity 300ms var(--ease);
}

.item__image.is-loaded .item__image-label {
    opacity: 1;
}

.item__image .skeleton {
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg, var(--surface-elevated) 30%, rgba(255, 255, 255, 0.06) 50%, var(--surface-elevated) 70%);
    background-size: 300% 100%;
    animation: skeleton-shimmer 1.6s ease-in-out infinite;
}

.item__image.is-loaded .skeleton {
    display: none;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

.edge-fade {
    position: absolute;
    left: 0;
    right: 0;
    height: 120px;
    z-index: 5;
    pointer-events: none;
    background: linear-gradient(to bottom, transparent, var(--overlay-blur-color, #000000));
}

.edge-fade--top {
    top: 0;
    transform: rotate(180deg);
}

.edge-fade--bottom {
    bottom: 0;
}

#article {
    flex-direction: column;
    align-items: center;
    padding: 100px 24px 180px;
}

.content-column {
    width: 100%;
    max-width: 640px;
}

.article-header {
    margin-bottom: 48px;
}

.article-sup-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.back-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-family: inherit;
    padding: 0;
    transition: color 0.2s var(--ease);
}

.back-btn:hover {
    color: var(--text-primary);
}

.article-category {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.article-heading {
    font-size: 38px;
    font-weight: 500;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: var(--text-primary);
}

.toc-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 12px;
}

.toc-sidebar__inner {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.toc-sidebar__inner::-webkit-scrollbar {
    display: none;
}

.toc-anchors {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.toc-anchors a {
    font-size: 12px;
    color: var(--text-secondary);
    border: none;
}

.toc-anchors a:hover {
    color: var(--text-primary);
}

.toc-sub-item {
    padding-left: 14px;
}

.article-rendered {
    font-size: 15px;
    line-height: 1.75;
    color: #d1d1d6;
    font-weight: 400;
    min-height: 120px;
}

.article-rendered>p {
    margin-bottom: 24px;
}

.article-rendered h2 {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    margin: 56px 0 16px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.article-rendered h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 32px 0 12px;
}

.article-rendered figure {
    margin: 40px 0;
    overflow: hidden;
}

.article-rendered figure img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    opacity: 0.9;
}

.article-rendered figcaption {
    padding-top: 14px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.article-rendered blockquote {
    margin: 28px 0;
    padding: 16px 20px;
    border-left: 2px solid var(--text-primary);
    background: var(--surface);
    border-radius: 0 8px 8px 0;
    font-size: 14px;
    color: var(--text-primary);
}

.article-rendered sup.reference {
    font-size: 10px;
    vertical-align: super;
    padding: 0 2px;
}

.article-rendered sup.reference a {
    color: var(--text-secondary);
    border: none;
}

.article-rendered sup.reference a:hover {
    color: var(--text-link);
}

.article-rendered ul,
.article-rendered ol {
    margin: 16px 0 24px 20px;
    color: var(--text-secondary);
}

.article-rendered ul li,
.article-rendered ol li {
    margin-bottom: 6px;
}

.article-rendered table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 32px 0;
    font-size: 13px;
    table-layout: fixed;
}

.article-rendered table caption {
    font-size: 15px;
    font-weight: 600;
    font-style: italic;
    color: var(--text-primary);
    padding-bottom: 16px;
    text-align: center;
}

.article-rendered table tr {
    border-bottom: 1px solid var(--border);
}

.article-rendered table th,
.article-rendered table td {
    padding: 8px 10px;
    text-align: left;
    vertical-align: top;
    color: #d1d1d6;
    word-wrap: break-word;
}

.article-rendered table th {
    color: var(--text-secondary);
    font-weight: 500;
    width: 35%;
    white-space: nowrap;
}

.article-rendered table td img,
.article-rendered table th img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.article-loading {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 4px;
}

.article-loading .skel-line {
    height: 14px;
    border-radius: 6px;
    background: linear-gradient(100deg, var(--surface-elevated) 30%, rgba(255, 255, 255, 0.06) 50%, var(--surface-elevated) 70%);
    background-size: 300% 100%;
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
}

.article-loading .skel-line:nth-child(1) {
    width: 100%;
}

.article-loading .skel-line:nth-child(2) {
    width: 92%;
}

.article-loading .skel-line:nth-child(3) {
    width: 96%;
}

.article-loading .skel-line:nth-child(4) {
    width: 60%;
}

.article-fade-in {
    animation: article-fade 260ms var(--ease) both;
}

@keyframes article-fade {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.references-wrapper {
    margin-top: 64px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
}

.references-wrapper h2 {
    font-size: 11px !important;
    margin: 0 0 12px 0 !important;
    border: none !important;
    padding: 0 !important;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
}

.references-wrapper ol {
    padding-left: 16px;
    line-height: 1.6;
    margin: 0;
    color: var(--text-secondary);
}

.references-wrapper li {
    margin-bottom: 8px;
}

.references-wrapper a {
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
}

.references-wrapper a:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
}

.search-dock-wrapper {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 380px;
    z-index: 200;
    padding: 0 16px;
}

.search-pill-container {
    position: relative;
}

.search-inner {
    display: flex;
    align-items: center;
    height: 40px;
    padding: 0 14px 0 16px;
}

.search-svg {
    width: 13px;
    height: 13px;
    stroke: var(--text-secondary);
    margin-right: 10px;
    flex-shrink: 0;
}

.search-box {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 13px;
    font-family: inherit;
}

.search-box::placeholder {
    color: var(--text-tertiary);
}

.search-shortcut {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-tertiary);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
}

.suggestions-dropdown {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    right: 0;
    overflow: hidden;
    display: none;
    max-height: 320px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.5) !important;
    backdrop-filter: blur(10px) saturate(120%) !important;
    -webkit-backdrop-filter: blur(10px) saturate(120%) !important;
}

.suggestions-dropdown.visible {
    display: block;
}

.suggestion-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    transition: background 0.15s var(--ease);
}

.suggestion-link:last-child {
    border-bottom: none;
}

.suggestion-link:hover {
    background: rgba(255, 255, 255, 0.06);
}

.suggestion-text {
    flex: 1;
    min-width: 0;
    padding-right: 12px;
}

.suggestion-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
}

.suggestion-highlight {
    font-style: normal;
    color: #ffffff;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.suggestion-description {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: normal;
    overflow-wrap: break-word;
    word-break: break-word;
}

.suggestion-thumbnail {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background-size: cover;
    background-position: center;
    background-color: var(--surface-elevated);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop.active {
    display: flex;
}

.modal-sheet {
    width: 100%;
    max-width: 360px;
    padding: 20px;
}

.modal-title {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 14px;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.modal-lang-opt {
    position: relative;
    padding: 8px 12px;
    border-radius: 100px !important;
    font-size: 12px;
    cursor: pointer;
    border: 1px solid transparent;
    color: var(--text-secondary);
    transition: color 0.15s var(--ease);
}

.modal-lang-opt:hover {
    color: var(--text-primary);
}

.glass-surface {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    border-radius: var(--glass-radius);
    background: rgba(255, 255, 255, var(--glass-bg-opacity));
}

.glass-surface__filter {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: -1;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.suggestions-dropdown.glass-surface,
.toc-sidebar.glass-surface,
.toc-drawer__sheet.glass-surface {
    --glass-radius: 14px;
}

.toc-fab.glass-surface,
.modal-lang-opt.glass-surface {
    --glass-radius: 8px;
}

.search-pill-container.glass-surface {
    --glass-radius: 980px;
}

.toc-sidebar {
    position: fixed;
    top: 50%;
    left: 24px;
    transform: translateY(-50%);
    width: 220px;
    max-height: 70vh;
    z-index: 150;
    display: none;
}

.toc-sidebar.visible {
    display: block;
}

.toc-sidebar__inner {
    padding: 16px;
    max-height: 70vh;
    overflow-y: auto;
}

.toc-sidebar .toc-anchors a {
    display: block;
    padding: 5px 8px;
    border: none;
    border-left: 2px solid transparent;
}

.toc-sidebar .toc-anchors a.active {
    color: #ffffff;
    border-left-color: #ffffff;
}

.toc-fab {
    display: none;
    position: fixed;
    bottom: 84px;
    right: 16px;
    width: 46px;
    height: 46px;
    z-index: 220;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    border: none;
}

.toc-fab.visible {
    display: flex;
}

.toc-drawer {
    position: fixed;
    inset: 0;
    z-index: 400;
    pointer-events: none;
}

.toc-drawer__scrim {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.25s var(--ease);
}

.toc-drawer__sheet {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0 12px 12px;
    transform: translateY(100%);
    transition: transform 0.3s var(--ease);
    border-radius: 20px 20px 0 0;
    max-height: 60vh;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background-color: rgba(0, 0, 0, 0.2);
}

.toc-drawer__sheet .toc-sidebar__inner {
    max-height: 60vh;
}

.toc-drawer.open {
    pointer-events: auto;
}

.toc-drawer.open .toc-drawer__scrim {
    opacity: 1;
}

.toc-drawer.open .toc-drawer__sheet {
    transform: translateY(0);
}

@media (min-width: 1180px) {
    .toc-fab {
        display: none !important;
    }

    .toc-drawer {
        display: none !important;
    }
}

@media (max-width: 1179px) {
    .toc-sidebar {
        display: none !important;
    }

    .toc-fab.visible {
        display: flex;
    }
}

@media (max-width: 640px) {
    .article-heading {
        font-size: 28px;
    }

    #article {
        padding: 88px 18px 160px;
    }
}

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}