/* monopole.design — design system documentation
   Aesthetic: swiss grid + neomorphism */

:root {
    --surface: #e8e8e8;
    --surface-raised: #ffffff;
    --shadow-light: #d1d1d1;
    --shadow-dark: #b8b8b8;
    --text: #1a1a2e;
    --text-muted: #8b8b8b;
    --brand-indigo: #6366f1;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-pill: 999px;

    --shadow-neo: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--surface-raised);
    --shadow-neo-sm: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--surface-raised);
    --shadow-neo-lg: 10px 10px 20px var(--shadow-dark), -10px -10px 20px var(--surface-raised);
    --shadow-neo-inset: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--surface-raised);
    --shadow-neo-inset-sm: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--surface-raised);

    --t-fast: 160ms cubic-bezier(.2,.7,.2,1);
    --t-base: 240ms cubic-bezier(.2,.7,.2,1);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--surface);
    color: var(--text);
    font-family: 'Manrope', 'Inter', system-ui, -apple-system, sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

code, pre, .code, .inline-code {
    font-family: 'Source Code Pro', ui-monospace, 'SF Mono', Menlo, monospace;
}

button {
    font-family: inherit;
    color: inherit;
    border: 0;
    background: none;
    cursor: pointer;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ---------- Layout ---------- */
.layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 220px;
    height: 100vh;
    overflow-y: auto;
    background: var(--surface);
    border-right: 1px solid var(--shadow-light);
    padding: 1.75rem 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    z-index: 5;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--shadow-light);
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-neo-sm);
    display: grid;
    place-items: center;
}

.brand-text {
    line-height: 1.1;
}

.brand-title {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.01em;
    color: var(--text);
}

.brand-sub {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.nav-label {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin: 1rem 0.6rem 0.5rem;
}

.nav-label:first-child {
    margin-top: 0.25rem;
}

.nav-link {
    position: relative;
    display: block;
    padding: 0.55rem 0.85rem;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text);
    border-left: 3px solid transparent;
    border-radius: 0 6px 6px 0;
    transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}

.nav-link:hover {
    background: rgba(99, 102, 241, 0.04);
}

.nav-link.active {
    border-left-color: var(--brand-indigo);
    background: rgba(99, 102, 241, 0.06);
    color: var(--text);
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--shadow-light);
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.version-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.7rem;
    background: var(--surface);
    box-shadow: var(--shadow-neo-inset-sm);
    border-radius: var(--radius-pill);
    font-family: 'Source Code Pro', monospace;
    font-size: 0.72rem;
    color: var(--text-muted);
    width: fit-content;
}

.version-pill .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--brand-indigo);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
}

.meta {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
    padding-left: 0.4rem;
}

/* ---------- Main ---------- */
.main {
    grid-column: 2;
    padding: 3rem 3.5rem 4rem;
    max-width: 100%;
}

.page-header {
    margin-bottom: 3rem;
}

.crumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
}

.crumb-sep {
    opacity: 0.5;
}

.page-title {
    margin: 0 0 0.85rem;
    font-weight: 600;
    font-size: clamp(1.8rem, 3.4vw, 2.6rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--text);
}

.page-lead {
    margin: 0;
    max-width: 640px;
    font-size: 1.02rem;
    line-height: 1.7;
    color: var(--text-muted);
}

/* ---------- Sections ---------- */
.section {
    padding: 1rem 0 1.5rem;
}

.section-head {
    display: grid;
    grid-template-columns: 64px 1fr;
    grid-template-rows: auto auto;
    column-gap: 1.25rem;
    row-gap: 0.4rem;
    margin-bottom: 2rem;
    align-items: start;
}

.section-num {
    grid-row: 1 / span 2;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding-top: 0.5rem;
    letter-spacing: 0.08em;
}

.section-title {
    margin: 0;
    font-weight: 600;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    letter-spacing: -0.015em;
}

.section-desc {
    margin: 0;
    max-width: 580px;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-muted);
}

.divider {
    height: 1px;
    background: var(--shadow-light);
    margin: 2rem 0;
}

.inline-code {
    font-size: 0.85em;
    padding: 0.1rem 0.4rem;
    background: var(--surface);
    box-shadow: var(--shadow-neo-inset-sm);
    border-radius: 5px;
    color: var(--text);
}

/* ---------- Colors ---------- */
.swatch-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem 1rem;
}

.swatch-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    padding: 1.25rem 0.5rem 1rem;
    border-radius: var(--radius-md);
    transition: background var(--t-base);
}

.swatch-cell:hover {
    background: rgba(255, 255, 255, 0.4);
}

.swatch {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    box-shadow: var(--shadow-neo);
    transition: transform var(--t-base), box-shadow var(--t-base);
}

