/* public/pages.css
   The content pages: how to play, terms, privacy, status.

   These are documents, not the playfield. style.css is deliberately not loaded
   here — it locks the body to the viewport with `overflow: hidden`, disables
   text selection and kills `touch-action`, all correct for a canvas game and
   all wrong for something you read and scroll. Tokens come from tokens.css so
   the two surfaces still share one palette. */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    background:
        radial-gradient(1100px 620px at 12% -10%, rgba(41, 211, 160, 0.10), transparent 60%),
        radial-gradient(900px 560px at 108% 110%, rgba(64, 132, 214, 0.12), transparent 62%),
        var(--bg);
    background-attachment: fixed;
    color: var(--ink);
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
        Apple Color Emoji, Segoe UI Emoji;
    line-height: 1.65;
    -webkit-text-size-adjust: 100%;
}

.doc {
    max-width: 760px;
    margin: 0 auto;
    padding: 24px 20px 80px;
}

/* --- site chrome ---------------------------------------------------------- */

.site-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 18px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--card-border);
    background: rgba(11, 14, 19, 0.72);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.site-nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
}

.site-nav a:hover,
.site-nav a[aria-current='page'] {
    color: var(--ink);
}

.site-nav .brand {
    font-weight: 800;
    font-size: 16px;
    color: var(--ink);
    margin-right: auto;
    letter-spacing: -0.01em;
}

.site-nav .nav-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 18px;
}

/* Hidden on wide screens, and hidden everywhere until `nav.js` says it works —
   see the note in that file. The links stay visible without script. */
.site-nav .nav-burger {
    display: none;
    background: none;
    border: 0;
    color: var(--muted);
    font-size: 22px;
    line-height: 1;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
}

.site-nav .nav-burger:hover,
.site-nav .nav-burger:focus-visible {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 640px) {
    .site-nav.nav-js .nav-burger {
        display: block;
    }

    .site-nav.nav-js .nav-links {
        display: none;
    }

    /* Open: a column under the bar, full width, with targets big enough to hit
       with a thumb rather than links spaced for a mouse. */
    .site-nav.nav-js.nav-open .nav-links {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        flex-basis: 100%;
        margin-top: 10px;
        border-top: 1px solid var(--card-border);
    }

    .site-nav.nav-js.nav-open .nav-links a {
        padding: 12px 4px;
        font-size: 15px;
        border-bottom: 1px solid var(--card-border);
    }

    .site-nav.nav-js.nav-open .nav-links a:last-child {
        border-bottom: 0;
    }
}

