/* ==========================================================================
   repo.leanstep.io — Package index + Quickstart
   Strictly derived from the LUI (Leanstep UI) design tokens.
   ========================================================================== */

/* --- 1. TOKENS (verbatim from LUI) --- */
:root {
    --radius: 0.2rem;

    --transition-fast: 0.15s ease-in-out;
    --transition-medium: 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);

    --space-1: 0.4rem;
    --space-2: 0.8rem;
    --space-3: 1.2rem;
    --space-4: 1.6rem;
    --space-6: 2.4rem;
    --space-8: 3.2rem;
    --space-12: 4.8rem;
    --space-16: 6.4rem;
    --space-24: 9.6rem;

    --font-standard: 'LUIFS', system-ui, -apple-system, sans-serif;
    --font-extended: 'LUIFE', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;

    --ocean-rgb: 19, 76, 204;
    --graphite-rgb: 55, 62, 72;
    --teal-rgb: 0, 114, 92;
}

:root, [data-theme="light"] {
    color-scheme: light;

    --color-primary: rgba(var(--ocean-rgb), 1);
    --color-primary-hover: rgba(var(--ocean-rgb), 0.8);
    --color-primary-40: rgba(var(--ocean-rgb), 0.4);
    --color-primary-20: rgba(var(--ocean-rgb), 0.2);
    --color-success: rgba(var(--teal-rgb), 1);

    --text-heading: rgba(0, 0, 0, 0.95);
    --text-main: rgba(var(--graphite-rgb), 1);
    --text-muted: rgba(var(--graphite-rgb), 0.6);

    --bg-app: #f4f5f7;
    --bg-surface: #ffffff;
    --bg-surface-hover: #f9f9fb;
    --border-light: rgba(var(--graphite-rgb), 0.15);
    --border-strong: rgba(var(--graphite-rgb), 0.3);

    --focus-ring: 0 0 0 0.3rem var(--color-primary-40);

    --syntax-text: #24292e;
    --syntax-comment: #6a737d;
}

[data-theme="dark"] {
    color-scheme: dark;

    --color-primary: rgba(var(--ocean-rgb), 0.8);
    --color-primary-hover: rgba(var(--ocean-rgb), 1);

    --text-heading: rgba(255, 255, 255, 0.95);
    --text-main: rgba(255, 255, 255, 0.85);
    --text-muted: rgba(255, 255, 255, 0.5);

    --bg-app: rgb(16, 18, 22);
    --bg-surface: rgb(24, 27, 32);
    --bg-surface-hover: rgba(255, 255, 255, 0.03);
    --border-light: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.2);

    --syntax-text: #c9d1d9;
    --syntax-comment: #8b949e;
}

/* --- 2. RESET & BASE --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 62.5%;
    scroll-behavior: smooth;
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: var(--font-standard);
    background: var(--bg-app);
    color: var(--text-main);
    font-size: 1.6rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background var(--transition-fast), color var(--transition-fast);
}

h1, h2, h3 {
    font-family: var(--font-extended);
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--text-heading);
}

a { color: var(--color-primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--color-primary-hover); }

:focus:not(:focus-visible) { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius); }

.muted { color: var(--text-muted); }

/* --- 3. LAYOUT --- */
.container {
    width: 100%;
    max-width: 128rem;          /* 1280px; below that: full width */
    margin-inline: auto;
    padding-inline: var(--space-6);
}

/* --- 4. HEADER --- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg-app) 88%, transparent);
    backdrop-filter: blur(8px);
    border-block-end: 0.1rem solid var(--border-light);
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 6.4rem;
}
.brand { display: inline-flex; align-items: center; }
.brand-logo { height: 2.2rem; width: auto; display: block; }
.brand-logo--dark { display: none; }
[data-theme="dark"] .brand-logo--light { display: none; }
[data-theme="dark"] .brand-logo--dark { display: block; }

.header-right { display: flex; align-items: center; gap: var(--space-6); }
.nav-link {
    font-family: var(--font-extended);
    text-transform: uppercase;
    letter-spacing: 0.08rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-muted);
}
.nav-link:hover { color: var(--color-primary); }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.8rem;
    height: 3.8rem;
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    transition: color var(--transition-fast);
}
.theme-toggle:hover { color: var(--color-primary); }
.theme-toggle .icon { width: 1.8rem; height: 1.8rem; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

/* --- 5. PAGE HEAD (Quickstart) --- */
.page-head { padding-block: var(--space-16) var(--space-12); }
.eyebrow {
    font-family: var(--font-extended);
    text-transform: uppercase;
    letter-spacing: 0.12rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-block-end: var(--space-4);
}
.page-title { font-size: 3.6rem; color: var(--text-heading); }

/* --- 6. SECTIONS --- */
.section { padding-block: var(--space-12) var(--space-16); }
.section:first-of-type { padding-block-start: var(--space-16); }
.section-title { font-size: 2rem; margin-block-end: var(--space-8); }

