/*
 * The Register, site-wide.
 *
 * WikiTrademarks reads like the official record it is built on: warm paper,
 * navy ink, ruled lines instead of floating cards, mono for anything an office
 * would stamp (serials, dates, classes), and ink stamps for status. One blue
 * means "you can click this". Gold appears only as a highlighter on the part
 * of a name that matched.
 *
 * Type: Public Sans (the US government's own typeface, from the US Web Design
 * System) for text, Newsreader for headings, IBM Plex Mono for record data.
 *
 * How it applies: the head script puts class "reg" on <html> and sets
 * data-theme to "paper" (day) or "ink" (night ledger). Everything below is
 * scoped to html.reg, so the classic dark theme is untouched until the switch
 * flips. Most pages are still written with the old Tailwind dark utilities;
 * section 3 maps those onto the register tokens, so every page moves at once
 * and pages can then be rebuilt with r- components one at a time.
 */

/* ---------- 1. Tokens ---------- */
html.reg {
    --paper: #f3efe4;
    --paper-2: #eae4d5;
    --paper-3: #ddd5c2;
    --sheet: #fbf9f4;
    --ink: #0e1726;
    --ink-2: #33405a;
    --ink-3: #5a6275;
    --ink-4: #868b98;
    --rule: rgba(14, 23, 38, .14);
    --rule-2: rgba(14, 23, 38, .3);
    --rule-ink: rgba(14, 23, 38, .9);
    --blue: #1e43c2;
    --blue-ink: #132f8f;
    --blue-tint: #e2e7f4;
    --live: #1c6b3e;
    --live-tint: #e0ebe1;
    --pending: #8a5a0d;
    --pending-tint: #f2e6cc;
    --dead: #a1261c;
    --dead-tint: #f3dfda;
    --mark: rgba(228, 176, 52, .5);
    --on-ink: #f3efe4;
    --foot-bg: #0e1726;
    --foot-fg: #f3efe4;
    --press: 0 3px 0 0 var(--blue);
    --f-display: 'Newsreader', 'Iowan Old Style', Georgia, serif;
    --f-text: 'Public Sans', 'Helvetica Neue', Arial, sans-serif;
    --f-mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
    color-scheme: light;

    /* Retire the old surface system's glow, gradients and soft shadows. */
    --wt-accent: #1e43c2;
    --wt-glow: transparent;
    --wt-card-radius: 3px;
    --wt-card-shadow: none;
    --wt-btn-shadow: none;
    --wt-head: transparent;
    --wt-row-hover: var(--paper-2);
    --wt-nav-shadow: 0 1px 0 0 var(--rule);
    --wt-card-border-hover: var(--ink);
}

html.reg[data-theme="ink"] {
    --paper: #0c1322;
    --paper-2: #151f33;
    --paper-3: #1e2a42;
    --sheet: #101929;
    --ink: #ece6d7;
    --ink-2: #c6c0b1;
    --ink-3: #959baa;
    --ink-4: #6f7686;
    --rule: rgba(236, 230, 215, .12);
    --rule-2: rgba(236, 230, 215, .26);
    --rule-ink: rgba(236, 230, 215, .7);
    --blue: #93aeff;
    --blue-ink: #bccbff;
    --blue-tint: rgba(147, 174, 255, .12);
    --live: #6cc995;
    --live-tint: rgba(108, 201, 149, .12);
    --pending: #e3aa52;
    --pending-tint: rgba(227, 170, 82, .13);
    --dead: #ff8a7e;
    --dead-tint: rgba(255, 138, 126, .12);
    --mark: rgba(228, 176, 52, .32);
    --on-ink: #0c1322;
    --foot-bg: #070c16;
    --foot-fg: #ece6d7;
    color-scheme: dark;
}

/* ---------- 2. Base ---------- */
html.reg body {
    background: var(--paper) !important;
    color: var(--ink);
    font-family: var(--f-text);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}
html.reg ::selection { background: var(--mark); color: var(--ink); }
html.reg body::before { display: none !important; }
html.reg :is(a, button, [tabindex]):focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 2px; }

