/* certstream-server-rust site styles */

:root {
    --paper:      #ffffff;
    --surface:    #f7f7f6;
    --ink:        #1b1b1a;
    --ink-2:      #4b4b48;
    --ink-3:      #6a6a66;   /* 4.5:1 on paper */
    --line:       #e4e4e0;
    --line-2:     #cfcfc9;
    --rust:       #b7410e;
    --rust-2:     #8f330b;

    --code-bg:    #1b1b19;
    --code-panel: #262624;
    --code-ink:   #e7e3d6;
    --code-dim:   #8d8979;

    --syn-kw:  #d68b56;
    --syn-fn:  #7aa7cf;
    --syn-str: #9bb074;
    --syn-cm:  #6f6a5a;
    --syn-var: #d2ab64;
    --inline-code-bg: #efefec;
    --code-border: #383835;

    --maxw: 1080px;
    --radius: 6px;
}

/* ---------- dark theme: media query for the OS setting, attribute for an explicit choice ---------- */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --paper:      #141413;
        --surface:    #1c1c1a;
        --ink:        #e9e9e5;
        --ink-2:      #b3b3ac;
        --ink-3:      #8e8e87;
        --line:       #2c2c29;
        --line-2:     #3d3d39;
        --rust:       #e08a5a;
        --rust-2:     #eba57d;
        --code-bg:    #0d0d0c;
        --code-panel: #1a1a18;
        --inline-code-bg: #242422;
        --code-border: #2c2c29;
    }
}

:root[data-theme="dark"] {
    --paper:      #141413;
    --surface:    #1c1c1a;
    --ink:        #e9e9e5;
    --ink-2:      #b3b3ac;
    --ink-3:      #8e8e87;
    --line:       #2c2c29;
    --line-2:     #3d3d39;
    --rust:       #e08a5a;
    --rust-2:     #eba57d;
    --code-bg:    #0d0d0c;
    --code-panel: #1a1a18;
    --inline-code-bg: #242422;
    --code-border: #2c2c29;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'IBM Plex Sans', system-ui, sans-serif;
    background: var(--paper);
    color: var(--ink);
    line-height: 1.65;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

code, pre, .mono { font-family: 'IBM Plex Mono', monospace; }

a { color: var(--rust); text-decoration: none; }
a:hover { color: var(--rust-2); text-decoration: underline; text-underline-offset: 3px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 32px; }

/* ---------- header ---------- */
header {
    border-bottom: 1px solid var(--line);
    padding: 18px 0;
    position: sticky;
    top: 0;
    background: var(--paper);
    z-index: 100;
}
header .wrap { display: flex; align-items: center; gap: 36px; }
header nav { margin-right: auto; }
.logo {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 0.95rem;
    letter-spacing: -0.01em;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 10px;
}
.logo img { height: 44px; width: auto; display: block; flex-shrink: 0; }
.logo-dark { display: none !important; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block !important; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .logo-light { display: none; }
    :root:not([data-theme="light"]) .logo-dark { display: block !important; }
}
.logo:hover { text-decoration: none; color: var(--ink); }

nav .nav-links { display: flex; gap: 30px; list-style: none; }
.nav-links a {
    color: var(--ink-2);
    font-size: 0.9rem;
    position: relative;
    padding: 2px 0;
}
.nav-links a:hover { color: var(--ink); text-decoration: none; }
.nav-links a.active { color: var(--ink); }
.nav-links a.active::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -3px;
    height: 2px;
    background: var(--rust);
}

.gh-link {
    margin-left: -12px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--ink-2);
    font-size: 0.85rem;
    border: 1px solid var(--line-2);
    padding: 7px 14px;
    border-radius: 7px;
}
.gh-link:hover { border-color: var(--ink-3); color: var(--ink); text-decoration: none; }

