/* base.css — Tokens, reset, buttons and fields shared by every page */

/* --- 1. DESIGN TOKENS --- */
:root {
    /* Backgrounds, darkest first */
    --abyss:        #030408;   /* edges */
    --night:        #05070d;
    --night-raised: #090d15;   /* centre of the gradient */

    /* Accent */
    --glow:         #c08b3e;   /* gold */
    --glow-rgb:     192, 139, 62;
    --glow-soft:    #d9a65a;   /* lighter gold: hovers, portrait titles */
    --star-rgb:     201, 172, 124;   /* borders and dots */

    /* Text: cream rather than pure white, which is too harsh on this background. */
    --text-bright:  #f6f1e7;                    /* headings */
    --text:         rgba(246, 241, 231, .72);   /* body */
    --text-muted:   rgba(240, 232, 216, .45);   /* secondary */

    /* Minimum size of a visitor's message. Long messages are clamped, never shrunk. */
    --message-size: .9444rem;

    /* Surfaces */
    --veil:         rgba(255, 248, 235, .04);   /* fields and cards */
    --rule:         rgba(201, 172, 124, .18);   /* separators */

    /* Lightened red, readable on the dark background. */
    --error:        #ff9b8a;

    /* Fonts are self-hosted (no third-party font service, for GDPR). */
    --sans:    "DIN Condensed", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --display: "Block Berthold", var(--sans);

    /* Rhythm */
    --radius:      10px;
    --radius-sm:   8px;
    --gutter:      1.5rem;   /* horizontal page margin */
}

/* Font faces. */
@font-face {
    font-family: "DIN Condensed";
    src: url("../fonts/din-condensed/DINCond-MediumAlternate.woff2") format("woff2");
    size-adjust: 115%;
    font-weight: 500;
    font-style: normal;
    font-display: block;   /* no fallback font swap */
}

@font-face {
    font-family: "DIN Condensed";
    src: url("../fonts/din-condensed/DINCond-BoldAlternate.woff2") format("woff2");
    size-adjust: 115%;
    font-weight: 700;
    font-style: normal;
    font-display: block;   /* no fallback font swap */
}

@font-face {
    font-family: "Block Berthold";
    src: url("../fonts/blockberthold/BlockBertholdBQ-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: block;   /* no fallback font swap */
}

/* --------------------------------------------------------------------------
   2. RESET
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    /* 18px root. A percentage, so the browser's text size setting still applies. */
    font-size: 112.5%;

    /* No automatic text inflation on iOS rotation. */
    -webkit-text-size-adjust: 100%;

    /* No tap highlight on mobile. */
    -webkit-tap-highlight-color: transparent;

    /* Dark variants of native widgets (checkboxes, scrollbars, pickers). */
    color-scheme: dark;
}

body {
    margin: 0;
    font-family: var(--sans);
    font-weight: 500;  /* Medium: the only regular weight of DIN Condensed here */
    font-size: 1rem;   /* 16px, in rem */
    line-height: 1.6;
    color: var(--text);
    background: var(--abyss);
}

/* Explicit, so no display rule can override [hidden]. */
[hidden] {
    display: none !important;
}

img,
svg {
    max-width: 100%;
}

/* Visually hidden, 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;
}

/* --- 3. BUTTONS --- */
.button {
    display: block;
    width: 100%;
    padding: 1rem 1.25rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    /* Bold capitals, slightly tracked. */
    font-family: var(--sans);
    font-size: .87rem;   /* 18px after the font's size-adjust of 115% */
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    text-align: center;
    cursor: pointer;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}

/* Primary action: solid fill. */
.button--primary {
    background: var(--glow);
    border-color: var(--glow);
    color: #1a1206;
}

.button--primary:hover {
    background: #d9a65a;
    border-color: #d9a65a;
}

/* Secondary action: outline. */
.button--secondary {
    background: var(--veil);
    border-color: rgba(var(--star-rgb), .22);
    color: var(--text-bright);
}

.button--secondary:hover {
    background: rgba(var(--star-rgb), .1);
    border-color: rgba(var(--glow-rgb), .45);
}

.button:focus-visible {
    outline: 2px solid var(--glow);
    outline-offset: 3px;
}

/* "Back" link under the primary button. */
.back-link {
    display: block;
    width: 100%;
    margin-top: .9rem;
    padding: .4rem;
    background: none;
    border: 0;
    font-family: var(--sans);
    font-size: .78rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-muted);
    cursor: pointer;
    transition: color .18s ease;
}