/* Headings: Newsreader for anything a reader scans for, set tight like a paper of record. */
html.reg main :is(h1, h2, h3):not(.uppercase) {
    font-family: var(--f-display);
    font-weight: 500;
    letter-spacing: -.015em;
    font-optical-sizing: auto;
}
html.reg main h1:not(.uppercase) { font-weight: 500; letter-spacing: -.022em; line-height: 1.04; }
html.reg main h1.text-2xl, html.reg main h1.text-3xl { font-size: 2.25rem; }
@media (min-width: 768px) {
    html.reg main h1.text-2xl, html.reg main h1.text-3xl, html.reg main h1.md\:text-3xl { font-size: 3rem; }
    html.reg main h1.md\:text-4xl { font-size: 3.5rem; }
}
html.reg main h3.text-sm:not(.uppercase), html.reg main h3.text-base:not(.uppercase) {
    font-family: var(--f-text); font-weight: 600; letter-spacing: 0;
}
html.reg main :is(h1, h2, h3).font-bold, html.reg main :is(h1, h2, h3).font-semibold { font-weight: 500; }
html.reg main h3.text-sm.font-semibold:not(.uppercase), html.reg main h3.text-base.font-semibold:not(.uppercase) { font-weight: 600; }

/* Register labels: every small uppercase label becomes mono, like a field on a form. */
html.reg :is(.uppercase.tracking-wider, .uppercase.tracking-wide, .uppercase.tracking-widest, .uppercase.tracking-wider *, th) {
    font-family: var(--f-mono);
    font-weight: 500;
    letter-spacing: .08em;
}
html.reg .uppercase.tracking-wider.text-xs, html.reg .uppercase.tracking-wide.text-xs, html.reg th { font-size: 11.5px; }
html.reg :is(.font-mono, code, kbd, samp, pre) { font-family: var(--f-mono); }
html.reg main table, html.reg .r-num { font-feature-settings: "tnum", "zero"; }

/* ---------- 3. Map the old dark utilities onto the register ---------- */
/* Surfaces */
html.reg .bg-gray-900 { background-color: var(--paper); }
html.reg :is(.bg-gray-800, .bg-white) { background-color: var(--sheet); }
html.reg :is(.bg-gray-750, .bg-gray-700, .hover\:bg-gray-700:hover, .hover\:bg-gray-750:hover) { background-color: var(--paper-2); }
html.reg :is(.bg-gray-600, .hover\:bg-gray-600:hover) { background-color: var(--paper-3); }
html.reg .bg-opacity-50 { --tw-bg-opacity: 1; }
html.reg :is(.bg-blue-900, .bg-blue-800) { background-color: var(--blue-tint); }
html.reg .bg-green-900 { background-color: var(--live-tint); }
html.reg .bg-red-900 { background-color: var(--dead-tint); }
html.reg .bg-yellow-900 { background-color: var(--pending-tint); }
html.reg .bg-purple-900 { background-color: var(--paper-2); }
html.reg :is(.bg-green-400, .bg-green-500) { background-color: var(--live); }
html.reg :is(.bg-red-500) { background-color: var(--dead); }
html.reg :is(.bg-yellow-400, .bg-yellow-500) { background-color: var(--pending); }
html.reg .bg-blue-400 { background-color: var(--blue); }

/* Text */
html.reg :is(.text-white, .text-gray-100, .text-gray-200) { color: var(--ink); }
html.reg .text-gray-300 { color: var(--ink-2); }
html.reg :is(.text-gray-400, .text-gray-500) { color: var(--ink-3); }
html.reg .text-gray-600 { color: var(--ink-4); }
html.reg :is(.hover\:text-white:hover, .hover\:text-gray-200:hover, .hover\:text-gray-300:hover, .hover\:text-gray-100:hover) { color: var(--ink); }
html.reg :is(.text-blue-200, .text-blue-300, .text-blue-400, .text-blue-500, .text-indigo-400, .text-purple-200, .text-purple-300, .text-purple-400) { color: var(--blue); }
html.reg :is(.hover\:text-blue-300:hover, .hover\:text-blue-200:hover, .hover\:text-blue-400:hover) { color: var(--blue-ink); }
html.reg :is(.text-green-200, .text-green-300, .text-green-400, .text-emerald-400) { color: var(--live); }
html.reg :is(.text-red-100, .text-red-200, .text-red-300, .text-red-400) { color: var(--dead); }
html.reg :is(.text-yellow-200, .text-yellow-300, .text-yellow-400, .text-amber-400, .text-amber-600) { color: var(--pending); }
html.reg :is(.hover\:text-yellow-300:hover) { color: var(--ink); }

