/* pagebook - Main Stylesheet */

/* CSS Custom Properties */
:root {
    --color-bg: #fafafa;
    --color-bg-elevated: #ffffff;
    --color-text: #1a1a2e;
    --color-text-muted: #6b7280;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-light: #dbeafe;
    --color-secondary: #64748b;
    --color-secondary-hover: #475569;
    --color-danger: #dc2626;
    --color-danger-hover: #b91c1c;
    --color-danger-light: #fef2f2;
    --color-success: #16a34a;
    --color-success-light: #f0fdf4;
    --color-warning: #d97706;
    --color-warning-light: #fffbeb;
    --color-border: #e5e7eb;
    --color-border-focus: #2563eb;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --radius: 8px;
    --radius-sm: 4px;
    --radius-lg: 12px;
    --transition: 150ms ease;
    /* Critically-damped feel: smooth settle, no overshoot — the default for UI */
    --ease-fluid: cubic-bezier(0.22, 1, 0.36, 1);
    /* Momentum spring: slight overshoot — only for physical/flung interactions */
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
    --max-width: 1200px;
    --header-height: 64px;
    --sidebar-width: 260px;
    /* Translucent chrome: the header floats over content, not a hard bar */
    --chrome-bg: color-mix(in srgb, var(--color-bg-elevated) 72%, transparent);
    --chrome-blur: blur(20px) saturate(180%);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --color-bg: #0f172a;
        --color-bg-elevated: #1e293b;
        --color-text: #f1f5f9;
        --color-text-muted: #94a3b8;
        --color-primary: #3b82f6;
        --color-primary-hover: #60a5fa;
        --color-primary-light: #1e3a5f;
        --color-secondary: #64748b;
        --color-secondary-hover: #94a3b8;
        --color-danger: #ef4444;
        --color-danger-hover: #f87171;
        --color-danger-light: #450a0a;
        --color-success: #22c55e;
        --color-success-light: #052e16;
        --color-warning: #f59e0b;
        --color-warning-light: #451a03;
        --color-border: #334155;
        --color-border-focus: #3b82f6;
    }
}

/* Explicit theme override via the toggle (persisted in localStorage) */
:root[data-theme="dark"] {
    --color-bg: #0f172a;
    --color-bg-elevated: #1e293b;
    --color-text: #f1f5f9;
    --color-text-muted: #94a3b8;
    --color-primary: #3b82f6;
    --color-primary-hover: #60a5fa;
    --color-primary-light: #1e3a5f;
    --color-secondary: #64748b;
    --color-secondary-hover: #94a3b8;
    --color-danger: #ef4444;
    --color-danger-hover: #f87171;
    --color-danger-light: #450a0a;
    --color-success: #22c55e;
    --color-success-light: #052e16;
    --color-warning: #f59e0b;
    --color-warning-light: #451a03;
    --color-border: #334155;
    --color-border-focus: #3b82f6;
}
:root[data-theme="light"] {
    --color-bg: #fafafa;
    --color-bg-elevated: #ffffff;
    --color-text: #1a1a2e;
    --color-text-muted: #6b7280;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-primary-light: #dbeafe;
    --color-secondary: #64748b;
    --color-secondary-hover: #475569;
    --color-danger: #dc2626;
    --color-danger-hover: #b91c1c;
    --color-danger-light: #fef2f2;
    --color-success: #16a34a;
    --color-success-light: #f0fdf4;
    --color-warning: #d97706;
    --color-warning-light: #fffbeb;
    --color-border: #e5e7eb;
    --color-border-focus: #2563eb;
}

html { transition: background-color var(--transition); }
body, .site-header, .artifact-card, .modal, .admin-sidebar { transition: background-color var(--transition), border-color var(--transition), color var(--transition); }

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre { font-family: var(--font-mono); font-size: 0.9em; }
img { max-width: 100%; height: auto; display: block; }

/* Ease dark<->light theme change instead of an abrupt brightness jump */
html.theme-anim *,
html.theme-anim *::before,
html.theme-anim *::after {
    transition: background-color 350ms var(--ease-fluid),
                border-color 350ms var(--ease-fluid),
                color 350ms var(--ease-fluid),
                fill 350ms var(--ease-fluid),
                box-shadow 350ms var(--ease-fluid) !important;
}

