/* ============================================================
   The Azure Toolbox — design system
   Dark-first developer-tool aesthetic. Amber accent. Dense, fast,
   keyboard-friendly. Light theme via html[data-theme="light"].
   ============================================================ */

:root {
    --bg: #0e1116;
    --bg-raised: #151a21;
    --bg-inset: #0a0d11;
    --border: #262d38;
    --border-strong: #39424f;
    --text: #dfe5ec;
    --text-muted: #96a0ad;
    /* 6.2:1 on --bg. Used for breadcrumb links and the lastReviewed meta line, so it has
       to clear WCAG AA for normal text (4.5:1) — the old #6b7482 was 4.0:1. */
    --text-faint: #8b95a3;
    --accent: #f6a821;
    --accent-strong: #ffbe45;
    --accent-dim: rgba(246, 168, 33, 0.12);
    --ok: #3fb950;
    --info: #58a6ff;
    --warn: #d29922;
    --error: #f85149;
    --ok-bg: rgba(63, 185, 80, 0.1);
    --info-bg: rgba(88, 166, 255, 0.1);
    --warn-bg: rgba(210, 153, 34, 0.12);
    --error-bg: rgba(248, 81, 73, 0.1);
    --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, "SF Mono", monospace;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
}

html[data-theme="light"] {
    --bg: #f7f8fa;
    --bg-raised: #ffffff;
    --bg-inset: #eef0f3;
    --border: #d9dee5;
    --border-strong: #b9c2cd;
    --text: #1c2430;
    --text-muted: #55606e;
    /* 5.0:1 on --bg — see the dark-theme note above (the old #8892a0 was only 3.0:1). */
    --text-faint: #616c7a;
    --accent: #c87d0e;
    --accent-strong: #a56508;
    --accent-dim: rgba(200, 125, 14, 0.1);
    --ok: #1a7f37;
    --info: #0969da;
    --warn: #9a6700;
    --error: #cf222e;
    --ok-bg: rgba(26, 127, 55, 0.08);
    --info-bg: rgba(9, 105, 218, 0.08);
    --warn-bg: rgba(154, 103, 0, 0.1);
    --error-bg: rgba(207, 34, 46, 0.08);
    --shadow: 0 1px 3px rgba(20, 30, 40, 0.1);
    color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

/* ---- Accessibility baseline ----------------------------------------------
   The design goal is "dense, fast, keyboard-friendly" — that only holds if the
   focus position is always visible and the header is skippable. */

.skip-link {
    /* fixed, not absolute: absolute would place it 8px from the top of the *document*,
       so it would open off-screen for anyone who tabs after scrolling. */
    position: fixed;
    left: 8px;
    top: -60px;
    z-index: 100;
    padding: 10px 16px;
    background: var(--bg-raised);
    color: var(--text);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    text-decoration: none;
    transition: top 0.15s ease;
}

.skip-link:focus { top: 8px; }

/* :focus-visible only, so pointer users don't get rings on every click. */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* The <main> and the routed <h1> are focus targets for skip-link/FocusOnNavigate;
   moving focus there shouldn't paint a ring around the whole page. */
.site-main:focus,
.site-main:focus-visible,
h1:focus-visible { outline: none; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 780px; margin: 0 auto; padding: 0 20px; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 1.7rem; margin: 0 0 .4rem; }
h1:focus { outline: none; }
h2 { font-size: 1.25rem; margin: 2rem 0 .6rem; }
h3 { font-size: 1.05rem; margin: 1.4rem 0 .5rem; }

p { margin: 0.6rem 0; }

code, kbd, pre {
    font-family: var(--mono);
    font-size: 0.86em;
}
code {
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1em 0.35em;
}
pre {
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    overflow-x: auto;
    line-height: 1.5;
}
pre code { background: none; border: none; padding: 0; }

kbd {
    background: var(--bg-inset);
    border: 1px solid var(--border-strong);
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 0 5px;
    font-size: 0.78em;
    color: var(--text-muted);
}

table { border-collapse: collapse; width: 100%; margin: 0.8rem 0; font-size: 0.92rem; }
th, td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
th { background: var(--bg-inset); font-weight: 600; }
tbody tr:hover { background: var(--accent-dim); }

hr { border: none; border-top: 1px solid var(--border); margin: 1.6rem 0; }

blockquote {
    margin: 0.8rem 0;
    padding: 0.4rem 1rem;
    border-left: 3px solid var(--accent);
    background: var(--bg-raised);
    color: var(--text-muted);
}

/* ---------- Header ---------- */

.site { display: flex; flex-direction: column; min-height: 100vh; }
.site-main { flex: 1; padding: 28px 0 56px; }

.site-header {
    background: var(--bg-raised);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 22px;
    height: 54px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    font-size: 1.02rem;
    color: var(--text);
    white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--text); }