/* Lines */
html.reg :is(.border-gray-600, .border-gray-700, .border-gray-800) { border-color: var(--rule); }
html.reg .border-gray-400 { border-color: var(--rule-2); }
html.reg :is(.divide-gray-700, .divide-gray-600, .divide-gray-800) > :not([hidden]) ~ :not([hidden]) { border-color: var(--rule); }
html.reg :is(.border-blue-400, .border-blue-500, .hover\:border-blue-500:hover, .hover\:border-blue-400:hover, .focus\:border-blue-500:focus, .focus\:border-blue-400:focus) { border-color: var(--ink); }
html.reg :is(.border-blue-700, .border-blue-800) { border-color: color-mix(in srgb, var(--blue) 35%, transparent); }
html.reg :is(.border-green-500, .border-green-700, .border-green-800) { border-color: color-mix(in srgb, var(--live) 40%, transparent); }
html.reg :is(.border-red-500, .border-red-700, .border-red-800) { border-color: color-mix(in srgb, var(--dead) 40%, transparent); }
html.reg :is(.border-yellow-500, .border-yellow-700, .border-yellow-800) { border-color: color-mix(in srgb, var(--pending) 45%, transparent); }
html.reg :is(.border-purple-700, .border-purple-800) { border-color: var(--rule-2); }
html.reg :is(.ring-blue-400, .ring-blue-500, .focus\:ring-blue-500:focus, .focus\:ring-blue-400:focus, .focus\:ring-1:focus) { --tw-ring-color: var(--blue); }
html.reg :is(.placeholder-gray-400, .placeholder-gray-500, .placeholder-gray-600)::placeholder { color: var(--ink-4); }

