/* CaelLab BY-SA Code License pages - stylesheet.
 *
 * Serves cbs-v3.* (the license page and the guide). Two themes: the dark
 * values are the defaults, [data-theme="light"] overrides them; the theme is
 * set on <html> by the inline script in each page.
 */

:root {
    --bg: #0b0d10;
    --bg-soft: #11141a;
    --card: #12161c;
    --card-hover: #161b22;
    --border: #232a33;
    --border-strong: #313a45;
    --text: #e8ebef;
    --text-dim: #98a1ad;
    --accent: #00d4aa;
    --accent-soft: rgba(0, 212, 170, 0.12);
    --accent-line: rgba(0, 212, 170, 0.35);
    --on-accent: #04241d;
    --mono-bg: #0d1014;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    --max: 1080px;
}


:root[data-theme="light"] {
    --bg: #fbfbfc;
    --bg-soft: #f3f5f7;
    --card: #ffffff;
    --card-hover: #ffffff;
    --border: #e3e6ea;
    --border-strong: #d3d8de;
    --text: #12161c;
    --text-dim: #5b6472;
    --accent: #00806a;
    --accent-soft: rgba(0, 128, 106, 0.09);
    --accent-line: rgba(0, 128, 106, 0.3);
    --on-accent: #ffffff;
    --mono-bg: #f6f7f9;
    --shadow: 0 1px 3px rgba(16, 24, 40, 0.07);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

.wrap {
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 24px;
}

/* ---------- top bar ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg);
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 600;
    font-size: 0.95rem;
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    width: 26px;
    height: 26px;
    flex: none;
    display: block;
    border-radius: 7px;
}

.brand-sep {
    color: var(--border-strong);
    font-weight: 400;
}

.brand-page {
    color: var(--text-dim);
    font-weight: 500;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}


.icon-btn {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.icon-btn:hover {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--bg-soft);
}

.icon-btn svg {
    width: 16px;
    height: 16px;
    pointer-events: none;
}

:root[data-theme="light"] .i-moon,
:root:not([data-theme="light"]) .i-sun {
    display: none;
}

/* ---------- hero ---------- */

.hero {
    position: relative;
    padding: 88px 24px 56px;
    text-align: center;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    left: 50%;
    top: -240px;
    width: 900px;
    height: 620px;
    transform: translateX(-50%);
    background: radial-gradient(50% 50% at 50% 50%, var(--accent-soft), transparent 68%);
    pointer-events: none;
}

.hero > * {
    position: relative;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    padding: 6px 14px;
    border-radius: 999px;
    margin-bottom: 26px;
}

h1 {
    font-size: clamp(2rem, 5.2vw, 3.2rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.12;
    max-width: 15ch;
    margin: 0 auto 20px;
}

.lede {
    font-size: clamp(1rem, 1.6vw, 1.12rem);
    color: var(--text-dim);
    max-width: 62ch;
    margin: 0 auto 28px;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 34px;
}

.chip {
    font-size: 0.82rem;
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 13px;
    background: var(--bg-soft);
}

.chip strong {
    color: var(--text);
    font-weight: 600;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: 22px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.92rem;
    font-weight: 600;
    padding: 11px 20px;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.12s, background 0.15s, border-color 0.15s, color 0.15s;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--accent);
    color: var(--on-accent);
}

.btn-primary:hover {
    background: var(--accent);
    filter: brightness(1.08);
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border-strong);
}

.btn-ghost:hover {
    background: var(--bg-soft);
    color: var(--text);
}

.btn svg {
    width: 15px;
    height: 15px;
}

.canonical {
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.82rem;
    color: var(--text-dim);
}

.canonical a {
    color: var(--text-dim);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ---------- deed (mbox) ---------- */

.mbox {
    display: flex;
    gap: 16px;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    padding: 18px 20px;
    margin-bottom: 48px;
    font-size: 0.95rem;
}

.mbox-image {
    flex: none;
}

.mbox-image img {
    display: block;
    width: 40px;
    height: 40px;
}

.mbox-text {
    flex: 1;
    min-width: 0;
}

.deed-title {
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
    padding: 0.3em 0;
}

.deed-sub {
    text-align: center;
    color: var(--text-dim);
    font-size: 0.92rem;
    margin-bottom: 18px;
}

.mbox-text > p {
    font-weight: 600;
    margin-bottom: 10px;
}

.mbox-text ul {
    margin: 0 0 18px 1.5em;
    padding-left: 1.1em;
    list-style: disc;
}

.mbox-text li {
    margin-bottom: 7px;
    color: var(--text-dim);
}

.mbox-text li strong {
    color: var(--text);
}

.mbox-text dl {
    margin: 0 0 2px 1.5em;
    color: var(--text-dim);
}

.mbox-text dd {
    margin-bottom: 8px;
}

/* ---------- document ---------- */

.doc {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 64px;
}

.doc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-soft);
}

.doc-head h2 {
    font-size: 1rem;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.doc-head p {
    font-size: 0.82rem;
    color: var(--text-dim);
}

.doc-body {
    padding: 30px 32px 36px;
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.82rem;
    line-height: 1.72;
    white-space: pre-wrap;
    overflow-wrap: break-word;
    background: var(--mono-bg);
}

.doc-body .keyword {
    color: var(--accent);
    font-weight: 700;
}

.doc-body::-webkit-scrollbar {
    height: 8px;
}

.doc-body::-webkit-scrollbar-track {
    background: transparent;
}

.doc-body::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 4px;
}