.swatch-cell:hover .swatch {
    transform: translateY(-2px);
    box-shadow: var(--shadow-neo-lg);
}

.swatch-gradient {
    background: linear-gradient(135deg, #e8e8e8 0%, #ffffff 100%);
}

.swatch-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
}

.swatch-hex {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ---------- Typography ---------- */
.type-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.type-card {
    background: var(--surface);
    box-shadow: var(--shadow-neo);
    border-radius: var(--radius-md);
    padding: 1.5rem 1.5rem 1.7rem;
}

.type-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.type-tag {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--brand-indigo);
    padding: 0.25rem 0.5rem;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 4px;
}

.type-spec {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.type-display {
    font-weight: 600;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.type-heading {
    font-weight: 600;
    font-size: 1.5rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.type-body {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text);
}

.type-code {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text);
}

.scale-row {
    display: flex;
    align-items: baseline;
    gap: 1.5rem;
    padding: 1.5rem 1.75rem;
    background: var(--surface);
    box-shadow: var(--shadow-neo-inset);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}

.scale-item {
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1;
}

/* ---------- Spacing ---------- */
.spacing-grid {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    background: var(--surface);
    box-shadow: var(--shadow-neo);
    border-radius: var(--radius-md);
    padding: 1.5rem 1.75rem;
}

.spacing-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.spacing-bar {
    height: 14px;
    background: var(--brand-indigo);
    border-radius: 3px;
    box-shadow: 0 1px 3px rgba(99, 102, 241, 0.3);
    flex-shrink: 0;
}

.spacing-label {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.spacing-label strong {
    color: var(--text);
    font-weight: 600;
    margin-right: 0.4rem;
}

/* ---------- Components ---------- */
.component-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

.demo-card {
    background: var(--surface);
    box-shadow: var(--shadow-neo);
    border-radius: var(--radius-md);
    padding: 1.5rem 1.5rem 1.7rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-height: 200px;
}

.demo-label {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-muted);
}

.demo-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.85rem;
}

.demo-row-stack {
    flex-direction: column;
    align-items: stretch;
}

/* Buttons */
.neo-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.15rem;
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-neo-sm);
    transition: box-shadow var(--t-fast), transform var(--t-fast);
}

.neo-btn:hover {
    box-shadow: var(--shadow-neo);
}

.neo-btn:active,
.neo-btn.is-pressed {
    box-shadow: var(--shadow-neo-inset-sm);
    transform: translateY(1px);
}

.neo-btn-accent {
    color: var(--brand-indigo);
}

.neo-btn-accent.is-pressed,
.neo-btn-accent:active {
    color: var(--brand-indigo);
}

/* Toggles */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.92rem;
    color: var(--text);
    cursor: pointer;
}

.neo-toggle {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--surface);
    box-shadow: var(--shadow-neo-inset-sm);
    border-radius: var(--radius-pill);
    transition: background var(--t-fast);
    flex-shrink: 0;
}

.neo-toggle-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: var(--surface-raised);
    border-radius: 50%;
    box-shadow: 2px 2px 5px var(--shadow-dark), -1px -1px 3px rgba(255,255,255,0.6);
    transition: left var(--t-base), background var(--t-base);
}

.neo-toggle[data-toggle="on"] {
    background: rgba(99, 102, 241, 0.15);
}

.neo-toggle[data-toggle="on"] .neo-toggle-knob {
    left: 25px;
    background: var(--brand-indigo);
    box-shadow: 2px 2px 5px rgba(99, 102, 241, 0.4), -1px -1px 3px rgba(255,255,255,0.4);
}

/* Inputs */
.neo-input {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--surface);
    box-shadow: var(--shadow-neo-inset-sm);
    border-radius: var(--radius-md);
    padding: 0.65rem 1rem;
    transition: box-shadow var(--t-fast);
}

.neo-input:focus-within {
    box-shadow: var(--shadow-neo-inset);
}

.neo-input-prefix {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.neo-input input {
    flex: 1;
    background: transparent;
    border: 0;
    outline: none;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text);
    min-width: 0;
}

.neo-input input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

/* Slider */
.slider-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--text);
}

.slider-value {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.82rem;
    color: var(--brand-indigo);
    background: rgba(99, 102, 241, 0.08);
    padding: 0.2rem 0.5rem;
    border-radius: 5px;
}

.neo-slider {
    position: relative;
    height: 26px;
    cursor: pointer;
    user-select: none;
}

.neo-slider-track {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 8px;
    transform: translateY(-50%);
    background: var(--surface);
    box-shadow: var(--shadow-neo-inset-sm);
    border-radius: var(--radius-pill);
}