.brand em { color: var(--accent); font-style: normal; }
.brand-mark { color: var(--accent); }

.site-nav { display: flex; gap: 4px; flex: 1; }
.site-nav a {
    color: var(--text-muted);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.94rem;
}
.site-nav a:hover { color: var(--text); background: var(--accent-dim); text-decoration: none; }

.header-actions { display: flex; align-items: center; gap: 10px; }
.search-link {
    color: var(--text-muted);
    font-size: 0.88rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 10px;
    background: var(--bg-inset);
}
.search-link:hover { text-decoration: none; border-color: var(--border-strong); color: var(--text); }

#theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer;
}
#theme-toggle:hover { color: var(--accent); border-color: var(--border-strong); }
html[data-theme="dark"] .icon-moon { display: none; }
html[data-theme="light"] .icon-sun { display: none; }

/* ---------- Footer ---------- */

.site-footer {
    border-top: 1px solid var(--border);
    background: var(--bg-raised);
    padding: 28px 0;
    font-size: 0.88rem;
    color: var(--text-muted);
}
.footer-inner { display: grid; gap: 14px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 16px; }
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--accent); }
.footer-disclaimer { color: var(--text-faint); font-size: 0.8rem; }
.footer-promise strong { color: var(--text); }

/* ---------- Cards & grids ---------- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
    margin: 1rem 0;
}
.card {
    display: block;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: border-color 0.12s ease;
}
.card:hover { border-color: var(--accent); text-decoration: none; color: var(--text); }
.card h3 { margin: 0 0 4px; font-size: 1rem; }
.card p { margin: 0; color: var(--text-muted); font-size: 0.88rem; }
.card .card-tag { float: right; }

.category-block { margin: 1.6rem 0; }
.category-block > h2 { margin-bottom: 0.2rem; }
.category-blurb { color: var(--text-muted); margin-top: 0; }

.badge {
    display: inline-block;
    font-size: 0.72rem;
    font-family: var(--mono);
    padding: 1px 7px;
    border-radius: 10px;
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    vertical-align: middle;
}
.badge-accent { border-color: var(--accent); color: var(--accent); }

/* ---------- Hero (home) ---------- */

.hero { text-align: center; padding: 30px 0 8px; }
.hero h1 { font-size: 2.1rem; }
.hero .tagline { color: var(--text-muted); font-size: 1.05rem; max-width: 620px; margin: 0.4rem auto 1.4rem; }
.hero-privacy {
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--ok);
    background: var(--ok-bg);
    display: inline-block;
    border-radius: 20px;
    padding: 3px 14px;
    margin-top: 1.2rem;
}

/* ---------- Search palette ---------- */

