/* SIROS Circuit Catalog — adapted from registry.siros.org's design tokens
   and header/hero/footer pattern (same brand: same colors, fonts, header
   scroll behavior, footer layout) so this site reads as a sibling of
   registry.siros.org / apt.siros.org, not a one-off. */

:root {
    --color-primary: #295FA6;
    --color-primary-dark: #1C4587;
    --color-secondary: #6c757d;
    --color-success: #28a745;
    --color-warning: #c77700;
    --color-danger: #b02a37;
    --color-background: #f8f9fa;
    --color-surface: #ffffff;
    --color-card-background: #f1f3f5;
    --color-text: #212529;
    --color-text-muted: #6c757d;
    --color-border: #dee2e6;
    --font-family: 'Helvetica Neue', Arial, system-ui, sans-serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Courier New', monospace;
    --border-radius: 8px;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

body {
    margin: 0;
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-background);
}

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

a:hover {
    text-decoration: underline;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Header — transparent to frosted white on scroll (matches main site) */
.site-header {
    background: transparent;
    border-bottom: 1px solid transparent;
    padding: 1rem 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    transition: background-color 0.3s, box-shadow 0.3s, border-color 0.3s;
}

.site-header--scrolled {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    border-bottom-color: hsl(210, 15%, 88%);
}

.site-header .container {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.logo-image {
    height: 40px;
    width: auto;
}

.logo-subtitle {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-primary);
}

.main-nav {
    flex: 1;
    display: flex;
    gap: 1.5rem;
}

.main-nav .nav-spacer {
    flex: 1;
}

.main-nav a {
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 0.875rem;
}

.main-nav a:hover {
    color: var(--color-primary);
    text-decoration: none;
}

.nav-github-link {
    display: flex;
    align-items: center;
    color: var(--color-text-muted);
    transition: color 0.2s;
}
.nav-github-link:hover {
    color: var(--color-primary);
    text-decoration: none;
}
.nav-github-link svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

main {
    min-height: calc(100vh - 200px);
    padding-top: 80px;
}

main:has(.hero) {
    padding-top: 0;
}

/* Hero */
.hero {
    position: relative;
    min-height: 50vh;
    display: flex;
    align-items: center;
    padding: 6rem 0 3rem;
    margin-bottom: 2rem;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.30;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.60),
        rgba(255, 255, 255, 0.80),
        rgba(255, 255, 255, 1)
    );
}

.hero-content {
    position: relative;
    z-index: 10;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem 2.5rem;
    width: 100%;
}

.hero h1 {
    font-size: 3.2rem;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0 0 1.5rem;
}

.hero-title-accent {
    background: linear-gradient(135deg, hsl(215, 60%, 35%), hsl(215, 70%, 55%));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-title-dark {
    color: hsl(220, 30%, 10%);
}

.hero-subtitle {
    font-size: 1.2rem;
    line-height: 1.6;
    color: hsla(220, 30%, 10%, 0.9);
    max-width: 640px;
    margin: 0 0 2rem;
    font-weight: 300;
}

.hero-disclaimer {
    display: block;
    margin-top: 0.75rem;
    color: var(--color-warning);
    font-weight: 600;
}

.hero-stats-row {
    display: flex;
    align-items: center;
    gap: 3rem;
    flex-wrap: wrap;
}

.stats {
    display: flex;
    justify-content: flex-start;
    gap: 3rem;
}

.hero-actions {
    margin-top: 0;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 2.75rem;
    font-weight: 700;
    color: var(--color-primary);
}

.stat-label {
    font-size: 0.95rem;
    color: var(--color-text-muted);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
}
.btn-primary:hover {
    background-color: var(--color-primary-dark);
    text-decoration: none;
}

.btn-secondary {
    background-color: var(--color-background);
    color: var(--color-text);
    border-color: var(--color-border);
}
.btn-secondary:hover {
    background-color: var(--color-border);
    text-decoration: none;
}

/* Circuit cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
    align-items: start;
}

.circuit-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.circuit-card h3 {
    margin: 0 0 0.25rem;
    font-size: 1.05rem;
    word-break: break-word;
}

.org-logo {
    border-radius: 4px;
    vertical-align: middle;
    margin-right: 0.4rem;
}

.circuit-card .circuit-meta {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    margin: 0 0 1rem;
}

.badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    margin-left: 0.4rem;
    vertical-align: middle;
}
.badge-active { background: hsla(210, 15%, 88%, 0.6); color: var(--color-text-muted); }
.badge-deprecated { background: #fff3cd; color: #7a5b00; }
.badge-revoked { background: #f8d7da; color: #7a1c25; }
.badge-yes { background: #e6f4ea; color: #1e6b3a; }
.badge-no { background: #f8d7da; color: #7a1c25; }
.badge-unknown { background: hsla(210, 15%, 88%, 0.6); color: var(--color-text-muted); }

.details-link {
    display: block;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
    color: var(--color-primary);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
}
.details-link:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

/* Provenance block — always shown on circuit.html, the standalone detail
   page (this file's card no longer needs a border/heading of its own
   above it, since it's the whole page's content, not a section within a
   quick-view card). */
.circuit-detail {
    max-width: 640px;
}
.circuit-detail .provenance {
    margin-top: 0.75rem;
}

.provenance dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.35rem 0.75rem;
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
}