/* ---------- hero ---------- */
.hero {
    padding: 56px 0 48px;
    border-bottom: 1px solid var(--line);
}
.hero h1 {
    font-family: 'IBM Plex Sans', system-ui, sans-serif;
    font-weight: 600;
    font-size: clamp(2rem, 5vw, 3rem);
    line-height: 1.12;
    letter-spacing: -0.01em;
    max-width: 24ch;
    margin: 0 auto 22px;
}
.hero-desc {
    font-size: 1.15rem;
    color: var(--ink-2);
    max-width: 58ch;
    margin: 0 auto 34px;
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; justify-items: center; text-align: center; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.hero-stats { display: flex; justify-content: center; gap: 24px; margin-top: 28px; font-size: 0.9rem; color: var(--ink-3); }
.hero-stats[hidden] { display: none; }
.hero-stats strong { color: var(--ink); font-weight: 600; }
.hero-stats a { color: var(--ink-3); }
.hero-stats a:hover { color: var(--ink); text-decoration: none; }
.hero-demo { display: flex; flex-direction: column; gap: 14px; min-width: 0; width: 100%; max-width: 640px; text-align: left; }
.hero-demo .code-example pre { font-size: 0.8rem; }
.copy-btn {
    margin-left: auto;
    background: none;
    border: 1px solid var(--code-border);
    color: var(--code-dim);
    padding: 2px 10px;
    border-radius: 5px;
    cursor: pointer;
    font: 0.72rem 'IBM Plex Mono', monospace;
}
.copy-btn:hover { color: var(--code-ink); }

/* ---------- buttons ---------- */
.btn {
    padding: 12px 22px;
    border-radius: 7px;
    font-weight: 500;
    font-size: 0.92rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--rust); color: #fff; }
.btn-secondary { background: transparent; color: var(--ink); border: 1px solid var(--line-2); }
.btn-secondary:hover { border-color: var(--ink); }

/* ---------- sections ---------- */
section { padding: 60px 0; border-bottom: 1px solid var(--line); }
section:last-of-type { border-bottom: none; }
.section-header { margin-bottom: 44px; max-width: 60ch; }
.section-header h2 {
    font-family: 'IBM Plex Sans', system-ui, sans-serif;
    font-weight: 600;
    font-size: 1.7rem;
    line-height: 1.2;
    margin-bottom: 12px;
}
.section-header p { color: var(--ink-2); font-size: 1.02rem; }

section h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 12px;
    margin-top: 36px;
}
section h3:first-of-type { margin-top: 0; }
section > .wrap > p { color: var(--ink-2); font-size: 0.98rem; max-width: 72ch; }
section > .wrap > p + p { margin-top: 1rem; }
section > .wrap > pre {
    background: var(--code-bg);
    border: 1px solid var(--code-panel);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin: 20px 0 24px;
    overflow-x: auto;
    font-size: 0.84rem;
    line-height: 1.65;
    color: var(--code-ink);
    scrollbar-width: thin;
}
section > .wrap > table { margin-top: 8px; }
section > .wrap > table + p,
section > .wrap > .code-examples + p,
section > .wrap > .code-example + p { margin-top: 20px; }
section > .wrap > p code,
.section-header p code {
    background: var(--inline-code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--rust-2);
    font-size: 0.85em;
}
section > .wrap > p strong { color: var(--ink); font-weight: 600; }

/* Home page sections: heading in a side column, content beside it. */
.split > .wrap { display: grid; grid-template-columns: 220px minmax(0, 1fr); column-gap: 64px; }
.split .section-header { grid-column: 1; grid-row: 1 / span 4; margin-bottom: 0; }
.split > .wrap > :not(.section-header) { grid-column: 2; min-width: 0; }
.split .features-list { grid-template-columns: repeat(2, 1fr); }
.split .features-list .feature-item:nth-child(-n+2) { border-top: 0; padding-top: 0; }
.split .code-examples { grid-template-columns: 1fr; }
.split .stat-grid { grid-template-columns: repeat(2, 1fr); border-top: 0; padding-top: 0; gap: 28px 24px; }
.split > .wrap > p { max-width: none !important; }