.back-link:hover {
    color: rgba(var(--glow-rgb), .9);
}

/* --- 4. INPUT FIELDS --- */
.field {
    display: block;
    width: 100%;
    padding: .85rem .95rem;
    background: var(--veil);
    border: 1px solid rgba(var(--star-rgb), .18);
    border-radius: var(--radius);
    font-family: var(--sans);
    font-size: 1rem;   /* 16px minimum: below that iOS zooms into the field on focus */
    line-height: 1.5;
    color: var(--text-bright);
    transition: border-color .18s ease, background-color .18s ease;
}

.field:focus {
    outline: none;
    border-color: rgba(var(--glow-rgb), .55);
    background: rgba(var(--star-rgb), .06);
}

.field::placeholder {
    color: var(--text-muted);
}

.field--textarea {
    min-height: 11rem;
    resize: vertical;
}

.field-label {
    display: block;
    margin-bottom: .45rem;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* Invalid field: border only. */
.field[aria-invalid="true"] {
    border-color: rgba(255, 155, 138, .6);
}

.field[aria-invalid="true"]:focus {
    border-color: var(--error);
}

.consent input[aria-invalid="true"] {
    outline: 2px solid rgba(255, 155, 138, .65);
    outline-offset: 2px;
}

/* Error message under a field, faded in. */
.field-error {
    margin: .4rem 0 0;
    font-size: .8rem;
    line-height: 1.45;
    color: var(--error);
    animation: error-in .25s ease both;
}

@keyframes error-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .field-error {
        animation: none;
    }
}

/* Styled open list of a <select class="field">, instead of the system's. */
select.field {
    appearance: none;
}

/* Pointer devices only. */
@supports (appearance: base-select) {
@media (hover: hover) and (pointer: fine) {
    select.field,
    select.field::picker(select) {
        appearance: base-select;
    }

    /* Flex row, so the selected text is vertically centred. */
    select.field {
        display: flex;
        align-items: center;
    }

    select.field::picker-icon {
        display: none;
    }

    select.field::picker(select) {
        max-height: min(20rem, 60vh);
        overflow-y: auto;
        margin-top: 6px;
        padding: 6px;
        background: rgba(9, 11, 17, .97);
        border: 1px solid rgba(var(--glow-rgb), .55);
        border-radius: 6px;
        box-shadow: 0 18px 50px rgba(0, 0, 0, .55);
        scrollbar-color: rgba(var(--glow-rgb), .45) transparent;
        scrollbar-width: thin;
    }

    select.field option {
        padding: 8px 12px;
        border-radius: 4px;
        background: transparent;
        color: var(--text);
        font-size: .82rem;
        letter-spacing: .04em;
        cursor: pointer;
    }

    select.field option:hover,
    select.field option:focus-visible {
        outline: none;
        background: rgba(var(--glow-rgb), .12);
        color: var(--text-bright);
    }

    select.field option:checked {
        color: var(--glow-soft);
    }

    select.field option::checkmark {
        color: var(--glow);
    }

    /* Group titles in the site's small capitals. */
    select.field optgroup {
        padding: 10px 12px 4px;
        font-size: .66rem;
        font-weight: 600;
        letter-spacing: .18em;
        text-transform: uppercase;
        color: var(--text-muted);
    }

    select.field optgroup option {
        text-transform: none;
        font-weight: 400;
    }
}
}

/* --------------------------------------------------------------------------
   5. INFO NOTE
   -------------------------------------------------------------------------- */
.note {
    display: flex;
    gap: .6rem;
    align-items: flex-start;
    margin: 1.1rem 0 0;
    font-size: .8rem;
    line-height: 1.5;
    color: var(--text-muted);
}

.note__icon {
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
    margin-top: .18rem;
    color: var(--glow);
}

/* --------------------------------------------------------------------------
   6. CONSENT CHECKBOX
   -------------------------------------------------------------------------- */
.consent {
    display: flex;
    gap: .7rem;
    align-items: flex-start;
    margin-top: 1.4rem;
    font-size: .8rem;
    line-height: 1.5;
    color: var(--text-muted);
    cursor: pointer;
}

.consent__more {
    margin-left: .25rem;
    color: var(--glow-soft);
    white-space: nowrap;
}

.consent input[type="checkbox"] {
    flex: 0 0 auto;
    width: 1.05rem;
    height: 1.05rem;
    margin: .18rem 0 0;
    accent-color: var(--glow);
}