/* Container */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    /* Feedback on press, not release — spring-feel settle on the way back */
    transition: transform 120ms var(--ease-spring),
                background-color var(--transition),
                border-color var(--transition),
                color var(--transition),
                box-shadow var(--transition);
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-primary { background: var(--color-primary); color: white; border-color: var(--color-primary); box-shadow: 0 1px 2px rgba(0,0,0,0.15); }
.btn-primary:hover { background: var(--color-primary-hover); border-color: var(--color-primary-hover); color: white; text-decoration: none; box-shadow: 0 2px 6px rgba(37,99,235,0.3); }
.btn-primary:active { box-shadow: 0 0 0 rgba(0,0,0,0); }
.btn-secondary { background: var(--color-bg-elevated); color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { background: var(--color-border); color: var(--color-text); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--color-text); border-color: transparent; }
.btn-ghost:hover { background: var(--color-border); text-decoration: none; }
.btn-danger { background: var(--color-danger); color: white; border-color: var(--color-danger); }
.btn-danger:hover { background: var(--color-danger-hover); border-color: var(--color-danger-hover); color: white; text-decoration: none; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 1rem; max-width: 600px; }
.form-group { display: flex; flex-direction: column; gap: 0.375rem; }
.form-group.checkbox { flex-direction: row; align-items: center; }
.form-group label { font-weight: 500; font-size: 0.875rem; }
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="url"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="search"],
.form-group select,
.form-group textarea {
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    font-family: inherit;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-bg-elevated);
    color: var(--color-text);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-border-focus);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}
.form-group small { font-size: 0.8125rem; color: var(--color-text-muted); }
.form-group.checkbox input { width: 1rem; height: 1rem; accent-color: var(--color-primary); }
.form-actions { display: flex; gap: 0.75rem; margin-top: 0.5rem; }
.form-actions .btn { flex: 1; }
fieldset { border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; }
legend { font-weight: 600; padding: 0 0.5rem; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th, .table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--color-border); }
.table th { font-weight: 600; color: var(--color-text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; background: var(--color-bg); }
.table tbody tr:hover { background: var(--color-bg-elevated); }
.table .empty { text-align: center; color: var(--color-text-muted); padding: 2rem; }

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: capitalize;
}
.status-badge.pending { background: var(--color-warning-light); color: var(--color-warning); }
.status-badge.building { background: var(--color-primary-light); color: var(--color-primary); }
.status-badge.success { background: var(--color-success-light); color: var(--color-success); }
.status-badge.failed { background: var(--color-danger-light); color: var(--color-danger); }
.status-badge.cancelled { background: var(--color-border); color: var(--color-text-muted); }
.status-badge.queued { background: var(--color-primary-light); color: var(--color-primary); }
.status-badge.running { background: var(--color-primary-light); color: var(--color-primary); }
/* Unpublished: muted and dashed, so a draft can never be misread as live at a
   glance next to a green "success" build badge. */
.status-badge.draft {
    background: var(--color-border);
    color: var(--color-text-muted);
    border: 1px dashed currentColor;
}

/* Tags */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    background: var(--color-primary-light);
    color: var(--color-primary);
    white-space: nowrap;
    transition: transform 160ms var(--ease-fluid), background-color var(--transition), color var(--transition), box-shadow var(--transition);
    -webkit-tap-highlight-color: transparent;
}
.tag:hover { text-decoration: none; opacity: 0.85; }
.tag:active { transform: scale(0.95); }

