:root {
    color-scheme: light;
    --bg: #f4f7f2;
    --surface: #ffffff;
    --surface-soft: #edf3ee;
    --ink: #202822;
    --muted: #63716a;
    --line: #d8e1da;
    --line-strong: #b7c6ba;
    --accent: #126342;
    --accent-strong: #0c4b31;
    --accent-soft: #dcefe4;
    --blue: #225b9e;
    --blue-soft: #e4edf8;
    --amber: #8b5a13;
    --amber-soft: #f6ebd8;
    --code-bg: #18251e;
    --code-ink: #e8f3eb;
    --shadow: 0 12px 32px rgba(32, 48, 37, 0.08);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #121713;
    --surface: #1a211c;
    --surface-soft: #202b23;
    --ink: #edf5ef;
    --muted: #a6b4aa;
    --line: #334039;
    --line-strong: #4c6052;
    --accent: #72d39c;
    --accent-strong: #9ae4b5;
    --accent-soft: #203d2b;
    --blue: #9dc6f4;
    --blue-soft: #21354b;
    --amber: #e9bb72;
    --amber-soft: #47351e;
    --code-bg: #0d120f;
    --code-ink: #e5f1e8;
    --shadow: 0 16px 34px rgba(0, 0, 0, 0.22);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 16px;
    line-height: 1.65;
    letter-spacing: 0;
}

button,
input {
    font: inherit;
}

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

a {
    color: inherit;
}

button {
    cursor: pointer;
}

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 100;
    padding: 10px 14px;
    background: var(--ink);
    color: var(--surface);
    transform: translateY(-160%);
    transition: transform 160ms ease;
}

.skip-link:focus {
    transform: translateY(0);
}

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

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(18px);
}

.header-inner,
.hero-inner,
.tool-inner,
.content-wrap,
.footer-inner {
    width: min(1180px, calc(100% - 48px));
    margin: 0 auto;
}

.header-inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    gap: 28px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    text-decoration: none;
    flex-shrink: 0;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    background: var(--accent);
    color: #f5fff8;
    font-weight: 800;
    border-radius: 6px;
}

.brand strong,
.brand small {
    display: block;
    line-height: 1.25;
}

.brand strong {
    font-size: 15px;
}

.brand small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 22px;
    margin-left: auto;
}

.site-nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 650;
}

.site-nav a:hover,
.site-nav a:focus-visible {
    color: var(--accent);
}

.theme-toggle {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 11px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--surface);
    color: var(--ink);
    font-size: 12px;
    font-weight: 700;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
    border-color: var(--accent);
    color: var(--accent);
}

.theme-dot {
    width: 9px;
    height: 9px;
    border: 2px solid currentColor;
    border-radius: 50%;
}

.hero-band {
    position: relative;
    min-height: 330px;
    overflow: hidden;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--line-strong);
}

.hero-art,
.hero-overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.hero-art {
    object-fit: cover;
    object-position: center;
}

.hero-overlay {
    background: color-mix(in srgb, var(--bg) 72%, transparent);
}

.hero-inner {
    position: relative;
    z-index: 1;
    padding: 54px 0 48px;
}

