/* ct.hbenali.ovh: one stylesheet for every page. Dark editorial design system shared with hbenali.ovh.
   Fonts are self-hosted (see fonts/README.md). */

@font-face { font-family: 'Big Shoulders'; font-style: normal; font-weight: 600 900; font-display: swap; src: url('fonts/big-shoulders-latin-wght.woff2') format('woff2'); }
@font-face { font-family: 'Newsreader'; font-style: normal; font-weight: 200 800; font-display: swap; src: url('fonts/newsreader-latin-wght.woff2') format('woff2'); }
@font-face { font-family: 'Newsreader'; font-style: italic; font-weight: 200 800; font-display: swap; src: url('fonts/newsreader-italic-latin-wght.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 100 800; font-display: swap; src: url('fonts/jetbrains-mono-latin-wght.woff2') format('woff2'); }

:root {
    --ink: #0c1218;
    --slate: #17212b;
    --line: #263341;
    --bone: #e7e1d3;
    --mist: #8e9aa6;
    --sodium: #e9a23b;
    --verdigris: #5db7a0;
    --fail: #e5776f;
    --glow: rgba(233, 162, 59, 0.2);
    --glow-soft: rgba(233, 162, 59, 0.06);

    --display: 'Big Shoulders', 'Arial Narrow', Impact, sans-serif;
    --serif: 'Newsreader', Georgia, serif;
    --mono: 'JetBrains Mono', ui-monospace, monospace;

    --gutter: clamp(1.5rem, 4vw, 2.5rem);
    color-scheme: dark;
}

/* Light: follows the system setting until the lamp (theme.js) is used. Dark above is the default and the identity.
   Contrast on --ink (page) / --slate (surface): text 16/14.7, muted 6.0/5.4, accent 5.5/4.9, ok 5.2/4.7, fail 5.7/5.1. */
@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --ink: #f4efe4;
        --slate: #e9e3d4;
        --line: #cbc3b0;
        --bone: #0c1218;
        --mist: #4f5b67;
        --sodium: #8a5300;
        --verdigris: #1b7058;
        --fail: #b3261e;
        --glow: rgba(233, 162, 59, 0.22);
        --glow-soft: rgba(233, 162, 59, 0.07);
        color-scheme: light;
    }
}
:root[data-theme="light"] {
    --ink: #f4efe4;
    --slate: #e9e3d4;
    --line: #cbc3b0;
    --bone: #0c1218;
    --mist: #4f5b67;
    --sodium: #8a5300;
    --verdigris: #1b7058;
    --fail: #b3261e;
    --glow: rgba(233, 162, 59, 0.22);
    --glow-soft: rgba(233, 162, 59, 0.07);
    color-scheme: light;
}

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

html { background: var(--ink); }