/* Tags browser page */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 { margin: 0 0 0.5rem; font-size: 2rem; letter-spacing: -0.02em; line-height: 1.15; }
.page-subtitle { margin: 0; color: var(--color-text-muted); font-size: 0.9375rem; max-width: 640px; }
.tags-browser { display: flex; flex-direction: column; gap: 2.5rem; }
.tag-filter-panel {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
}
.tag-filter-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.tag-filter-title { font-size: 0.8125rem; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.tag-filter-clear { font-size: 0.8125rem; color: var(--color-primary); }
.tag-filter-clear:hover { text-decoration: none; }
.tag-filter-panel .tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag-filter {
    background: var(--color-bg);
    color: var(--color-text-muted);
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    cursor: pointer;
}
.tag-filter:hover { opacity: 1; background: var(--color-border); color: var(--color-text); }
.tag-filter.active {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 1px 3px rgba(37,99,235,0.35);
}
.tag-filter.active:hover { background: var(--color-primary-hover); color: white; }
.tag-count { font-weight: 700; margin-left: 0.25rem; opacity: 0.75; font-variant-numeric: tabular-nums; }
.tag-results .section-header { margin-bottom: 1rem; }
.result-count { font-size: 0.8125rem; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 2rem; }
.pagination a { padding: 0.5rem 1rem; border: 1px solid var(--color-border); border-radius: var(--radius); }
.pagination a:hover { background: var(--color-border); text-decoration: none; }
.pagination span { color: var(--color-text-muted); }

/* Alerts */
.alert { padding: 1rem 1.25rem; border-radius: var(--radius); margin-bottom: 1rem; }
.alert-success { background: var(--color-success-light); color: var(--color-success); border: 1px solid var(--color-success); }
.alert-error { background: var(--color-danger-light); color: var(--color-danger); border: 1px solid var(--color-danger); }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center; padding: 1rem;
    z-index: 1000; animation: fadeIn 180ms var(--ease-fluid);
    backdrop-filter: blur(2px);
}
.modal {
    background: var(--color-bg-elevated);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    /* Materialize: scale + rise together, anchored to its center — a real
       surface arriving, not a plain opacity fade */
    animation: materialize 300ms var(--ease-fluid);
    transform-origin: center;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; border-bottom: 1px solid var(--color-border); }
.modal-header h3 { margin: 0; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--color-text-muted); padding: 0; line-height: 1; }
.modal-close:hover { color: var(--color-text); }
.modal .form { padding: 1.5rem; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes materialize {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Token Display */
.token-display { display: flex; align-items: center; gap: 0.75rem; margin: 1rem 0; }
.token-display code {
    flex: 1; background: var(--color-bg); border: 1px solid var(--color-border);
    padding: 0.75rem; border-radius: var(--radius); font-size: 0.875rem;
    word-break: break-all;
}

/* News Ticker */
.news-ticker {
    display: flex;
    align-items: center;
    height: 34px;
    background: var(--color-text);
    color: var(--color-bg);
    overflow: hidden;
    font-size: 0.8125rem;
    font-weight: 500;
}
:root[data-theme="dark"] .news-ticker { background: var(--color-primary-hover); color: #0b1220; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .news-ticker { background: var(--color-primary-hover); color: #0b1220; }
}
.news-ticker-label {
    flex-shrink: 0;
    padding: 0 1rem;
    height: 100%;
    display: flex;
    align-items: center;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.6875rem;
    font-weight: 700;
    background: rgba(0,0,0,0.15);
}
.news-ticker-viewport { flex: 1; overflow: hidden; position: relative; height: 100%; }
.news-ticker-track {
    display: flex;
    align-items: center;
    position: absolute;
    white-space: nowrap;
    height: 100%;
    animation: ticker-scroll 28s linear infinite;
    will-change: transform;
}
.news-ticker:hover .news-ticker-track { animation-play-state: paused; }
.news-ticker-item { padding: 0 2.5rem; }
@keyframes ticker-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
    .news-ticker-track { animation: none; }
    .news-ticker-viewport { overflow-x: auto; }
}

/* Navbar */
.navbar { display: flex; align-items: center; justify-content: space-between; height: var(--header-height); }
.navbar nav { display: flex; align-items: center; gap: 1.5rem; }

/* Theme toggle */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9999px;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: transform 160ms var(--ease-spring),
                color var(--transition),
                border-color var(--transition),
                background-color var(--transition);
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}
.theme-toggle:hover { color: var(--color-text); border-color: var(--color-text-muted); }
.theme-toggle:active { transform: scale(0.88); }
.theme-toggle svg { width: 1.125rem; height: 1.125rem; transition: transform 300ms var(--ease-spring), opacity 150ms ease; }
.theme-toggle .icon-moon { display: none; transform: rotate(-90deg); }
.theme-toggle .icon-sun { display: block; transform: rotate(0deg); }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; transform: rotate(0deg); }