.eyebrow,
.section-kicker {
    margin: 0;
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

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

h1,
h2,
h3 {
    line-height: 1.15;
}

h1 {
    max-width: 650px;
    margin-bottom: 16px;
    font-size: 72px;
    letter-spacing: 0;
}

h1 .title-phrase {
    white-space: nowrap;
}

.hero-lead {
    max-width: 560px;
    margin-bottom: 22px;
    color: var(--muted);
    font-size: 19px;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.hero-meta span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.hero-meta span::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.tool-bar {
    position: relative;
    z-index: 2;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.tool-inner {
    min-height: 82px;
    display: grid;
    grid-template-columns: minmax(230px, 1fr) auto auto;
    align-items: center;
    gap: 18px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 13px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: var(--bg);
    color: var(--muted);
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-box input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
}

.search-box input::placeholder {
    color: var(--muted);
}

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface-soft);
}

.category-tabs button {
    min-height: 34px;
    padding: 5px 10px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
}

.category-tabs button:hover,
.category-tabs button:focus-visible {
    color: var(--accent);
}

.category-tabs button.is-active {
    background: var(--surface);
    color: var(--accent-strong);
    box-shadow: 0 2px 8px rgba(25, 53, 36, 0.08);
}

.result-count {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.result-count strong {
    color: var(--ink);
}

.content-wrap {
    padding-bottom: 70px;
}

.mirror-section,
.notes-section {
    padding: 58px 0 62px;
    border-bottom: 1px solid var(--line);
    scroll-margin-top: 95px;
}

.section-heading {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
    gap: 32px;
    align-items: end;
    margin-bottom: 28px;
}

.section-heading h2 {
    margin-bottom: 0;
    font-size: 32px;
}

.section-heading > p {
    max-width: 500px;
    margin-bottom: 2px;
    color: var(--muted);
}

.source-list {
    border-top: 1px solid var(--line-strong);
}

.source-row {
    display: grid;
    grid-template-columns: minmax(150px, 0.7fr) minmax(260px, 1.45fr) auto;
    align-items: center;
    gap: 20px;
    min-height: 78px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}

.source-row:hover {
    background: color-mix(in srgb, var(--surface-soft) 58%, transparent);
}

.source-name strong,
.source-name span {
    display: block;
}

.source-name strong {
    font-size: 15px;
}

.source-name span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.source-url {
    min-width: 0;
    overflow-x: auto;
    color: var(--blue);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
}

.source-url:hover,
.source-url:focus-visible {
    text-decoration: underline;
}

.source-actions,
.hero-meta,
.category-tabs,
.command-heading > div {
    display: flex;
    align-items: center;
}

.source-actions {
    justify-content: flex-end;
    gap: 7px;
}

.tag,
.icon-button,
.copy-button {
    min-height: 32px;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
    background: var(--surface);
    color: var(--ink);
    font-size: 12px;
    font-weight: 750;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    color: var(--muted);
    white-space: nowrap;
}

.tag-accent {
    border-color: color-mix(in srgb, var(--amber) 35%, var(--line));
    background: var(--amber-soft);
    color: var(--amber);
}

.icon-button,
.copy-button {
    padding: 5px 10px;
    text-decoration: none;
}

.icon-button:hover,
.icon-button:focus-visible,
.copy-button:hover,
.copy-button:focus-visible {
    border-color: var(--accent);
    color: var(--accent-strong);
}

.copy-button.is-copied {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.command-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 28px;
}

.command-card {
    min-width: 0;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
}

.command-card-wide {
    grid-column: span 2;
}

.command-heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}

.command-heading > div {
    gap: 9px;
}

.command-index,
.note-index {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    border-radius: 4px;
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 11px;
    font-weight: 800;
}

.command-heading h3 {
    margin: 0;
    font-size: 17px;
}

.command-heading p {
    max-width: 210px;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
    text-align: right;
}

.code-shell {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: 72px;
    padding: 14px;
    border: 1px solid color-mix(in srgb, var(--code-bg) 72%, var(--line));
    border-radius: 5px;
    background: var(--code-bg);
    color: var(--code-ink);
}

.code-shell code {
    display: block;
    min-width: 0;
    overflow-x: auto;
    padding: 2px 0;
    color: inherit;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 12px;
    line-height: 1.65;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.copy-code {
    flex-shrink: 0;
    border-color: color-mix(in srgb, var(--code-ink) 28%, transparent);
    background: transparent;
    color: var(--code-ink);
}

.copy-code:hover,
.copy-code:focus-visible,
.copy-code.is-copied {
    border-color: var(--code-ink);
    background: color-mix(in srgb, var(--code-ink) 12%, transparent);
    color: var(--code-ink);
}

.subsection-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-top: 52px;
    padding-top: 28px;
    border-top: 1px solid var(--line);
}

.subsection-heading h3 {
    margin: 7px 0 0;
    font-size: 23px;
}

.subsection-heading p {
    max-width: 380px;
    margin-bottom: 1px;
    color: var(--muted);
    font-size: 13px;
    text-align: right;
}

.subsection-heading code,
.note-item code {
    padding: 2px 5px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--surface-soft);
    color: var(--accent-strong);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.92em;
}

.notes-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

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

.note-item {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
}

.note-item h3 {
    margin: 14px 0 7px;
    font-size: 17px;
}

.note-item p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 14px;
}

.note-item a {
    color: var(--blue);
    text-decoration: none;
    font-weight: 650;
}

