/* ==========================================================================
   Paul K Saunders — Client Toolkit
   Shared stylesheet for all 4 Keys Program resources.
   Add new tools by linking this file and reusing the patterns below.
   ========================================================================== */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --gold: #D4A843;
    --gold-light: #E8C872;
    --dark: #0F0F0F;
    --dark-surface: #1A1A1A;
    --dark-card: #222222;
    --text-primary: #F5F5F5;
    --text-secondary: #A0A0A0;
    --text-muted: #6B6B6B;
    --radius: 12px;
    --good: #6FBF73;
    --warn: #D9A441;
    --bad: #C96A5B;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Verdana', Geneva, sans-serif;
    background: var(--dark);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Navigation ── */
nav {
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(212, 168, 67, 0.1);
    background: rgba(15, 15, 15, 0.9);
    flex-wrap: wrap;
    gap: 1rem;
}

.nav-logo {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gold);
    text-decoration: none;
    letter-spacing: 0.02em;
}

.nav-logo span {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.nav-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ── Layout ── */
.wrap {
    max-width: 1000px;
    margin: 0 auto;
    padding: 3rem 2rem 5rem;
}

.wrap-wide { max-width: 1240px; }

.page-head { margin-bottom: 2.5rem; }

.eyebrow {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 0.9rem;
}

h1 {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.lede {
    font-size: 1.02rem;
    color: var(--text-secondary);
    line-height: 1.75;
    max-width: 700px;
}

.muted {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.7;
}

/* ── Cards & panels ── */
.card {
    background: var(--dark-card);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.card-gold { border-color: rgba(212, 168, 67, 0.28); }

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.section-head h2 { margin-bottom: 0; }

.section-key {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    border-radius: 100px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: transparent;
    color: var(--text-primary);
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.btn:hover {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.05);
}

.btn-gold {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--dark);
}

.btn-gold:hover {
    background: var(--gold-light);
    border-color: var(--gold-light);
    transform: translateY(-1px);
}

.btn svg { width: 15px; height: 15px; }

/* ── Form controls ──────────────────────────────────────────────────────────
   Wrapped in :where() so this contributes ZERO specificity. Component classes
   like .cell and .cin in the toolkit tools then override it cleanly without
   needing !important. Covers every text-like type — omitting one (email, url)
   drops that field back to the browser default, which on a dark page renders
   as a glaring white box.
   ------------------------------------------------------------------------- */
:where(
    input[type="text"],
    input[type="email"],
    input[type="url"],
    input[type="tel"],
    input[type="password"],
    input[type="search"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    input[type="datetime-local"],
    input[type="month"],
    input:not([type]),
    select,
    textarea
) {
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    background: var(--dark-surface);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    color: var(--text-primary);
    padding: 0.8rem 1rem;
    width: 100%;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
    -webkit-appearance: none;
    appearance: none;
}

:where(input, select, textarea)::placeholder { color: rgba(255, 255, 255, 0.22); }

:where(input, select, textarea):hover { border-color: rgba(255, 255, 255, 0.26); }

:where(input, select, textarea):focus {
    outline: none;
    border-color: var(--gold);
    background: #1F1B12;
    box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.16);
}

/* Native dropdown arrow, drawn so it matches the dark theme */
:where(select) {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A0A0A0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    background-size: 15px;
    padding-right: 2.5rem;
    cursor: pointer;
}

/* Date pickers ship a near-invisible dark indicator on a dark field */
:where(input[type="date"], input[type="month"], input[type="time"])::-webkit-calendar-picker-indicator {
    filter: invert(0.7) sepia(1) saturate(3) hue-rotate(5deg);
    cursor: pointer;
}

/* Spinners add clutter and mis-scroll values on long forms */
:where(input[type="number"])::-webkit-outer-spin-button,
:where(input[type="number"])::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
:where(input[type="number"]) { -moz-appearance: textfield; }

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

.field-row {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.field-row > div { flex: 1 1 200px; }

/* ── Tables ── */
.table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius);
    background: var(--dark-card);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold);
    padding: 0.9rem 1rem;
    border-bottom: 1px solid rgba(212, 168, 67, 0.2);
    background: rgba(212, 168, 67, 0.04);
    white-space: nowrap;
}

tbody td {
    padding: 0.65rem 1rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody th[scope="row"] {
    text-align: left;
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
}

/* ── Status pills ── */
.pill {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.25rem 0.7rem;
    border-radius: 100px;
    border: 1px solid currentColor;
}

.pill-good { color: var(--good); }
.pill-warn { color: var(--warn); }
.pill-bad  { color: var(--bad); }

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(200%);
    background: var(--gold);
    color: var(--dark);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 100px;
    z-index: 500;
    transition: transform 0.3s ease;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.toast.show { transform: translateX(-50%) translateY(0); }

/* ── Footer ── */
footer {
    padding: 2.5rem 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

footer p {
    color: var(--text-muted);
    font-size: 0.8rem;
}

footer a { color: var(--gold); }

/* ── Responsive ── */
@media (max-width: 680px) {
    nav { padding: 1rem 1.25rem; }
    .wrap { padding: 2rem 1.25rem 3.5rem; }
    .card { padding: 1.5rem 1.25rem; }

    /* Uppercase labels at 11.5px are legible on a monitor and not on a phone */
    .section-key,
    .eyebrow,
    .nav-logo span,
    .pill { font-size: 0.78rem; }
}

/* ── Print ── */
@media print {
    :root {
        --dark: #FFFFFF;
        --dark-surface: #FFFFFF;
        --dark-card: #FFFFFF;
        --text-primary: #111111;
        --text-secondary: #333333;
        --text-muted: #666666;
        --gold: #8A6A15;
        --gold-light: #8A6A15;
    }

    body { background: #fff; color: #111; }

    nav, footer, .no-print { display: none !important; }

    .wrap { padding: 0; max-width: none; }

    .card {
        border: 1px solid #ccc;
        break-inside: avoid;
        page-break-inside: avoid;
        margin-bottom: 1rem;
        padding: 1.25rem;
    }

    .table-wrap { border: 1px solid #ccc; overflow: visible; }

    thead th { background: #f2f2f2; color: #111; border-bottom: 1px solid #999; }

    tbody td, tbody th[scope="row"] { border-bottom: 1px solid #e2e2e2; }

    input, select, textarea {
        border: 1px solid #bbb !important;
        background: #fff !important;
        color: #111 !important;
    }

    a { text-decoration: none; color: #111; }
}