.site-footer {
    border-top: 1px solid var(--card-border);
    margin-top: 48px;
    padding: 20px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.site-footer a {
    color: var(--muted);
}

/* --- document type -------------------------------------------------------- */

.doc h1 {
    font-size: clamp(28px, 5vw, 40px);
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin: 28px 0 8px;
    background: linear-gradient(100deg, var(--ink) 10%, var(--accent) 95%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.doc h2 {
    font-size: 22px;
    margin: 40px 0 10px;
    letter-spacing: -0.01em;
}

.doc h3 {
    font-size: 17px;
    margin: 26px 0 6px;
}

.doc p,
.doc li {
    color: rgba(242, 242, 242, 0.86);
}

.doc a {
    color: var(--accent);
}

.doc .lede {
    font-size: 18px;
    color: var(--muted);
    margin-top: 0;
}

.doc ul,
.doc ol {
    padding-left: 22px;
}

.doc li {
    margin: 6px 0;
}

.doc code,
.doc kbd {
    font-family: ui-monospace, monospace;
    font-size: 0.9em;
}

kbd {
    display: inline-block;
    min-width: 26px;
    padding: 2px 7px;
    margin: 0 1px;
    text-align: center;
    border: 1px solid var(--card-border);
    border-bottom-width: 2px;
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--ink);
}

.doc table {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    font-size: 15px;
}

.doc th,
.doc td {
    text-align: left;
    padding: 9px 10px;
    border-bottom: 1px solid var(--card-border);
    vertical-align: top;
}

.doc th {
    color: var(--muted);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.panel-note {
    background: var(--surface-2);
    border: 1px solid var(--card-border);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin: 20px 0;
}

.panel-note.warn {
    border-left-color: var(--warn);
}

/* `a.cta`, not `.cta`: `.doc a` sets the accent colour and, at one class plus
   one element, outranks a bare class — which painted the label accent-green on
   an accent-green button and left the CTA looking like an empty rectangle. */
a.cta {
    display: inline-block;
    margin: 18px 0 8px;
    padding: 12px 22px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #0b0e13;
    font-weight: 700;
    text-decoration: none;
}

a.cta:hover {
    filter: brightness(1.08);
}

.updated {
    color: var(--muted);
    font-size: 13px;
}

/* --- status page ---------------------------------------------------------- */

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin: 20px 0;
}

.stat {
    background: var(--card);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
}

.stat dt {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
}

.stat dd {
    margin: 4px 0 0;
    font-size: 24px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    font-family: ui-monospace, monospace;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 14px;
}

.badge::before {
    content: '';
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: currentColor;
}

.badge.ok { background: var(--accent-dim); color: var(--accent); }
.badge.draining { background: rgba(255, 204, 0, 0.14); color: var(--warn); }
.badge.down { background: rgba(255, 90, 90, 0.14); color: var(--danger); }

/* --- settings page -------------------------------------------------------- */

.settings-group h2 {
    /* Same rhythm as `.doc h2`, which does not apply inside the form. */
    margin: 32px 0 4px;
    font-size: 20px;
}

.setting {
    display: grid;
    /* Label and control on one line, help text underneath and full width, so a
       long explanation never squeezes the control it belongs to. */
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 4px 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--card-border);
}

.setting-label {
    font-weight: 600;
    grid-column: 1;
}

.setting-field {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-help {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    max-width: 62ch;
}

/* A disabled control still says what it is and what it would do — it is only
   dimmed, so the reason it is unavailable (the switch above it) stays legible. */
.setting.is-disabled .setting-label,
.setting.is-disabled .setting-help {
    opacity: 0.5;
}

/* Lives inside `.setting-field`, beside the slider. As a grid item of its own
   it shared a cell with the control and printed on top of it. Tabular figures
   so the width does not jitter while the slider is dragged. */
.setting-value {
    color: var(--muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    min-width: 4ch;
    text-align: right;
}

.setting input[type="text"],
.setting select {
    background: var(--surface-2);
    color: var(--ink);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font: inherit;
    min-width: 12ch;
}

.setting input[type="range"] {
    width: 180px;
    accent-color: var(--accent);
}

.setting input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--accent);
}

.setting input:focus-visible,
.setting select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn-secondary {
    background: var(--card);
    color: var(--ink);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 9px 18px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.btn-secondary:hover {
    border-color: var(--accent);
}

@media (max-width: 560px) {
    .setting {
        grid-template-columns: 1fr;
    }

    .setting-field {
        grid-column: 1;
        grid-row: auto;
        justify-self: start;
    }
}

/* --- contact form --------------------------------------------------------- */

.contact-form {
    margin: 24px 0;
}

.contact-form fieldset {
    border: 0;
    padding: 0;
    margin: 0 0 18px;
}

.contact-form legend,
.contact-form .field > label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

.kind-picker label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 4px 18px 4px 0;
    cursor: pointer;
}

.contact-form input[type="radio"],
.contact-form input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.contact-form .field {
    margin: 0 0 18px;
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
    display: block;
    width: 100%;
    background: var(--surface-2);
    color: var(--ink);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font: inherit;
}

.contact-form textarea {
    resize: vertical;
    min-height: 96px;
}

.contact-form input:focus-visible,
.contact-form textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.contact-form [aria-invalid="true"] {
    border-color: var(--danger);
}

.contact-form .optional {
    font-weight: 400;
    color: var(--muted);
    font-size: 13px;
    margin-left: 6px;
}

.contact-form .check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    cursor: pointer;
}

.field-help {
    margin: 6px 0;
    color: var(--muted);
    font-size: 13px;
}

/* Empty until the server or the page has something to say, and then red. No
   reserved height: a gap under every field for an error most people never see
   makes the form look broken. */
.field-error {
    margin: 6px 0 0;
    color: var(--danger);
    font-size: 14px;
}

.field-error:empty {
    display: none;
}

.diag-preview {
    margin: 6px 0 0;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

.diag-preview.is-off {
    opacity: 0.35;
    text-decoration: line-through;
}

/* Off-screen rather than display:none — some bots skip fields that are not
   rendered at all. aria-hidden and tabindex=-1 keep people out of it. */
.hp {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.btn-primary {
    background: var(--accent);
    color: #0b0e13;
    border: 0;
    border-radius: var(--radius-sm);
    padding: 11px 26px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.btn-primary:hover {
    filter: brightness(1.08);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: progress;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}