.doc-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 18px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-soft);
}

/* ---------- faq ---------- */

.section-title {
    font-size: 1.35rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.section-sub {
    color: var(--text-dim);
    font-size: 0.95rem;
    margin-bottom: 26px;
}

.faq {
    margin-bottom: 64px;
}

.faq details {
    border-bottom: 1px solid var(--border);
}

.faq details:first-of-type {
    border-top: 1px solid var(--border);
}

.faq summary {
    list-style: none;
    cursor: pointer;
    padding: 17px 34px 17px 0;
    position: relative;
    font-weight: 600;
    font-size: 0.97rem;
    transition: color 0.15s;
}

.faq summary::-webkit-details-marker {
    display: none;
}

.faq summary:hover {
    color: var(--accent);
}

.faq summary::after {
    content: "+";
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.15rem;
    font-weight: 400;
    color: var(--text-dim);
    transition: transform 0.18s;
}

.faq details[open] summary::after {
    content: "\2212";
}

.faq details p {
    padding: 0 0 19px;
    color: var(--text-dim);
    font-size: 0.94rem;
    max-width: 84ch;
}

/* ---------- notice ---------- */

.notice {
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--bg-soft);
    padding: 26px 28px;
    margin-bottom: 72px;
}

.notice h2 {
    font-size: 1rem;
    font-weight: 650;
    margin-bottom: 12px;
}

.notice p {
    color: var(--text-dim);
    font-size: 0.92rem;
    margin-bottom: 12px;
}

.notice p:last-child {
    margin-bottom: 0;
}

/* ---------- footer ---------- */

footer {
    border-top: 1px solid var(--border);
    padding: 30px 0 46px;
}

.foot-guide {
    font-size: 0.94rem;
    margin-bottom: 18px;
}

.foot-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.foot-note {
    color: var(--text-dim);
    font-size: 0.84rem;
}

@media (max-width: 860px) {
    .hero {
        padding: 64px 24px 44px;
    }

    .mbox {
        padding: 14px 16px;
        gap: 12px;
    }

    .deed-title {
        font-size: 1.1rem;
    }

    .doc-head,
    .doc-foot {
        padding: 16px 20px;
    }
}

/* The canonical text is hard-wrapped at 78 columns: below this width,
   keep its indentation intact and scroll instead of re-wrapping. */
@media (max-width: 820px) {
    .doc-body {
        padding: 22px 20px 26px;
        font-size: 0.74rem;
        white-space: pre;
        overflow-wrap: normal;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ---------- license page (legalcode) ---------- */

.legal-head {
    text-align: center;
    padding: 64px 0 36px;
}

.legal-head h1 {
    font-size: clamp(1.7rem, 4.2vw, 2.5rem);
    max-width: 22ch;
    margin: 0 auto 14px;
}

.legal-meta {
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.84rem;
    color: var(--text-dim);
    line-height: 1.9;
}

.legal-meta a {
    color: var(--text-dim);
    text-decoration: underline;
    text-underline-offset: 3px;
}

@media (max-width: 860px) {
    .legal-head {
        padding: 44px 0 28px;
    }
}

/* ---------- language switcher ---------- */

.lang-switch select {
    font: inherit;
    font-size: 0.86rem;
    color: var(--text-dim);
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px 8px;
    max-width: 150px;
    cursor: pointer;
}

.lang-switch select:hover {
    color: var(--text);
    border-color: var(--border-strong);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.translation-note {
    max-width: 62ch;
    margin: 14px auto 0;
    font-size: 0.86rem;
    color: var(--text-dim);
}


[dir="rtl"] .mbox {
    flex-direction: row-reverse;
}
@media (max-width: 520px) {
    .topbar-inner {
        padding: 10px 16px;
        gap: 10px;
    }

    .brand-sep,
    .brand-page {
        display: none;
    }

    .topbar-actions {
        gap: 6px;
    }

    .lang-switch select {
        max-width: 112px;
        font-size: 0.8rem;
        padding: 6px;
    }

    .topbar-actions .btn {
        padding: 10px 14px;
    }
}

/* ---------- guide extras: tables, code blocks, callouts ---------- */

.guide-section {
    margin-bottom: 64px;
}

.guide-section > p {
    color: var(--text-dim);
    font-size: 0.95rem;
    margin-bottom: 12px;
}

.guide-section > p strong {
    color: var(--text);
}

.table-scroll {
    overflow-x: auto;
    margin-bottom: 20px;
}

.comparison {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.comparison th,
.comparison td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.comparison td:first-child {
    white-space: normal;
}

.comparison th {
    color: var(--text-dim);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.comparison tbody tr:hover td {
    background: var(--bg-soft);
}

.yes {
    color: var(--accent);
    font-weight: 600;
}

.no {
    color: #ff6b6b;
}

:root[data-theme="light"] .no {
    color: #c2382f;
}

.code-block {
    position: relative;
    background: var(--mono-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 36px 16px 14px;
    margin-bottom: 16px;
    overflow-x: auto;
}

.code-block pre {
    margin: 0;
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.72;
    color: var(--text);
}

.code-block .lang-tag {
    position: absolute;
    top: 9px;
    left: 16px;
    font-size: 0.72rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.note {
    border-left: 3px solid var(--accent-line);
    background: var(--bg-soft);
    padding: 16px 18px;
    margin-bottom: 20px;
    font-size: 0.92rem;
    color: var(--text-dim);
}

.note strong {
    color: var(--text);
}