.note-item a:hover,
.note-item a:focus-visible {
    text-decoration: underline;
}

.command-heading code {
    padding: 1px 4px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--surface-soft);
    color: var(--accent-strong);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.92em;
}

.evidence-block {
    margin-top: 30px;
    padding-top: 28px;
    border-top: 1px solid var(--line-strong);
}

.evidence-block h3 {
    margin-bottom: 0;
    font-size: 20px;
}

.evidence-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 24px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}

.evidence-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.evidence-list a {
    color: var(--blue);
    font-size: 14px;
    font-weight: 650;
    text-decoration: none;
}

.evidence-list a:hover,
.evidence-list a:focus-visible {
    text-decoration: underline;
}

.empty-state {
    width: min(1180px, calc(100% - 48px));
    margin: 42px auto;
    padding: 34px;
    border: 1px dashed var(--line-strong);
    border-radius: 6px;
    background: var(--surface);
    text-align: center;
}

.empty-state strong {
    display: block;
    margin-bottom: 5px;
}

.empty-state p {
    margin-bottom: 0;
    color: var(--muted);
}

.site-footer {
    background: var(--ink);
    color: var(--bg);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding: 28px 0;
}

.footer-inner strong {
    display: block;
    margin-bottom: 3px;
    color: #ffffff;
}

.footer-inner p {
    margin: 0;
    color: color-mix(in srgb, var(--bg) 76%, transparent);
    font-size: 13px;
}

.toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 40;
    max-width: min(320px, calc(100% - 44px));
    padding: 11px 14px;
    border: 1px solid var(--accent);
    border-radius: 5px;
    background: var(--surface);
    color: var(--accent-strong);
    box-shadow: var(--shadow);
    font-size: 13px;
    font-weight: 750;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

[hidden] {
    display: none !important;
}

@media (max-width: 900px) {
    .tool-inner {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 16px 0;
    }

    .result-count {
        justify-self: start;
    }

    .section-heading {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .section-heading > p {
        margin-bottom: 0;
    }

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

    .command-card-wide {
        grid-column: span 2;
    }
}

@media (max-width: 760px) {
    .header-inner {
        min-height: 64px;
        gap: 14px;
    }

    .site-nav {
        gap: 13px;
    }

    .site-nav a {
        font-size: 12px;
    }

    .theme-label {
        display: none;
    }

    .theme-toggle {
        width: 38px;
        justify-content: center;
        padding: 7px;
    }

    .hero-band {
        min-height: 315px;
    }

    .hero-inner {
        padding: 42px 0 38px;
    }

    h1 {
        font-size: 48px;
    }

    .hero-lead {
        font-size: 17px;
    }

    .source-row {
        grid-template-columns: 1fr auto;
        gap: 9px 12px;
        padding: 16px 0;
    }

    .source-url {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .source-actions {
        grid-column: 2;
        grid-row: 1;
        flex-wrap: wrap;
    }

    .command-grid,
    .notes-grid {
        grid-template-columns: 1fr;
    }

    .evidence-list {
        grid-template-columns: 1fr;
    }

    .command-card-wide {
        grid-column: auto;
    }

    .command-heading,
    .subsection-heading {
        display: block;
    }

    .command-heading p,
    .subsection-heading p {
        max-width: none;
        margin-top: 10px;
        text-align: left;
    }

    .subsection-heading {
        margin-top: 38px;
    }

    .footer-inner {
        display: block;
    }

    .footer-inner > p {
        margin-top: 14px;
    }
}

@media (max-width: 520px) {
    .header-inner,
    .hero-inner,
    .tool-inner,
    .content-wrap,
    .footer-inner,
    .empty-state {
        width: min(100% - 28px, 1180px);
    }

    .brand small {
        display: none;
    }

    .site-nav {
        margin-left: auto;
    }

    .site-nav a:nth-child(3) {
        display: none;
    }

    h1 {
        font-size: 41px;
    }

    .hero-lead {
        max-width: 290px;
    }

    .category-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .category-tabs button {
        width: 100%;
    }

    .source-actions {
        gap: 5px;
    }

    .tag {
        display: none;
    }

    .code-shell {
        display: block;
    }

    .copy-code {
        width: 100%;
        margin-top: 11px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