.palette { max-width: 640px; margin: 0 auto; position: relative; }
.palette input {
    width: 100%;
    font-size: 1.05rem;
    padding: 12px 16px;
    background: var(--bg-raised);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    outline: none;
}
.palette input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.palette-results {
    position: absolute;
    inset-inline: 0;
    top: calc(100% + 6px);
    background: var(--bg-raised);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.45);
    max-height: 380px;
    overflow-y: auto;
    z-index: 60;
    text-align: left;
}
.palette-results a {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 14px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
}
.palette-results a:last-child { border-bottom: none; }
.palette-results a:hover, .palette-results a.active { background: var(--accent-dim); text-decoration: none; }
.palette-results .result-type { color: var(--text-faint); font-family: var(--mono); font-size: 0.75rem; align-self: center; white-space: nowrap; }
.palette-empty { padding: 12px 14px; color: var(--text-muted); }

/* ---------- Tool pages ---------- */

.tool-header { margin-bottom: 1.1rem; }
.tool-header .breadcrumbs { font-size: 0.82rem; color: var(--text-faint); margin-bottom: 4px; }
.tool-header .breadcrumbs a { color: var(--text-faint); }
.tool-header .breadcrumbs a:hover { color: var(--accent); }
.tool-lede { color: var(--text-muted); max-width: 760px; margin-top: 0; }

.clientside-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--ok);
    background: var(--ok-bg);
    border-radius: 20px;
    padding: 2px 12px;
    margin: 4px 0 14px;
}
.clientside-note.serverside { color: var(--warn); background: var(--warn-bg); }

.tool-island {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 1.6rem;
}

textarea.tool-input, input.tool-input, select.tool-input {
    width: 100%;
    background: var(--bg-inset);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 10px 12px;
    font-family: var(--mono);
    font-size: 0.86rem;
    line-height: 1.5;
    outline: none;
}
textarea.tool-input { min-height: 150px; resize: vertical; }
.tool-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.input-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.input-row label { font-size: 0.88rem; color: var(--text-muted); }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: var(--accent);
    color: #14100a;
    font-weight: 650;
    font-size: 0.92rem;
    border: none;
    border-radius: var(--radius);
    padding: 8px 18px;
    cursor: pointer;
}
.btn:hover { background: var(--accent-strong); }
.btn-secondary {
    background: var(--bg-inset);
    color: var(--text);
    border: 1px solid var(--border-strong);
    font-weight: 500;
}
.btn-secondary:hover { background: var(--bg-raised); border-color: var(--accent); }
.btn-small { font-size: 0.8rem; padding: 3px 10px; }

/* ---------- Findings ---------- */

.findings { display: grid; gap: 8px; margin: 1rem 0; }
.finding {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-raised);
    font-size: 0.92rem;
}
.finding .finding-icon { font-family: var(--mono); font-weight: 700; }
.finding-ok { border-color: var(--ok); background: var(--ok-bg); }
.finding-ok .finding-icon { color: var(--ok); }
.finding-info { border-color: var(--info); background: var(--info-bg); }
.finding-info .finding-icon { color: var(--info); }
.finding-warning { border-color: var(--warn); background: var(--warn-bg); }
.finding-warning .finding-icon { color: var(--warn); }
.finding-error { border-color: var(--error); background: var(--error-bg); }
.finding-error .finding-icon { color: var(--error); }
.finding strong { display: block; margin-bottom: 1px; }

/* ---------- Output fields ---------- */

.kv-table { font-size: 0.9rem; }
.kv-table th { width: 220px; white-space: nowrap; font-family: var(--mono); font-weight: 500; color: var(--text-muted); }
.kv-table td { font-family: var(--mono); word-break: break-all; }
.copy-wrap { display: flex; gap: 8px; align-items: flex-start; }
.copy-wrap > :first-child { flex: 1; min-width: 0; }
.copy-btn {
    background: var(--bg-inset);
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    border-radius: 6px;
    font-size: 0.74rem;
    font-family: var(--mono);
    padding: 2px 8px;
    cursor: pointer;
    white-space: nowrap;
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Product callout (the one per page) ---------- */

.product-callout {
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    background: var(--accent-dim);
    padding: 14px 18px;
    margin: 1.8rem 0;
    font-size: 0.94rem;
}
.product-callout .callout-label {
    font-family: var(--mono);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    display: block;
    margin-bottom: 3px;
}

/* ---------- FAQ / explainer ---------- */

details.faq-item, details.explainer {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-raised);
    padding: 0;
    margin: 8px 0;
}
details.faq-item summary, details.explainer summary {
    cursor: pointer;
    font-weight: 600;
    padding: 10px 14px;
    list-style-position: inside;
}
details.faq-item[open] summary, details.explainer[open] summary { border-bottom: 1px solid var(--border); }
details.faq-item > div, details.explainer > div { padding: 10px 14px; color: var(--text-muted); }