/* Shape: square-ish corners and no floating shadows. Pills and dots stay round. */
html.reg main :is(.rounded, .rounded-md, .rounded-lg, .rounded-xl, .rounded-2xl, .rounded-3xl),
html.reg :is(#wt-nav, footer, #aeo-popup, #newsletter-popup) :is(.rounded, .rounded-md, .rounded-lg, .rounded-xl, .rounded-2xl) { border-radius: 3px; }
html.reg :is(.shadow, .shadow-md, .shadow-lg, .shadow-xl, .shadow-2xl) { box-shadow: none; }
html.reg :is(.bg-gradient-to-r, .bg-gradient-to-l, .bg-gradient-to-b, .bg-gradient-to-br, .bg-gradient-to-tr) { background-image: none; }

/* Cards: a sheet on the paper, held by a hairline, with an ink rule along the top
   like a record in the register. Nested cards drop the ink rule. */
html.reg main :where(div, section, article, aside, li, details, form).bg-gray-800:where(.rounded-lg, .rounded-xl, .rounded-2xl) {
    border-color: var(--rule);
    box-shadow: inset 0 2px 0 0 var(--ink);
}
html.reg main .bg-gray-800 .bg-gray-800 { box-shadow: none; }
html.reg main a.bg-gray-800:where(.rounded-lg, .rounded-xl) { box-shadow: inset 0 2px 0 0 var(--ink); }
html.reg .wt-card:hover, html.reg main a.bg-gray-800:hover { transform: none; border-color: var(--ink) !important; background-color: var(--sheet); box-shadow: inset 0 3px 0 0 var(--blue); }

/* Tables read like a ledger page. */
html.reg main thead tr { background: transparent; }
html.reg main thead th { color: var(--ink-3); border-bottom: 1.5px solid var(--ink); }
html.reg main tbody tr:hover { background-color: var(--paper-2); }

/* ---------- 4. Buttons ---------- */
/* Primary: solid ink, with a blue press edge that closes when you click. */
html.reg :is(a, button, input):is(.bg-blue-500, .bg-blue-600, .bg-blue-700) {
    background-color: var(--ink) !important;
    background-image: none !important;
    color: var(--on-ink) !important;
    border-radius: 3px;
    box-shadow: var(--press) !important;
    font-weight: 600;
}
html.reg :is(a, button, input):is(.bg-blue-500, .bg-blue-600, .bg-blue-700):hover { background-color: var(--blue-ink) !important; }
html.reg :is(a, button, input):is(.bg-blue-500, .bg-blue-600, .bg-blue-700):active { transform: translateY(2px); box-shadow: 0 1px 0 0 var(--blue) !important; }
/* Secondary emphasis (watch and claim actions): registry blue. */
html.reg :is(a, button, input):is(.bg-purple-600, .bg-purple-700, .bg-green-600, .bg-green-700) {
    background-color: var(--blue) !important;
    background-image: none !important;
    color: var(--on-ink) !important;
    border-radius: 3px;
    box-shadow: 0 3px 0 0 var(--ink) !important;
    font-weight: 600;
}
html.reg :is(a, button, input):is(.bg-purple-600, .bg-purple-700, .bg-green-600, .bg-green-700):hover { background-color: var(--blue-ink) !important; }
html.reg :is(.bg-blue-500, .bg-blue-600, .bg-blue-700, .bg-purple-600, .bg-purple-700, .bg-green-600, .bg-green-700, .bg-red-600) :is(.text-white, .text-gray-100, .text-gray-200, .text-blue-200, .text-blue-100, .text-purple-200, .opacity-75, .opacity-80, span) { color: inherit !important; }
/* Quiet buttons on paper. */
html.reg :is(a, button):is(.bg-gray-700, .bg-gray-600).text-white { color: var(--ink); border: 1px solid var(--rule-2); }

/* ---------- 5. Fields ---------- */
html.reg :is(input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not(.bg-transparent), select, textarea):is(.bg-gray-700, .bg-gray-800, .bg-gray-900) {
    background-color: var(--sheet);
    border-color: var(--rule-2);
    color: var(--ink);
    border-radius: 3px;
}
html.reg main :is(input:not([type="checkbox"]):not([type="radio"]):not(.bg-transparent), select, textarea):focus,
html.reg #wt-nav input:focus {
    border-color: var(--ink) !important;
    box-shadow: 0 0 0 3px var(--mark) !important;
    outline: none;
}

/* ---------- 6. Masthead ---------- */
html.reg .wt-nav { background: var(--paper); border-bottom: 1.5px solid var(--ink); }
html.reg .wt-nav.is-scrolled { box-shadow: none; }
html.reg #wt-nav a.wt-tap.font-bold {
    font-family: var(--f-display);
    font-weight: 600;
    font-size: 23px;
    letter-spacing: -.02em;
    color: var(--ink);
}
html.reg #wt-nav a.wt-tap.font-bold span { color: var(--ink); }
/* TM, not (R): WikiTrademarks is not a registered mark, and a trademark site must not misuse the symbol. */
html.reg #wt-nav a.wt-tap.font-bold::after {
    content: "TM";
    font-family: var(--f-mono);
    font-size: 8.5px;
    font-weight: 600;
    letter-spacing: .04em;
    vertical-align: 12px;
    margin-left: -3px;
    color: var(--blue);
}
html.reg .wt-nav-link { color: var(--ink-2); font-weight: 500; }
html.reg .wt-nav-link[aria-current="page"] { color: var(--ink); }
html.reg .wt-nav-link[aria-current="page"]::after { background: var(--blue); height: 3px; border-radius: 0; bottom: -1.02rem; }
html.reg #wt-nav input[type="search"], html.reg #mobile-nav input {
    background: var(--sheet);
    border: 1px solid var(--rule-2);
    border-radius: 3px;
    color: var(--ink);
}
html.reg .wt-kbd { font-family: var(--f-mono); border-color: var(--rule-2); color: var(--ink-3); border-radius: 2px; }
html.reg #mobile-nav a[aria-current="page"] { background: var(--paper-2); color: var(--ink); box-shadow: inset 3px 0 0 var(--blue); }