.provenance dt {
    color: var(--color-text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.provenance dd {
    margin: 0;
    word-break: break-word;
}

.provenance dd.unknown {
    color: var(--color-text-muted);
    font-style: italic;
}

.empty-state {
    background: var(--color-card-background);
    border: 1px dashed var(--color-border);
    border-radius: var(--border-radius);
    padding: 2rem;
    text-align: center;
    color: var(--color-text-muted);
}

.error-state {
    background: #f8d7da;
    color: #7a1c25;
    border-radius: var(--border-radius);
    padding: 1.5rem;
}

.fetch-meta {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 0.5rem;
}

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background-color: var(--color-background);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    /* overflow-wrap (not word-break: break-all) — breaks only when a word
       truly doesn't fit, preferring natural boundaries like "/" and "."
       first. break-all was breaking short inline URLs/identifiers
       mid-character ("htt"/"ps://...") for no reason; pre code below still
       gets its own break-word for genuinely unbreakable long hashes. */
    overflow-wrap: break-word;
}

pre {
    background-color: #1e2530;
    color: #e3e8ef;
    padding: 1rem;
    border-radius: var(--border-radius);
    overflow-x: auto;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--font-mono);
    font-size: 0.875em;
    line-height: 1.6;
}

pre code {
    padding: 0;
    background: none;
    word-break: inherit;
}

pre .cmt {
    color: #8b96a5;
}

.code-block {
    position: relative;
    margin: 0 0 1.5rem;
}

.copy-btn {
    position: absolute;
    top: 0.6rem;
    right: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    color: #c3cad4;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.copy-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}
.copy-btn.copied {
    color: #6fd67f;
    border-color: rgba(111, 214, 127, 0.4);
}
.copy-btn svg {
    width: 1rem;
    height: 1rem;
    fill: currentColor;
}

.endpoint {
    margin: 2.5rem 0;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

.endpoint:first-of-type {
    border-top: none;
    padding-top: 0;
}

.endpoint h3 {
    font-family: var(--font-mono);
    font-size: 1.1rem;
}

.docs-toc {
    background: var(--color-card-background);
    border-radius: var(--border-radius);
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0 2.5rem;
}
.docs-toc h4 {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
}
.docs-toc ul {
    margin: 0;
    padding-left: 1.25rem;
    columns: 2;
}

/* About section */
.about {
    margin: 3rem 0;
}
.about ul {
    padding-left: 1.25rem;
}

.disclaimer {
    border-left: 3px solid var(--color-warning);
    background: var(--color-card-background);
    border-radius: var(--border-radius);
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
}
.disclaimer p {
    margin: 0;
}

section h2 {
    margin-top: 0;
}

/* Footer — matches registry.siros.org */
.site-footer {
    border-top: 1px solid var(--color-border);
    padding: 2.5rem 0;
    margin-top: 3rem;
    font-size: 0.875rem;
}
.site-footer .container {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2rem;
}
.footer-address {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    color: var(--color-text-muted);
}
.footer-address a {
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color 0.2s;
}
.footer-address a:hover {
    color: var(--color-primary);
    text-decoration: none;
}
.footer-address address {
    font-style: normal;
}
.footer-org {
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}
.footer-org a {
    color: inherit;
    text-decoration: none;
}
.footer-org a:hover {
    color: var(--color-primary);
}
.footer-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
    padding-top: 0.5rem;
}
.footer-nav a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}
.footer-nav a:hover {
    color: var(--color-primary);
    text-decoration: none;
}
.footer-github-link {
    display: flex;
    align-items: center;
}
.footer-github-link svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}
.site-footer .build-info {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 1rem;
}
.site-footer .build-info a {
    color: inherit;
}

@media (max-width: 640px) {
    .site-footer .container {
        flex-direction: column;
        gap: 1.5rem;
    }
    .footer-nav {
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .site-header .container {
        flex-direction: column;
        gap: 1rem;
    }
    .main-nav {
        gap: 1rem;
    }
    .hero h1 {
        font-size: 2.25rem;
    }
    .hero {
        padding: 5rem 0 2rem;
        min-height: 40vh;
    }
    .stats {
        flex-direction: column;
        gap: 1.5rem;
    }
    .card-grid {
        grid-template-columns: 1fr;
    }
    .provenance dl {
        grid-template-columns: 1fr;
    }
}

/* api.html-specific bits, kept out of index.html's inline style="" attributes
   so a strict style-src 'self' CSP applies without exceptions. */
.api-main {
    padding-top: 6rem;
}

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

.text-muted-inline {
    font-weight: 400;
    color: var(--color-text-muted);
    font-size: 0.8em;
}
