/* ============================================================
   GENERIC DARK STYLESHEET
   Clean, transparent panels over a solid charcoal page.
   No gradients, glow, external fonts.

   Layout:     .container, .stack, .row, .grid, .grid-2
   Panels:     .card, .card-header, .section-title
   Summaries:  .summary, .summary-main, .summary-icon,
               .summary-value, .summary-description, .stats, .stat
   Content:    .items, .item, .item-header, .item-title,
               .item-body, .item-meta, .content
   Forms:      .field, .form-grid, .choice, .actions, .input-group
   Buttons:    .button, .button-primary, .button-danger, .toggle

   Optional state classes: .is-open, .is-expanded, .is-clamped,
   .is-urgent, .is-success, .is-warning.
   State classes alone do not implement expand/collapse behavior.
   ============================================================ */

/* 1. THEME ---------------------------------------------------
   No color-scheme declaration. The page background is explicitly
   dark; cards and controls remain transparent like the reference.
   Edit these variables to customize the whole stylesheet. */
:root {
    --background: #1e1e1e;
    --text: #e8ebf2;
    --muted: #98a1b3;
    --accent: #4fa3ff;
    --urgent: #ef6565;
    --success: #7bdca2;
    --warning: #f2ce75;
    --line: rgba(128, 128, 128, .35);
    --code: rgba(128, 128, 128, .2);
    --hover: rgba(128, 128, 128, .08);
    --radius: 10px;
    --radius-large: 14px;
    --page-width: 900px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* 2. BASE ---------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--background); }
html, body { margin: 0; }
body {
    min-height: 100vh;
    padding: 12px;
    background: var(--background);
    color: var(--text);
    font-family: var(--font);
    font-size: .9rem;
    line-height: 1.45;
    overflow-wrap: break-word;
}
/* Use <html class="is-embedded"> only when transparency is wanted. */
html.is-embedded, html.is-embedded body { background: transparent; }
html.is-embedded body { min-height: 0; }
::selection { background: rgba(79, 163, 255, .28); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
img, video, svg, canvas { max-width: 100%; }
img, video { height: auto; }
iframe { max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius); }

/* 3. TEXT ----------------------------------------------------
   Normal headings stay normal. Use .section-title for the small,
   uppercase labels shown in the reference. */
h1, h2, h3, h4, h5, h6 {
    margin: 0 0 .6em;
    color: var(--text);
    line-height: 1.25;
    font-weight: 600;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1rem; }