/* ---------- 7. Footer: an ink colophon ---------- */
html.reg footer#explore { background: var(--foot-bg) !important; color: var(--foot-fg); border-top: 0; margin-top: 4rem; }
html.reg footer#explore :is(.text-white, .text-gray-100, .text-gray-200, .text-gray-300) { color: var(--foot-fg); }
html.reg footer#explore :is(.text-gray-400, .text-gray-500, .text-gray-600) { color: color-mix(in srgb, var(--foot-fg) 64%, transparent); }
html.reg footer#explore a:is(.text-gray-400, .text-gray-500):hover { color: var(--foot-fg); text-decoration: underline; text-underline-offset: 3px; }
html.reg footer#explore :is(.text-blue-400, .text-yellow-400, .text-blue-300) { color: var(--foot-fg); text-decoration: underline; text-decoration-color: var(--mark); text-decoration-thickness: 2px; text-underline-offset: 4px; }
html.reg footer#explore :is(.border-gray-700, .border-gray-800) { border-color: color-mix(in srgb, var(--foot-fg) 18%, transparent); }
html.reg footer#explore h4 { font-family: var(--f-mono); }
html.reg footer#explore h4.text-white { font-family: var(--f-display); font-size: 20px; letter-spacing: -.015em; }
html.reg footer#explore h4 .text-blue-400 { text-decoration: none; }
html.reg footer#explore :is(input, select) { background: transparent !important; border-color: color-mix(in srgb, var(--foot-fg) 35%, transparent) !important; color: var(--foot-fg) !important; }
html.reg footer#explore :is(a, button):is(.bg-blue-600, .bg-blue-500) { background-color: var(--foot-fg) !important; color: var(--foot-bg) !important; box-shadow: 0 3px 0 0 var(--mark) !important; }

/* ---------- 8. Status: ink stamps ---------- */
html.reg :is(.score-high, .score-mid, .score-low) {
    background: transparent;
    border: 2px solid currentColor;
    border-radius: 2px;
    font-family: var(--f-mono);
}
html.reg .score-high { color: var(--live); }
html.reg .score-mid { color: var(--pending); }
html.reg .score-low { color: var(--dead); }
html.reg .r-stamp-auto { font-family: var(--f-mono); letter-spacing: .12em; text-transform: uppercase; }

/* Promo panels become a solid ink notice, like a boxed announcement in a gazette. */
html.reg .dark-promo {
    background: var(--ink) !important;
    background-image: none !important;
    border-color: var(--ink) !important;
    border-radius: 3px;
    box-shadow: none !important;
}
html.reg .dark-promo :is(.text-white, .text-gray-100, .text-gray-200, .text-gray-300, .text-blue-300, .text-blue-200) { color: var(--on-ink) !important; }
html.reg .dark-promo :is(.bg-blue-900, .bg-blue-500) { background: transparent !important; }
html.reg .dark-promo :is(.border-blue-700, .border-blue-500) { border-color: color-mix(in srgb, var(--on-ink) 40%, transparent) !important; }
html.reg .dark-promo svg { color: var(--on-ink) !important; }

/* ---------- 9. Homepage hero: calm, printed, no light show ---------- */
html.reg :is(.wt-aurora-field, .wt-aurora) { display: none !important; }
html.reg .wt-hero::before { display: none; }
html.reg .wt-grad-text {
    background: linear-gradient(transparent 62%, var(--mark) 62%, var(--mark) 92%, transparent 92%) !important;
    -webkit-background-clip: border-box !important;
            background-clip: border-box !important;
    color: var(--ink) !important;
    -webkit-text-fill-color: currentColor !important;
    animation: none !important;
    padding: 0 .06em;
}
html.reg .wt-hero h1 { font-family: var(--f-display); font-weight: 500; letter-spacing: -.03em; line-height: .98; }
html.reg .wt-demo-card { transform: none !important; box-shadow: 0 5px 0 0 var(--ink) !important; border: 1.5px solid var(--ink) !important; border-radius: 3px; background: var(--sheet) !important; }
html.reg .wt-scan-bar { background: var(--ink) !important; border-radius: 0; }
html.reg .wt-caret { background: var(--ink); }
html.reg .wt-float { animation: none !important; }
html.reg .wt-path { --path: var(--ink) !important; --path-soft: var(--paper-2) !important; --path-glow: transparent !important; }
html.reg .wt-path::before { display: none; }
html.reg .wt-path::after { background: var(--blue); height: 3px; transform: scaleX(1); opacity: 0; }
html.reg .wt-path:hover::after { opacity: 1; }
html.reg .wt-path-tint { color: var(--blue) !important; }
html.reg .wt-toggle { background: var(--paper-3); }
html.reg .wt-toggle.is-on { background: var(--live); }

