/* Rebel theme: strong and stoic. See docs/ui-design-system.md. Light is the base, dark follows the device setting. */
@font-face { font-family: "Inter"; src: url("/fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/fonts/montserrat-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("/fonts/montserrat-900.woff2") format("woff2"); font-weight: 900; font-display: swap; }

:root {
    color-scheme: light;
    --rebel-canvas: #f5f3ee;
    --rebel-surface: #fff;
    --rebel-surface-muted: #ece9e2;
    --rebel-graphite: #ece9e2;
    --rebel-ink: #141312;
    --rebel-muted: #5f5b55;
    --rebel-line: #ddd8cf;
    --rebel-control-line: #8a857c;
    --rebel-primary: #141312;
    --rebel-primary-hover: #34312d;
    --rebel-on-primary: #f5f3ee;
    --rebel-white: var(--rebel-ink);
    --rebel-accent: #b8261f;
    --rebel-accent-hover: #9e1f19;
    --rebel-danger: #b8261f;
    --rebel-accent-bright: var(--rebel-ink);
    --rebel-accent-soft: var(--rebel-surface-muted);
    --rebel-focus: #1a5fb4;
    --rebel-warning-ink: #7a4b00;
    --rebel-warning-surface: #fbebcf;
    --rebel-success-ink: #1e6b3e;
    --rebel-success-surface: #ddf2e4;
    --rebel-backdrop: #141312b3;
    --rebel-logo-filter: none;
    --rebel-font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --rebel-display: "Montserrat", "Arial Black", var(--rebel-font);
    --rebel-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    --rebel-radius: 0;
    --rebel-control-radius: 0;
    --rebel-frame: 1px solid var(--rebel-line);
    --rebel-panel-shadow: none;
    --rebel-gutter: clamp(1rem, 3vw, 2rem);
    --rebel-content: 72rem;
    --rebel-control-height: 2.75rem;
    --rebel-motion-fast: 160ms;
    --rebel-motion-view: 320ms;
    --rebel-motion-ease: cubic-bezier(.2, .7, .25, 1);
    font: 100%/1.5 var(--rebel-font);
    background: var(--rebel-canvas);
    color: var(--rebel-ink);
}
/* Dark tokens: follow the device unless a page forces light (data-theme="light" on <html>), or force them with
   data-theme="dark". Only the public site sets data-theme. Keep both blocks identical. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --rebel-canvas: #0a0a0a;
        --rebel-surface: #161514;
        --rebel-surface-muted: #1f1e1c;
        --rebel-graphite: #121110;
        --rebel-ink: #f2efe8;
        --rebel-muted: #a8a39a;
        --rebel-line: #2a2826;
        --rebel-control-line: #6e6a63;
        --rebel-primary: #f2efe8;
        --rebel-primary-hover: #fff;
        --rebel-on-primary: #0a0a0a;
        --rebel-accent: #d7322b;
        --rebel-accent-hover: #e84a43;
        --rebel-danger: #ff6b63;
        --rebel-focus: #78caff;
        --rebel-warning-ink: #f2b66d;
        --rebel-warning-surface: #2e2414;
        --rebel-success-ink: #8fd9ae;
        --rebel-success-surface: #14281e;
        --rebel-backdrop: #000000d9;
        --rebel-logo-filter: invert(1);
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --rebel-canvas: #0a0a0a;
    --rebel-surface: #161514;
    --rebel-surface-muted: #1f1e1c;
    --rebel-graphite: #121110;
    --rebel-ink: #f2efe8;
    --rebel-muted: #a8a39a;
    --rebel-line: #2a2826;
    --rebel-control-line: #6e6a63;
    --rebel-primary: #f2efe8;
    --rebel-primary-hover: #fff;
    --rebel-on-primary: #0a0a0a;
    --rebel-accent: #d7322b;
    --rebel-accent-hover: #e84a43;
    --rebel-danger: #ff6b63;
    --rebel-focus: #78caff;
    --rebel-warning-ink: #f2b66d;
    --rebel-warning-surface: #2e2414;
    --rebel-success-ink: #8fd9ae;
    --rebel-success-surface: #14281e;
    --rebel-backdrop: #000000d9;
    --rebel-logo-filter: invert(1);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--rebel-canvas); }
[hidden] { display: none !important; }
.wrap { width: min(var(--rebel-content), calc(100% - 2 * var(--rebel-gutter))); margin-inline: auto; }
a { color: var(--rebel-ink); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
    outline: 3px solid var(--rebel-focus);
    outline-offset: 3px;
}
h1, h2, p { margin-top: 0; }
h1 {
    font: 900 clamp(1.75rem, 4.5vw, 2.6rem)/1.05 var(--rebel-display);
    text-transform: uppercase;
    letter-spacing: 0;
    margin-bottom: 0;
    overflow-wrap: anywhere;
}
h2 { font-size: 1.25rem; line-height: 1.3; font-weight: 650; letter-spacing: -.01em; margin-bottom: .6rem; }
small { display: block; color: var(--rebel-muted); font-size: .875rem; }
label { display: block; font-size: .875rem; font-weight: 600; color: var(--rebel-muted); margin-bottom: .4rem; }

input, button, select, textarea, .button-link {
    font: inherit;
    border: 1px solid var(--rebel-control-line);
    border-radius: var(--rebel-control-radius);
    min-height: var(--rebel-control-height);
    padding: .5rem .875rem;
    background-color: var(--rebel-surface);
    color: var(--rebel-ink);
}
input { width: 10rem; max-width: 100%; }
button, .button-link {
    cursor: pointer;
    text-decoration: none;
    font-weight: 700;
    border: 2px solid var(--rebel-primary);
    background-color: var(--rebel-primary);
    color: var(--rebel-on-primary);
}
button:hover:not(:disabled), .button-link:hover {
    background-color: var(--rebel-primary-hover);
    border-color: var(--rebel-primary-hover);
}
button:disabled { opacity: .6; cursor: wait; }
.button-link { display: inline-flex; align-items: center; }
.secondary { color: var(--rebel-ink); background-color: transparent; border-color: var(--rebel-control-line); }
.secondary:hover:not(:disabled) { background-color: var(--rebel-surface-muted); border-color: var(--rebel-ink); }
.danger { background-color: var(--rebel-accent); border-color: var(--rebel-accent); color: #fff; }
.danger:hover:not(:disabled) { background-color: var(--rebel-accent-hover); border-color: var(--rebel-accent-hover); }
select {
    max-width: 100%;
    padding-right: 2.2rem;
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--rebel-muted) 50%),
        linear-gradient(135deg, var(--rebel-muted) 50%, transparent 50%);
    background-position: calc(100% - 16px) center, calc(100% - 11px) center;
    background-size: 5px 5px;
    background-repeat: no-repeat;
}
.panel, .search, #results, #owner-settings, #changeovers {
    background: var(--rebel-surface);
    border: var(--rebel-frame);
    border-radius: var(--rebel-radius);
    box-shadow: var(--rebel-panel-shadow);
    padding: clamp(1rem, 3vw, 1.5rem);
}

.mast { background-color: var(--rebel-canvas); color: var(--rebel-ink); border-bottom: 2px solid var(--rebel-ink); }
.mast .wrap { display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; align-items: center; min-height: 4rem; padding-block: .5rem; }
.wordmark { display: inline-flex; align-items: center; color: inherit; text-decoration: none; }
.wordmark img { display: block; height: clamp(2.5rem, 7vw, 3rem); width: auto; filter: var(--rebel-logo-filter); }
.mast a { color: var(--rebel-ink); font-size: .9375rem; font-weight: 600; }
.mast nav { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem 1.25rem; }
.mast nav button { background: transparent; color: var(--rebel-ink); border: 1px solid var(--rebel-control-line); min-height: 2.5rem; padding: .25rem .8rem; font-size: .875rem; }
.mast nav button:hover:not(:disabled) { background: var(--rebel-surface-muted); border-color: var(--rebel-ink); }

.main-nav a { display: inline-flex; align-items: center; min-height: 2.75rem; text-decoration: none; color: var(--rebel-muted); }
.main-nav a:hover { color: var(--rebel-ink); }
.main-nav a[aria-current="page"] { color: var(--rebel-ink); box-shadow: inset 0 -3px 0 var(--rebel-ink); }
@media (max-width: 560px) {
    .mast .wrap { padding-block: .5rem 0; }
    .main-nav { width: 100%; gap: 0 1.25rem; }
}

/* Page titles are plain: one strong heading, no banner. */
.page-heading { margin-bottom: 1.25rem; }
.page-heading a { color: var(--rebel-ink); }
.sign-in { padding-block: clamp(2rem, 10vw, 5rem); }
.sign-in .panel { max-width: 32rem; margin-inline: auto; border-top: 3px solid var(--rebel-ink); }
.sign-in h1 { margin-bottom: .85rem; }
.sign-in p { color: var(--rebel-muted); }
.sign-in [role="alert"] { color: var(--rebel-danger); font-weight: 700; }

@media (prefers-reduced-motion: no-preference) {
    @view-transition { navigation: auto; }
    ::view-transition-old(root) { animation-duration: var(--rebel-motion-fast); }
    ::view-transition-new(root) {
        animation: rebel-view-in var(--rebel-motion-view) var(--rebel-motion-ease) both;
    }
    button, .button-link {
        transition: background-color var(--rebel-motion-fast), border-color var(--rebel-motion-fast),
            transform var(--rebel-motion-fast) var(--rebel-motion-ease);
    }
    button:active:not(:disabled), .button-link:active { transform: translateY(1px); }
}

@keyframes rebel-view-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes rebel-instrument-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