/* Public Layout */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: var(--chrome-bg);
    -webkit-backdrop-filter: var(--chrome-blur);
    backdrop-filter: var(--chrome-blur);
    border-bottom: none;
    /* Scroll-edge fade, not a hard divider: the header's edge dissolves
       where content passes underneath */
    box-shadow: 0 1px 0 0 color-mix(in srgb, var(--color-border) 60%, transparent);
}
.logo { font-weight: 700; font-size: 1.25rem; color: var(--color-text); text-decoration: none; display: inline-flex; align-items: baseline; gap: 0.5rem; }
.logo span { font-weight: 400; color: var(--color-text-muted); font-size: 0.75rem; }
.site-header nav a { color: var(--color-text-muted); font-weight: 500; font-size: 0.875rem; position: relative; }
.site-header nav a::after {
    content: ''; position: absolute; left: 0; right: 100%; bottom: -4px; height: 2px;
    background: var(--color-primary); border-radius: 2px;
    transition: right 250ms var(--ease-fluid);
}
.site-header nav a:hover { color: var(--color-text); text-decoration: none; }
.site-header nav a:hover::after { right: 0; }

.site-footer { border-top: 1px solid var(--color-border); padding: 2rem 0; margin-top: 4rem; color: var(--color-text-muted); text-align: center; font-size: 0.875rem; }