h5, h6 { font-size: .9rem; }
p, ul, ol, dl, blockquote, pre, figure { margin: 0 0 .8em; }
ul, ol { padding-left: 1.4em; }
li + li { margin-top: .15em; }
dt { font-weight: 600; }
dd { margin: .2em 0 .8em 1.2em; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
small, .small { font-size: .75rem; }
.muted, time, figcaption { color: var(--muted); }
figcaption { margin-top: 6px; font-size: .75rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.section-title {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
}

/* 4. LAYOUT AND PANELS --------------------------------------- */
.container { width: 100%; max-width: var(--page-width); margin-inline: auto; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack > * { margin-block: 0; }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.between { justify-content: space-between; }
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
:where(.row, .grid, .form-grid) > * { min-width: 0; }
.card {
    min-width: 0;
    padding: 16px;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: var(--radius-large);
}
.card > :last-child { margin-bottom: 0; }
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}
.card-header > .section-title { margin: 0; }
.card-footer { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }

/* 5. SUMMARY AND STAT BOXES ----------------------------------
   Generic structure for weather, services, counts, or status.
   .stat-value and .stat-label are children of .stat. */
.summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.summary-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.summary-icon { font-size: 3rem; line-height: 1; flex-shrink: 0; }
.summary-value { font-size: 2.8rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.summary-description { color: var(--muted); margin-top: 4px; font-size: .9rem; }
.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    flex: 1 1 300px;
    max-width: 420px;
    min-width: 0;
}
.stat { text-align: center; padding: 8px 4px; border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.stat-value { font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-label { font-size: .7rem; color: var(--muted); margin-top: 2px; }

/* 6. CONTENT CARDS -------------------------------------------
   Default: horizontally arranged items that can scroll.
   Add .is-open to .items for fixed-width expanded-list cards.
   .is-extra items are hidden until that list is open. */
.items {
    margin-top: 14px;
    display: flex;
    gap: 10px;
    align-items: stretch;
    overflow-x: auto;
    padding-bottom: 6px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
}
.item {
    flex: 1 1 0;
    min-width: 200px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 12px;
    background: transparent;
}
.items.is-open > .item { flex: 0 0 270px; }
.items:not(.is-open) > .is-extra { display: none; }
.item-header { display: flex; align-items: flex-start; gap: 8px; }
.item-icon { font-size: 1.1rem; line-height: 1.3; flex-shrink: 0; }
.item-title { font-weight: 600; overflow-wrap: anywhere; }
.item-body { margin-top: 6px; overflow-wrap: anywhere; }
/* Clamping is opt-in: do not silently truncate ordinary content. */
.item.is-clamped:not(.is-expanded) .item-body {
    max-height: 7.5em;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(#000 65%, transparent);
    mask-image: linear-gradient(#000 65%, transparent);
}
.item.is-expanded .item-body { max-height: none; }
.plain-text { white-space: pre-wrap; }
.item-more { display: none; margin-top: 4px; font-size: .72rem; color: var(--accent); }
.item.is-clamped .item-more, .item.is-expanded .item-more { display: block; }
.item-meta { margin-top: auto; padding-top: 8px; color: var(--muted); font-size: .75rem; }
.item.is-urgent { border-color: var(--urgent); }
.item.is-urgent .item-title { color: var(--urgent); }
.scroll-area { max-height: 320px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

/* 7. RENDERED CONTENT, CODE, AND TABLES ----------------------- */
.content > :first-child { margin-top: 0; }
.content > :last-child { margin-bottom: 0; }
.content p, .content ul, .content ol, .content pre,
.content blockquote, .content table { margin-bottom: .6em; }
.content h1, .content h2, .content h3, .content h4 {
    margin: .8em 0 .35em;
    line-height: 1.25;
    font-size: 1rem;
    text-transform: none;
    letter-spacing: 0;
}
.content h1 { font-size: 1.15rem; }
.content h2 { font-size: 1.05rem; }
code, kbd, samp { background: var(--code); border-radius: 4px; padding: .1em .35em; font: .85em var(--mono); }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; }
pre { background: var(--code); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow-x: auto; font-family: var(--mono); tab-size: 4; }
pre code { background: none; padding: 0; font-size: .82rem; }
blockquote { border-left: 3px solid var(--line); margin-left: 0; padding: 0 0 0 12px; color: var(--muted); }
.content img { border-radius: 8px; }
.table-wrap { max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9em; }
th, td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
th { background: var(--code); font-weight: 600; }
caption { text-align: left; color: var(--muted); padding-bottom: 6px; }
/* Markdown tables can scroll without a separate wrapper. */
.content table { display: block; overflow-x: auto; }

/* 8. FORMS ---------------------------------------------------
   Covers text, password, email, search, number, date, URL, etc.
   Native date/select popups remain browser-controlled. */
form { margin: 0; }
.field { display: grid; gap: 5px; min-width: 0; }
.field + .field { margin-top: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid > .field { margin-top: 0; }
.full-width { grid-column: 1 / -1; }
label { color: var(--text); font-size: .85rem; font-weight: 500; }
input, textarea, select, button { font: inherit; color: var(--text); }
input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="hidden"], [type="button"], [type="submit"], [type="reset"], [type="image"]),
textarea, select {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding: 10px 12px;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    font-size: .9rem;
    line-height: 1.4;
}
textarea { resize: vertical; min-height: 90px; }
select { cursor: pointer; }
select[multiple] { min-height: 120px; }
option, optgroup { background: var(--background); color: var(--text); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 2px; }
input[readonly], textarea[readonly] { background: var(--hover); }
:where(input, textarea, select)[aria-invalid="true"] { border-color: var(--urgent); }
:where(input, textarea, select, button):disabled { opacity: .5; cursor: not-allowed; }
.hint, .field-error { margin: 0; font-size: .7rem; }
.hint { color: var(--muted); }
.field-error { color: var(--urgent); }
fieldset { min-width: 0; margin: 0 0 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
legend { padding: 0 6px; color: var(--muted); font-size: .8rem; }
/* Keep native checkbox/radio behavior and use the accent color. */
input[type="checkbox"], input[type="radio"] { width: 1rem; height: 1rem; margin: 0; flex-shrink: 0; accent-color: var(--accent); cursor: pointer; }
.choice { display: flex; align-items: flex-start; gap: 8px; width: fit-content; font-weight: 400; cursor: pointer; }
.choice > input { margin-top: .15rem; }
input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="color"] { width: 56px; height: 42px; padding: 4px; background: transparent; border: 1px solid var(--line); border-radius: 8px; }
input[type="file"]::file-selector-button { margin-right: 10px; padding: 6px 9px; font: inherit; color: var(--accent); background: var(--background); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
input:-webkit-autofill { -webkit-text-fill-color: var(--text); caret-color: var(--text); box-shadow: 0 0 0 1000px var(--background) inset; }
.input-group { display: flex; align-items: stretch; gap: 8px; }
.input-group > input { flex: 1; min-width: 0; }
.input-group > button { flex-shrink: 0; }

/* 9. BUTTONS -------------------------------------------------
   Default buttons match the outlined reference style.
   Use .button on an anchor for a button-like link.
   Use real disabled buttons; aria-disabled links require JS. */
button, .button, input[type="button"], input[type="submit"], input[type="reset"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 9px 16px;
    font: inherit;
    font-size: .88rem;
    font-weight: 600;
    color: var(--accent);
    background: transparent;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    text-decoration: none;
    line-height: 1.3;
    text-align: center;
    cursor: pointer;
}
:where(button, .button, input[type="button"], input[type="submit"], input[type="reset"]):not(:disabled):not([aria-disabled="true"]):hover { border-color: var(--accent); text-decoration: none; }
.button-primary { border-color: var(--accent); }
.button-danger { color: var(--urgent); }
.button-danger:not(:disabled):not([aria-disabled="true"]):hover { border-color: var(--urgent); }
.button-ghost { border-color: transparent; }
.button-small { min-height: 30px; padding: 5px 9px; font-size: .75rem; }
.button-block { display: flex; width: 100%; }
.button[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 14px; }
.toggle { display: flex; width: 100%; margin-top: 14px; padding: 9px; }
.toggle-icon { display: inline-block; font-size: 1.1rem; line-height: 1; transition: transform .2s; }
.toggle.is-open .toggle-icon, .toggle[aria-expanded="true"] .toggle-icon { transform: rotate(180deg); }

/* 10. STATUS AND FEEDBACK ------------------------------------ */
.status { color: var(--muted); font-size: .75rem; }
.is-urgent, .text-danger { color: var(--urgent); }
.is-success { color: var(--success); }
.is-warning { color: var(--warning); }
.alert { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.alert.is-urgent { border-color: var(--urgent); }
.alert.is-success { border-color: var(--success); }
.alert.is-warning { border-color: var(--warning); }
.alert > :last-child { margin-bottom: 0; }
.badge { display: inline-block; padding: 2px 7px; border: 1px solid var(--line); border-radius: 999px; font-size: .7rem; }
.empty { margin: 0; padding: 24px 10px; color: var(--muted); text-align: center; }
progress, meter { width: 100%; height: 10px; accent-color: var(--accent); }

/* 11. NAVIGATION, DISCLOSURES, AND DIALOGS -------------------- */
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
nav a { padding: 7px 10px; color: var(--muted); border-radius: 8px; }
nav a[aria-current="page"] { color: var(--accent); background: var(--hover); }
details { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
details + details { margin-top: 10px; }
summary { font-weight: 600; cursor: pointer; }
details[open] > summary { margin-bottom: 10px; }
details > :last-child { margin-bottom: 0; }
/* Open modal dialogs with showModal() in your application. */
dialog { width: min(560px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; padding: 16px; color: var(--text); background: var(--background); border: 1px solid var(--line); border-radius: var(--radius-large); }
dialog::backdrop { background: rgba(0, 0, 0, .65); }

/* 12. UTILITIES ---------------------------------------------- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.no-margin { margin: 0; }
.break-anywhere { overflow-wrap: anywhere; }
/* Visually hidden labels that remain available to screen readers. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* 13. SMALL SCREENS ------------------------------------------ */
@media (max-width: 560px) {
    .summary { flex-direction: column; align-items: stretch; }
    .summary-main { justify-content: center; }
    .stats { max-width: none; flex-basis: auto; }
    .grid-2, .grid-3, .form-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
    body { padding: 8px; }
    .card { padding: 12px; }
    button, .button { padding-inline: 12px; }
    .summary-value { font-size: 2.4rem; }
    .stat-value { font-size: .95rem; }
}

/* 14. ACCESSIBILITY AND PRINT -------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media print {
    :root { --background: #fff; --text: #111; --muted: #555; --accent: #174a80; --urgent: #a21c1c; --success: #176539; --warning: #765200; --line: #bbb; --code: #eee; }
    body { min-height: 0; padding: 0; }
    .no-print { display: none !important; }
    .items { display: block; overflow: visible; }
    .item { margin-bottom: 10px; break-inside: avoid; }
    .scroll-area, .table-wrap { max-height: none; overflow: visible; }
    .item.is-clamped:not(.is-expanded) .item-body { max-height: none; overflow: visible; mask-image: none; -webkit-mask-image: none; }
    }
 /* ==========================================================
   STICKY NAVIGATION
   Desktop: links visible, menu button hidden.
   Mobile: menu button visible, links expandable.
   ========================================================== */

.site-nav {
    position: sticky;
    top: 8px;
    z-index: 100;

    padding: 6px;
    background: var(--background, #1e1e1e);
    border: 1px solid var(--line);
    border-radius: 14px;
}

/* Hide the mobile button on desktop. */
.site-nav .site-nav-toggle {
    display: none;
}

/* Visible desktop links. */
.site-nav .site-nav-links {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 4px;

    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
}

.site-nav .site-nav-links a {
    flex-shrink: 0;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--muted);
    font-size: .85rem;
    white-space: nowrap;
    text-decoration: none;
}

.site-nav .site-nav-links a:hover {
    background: var(--hover, rgba(128, 128, 128, .08));
    color: var(--text);
}

.site-nav .site-nav-links a[aria-current="location"] {
    background: var(--hover, rgba(128, 128, 128, .08));
    color: var(--accent);
}

/* Stop section headings from landing beneath the sticky bar. */
main > section[id] {
    scroll-margin-top: 90px;
}

/* Mobile layout. */
@media (max-width: 640px) {
    .site-nav .site-nav-links {
        flex-direction: column;
        align-items: stretch;
        max-height: 65vh;
        overflow-y: auto;
    }

    .site-nav .site-nav-links a {
        padding: 10px 12px;
    }

    /* Only collapse the links when the JS is ready.
       Without JS, navigation remains visible and usable. */
    .site-nav.is-ready .site-nav-toggle {
        display: flex;
        justify-content: space-between;
        width: 100%;
        border-color: transparent;
        background: transparent;
        color: var(--text);
    }

    .site-nav.is-ready:not(.is-open) .site-nav-links {
        display: none;
    }

    .site-nav.is-ready.is-open .site-nav-links {
        margin-top: 6px;
        padding-top: 6px;
        border-top: 1px solid var(--line);
    }
}

@media print {
    .site-nav {
        display: none;
    }   
}

 /* 15. SUBTLE MAKER'S MARK ------------------------------------ */

/* Keep the mark behind content without placing it behind the page. */
body {
    isolation: isolate;
}

.maker-mark {
    position: fixed;
    bottom: 18px;
    left: 18px;
    z-index: -1;

    width: 60px;
    height: 60px;
    object-fit: contain;

    opacity: .25;
    filter: grayscale(1) blur(.5px);

    pointer-events: none;
    user-select: none;
}

@media (max-width: 420px) {
    .maker-mark {
        bottom: 12px;
        left: 12px;
        width: 48px;
        height: 48px;
    }
}

@media print {
    .maker-mark {
        display: none !important;
    }
}

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    border: 0;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line, rgba(128, 128, 128, .35));
}

.divider span {
    width: 6px;
    height: 6px;
    flex-shrink: 0;
    background: var(--accent, #4fa3ff);
    transform: rotate(45deg);
    opacity: .7;
}

/* Larger animated divider — independent of .divider */
.divider-motion {
    display: flex;
    align-items: center;
    gap: 18px;
    margin: 28px 0;
    min-height: 20px;
    border: 0;
}

.divider-motion::before,
.divider-motion::after {
    content: "";
    flex: 1;
    height: 2px;
    background: var(--line, rgba(128, 128, 128, .35));
    animation: divider-motion-pulse 4s ease-in-out infinite;
}

.divider-motion span {
    display: block;
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    border: 2px solid var(--accent, #4fa3ff);
    border-radius: 2px;
    transform: rotate(45deg);
    animation: divider-motion-turn 8s ease-in-out infinite;
}

@keyframes divider-motion-pulse {
    0%, 100% { opacity: .45; }
    50%      { opacity: 1; }
}

@keyframes divider-motion-turn {
    0%, 35%   { transform: rotate(45deg); }
    65%, 100% { transform: rotate(225deg); }
}

/* Keep it static when reduced motion is preferred. */
@media (prefers-reduced-motion: reduce) {
    .divider-motion::before,
    .divider-motion::after,
    .divider-motion span {
        animation: none;
    }
}