.neo-slider-fill {
    position: absolute;
    top: 50%;
    left: 0;
    height: 8px;
    transform: translateY(-50%);
    background: var(--brand-indigo);
    border-radius: var(--radius-pill);
    width: 50%;
    transition: width var(--t-fast);
    pointer-events: none;
}

.neo-slider-thumb {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    transform: translate(-50%, -50%);
    background: var(--surface-raised);
    border-radius: 50%;
    box-shadow: 3px 3px 6px var(--shadow-dark), -2px -2px 4px rgba(255,255,255,0.7);
    transition: left var(--t-fast);
    pointer-events: none;
}

/* Card raised */
.info-card {
    background: var(--surface);
    box-shadow: var(--shadow-neo-sm);
    border-radius: var(--radius-md);
    padding: 1.1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.info-card-head {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.info-card-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow-neo-inset-sm);
    color: var(--brand-indigo);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.info-card-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
}

.info-card-sub {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.74rem;
    color: var(--text-muted);
}

.info-card-body {
    font-size: 0.88rem;
    line-height: 1.65;
    color: var(--text-muted);
}

/* Segmented */
.neo-segment {
    display: inline-flex;
    background: var(--surface);
    box-shadow: var(--shadow-neo-inset-sm);
    border-radius: var(--radius-md);
    padding: 4px;
    gap: 4px;
}

.seg-item {
    padding: 0.45rem 0.95rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: 8px;
    transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}

.seg-item.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: 3px 3px 6px var(--shadow-dark), -2px -2px 4px var(--surface-raised);
    font-weight: 600;
}

.seg-preview {
    padding: 1.25rem 1rem;
    display: flex;
    justify-content: center;
}

.seg-preview-box {
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-radius: var(--radius-md);
    font-family: 'Source Code Pro', monospace;
    font-size: 0.9rem;
    color: var(--text);
    min-width: 140px;
    text-align: center;
    transition: box-shadow var(--t-base);
}

.seg-preview-box.raised {
    box-shadow: var(--shadow-neo);
}

.seg-preview-box.flat {
    box-shadow: 0 0 0 1px var(--shadow-light);
}

.seg-preview-box.inset {
    box-shadow: var(--shadow-neo-inset);
}

/* ---------- Tokens / Code Block ---------- */
.code-block {
    position: relative;
    background: var(--surface);
    box-shadow: var(--shadow-neo);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.code-header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--shadow-light);
}

.code-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 0.5px rgba(0,0,0,0.08);
}

.code-file {
    margin-left: 0.6rem;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.code-pre {
    margin: 0;
    padding: 1.25rem 1.5rem;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.85rem;
    line-height: 1.8;
    color: var(--text);
    overflow-x: auto;
}

.line {
    display: block;
    padding: 0.05rem 0.5rem;
    margin: 0 -0.5rem;
    border-radius: 5px;
    transition: background var(--t-fast);
}

.line[data-copy] {
    cursor: pointer;
}

.line[data-copy]:hover {
    background: rgba(99, 102, 241, 0.06);
}

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

.c-prop {
    color: var(--brand-indigo);
}

.c-val {
    color: var(--text);
    font-weight: 500;
}

.copy-toast {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.4rem 0.8rem;
    background: var(--text);
    color: var(--surface);
    border-radius: 6px;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.75rem;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity var(--t-base), transform var(--t-base);
}

.copy-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- Icons ---------- */
.icon-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
}

.icon-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    padding: 1.25rem 0.75rem 1rem;
    background: var(--surface);
    border-radius: var(--radius-md);
    transition: background var(--t-base);
}

.icon-cell:hover {
    background: rgba(255,255,255,0.45);
}

.icon-tile {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-neo-sm);
    display: grid;
    place-items: center;
    transition: box-shadow var(--t-fast), transform var(--t-fast);
}

.icon-cell:hover .icon-tile {
    box-shadow: var(--shadow-neo);
    transform: translateY(-2px);
}

.icon-cell:active .icon-tile {
    box-shadow: var(--shadow-neo-inset-sm);
    transform: translateY(0);
}

.icon-name {
    font-family: 'Source Code Pro', monospace;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ---------- Footer ---------- */
.page-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--shadow-light);
}

.foot-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.foot-mark {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: 'Source Code Pro', monospace;
    font-size: 0.82rem;
    color: var(--text);
}

.foot-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--brand-indigo);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
}

.foot-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .swatch-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .icon-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 880px) {
    .layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--shadow-light);
        padding: 1.25rem 1.5rem;
    }
    .main {
        grid-column: 1;
        padding: 2rem 1.5rem 3rem;
    }
    .type-grid,
    .component-grid {
        grid-template-columns: 1fr;
    }
    .swatch-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .icon-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .section-head {
        grid-template-columns: 1fr;
    }
    .section-num {
        grid-row: auto;
        padding-top: 0;
    }
}