/* Hero */
.hero { text-align: center; padding: 5rem 0 3.5rem; position: relative; }
.hero-kicker {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-primary);
    background: var(--color-primary-light);
    padding: 0.375rem 0.875rem;
    border-radius: 9999px;
    margin-bottom: 1.25rem;
}
.hero h1 {
    font-size: clamp(2.5rem, 6vw, 3.5rem);
    line-height: 1.05;              /* tight leading at display size */
    font-weight: 800;
    margin: 0 0 1.25rem;
    letter-spacing: -0.03em;        /* negative tracking as text grows */
    font-optical-sizing: auto;
    background: linear-gradient(135deg, var(--color-text) 20%, var(--color-primary) 80%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero .subtitle { font-size: 1.1875rem; color: var(--color-text-muted); max-width: 560px; margin: 0 auto 2.25rem; line-height: 1.5; }
/* Staggered rise-in: the hero content answers in sequence, critically damped */
.hero-kicker, .hero h1, .hero .subtitle, .hero .search-form {
    animation: rise-in 550ms var(--ease-fluid) both;
}
.hero h1 { animation-delay: 60ms; }
.hero .subtitle { animation-delay: 120ms; }
.hero .search-form { animation-delay: 180ms; }
@keyframes rise-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.search-form { display: flex; gap: 0.5rem; max-width: 480px; margin: 0 auto; }
.search-form input { flex: 1; padding: 0.75rem 1rem; font-size: 1rem; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-bg-elevated); color: var(--color-text); transition: border-color var(--transition), box-shadow var(--transition); }
.search-form input:focus { outline: none; border-color: var(--color-border-focus); box-shadow: 0 0 0 3px var(--color-primary-light); }
.search-form .btn { padding: 0.75rem 1.5rem; font-size: 1rem; }

/* Stats */
.stats { display: flex; justify-content: center; align-items: center; gap: 3rem; margin: 3.5rem 0; padding: 0; }
.stat-divider { width: 1px; height: 2.5rem; background: var(--color-border); }
.stat { text-align: center; }
.stat-value { display: block; font-size: 2.25rem; font-weight: 800; color: var(--color-text); line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 0.75rem; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 0.375rem; display: block; }

/* Sections */
.section { margin-bottom: 3rem; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.section-header h2 { margin: 0; font-size: 1.5rem; }

/* Artifact Grid */
.artifact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.5rem; }
a.artifact-card { display: block; text-decoration: none; color: inherit; }
.artifact-card {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    /* Critically-damped lift on hover; instant press feedback on pointer-down */
    transition: transform 220ms var(--ease-fluid), box-shadow 220ms var(--ease-fluid), border-color 220ms var(--ease-fluid);
    -webkit-tap-highlight-color: transparent;
}
.artifact-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--color-primary) 45%, var(--color-border)); text-decoration: none; }
.artifact-card:active { transform: translateY(-1px) scale(0.99); box-shadow: var(--shadow); }
.artifact-preview { aspect-ratio: 4/3; background: var(--color-bg); position: relative; overflow: hidden; }
.artifact-preview iframe { width: 100%; height: 100%; border: none; background: white; pointer-events: none; }
.artifact-preview .no-preview { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 3rem; background: var(--color-bg); }
.artifact-info { padding: 1.25rem; }
.artifact-info h3 { margin: 0 0 0.5rem; font-size: 1.125rem; color: var(--color-text); }
.artifact-meta { margin: 0 0 0.5rem; font-size: 0.8125rem; color: var(--color-text-muted); }
.artifact-desc { margin: 0 0 0.75rem; font-size: 0.875rem; color: var(--color-text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.artifact-tags { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.empty { text-align: center; color: var(--color-text-muted); padding: 3rem; grid-column: 1/-1; }

/* Artifact Detail */
.artifact-detail { max-width: 900px; margin: 0 auto; }
.artifact-header { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--color-border); }
.artifact-header h1 { margin: 0 0 0.75rem; font-size: 2rem; }
.artifact-header .artifact-meta { display: flex; flex-wrap: wrap; gap: 1.5rem; margin-bottom: 1rem; }
.artifact-header .artifact-tags { margin-bottom: 1rem; }
.source-link { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem; background: var(--color-primary-light); color: var(--color-primary); border-radius: var(--radius); font-weight: 500; }
.source-link:hover { background: var(--color-primary); color: white; text-decoration: none; }
.artifact-description { margin-bottom: 2rem; line-height: 1.8; }
.artifact-description h1, .artifact-description h2, .artifact-description h3 { margin-top: 2rem; }
.artifact-description code { background: var(--color-bg); padding: 0.125rem 0.375rem; border-radius: var(--radius-sm); }
.artifact-description pre { background: var(--color-bg); padding: 1rem; border-radius: var(--radius); overflow-x: auto; }
.artifact-description pre code { background: none; padding: 0; }
.artifact-preview-section { margin-bottom: 2rem; }
.preview-container { border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; background: white; }
.preview-container iframe { width: 100%; height: 500px; border: none; }
.preview-note { margin-top: 0.75rem; font-size: 0.875rem; color: var(--color-text-muted); }
.artifact-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* Build History */
.build-table { width: 100%; }
.build-table th, .build-table td { padding: 0.75rem; text-align: left; border-bottom: 1px solid var(--color-border); }

/* Admin Layout */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: var(--sidebar-width); background: var(--color-bg-elevated); border-right: 1px solid var(--color-border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar-header { padding: 1.5rem; border-bottom: 1px solid var(--color-border); }
.sidebar-nav { flex: 1; padding: 1rem; display: flex; flex-direction: column; gap: 0.25rem; }
.sidebar-nav a { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-radius: var(--radius); color: var(--color-text-muted); font-weight: 500; font-size: 0.875rem; transition: all var(--transition); }
.sidebar-nav a:hover { background: var(--color-border); color: var(--color-text); text-decoration: none; }
.sidebar-nav a.active { background: var(--color-primary-light); color: var(--color-primary); }
.sidebar-footer { padding: 1rem; border-top: 1px solid var(--color-border); }
.user-info { display: block; font-size: 0.8125rem; color: var(--color-text-muted); margin-bottom: 0.75rem; }
.admin-main { flex: 1; min-width: 0; }
.admin-header { position: sticky; top: 0; background: var(--color-bg-elevated); border-bottom: 1px solid var(--color-border); z-index: 50; }
.admin-header .container { padding: 1rem 1.5rem; }
.admin-header h1 { margin: 0; font-size: 1.5rem; }
.admin-content { padding: 1.5rem; }

/* Dashboard Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--color-bg-elevated); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1.5rem; }
.stat-card h3 { margin: 0 0 0.5rem; font-size: 0.875rem; font-weight: 500; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-card .stat-value { font-size: 2.5rem; font-weight: 700; color: var(--color-primary); }

/* Build Log */
.build-detail { background: var(--color-bg-elevated); border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.build-header { display: flex; align-items: center; gap: 1rem; padding: 1.5rem; border-bottom: 1px solid var(--color-border); }
.build-header h3 { margin: 0; font-size: 1.125rem; font-family: var(--font-mono); }
.build-meta { padding: 1.5rem; border-bottom: 1px solid var(--color-border); }
.build-meta dl { display: grid; grid-template-columns: 120px 1fr; gap: 0.5rem 1.5rem; margin: 0; }
.build-meta dt { font-weight: 500; color: var(--color-text-muted); font-size: 0.875rem; }
.build-meta dd { margin: 0; }
.build-meta dd.error { color: var(--color-danger); }
.build-log { padding: 1.5rem; }
.log-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.log-header h4 { margin: 0; font-size: 0.875rem; font-weight: 600; }
#log-content { background: #0d1117; color: #e6edf3; padding: 1rem; border-radius: var(--radius); font-size: 0.8125rem; line-height: 1.6; overflow-x: auto; max-height: 60vh; overflow-y: auto; white-space: pre-wrap; font-family: var(--font-mono); }

/* Tags Cloud */
.tags-cloud { margin-top: 3rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tags a { transition: transform var(--transition); }
.tags a:hover { transform: scale(1.05); text-decoration: none; }

/* Filters */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-bottom: 1.5rem; font-size: 0.875rem; color: var(--color-text-muted); }
.filters .tag { margin-right: 0.25rem; }

/* Quick Actions */
.quick-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* Error Pages */
.error-page { text-align: center; padding: 4rem 0; }
.error-page h1 { font-size: 6rem; font-weight: 700; margin: 0 0 1rem; color: var(--color-primary); }
.error-page p { font-size: 1.25rem; color: var(--color-text-muted); }

/* Utilities */
.shortID { font-family: var(--font-mono); font-size: 0.8125rem; }
.duration { font-family: var(--font-mono); font-size: 0.8125rem; }
.token-value { font-family: var(--font-mono); }

@media (prefers-reduced-motion: reduce) {
    /* Replace slides/springs with short opacity cross-fades; no overshoot */
    .news-ticker-track { animation: none; }
    .news-ticker-viewport { overflow-x: auto; }
    .hero-kicker, .hero h1, .hero .subtitle, .hero .search-form { animation: none; }
    .modal-overlay { animation: fadeIn 120ms ease; }
    .modal { animation: fadeIn 160ms ease; }
    .artifact-card, .btn, .theme-toggle, .site-header nav a::after { transition: opacity 120ms ease, color 120ms ease, background-color 120ms ease, border-color 120ms ease; }
    .artifact-card:hover, .artifact-card:active { transform: none; }
    .btn:active, .theme-toggle:active { transform: none; }
}

@media (prefers-reduced-transparency: reduce) {
    /* Frost the glass: near-solid chrome with no blur */
    .site-header {
        background: var(--color-bg-elevated);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
    .modal-overlay { backdrop-filter: none; }
}

/* Responsive */
@media (max-width: 768px) {
    .hero { padding: 3rem 0 2.5rem; }
    .hero h1 { font-size: 2rem; }
    .stats { gap: 1.75rem; }
    .artifact-grid { grid-template-columns: 1fr; }
    .admin-sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 200; transform: translateX(-100%); transition: transform var(--transition); }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { width: 100%; }
    .build-meta dl { grid-template-columns: 1fr; gap: 0.25rem 0; }
    .build-meta dt { margin-bottom: 0.25rem; }
    .search-form { flex-direction: column; }
    .search-form .btn { width: 100%; }
    .logo span { display: none; }
    .news-ticker-label { display: none; }
}