/* ---------- Reference pages ---------- */

.error-code-title { font-family: var(--mono); }
.meta-line { color: var(--text-faint); font-size: 0.82rem; margin: 0.2rem 0 1.2rem; }
.list-plain { list-style: none; padding: 0; }
.list-plain li { padding: 7px 0; border-bottom: 1px solid var(--border); }
.list-plain li:last-child { border-bottom: none; }
.list-plain .item-title { font-family: var(--mono); }
.list-plain .item-desc { color: var(--text-muted); font-size: 0.88rem; }

.content-body { max-width: 760px; }
.content-body img { max-width: 100%; }
.content-body h2 { border-bottom: 1px solid var(--border); padding-bottom: 4px; }

.related-links { margin: 1.6rem 0; }
.related-links h2 { font-size: 1.02rem; }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
    border: 1px solid var(--border-strong);
    border-radius: 20px;
    padding: 3px 13px;
    font-size: 0.84rem;
    color: var(--text);
    background: var(--bg-raised);
}
.pill:hover { border-color: var(--accent); text-decoration: none; }

/* ---------- Week grid (VM calculator) ---------- */

.week-grid { border-collapse: collapse; user-select: none; font-size: 0.7rem; }
.week-grid th, .week-grid td { border: 1px solid var(--border); padding: 0; text-align: center; }
.week-grid th { padding: 2px 6px; font-family: var(--mono); background: var(--bg-inset); }
.week-grid td { width: 26px; height: 22px; cursor: pointer; background: var(--bg-inset); }
.week-grid td.on { background: var(--accent); }
.week-grid td:hover { outline: 2px solid var(--accent-strong); outline-offset: -2px; }

.stat-row { display: flex; gap: 14px; flex-wrap: wrap; margin: 1rem 0; }
.stat {
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 16px;
    min-width: 150px;
}
.stat .stat-value { font-size: 1.35rem; font-weight: 700; font-family: var(--mono); }
.stat .stat-label { font-size: 0.78rem; color: var(--text-muted); }
.stat.stat-accent .stat-value { color: var(--accent); }

/* ---------- Timeline (cron) ---------- */

.timeline { list-style: none; padding: 0; font-family: var(--mono); font-size: 0.88rem; }
.timeline li { padding: 5px 0 5px 18px; border-left: 2px solid var(--accent); margin-left: 6px; position: relative; }
.timeline li::before {
    content: "";
    position: absolute;
    left: -5px; top: 12px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent);
}

/* ---------- Internal dashboard ---------- */

.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.dash-panel { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.dash-panel h2 { margin-top: 0; font-size: 1rem; }

/* ---------- Misc ---------- */

.wave-tag { color: var(--text-faint); font-size: 0.72rem; font-family: var(--mono); }
.text-muted { color: var(--text-muted); }
.mt-0 { margin-top: 0; }

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    color: #333;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.loading-note { color: var(--text-faint); font-family: var(--mono); font-size: 0.82rem; }

@media (max-width: 760px) {
    .site-nav { display: none; }
    .header-inner { justify-content: space-between; }
    .hero h1 { font-size: 1.6rem; }
}

@media print {
    .site-header, .site-footer, .product-callout, #theme-toggle, .search-link { display: none !important; }
    body { background: #fff; color: #000; }
    a { color: #000; }
}