/* --- 7. STEPS (Quickstart only) --- */
.steps { list-style: none; display: flex; flex-direction: column; gap: var(--space-12); }
.step-head { display: flex; align-items: baseline; gap: var(--space-3); margin-block-end: var(--space-4); }
.step-num { font-family: var(--font-mono); font-weight: 700; font-size: 1.3rem; color: var(--color-primary); }
.step-label {
    font-family: var(--font-extended);
    text-transform: uppercase;
    letter-spacing: 0.05rem;
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--text-heading);
}
.step-note { margin-block-start: var(--space-3); font-size: 1.3rem; color: var(--text-muted); }
.step-note code { font-family: var(--font-mono); font-size: 0.92em; color: var(--text-main); }

/* --- 8. SEGMENTED CONTROL (EL / Fedora) --- */
.seg { display: inline-flex; border: 0.1rem solid var(--border-strong); border-radius: var(--radius); overflow: hidden; margin-block-end: var(--space-4); }
.seg-btn {
    background: transparent; border: none; cursor: pointer;
    font-family: var(--font-extended); text-transform: uppercase; letter-spacing: 0.05rem;
    font-weight: 700; font-size: 1.2rem; color: var(--text-muted);
    padding: 1rem 1.8rem; transition: all var(--transition-fast);
}
.seg-btn + .seg-btn { border-inline-start: 0.1rem solid var(--border-strong); }
.seg-btn[aria-selected="true"] { background: var(--color-primary); color: #ffffff; }
.seg-panel[hidden] { display: none; }

/* --- 9. CODE BLOCKS (Quickstart guide — mono lives here) --- */
.code { position: relative; background: var(--color-primary-20); border: 0.1rem solid var(--border-strong); border-radius: var(--radius); }
.code pre { margin: 0; padding: var(--space-6) var(--space-8); padding-inline-end: 9rem; overflow: hidden; }
.code code {
    display: block; font-family: var(--font-mono); font-size: 1.3rem; line-height: 1.7;
    color: var(--syntax-text); white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; tab-size: 4;
}
.code .cm { color: var(--syntax-comment); }
.code-copy {
    position: absolute; top: 1rem; inset-inline-end: 1rem;
    font-family: var(--font-extended); text-transform: uppercase; letter-spacing: 0.05rem;
    font-weight: 700; font-size: 1.05rem; padding: 0.6rem 1rem;
    background: var(--bg-surface); color: var(--text-main);
    border: 0.1rem solid var(--border-strong); border-radius: var(--radius);
    cursor: pointer; transition: all var(--transition-fast);
}
.code-copy:hover { border-color: var(--color-primary); color: var(--color-primary); }
.code-copy.is-done { border-color: var(--color-success); color: var(--color-success); }

/* --- 10. REPOSITORY INDEX TABLE --- */
.index-table { width: 100%; border-collapse: collapse; }
.index-table th, .index-table td {
    text-align: start;
    padding: var(--space-4) var(--space-2);
    border-block-end: 0.1rem solid var(--border-light);
    vertical-align: baseline;
}
.index-table thead th {
    font-family: var(--font-extended); text-transform: uppercase; letter-spacing: 0.05rem;
    font-weight: 700; font-size: 1.15rem; color: var(--text-muted);
    border-block-end-color: var(--border-strong);
}
.index-table tbody tr:last-child td { border-block-end: none; }
/* First & last column: no horizontal padding (flush to container edges) */
.index-table th:first-child, .index-table td:first-child { padding-inline: 0; }
.index-table th:last-child,  .index-table td:last-child  { padding-inline: 0; }

.index-dist { font-weight: 700; color: var(--text-heading); }
.index-arch { color: var(--text-muted); }
.index-path a { display: inline-flex; align-items: center; gap: 0.6rem; }
.index-path a::after { content: "\2197"; font-size: 0.9em; opacity: 0.6; }

/* --- 11. FOOTER --- */
.site-footer { border-block-start: 0.1rem solid var(--border-light); margin-block-start: var(--space-16); }
.site-footer .container {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
    gap: var(--space-4); padding-block: var(--space-8); font-size: 1.3rem; color: var(--text-muted);
}

/* --- 12. RESPONSIVE --- */
@media (max-width: 640px) {
    .page-head { padding-block: var(--space-12) var(--space-8); }
    .page-title { font-size: 2.8rem; }
    .code pre { padding: var(--space-4); padding-inline-end: var(--space-4); padding-block-start: 4.4rem; }
    .code-copy { top: 0.8rem; inset-inline-start: 0.8rem; inset-inline-end: auto; }
    .index-table th:nth-child(2), .index-table td:nth-child(2) { display: none; }
}

/* --- 13. MOTION PREFERENCES --- */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; scroll-behavior: auto !important; }
}