/* ---------- 10. Popups ---------- */
html.reg :is(#aeo-popup, #newsletter-popup) { border: 1.5px solid var(--ink) !important; box-shadow: 0 5px 0 0 var(--ink) !important; border-radius: 3px; }

/* ---------- 11. Motion ---------- */
html.reg .js .wt-reveal { transform: translateY(8px); }
@media (prefers-reduced-motion: no-preference) {
    html.reg .r-stamp-in { animation: reg-thunk .32s cubic-bezier(.3, 1.6, .5, 1) both; }
}
@keyframes reg-thunk {
    0% { transform: scale(1.7) rotate(-10deg); opacity: 0; }
    70% { opacity: 1; }
    100% { transform: scale(1) rotate(-2deg); opacity: 1; }
}

/* ---------- 12. Name check search: a ruled entry field with an ink press edge ---------- */
html.reg .wt-ring,
html.reg .wt-name-check__field {
    background: var(--sheet) !important;
    background-image: none !important;
    border: 1.5px solid var(--ink) !important;
    border-radius: 3px !important;
    box-shadow: 0 4px 0 0 var(--ink) !important;
    padding: 0 !important;
}
html.reg .wt-ring::before, html.reg .wt-ring::after { display: none !important; }
html.reg .wt-name-check__field:focus-within { border-color: var(--blue) !important; box-shadow: 0 4px 0 0 var(--blue) !important; }
html.reg .wt-name-check--hero input {
    font-family: var(--f-display);
    font-size: 26px;
    letter-spacing: -.01em;
    color: var(--ink);
}
html.reg .wt-name-check input { color: var(--ink); }
html.reg .wt-name-check__field button {
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    padding-left: 1.75rem;
    padding-right: 1.75rem;
}
html.reg .wt-name-check a.rounded-full { font-family: var(--f-mono); font-size: 12.5px; letter-spacing: .04em; border-radius: 2px; background: transparent; border-color: var(--rule-2); }
html.reg .wt-name-check a.rounded-full:hover { background: var(--mark); border-color: var(--ink); }

/* ---------- 13. Homepage demo: a record card, not a fake browser window ---------- */
html.reg .wt-demo-card > div:first-child > span.rounded-full { display: none; }
html.reg .wt-demo-card > div:first-child > span { margin-left: 0; font-family: var(--f-mono); font-size: 11px; letter-spacing: .04em; }
html.reg .wt-demo [data-demo-name] { font-family: var(--f-display); font-weight: 600; letter-spacing: -.01em; }
html.reg .wt-demo [data-demo-verdict] { border-left-width: 0 !important; background: transparent !important; padding: .25rem 0 0 !important; }
html.reg .wt-demo [data-demo-verdict] > p.uppercase,
html.reg .r-stamp {
    display: inline-block;
    font-family: var(--f-mono);
    font-weight: 600;
    font-size: 11.5px;
    letter-spacing: .14em;
    text-transform: uppercase;
    border: 2px solid currentColor;
    outline: 1px solid currentColor;
    outline-offset: 2px;
    border-radius: 2px;
    padding: 4px 9px 3px;
    margin: 4px 0 10px 3px;
    transform: rotate(-2deg);
}
html.reg .wt-demo .rounded-xl.bg-gray-900 { background: var(--paper-2) !important; }

/* Charts and meters print in ink. */
html.reg :is(div, span, i):is(.bg-blue-500, .bg-blue-600, .bg-blue-700, .bg-indigo-500) { background-color: var(--ink); }
html.reg :is(div, span):is(.bg-blue-500, .bg-blue-600):hover { background-color: var(--blue); }

/* No pulsing "live" dots: the date on the page says how fresh the data is. */
html.reg .animate-ping { display: none; }