body {
    min-height: 100vh;
    background: var(--ink);
    color: var(--bone);
    font-family: var(--serif);
    font-size: 1.125rem;
    line-height: 1.7;
    font-optical-sizing: auto;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection { background: var(--sodium); color: var(--ink); }
:focus-visible { outline: 2px solid var(--sodium); outline-offset: 4px; border-radius: 2px; }

a { color: inherit; }
ul { list-style: none; }
strong { font-weight: 600; }
code { font-family: var(--mono); font-size: 0.85em; background: var(--slate); padding: 0.1em 0.4em; border-radius: 2px; overflow-wrap: anywhere; }
[hidden] { display: none !important; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; top: 0.75rem; left: 0.75rem; z-index: 60; background: var(--sodium); color: var(--ink); padding: 0.5rem 1rem; transform: translateY(-300%); }
.skip:focus { transform: none; }

/* Underline that draws in on hover and focus. */
.link, footer a, .note a {
    text-decoration: none;
    background-image: linear-gradient(currentColor, currentColor);
    background-repeat: no-repeat;
    background-size: 100% 1px;
    background-position: 0 100%;
    padding-bottom: 2px;
    transition: background-size 0.35s cubic-bezier(0.22, 1, 0.36, 1), color 0.2s;
}
.link:hover, .link:focus-visible, footer a:hover, footer a:focus-visible, .note a:hover, .note a:focus-visible { color: var(--sodium); background-size: 100% 2px; }

.display { font-family: var(--display); font-weight: 800; line-height: 0.86; letter-spacing: -0.01em; }

.wrap { max-width: 64rem; margin: 0 auto; padding-inline: var(--gutter); }

/* Hero */
.hero { position: relative; isolation: isolate; overflow: hidden; padding-block: 4.5rem 3.5rem; }
.hero::before {
    content: ''; position: absolute; z-index: -1; top: -14rem; right: -12rem;
    width: min(46rem, 140vw); aspect-ratio: 1; border-radius: 50%;
    background: radial-gradient(closest-side, var(--glow), var(--glow-soft) 55%, transparent);
    pointer-events: none;
}
.hero h1 { font-size: clamp(4rem, 17vw, 9.5rem); margin-left: -0.03em; }
.hero h1 .line { display: block; overflow: hidden; padding-bottom: 0.05em; }
.hero h1 .line > span { display: block; animation: rise 1.1s cubic-bezier(0.16, 1, 0.3, 1) both; }
.hero h1 .line:nth-child(2) { color: var(--sodium); font-size: 0.42em; line-height: 1; margin-top: 0.15em; }
.hero h1 .line:nth-child(2) > span { animation-delay: 0.13s; }
.hero .lead { margin-top: 2rem; max-width: 40ch; font-size: clamp(1.25rem, 2.4vw, 1.6rem); line-height: 1.5; animation: fade 0.9s 0.5s both; }
.hero .lead strong { color: var(--sodium); font-weight: 600; }

@keyframes rise { from { transform: translateY(108%); } }
@keyframes fade { from { opacity: 0; transform: translateY(12px); } }

/* Sections */
.block { position: relative; padding-block: 3.5rem; }
.block::before { content: ''; position: absolute; top: 0; left: var(--gutter); right: var(--gutter); height: 1px; background: var(--line); }
.block-title { font-family: var(--display); font-weight: 800; font-size: clamp(2.6rem, 7vw, 4rem); line-height: 0.9; letter-spacing: -0.01em; color: var(--sodium); }
.block-note { margin-top: 0.75rem; max-width: 52ch; color: var(--mist); }

/* Fields */
.field { margin-top: 2rem; }
.field label, .gen-label { display: block; color: var(--mist); font-size: 1rem; margin-bottom: 0.3rem; }
.field label i { font-style: italic; margin-left: 0.5rem; }
.field-row { display: flex; align-items: stretch; gap: 1rem; border-bottom: 1px solid var(--mist); transition: border-color 0.2s; }
.field-row:focus-within { border-color: var(--sodium); }
input[type="text"], input[type="number"], select {
    background: none; border: 0; color: var(--bone); border-radius: 0;
    font: 500 1.05rem/1.3 var(--mono); padding: 0.75rem 0; outline: 0; min-width: 0;
}
.field-row input { flex: 1; }
input::placeholder { color: var(--mist); opacity: 0.8; }
select { cursor: pointer; width: 100%; appearance: none; -webkit-appearance: none; }
select option { background: var(--slate); color: var(--bone); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
    background: var(--sodium); color: var(--ink); border: 1px solid var(--sodium); padding: 0.55rem 1.3rem;
    font: 600 1.05rem/1.4 var(--serif); border-radius: 2px; cursor: pointer;
    transition: background-color 0.2s, color 0.2s, transform 0.2s;
}
.btn:hover, .btn:focus-visible { background: var(--bone); border-color: var(--bone); transform: translateY(-2px); }
.btn:disabled { opacity: 0.7; cursor: progress; transform: none; }
.btn.quiet { background: none; color: var(--bone); border-color: var(--line); }
.btn.quiet:hover, .btn.quiet:focus-visible { border-color: var(--sodium); color: var(--sodium); background: none; }
.field-row .btn { align-self: center; margin-bottom: 0.4rem; }

.loader { width: 0.9rem; height: 0.9rem; border: 2px solid var(--ink); border-top-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Result states */
.result-area { margin-top: 2.5rem; }
.state { border-top: 1px solid var(--line); padding-top: 1.5rem; }
.state-title { font-family: var(--display); font-weight: 800; font-size: 1.9rem; line-height: 1.05; }
.state p { margin-top: 0.5rem; max-width: 60ch; color: var(--mist); }
.state p strong { color: var(--bone); }
.state.empty { color: var(--mist); }
.state.warn { border-top-color: var(--sodium); }
.state.warn .state-title { color: var(--sodium); }
.state.ok { border-top-color: var(--verdigris); }
.state.ok .state-title { color: var(--verdigris); }
.state.fail { border-top-color: var(--fail); }
.state.fail .state-title { color: var(--fail); }
.state.fail p { color: var(--bone); }
.badge-domain { font: 500 1rem var(--mono); color: var(--bone); overflow-wrap: anywhere; display: block; margin-top: 0.5rem; }

.record-list { margin-top: 1.25rem; }
.record-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 1.25rem; border-top: 1px solid var(--line); padding: 0.9rem 0; font: 0.95rem/1.5 var(--mono); }
.record-item:last-child { border-bottom: 1px solid var(--line); }
.flag-tag { color: var(--sodium); }
.flag-tag .k { font-family: var(--serif); color: var(--mist); font-size: 1rem; margin-right: 0.4rem; }
.record-value { overflow-wrap: anywhere; min-width: 0; }
.count { margin-top: 0.75rem; color: var(--mist); font-size: 1rem; }

/* Generator */
.gen-grid { margin-top: 2rem; display: grid; gap: 1.75rem; }
.gen-row { border-bottom: 1px solid var(--mist); transition: border-color 0.2s; position: relative; }
.gen-row:focus-within { border-color: var(--sodium); }
.gen-row .hint { color: var(--mist); font-size: 1rem; display: block; padding-bottom: 0.5rem; }
.gen-row.v { border-bottom: 0; }
.value-input-wrapper { position: relative; border-bottom: 1px solid var(--mist); transition: border-color 0.2s; }
.value-input-wrapper:focus-within { border-color: var(--sodium); }
.value-input-wrapper input { width: 100%; }

.suggestions-dropdown {
    display: none; position: absolute; z-index: 20; left: 0; right: 0; top: 100%;
    max-height: 14rem; overflow-y: auto; background: var(--slate); border: 1px solid var(--line); border-radius: 2px;
    font: 0.95rem/1.4 var(--mono);
}
.suggestions-dropdown div { padding: 0.55rem 0.9rem; cursor: pointer; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.suggestions-dropdown div:last-child { border-bottom: 0; }
.suggestions-dropdown div:hover, .suggestions-dropdown div.active { background: var(--ink); color: var(--sodium); }

.field-error { display: none; color: var(--fail); font-size: 1rem; }
.field-error.visible { display: block; }
#loadExistingHint.visible { color: var(--sodium); }

.preview { font: 0.95rem/1.6 var(--mono); background: var(--slate); border: 1px solid var(--line); border-radius: 2px; padding: 1rem 1.25rem; overflow-wrap: anywhere; }
.preview-label { color: var(--mist); font-size: 1rem; margin-bottom: 0.3rem; }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; }
.pub-head { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.pub-head h3 { font-family: var(--display); font-weight: 800; font-size: 1.9rem; line-height: 1.05; color: var(--sodium); }
.pub-head span { color: var(--mist); }
.gen-list { margin-top: 0.75rem; }
.gen-list li { display: flex; align-items: center; gap: 1rem; border-top: 1px solid var(--line); padding: 0.4rem 0; font: 0.95rem/1.5 var(--mono); }
.gen-list li:last-child { border-bottom: 1px solid var(--line); }
.gen-list li.none { font: inherit; font-family: var(--serif); font-size: 1.05rem; color: var(--mist); padding: 0.9rem 0; }
.gen-list li span { flex: 1; overflow-wrap: anywhere; min-width: 0; }
.remove-record { background: none; border: 1px solid transparent; color: var(--fail); font: 1.4rem/1 var(--serif); cursor: pointer; padding: 0.35rem 0.7rem; border-radius: 2px; }
.remove-record:hover { border-color: var(--fail); }
.bind-output { display: none; margin-top: 1rem; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Footer */
footer { color: var(--mist); font-size: 1rem; }
.foot { max-width: 64rem; margin: 0 auto; padding: 0 var(--gutter) 3rem; }
.foot > footer { border-top: 1px solid var(--line); padding-top: 2rem; display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; }
.foot strong { color: var(--bone); }

/* 404 */
.nf { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding-block: 4rem; position: relative; isolation: isolate; overflow: hidden; }
.nf::before {
    content: ''; position: absolute; z-index: -1; top: -12rem; right: -10rem; width: min(40rem, 140vw); aspect-ratio: 1; border-radius: 50%;
    background: radial-gradient(closest-side, var(--glow), var(--glow-soft) 55%, transparent);
}
.nf-code { font-size: clamp(9rem, 34vw, 22rem); color: var(--sodium); }
.nf h1 { font-size: clamp(2.8rem, 7vw, 5rem); margin-top: 0.5rem; }
.nf .nf-lead { margin-top: 1rem; max-width: 40ch; color: var(--mist); font-size: 1.3rem; }
.nf-links { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: 0.75rem 2rem; font-size: 1.25rem; }
.nf-search { margin-top: 3rem; max-width: 30rem; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; }
}

/* ---- Theme lamp: pull-cord switch (see theme.js). Lamp on = light theme. ---- */
.theme-lamp {
    position: absolute; /* scrolls away with the page; fixed on pages with a fixed bar, see below */
    top: 0;
    inset-inline-end: clamp(0.75rem, 3vw, 2rem);
    z-index: 1000;
    display: block;
    width: 2.75rem;
    height: 5.25rem;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
/* Pages with a fixed top bar or fixed top-right controls: the lamp stays visible and the bar
   reserves room for it (lamp offset + lamp width + gap), so it never covers a link. */
html:has(.bar-inner) .theme-lamp,
html:has(.controls) .theme-lamp { position: fixed; }
.bar-inner { padding-inline-end: calc(clamp(0.75rem, 3vw, 2rem) + 2.75rem + 0.75rem); }
.controls { right: calc(clamp(0.75rem, 3vw, 2rem) + 2.75rem + 0.75rem); }
.theme-lamp svg { display: block; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.lamp-wire { stroke: var(--mist); stroke-width: 1.2; }
.lamp-shade { fill: var(--slate); stroke: var(--bone); stroke-width: 1.4; stroke-linejoin: round; }
.lamp-bulb { fill: var(--line); transition: fill 0.4s; }
.lamp-halo { fill: var(--sodium); opacity: 0; transition: opacity 0.5s; }
.lamp-cone { fill: url(#lamp-cone); opacity: 0; transition: opacity 0.5s; }
.lamp-stop-a { stop-color: var(--sodium); stop-opacity: 0.38; }
.lamp-stop-b { stop-color: var(--sodium); stop-opacity: 0; }
.lamp-cord { stroke: var(--mist); stroke-width: 1; }
.lamp-bead { fill: var(--sodium); }
.theme-lamp[data-on="true"] .lamp-bulb { fill: #ffd27a; }
.theme-lamp[data-on="true"] .lamp-halo { opacity: 0.35; }
.theme-lamp[data-on="true"] .lamp-cone { opacity: 1; }
.lamp-swing { transform-box: view-box; transform-origin: 22px 0; animation: lamp-swing 0.9s ease-out; }
.lamp-pull { animation: lamp-pull 0.45s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes lamp-swing { 20% { transform: rotate(-5deg); } 45% { transform: rotate(3.5deg); } 70% { transform: rotate(-1.5deg); } }
@keyframes lamp-pull { 35% { transform: translateY(10px); } }

/* The theme switch is a plain cross-fade of the whole page. */
html.theme-vt::view-transition-old(root) { animation: 0.45s ease both lamp-fade-out; }
html.theme-vt::view-transition-new(root) { animation: 0.45s ease both lamp-fade-in; }
@keyframes lamp-fade-out { to { opacity: 0; } }
@keyframes lamp-fade-in { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
    .lamp-swing, .lamp-pull { animation: none; }
    .lamp-bulb, .lamp-halo, .lamp-cone { transition: none; }
}

/* ---- Certificate Transparency search ---- */
.opts { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; color: var(--mist); }
.opts label { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; }
.opts input { accent-color: var(--sodium); width: 1.1rem; height: 1.1rem; }
.status { margin-top: 1rem; color: var(--mist); min-height: 1.5rem; }
.stats { margin-top: 1.5rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 1rem; }
.stat { border-top: 1px solid var(--line); padding-top: 0.6rem; }
.stat b { display: block; font: 800 2.4rem/1 var(--display); color: var(--bone); }
.stat span { color: var(--mist); font-size: 1rem; }
.stat.warn b { color: var(--sodium); }
.stat.fail b { color: var(--fail); }
.sub-title { font-family: var(--display); font-weight: 800; font-size: 1.9rem; line-height: 1; margin-top: 2.5rem; }
.sub-note { margin-top: 0.4rem; color: var(--mist); max-width: 60ch; }
.filter-row { margin-top: 1.5rem; }
.filter-row .field-row input { width: 100%; }
.tbl-wrap { margin-top: 1rem; overflow-x: auto; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; font-size: 1rem; }
th { text-align: left; color: var(--mist); font: 500 0.95rem var(--serif); padding: 0.6rem 0.9rem 0.6rem 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { vertical-align: top; padding: 0.6rem 0.9rem 0.6rem 0; border-bottom: 1px solid var(--line); font: 0.85rem/1.5 var(--mono); }
tr:last-child td { border-bottom: 0; }
td.names { min-width: 16rem; overflow-wrap: anywhere; }
td.names .cn { color: var(--bone); font-weight: 600; }
td.names .san { color: var(--mist); }
td.issuer { min-width: 11rem; overflow-wrap: anywhere; }
td.date { white-space: nowrap; }
td.serial { max-width: 14rem; overflow-wrap: anywhere; color: var(--mist); }
.flag { display: inline-block; margin-left: 0.4rem; font: 600 0.72rem/1.6 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }
.flag.expired { color: var(--fail); }
.flag.soon { color: var(--sodium); }
.flag.ok { color: var(--verdigris); }
.flag.wild { color: var(--sodium); }
details summary { cursor: pointer; color: var(--sodium); }
.more-row { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: center; }
.more-row .count { margin-top: 0; }
.names-list { margin-top: 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 0 1.5rem; }
.names-list li { border-top: 1px solid var(--line); padding: 0.4rem 0; font: 0.85rem/1.5 var(--mono); overflow-wrap: anywhere; }
.names-list li .n { color: var(--mist); font-size: 0.75rem; margin-left: 0.4rem; }
.curl { margin-top: 0.75rem; font: 0.85rem/1.6 var(--mono); background: var(--slate); border: 1px solid var(--line); padding: 0.75rem 1rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.provider { margin-top: 0.75rem; color: var(--mist); }
.provider strong { color: var(--bone); }