/* ---------- page header (inner pages) ---------- */
.page-header { padding: 60px 0 40px; border-bottom: 1px solid var(--line); }
.page-header h1 {
    font-family: 'IBM Plex Sans', system-ui, sans-serif;
    font-weight: 600;
    font-size: clamp(1.9rem, 4.5vw, 2.6rem);
    line-height: 1.15;
    letter-spacing: -0.01em;
    margin-bottom: 14px;
}
.page-header p { color: var(--ink-2); font-size: 1.12rem; max-width: 58ch; }

/* ---------- feature cards ---------- */
/* Plain two-column list; cards add boxes without adding information. */
.features-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 40px; }
.features-list.cols-2 { grid-template-columns: repeat(2, 1fr); }
.feature-item { border-top: 1px solid var(--line); padding: 20px 0 28px; }
.feature-item { min-width: 0; }
.feature-item code { overflow-wrap: anywhere; }
.feature-item h3 {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 1.02rem;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: var(--ink);
    margin: 0 0 9px;
}
.feature-item h3 a { color: var(--rust); }
.feature-item p { color: var(--ink-2); font-size: 0.9rem; line-height: 1.6; }
.feature-item ul { list-style: none; margin: 0; padding: 0; }
.feature-item ul li {
    color: var(--ink-2);
    font-size: 0.88rem;
    line-height: 1.55;
    padding: 4px 0 4px 16px;
    position: relative;
}
.feature-item ul li::before { content: ""; width: 5px; height: 5px; background: var(--rust); border-radius: 50%; position: absolute; left: 2px; top: 0.95em; }
.feature-item ul li strong { color: var(--ink); font-weight: 600; }

/* ---------- stat cards (own performance) ---------- */
/* Flat figures separated by rules, not tiles. */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; border-top: 1px solid var(--line); padding-top: 24px; }
.stat-cell { min-width: 0; }
.stat-cell .num {
    font-family: 'IBM Plex Sans', system-ui, sans-serif;
    font-size: 2rem;
    font-weight: 600;
    line-height: 1;
    color: var(--ink);
    letter-spacing: -0.01em;
}
.stat-cell .num .unit { font-size: 1rem; color: var(--ink-3); margin-left: 3px; }
.stat-cell .lbl {
    font-size: 0.85rem;
    color: var(--ink-3);
    margin-top: 8px;
}

/* ---------- tables ---------- */
.endpoints-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.endpoints-table th, .endpoints-table td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.endpoints-table thead th { border-bottom: 1px solid var(--line-2); }
.endpoints-table tbody tr:hover { background: var(--surface); }
.endpoints-table th {
    color: var(--ink-3);
    font-weight: 500;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.endpoints-table td { color: var(--ink-2); }
.endpoints-table td strong { color: var(--ink); font-weight: 600; }
.endpoints-table code {
    background: var(--inline-code-bg);
    padding: 3px 7px;
    border-radius: 4px;
    color: var(--rust-2);
    font-size: 0.84em;
}

/* ---------- code examples ---------- */
.code-examples { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.code-examples > .code-example:last-child:nth-child(odd) { grid-column: 1 / -1; }
.code-example {
    background: var(--code-bg);
    border: 1px solid var(--code-panel);
    border-radius: var(--radius);
    overflow: hidden;
}
.code-example-header {
    background: var(--code-panel);
    padding: 11px 16px;
    border-bottom: 1px solid var(--code-border);
    display: flex;
    align-items: center;
    gap: 9px;
}
.code-example-header .lang { font-family: 'IBM Plex Mono', monospace; font-weight: 500; font-size: 0.82rem; color: var(--code-ink); }
.code-example-header .tag {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.68rem;
    background: var(--code-border);
    padding: 2px 9px;
    border-radius: 20px;
    color: var(--code-dim);
    margin-left: auto;
}
.code-example pre {
    padding: 20px;
    overflow-x: auto;
    font-size: 0.84rem;
    line-height: 1.65;
    color: var(--code-ink);
    /* Shell one-liners are longer than these cards are wide. Wrapping keeps
       the whole command visible; a horizontal scrollbar on a dark card reads
       as a truncated command instead, which is what people reported. Line
       breaks in the source are still honoured. */
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    /* Overlay scrollbars hide themselves until you scroll, which reads as a
       truncated command. Keep the track visible wherever the platform allows. */
    scrollbar-width: thin;
    scrollbar-color: var(--code-dim) transparent;
}
.code-example pre::-webkit-scrollbar { height: 8px; }
.code-example pre::-webkit-scrollbar-thumb {
    background: var(--code-dim);
    border-radius: 4px;
}
.code-example pre::-webkit-scrollbar-track { background: transparent; }

/* Commands that would otherwise run off the card wrap at any character
   rather than disappearing. Applied where the content is a shell one-liner. */
.code-example pre.wrap {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.code-example .kw  { color: var(--syn-kw); }
.code-example .fn  { color: var(--syn-fn); }
.code-example .str { color: var(--syn-str); }
.code-example .cm  { color: var(--syn-cm); font-style: italic; }
.code-example .var { color: var(--syn-var); }

/* ---------- info box / steps / format grid (architecture) ---------- */
.info-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 2px solid var(--rust);
    border-radius: 8px;
    padding: 22px 26px;
    margin: 24px 0;
    max-width: 820px;
}
.info-box h4 { font-size: 0.95rem; color: var(--ink); margin: 0 0 10px; }
.info-box p { margin: 0; color: var(--ink-2); line-height: 1.65; font-size: 0.94rem; }
.info-box code, .step-list code, .format-card code {
    background: var(--inline-code-bg); padding: 2px 6px; border-radius: 4px; color: var(--rust-2); font-size: 0.85em;
}

.step-list { counter-reset: step; list-style: none; padding: 0; max-width: 720px; }
.step-list li {
    counter-increment: step;
    padding: 4px 0 26px 52px;
    position: relative;
    border-left: 1px solid var(--line-2);
    margin-left: 15px;
}
.step-list li:last-child { border-left-color: transparent; padding-bottom: 0; }
.step-list li::before {
    content: counter(step, decimal-leading-zero);
    position: absolute;
    left: -15px; top: -2px;
    width: 30px; height: 30px;
    background: var(--paper);
    border: 1px solid var(--rust);
    color: var(--rust);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 500;
    font-size: 12px;
}
.step-list li h4 { margin: 0 0 6px; color: var(--ink); font-size: 1rem; }
.step-list li p { margin: 0; color: var(--ink-2); font-size: 0.94rem; }

.format-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.format-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 22px; }
.format-card h4 { margin: 0 0 4px; color: var(--ink); font-family: 'IBM Plex Mono', monospace; font-size: 0.95rem; }
.format-card .endpoint { color: var(--rust); font-family: 'IBM Plex Mono', monospace; font-size: 0.8rem; margin-bottom: 10px; }
.format-card p { margin: 0; color: var(--ink-2); font-size: 0.9rem; }
.format-card .size { margin-top: 10px; color: var(--ink-3); font-size: 0.78rem; font-family: 'IBM Plex Mono', monospace; }

/* mermaid container */
.mermaid { display: flex; justify-content: center; margin: 32px 0; }
.mermaid svg { max-width: 100%; }

/* ---------- support / centered block ---------- */
.center-block { max-width: 640px; }
.center-block p { color: var(--ink-2); line-height: 1.7; margin-bottom: 14px; }

/* ---------- footer ---------- */
footer { padding: 40px 0; color: var(--ink-3); font-size: 0.85rem; border-top: 1px solid var(--line); }
footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
footer .links { display: flex; gap: 22px; flex-wrap: wrap; }
footer a { color: var(--ink-2); }
footer a:hover { color: var(--ink); }
footer .colophon { font-family: 'IBM Plex Mono', monospace; font-size: 0.78rem; color: var(--ink-3); }

/* ---------- mobile nav ---------- */
.mobile-menu-btn { display: none; background: none; border: none; color: var(--ink-2); padding: 8px; cursor: pointer; flex-direction: column; gap: 5px; }
.mobile-menu-btn span { display: block; width: 22px; height: 2px; background: currentColor; border-radius: 1px; }
.mobile-nav { display: none; position: fixed; inset: 0; background: var(--paper); z-index: 200; flex-direction: column; padding: 20px 32px; }
.mobile-nav.active { display: flex; }
.mobile-nav-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 20px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.mobile-nav-close { background: none; border: none; color: var(--ink-2); font-size: 1.6rem; cursor: pointer; padding: 4px 8px; line-height: 1; }
.mobile-nav-links { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.mobile-nav-links a { display: block; padding: 15px 16px; color: var(--ink); font-size: 1.1rem; border-radius: 8px; }
.mobile-nav-links a:hover { background: var(--surface); text-decoration: none; }
.mobile-nav-links a.active { color: var(--rust); }

/* ---------- responsive ---------- */
@media (max-width: 920px) {
    .features-list, .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .code-examples { grid-template-columns: 1fr; }
    .split > .wrap { grid-template-columns: 1fr; }
    .split .section-header { grid-row: auto; margin-bottom: 28px; }
    .split > .wrap > :not(.section-header) { grid-column: 1; }
    /* Matches the specificity of `nav .nav-links` above, which a bare
       `.nav-links` loses to no matter which media query it sits in. */
    nav .nav-links, .gh-link { display: none; }
    .mobile-menu-btn { display: flex; }
    section { padding: 44px 0; }
    .hero { padding: 64px 0 56px; }
}

@media (max-width: 600px) {
    .wrap { padding: 0 20px; }
    /* Identifiers like CERTSTREAM_CT_LOG_FORCE_HTTP1_OPERATORS have no break
       opportunity, so on a narrow screen one of them widens the whole page. */
    :not(pre) > code { overflow-wrap: break-word; }
    .features-list, .features-list.cols-2 { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .section-header h2 { font-size: 1.7rem; }
    .hero-actions { width: 100%; }
    .hero-actions .btn { flex: 1; justify-content: center; }
    .endpoints-table { display: block; overflow-x: auto; }
    .endpoints-table th, .endpoints-table td { white-space: nowrap; }
    footer .wrap { flex-direction: column; align-items: flex-start; }
}

/* ---------- theme toggle ---------- */
.theme-toggle {
    background: none;
    border: 1px solid var(--line-2);
    border-radius: 999px;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--ink-2);
    padding: 0;
    flex: 0 0 auto;
}
.theme-toggle:hover { color: var(--rust); border-color: var(--rust); }
.theme-toggle svg { width: 15px; height: 15px; display: block; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
    :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
}

/* ---------- live usage panel ---------- */
.live-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.live-stat { padding: 20px; display: flex; flex-direction: column; gap: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.live-label { font-size: 0.82rem; color: var(--ink-3); }
.live-value { font-family: 'IBM Plex Mono', monospace; font-size: 1.6rem; font-weight: 500; color: var(--ink); line-height: 1.2; }
.live-status { margin-top: 14px; font-size: 0.85rem; color: var(--ink-3); }
.sponsor-list { display: flex; flex-wrap: wrap; gap: 10px; }
.sponsor-list img { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); display: block; }
.endpoints-table + .code-examples { margin-top: 28px; }
.hero-note { margin-top: 20px; font-size: 0.95rem; color: var(--ink-2); }
.faq { margin-bottom: 32px; }
.faq-group + .faq-group { margin-top: 40px; }
.faq-group h3 {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-3);
    margin: 0 0 6px;
}
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 24px;
    padding: 15px 0;
    font-weight: 500;
    color: var(--ink);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: 'IBM Plex Mono', monospace; color: var(--ink-3); flex-shrink: 0; }
.faq details[open] summary::after { content: "\2212"; }
.faq summary:hover::after { color: var(--ink); }
.faq summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 2px; }
.faq details p { color: var(--ink-2); line-height: 1.7; max-width: 68ch; padding: 0 32px 20px 0; }
