/* ==========================================================================
   immortalguardians.net — site styles
   Layered ON TOP of UIkit 3 (loaded first), so these rules win.
   Restores the Gen-3 visual identity: dark theme, warrior-gold accent,
   Oswald headings + Roboto Light body (self-hosted woff2, latin subset).
   ========================================================================== */

/* --- Self-hosted fonts (gwfh latin subset; see fonts/PROVENANCE.txt) ------ */
@font-face {
    font-family: 'Oswald';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/assets/fonts/oswald-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Oswald';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/assets/fonts/oswald-500.woff2') format('woff2');
}
@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url('/assets/fonts/roboto-300.woff2') format('woff2');
}

/* --- Theme tokens -------------------------------------------------------
   User-selectable colour themes. Every rule below reads these var(--ig-*)
   tokens, so a theme is just a different token set. The server sets
   <html data-theme="…"> from the ig_theme cookie (default slate-bronze), so
   the right block applies on first paint — no flash, no inline script (keeps
   the strict CSP). Slugs here must match src/themes.php. The default block
   also answers to :root, so the site is themed even with no attribute. */
:root {                                  /* default = Warm Ink & Bronze */
    --ig-bg: #1a1613;
    --ig-bg-elevated: #221c17;
    --ig-fg: #ece3d2;
    --ig-muted: #94897a;
    --ig-accent: #cba46a;
    --ig-accent-hover: #e3bd85;
    --ig-border: #322a22;
}
[data-theme="slate-bronze"] {
    --ig-bg: #181d23;
    --ig-bg-elevated: #212832;
    --ig-fg: #e8edf2;
    --ig-muted: #8b97a5;
    --ig-accent: #cba46a;
    --ig-accent-hover: #e3bd85;
    --ig-border: #2c343f;
}
[data-theme="gold"] {                    /* Charcoal & Warrior Gold (the original) */
    --ig-bg: #262626;
    --ig-bg-elevated: #2c2c2c;
    --ig-fg: #eeeeee;
    --ig-muted: #888888;
    --ig-accent: #c79c6e;
    --ig-accent-hover: #e0b896;
    --ig-border: #333333;
}
[data-theme="slate-amber"] {
    --ig-bg: #181d23;
    --ig-bg-elevated: #212832;
    --ig-fg: #e8edf2;
    --ig-muted: #8b97a5;
    --ig-accent: #e0a953;
    --ig-accent-hover: #f2c477;
    --ig-border: #2c343f;
}
[data-theme="crimson"] {
    --ig-bg: #141414;
    --ig-bg-elevated: #1e1e1e;
    --ig-fg: #f3f3f3;
    --ig-muted: #8a8a8a;
    --ig-accent: #cf4640;
    --ig-accent-hover: #e8645e;
    --ig-border: #2a2a2a;
}
[data-theme="navy"] {
    --ig-bg: #0f1620;
    --ig-bg-elevated: #16202e;
    --ig-fg: #e6edf5;
    --ig-muted: #7e8a9a;
    --ig-accent: #5aa9e6;
    --ig-accent-hover: #82c2f2;
    --ig-border: #1f2c3c;
}
[data-theme="emerald"] {
    --ig-bg: #17191a;
    --ig-bg-elevated: #1f2422;
    --ig-fg: #eaeee9;
    --ig-muted: #828b86;
    --ig-accent: #2dd4a7;
    --ig-accent-hover: #5ee3bf;
    --ig-border: #2a2f2c;
}
[data-theme="bronze"] {
    --ig-bg: #1a1613;
    --ig-bg-elevated: #221c17;
    --ig-fg: #ece3d2;
    --ig-muted: #94897a;
    --ig-accent: #cba46a;
    --ig-accent-hover: #e3bd85;
    --ig-border: #322a22;
}
[data-theme="violet"] {
    --ig-bg: #1a1820;
    --ig-bg-elevated: #221f2b;
    --ig-fg: #ece9f2;
    --ig-muted: #8b8598;
    --ig-accent: #a77bd6;
    --ig-accent-hover: #c19fe6;
    --ig-border: #2c2838;
}

/* --- Base: Roboto Light body on the dark ground -------------------------- */
/* Background on <html> too, so the whole viewport/canvas is dark regardless of
   content height or over-scroll — no white bar below a short page. */
html {
    background: var(--ig-bg);
}
body {
    background: var(--ig-bg);
    color: var(--ig-fg);
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    font-weight: 300;
    font-size: 17px;
    line-height: 1.6;
    /* Full-height flex column so the footer sits at the bottom of short pages
       (and the dark ground always fills the window). */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
/* flex: grows to push the footer down (main axis). width: in this column flex,
   .uk-container's cross-axis `margin-left/right:auto` would otherwise suppress
   align-items:stretch, so <main> shrink-wraps to its content (fine for the
   text-heavy About/Roster, but it collapsed the bar-only Guild page to a narrow
   column). An explicit width:100% stops the shrink-wrap; max-width + auto margins
   still cap and centre it. border-box keeps UIkit's padding inside the cap. */
main.uk-container { flex: 1 0 auto; width: 100%; box-sizing: border-box; }
.ig-footer { flex-shrink: 0; }

/* Headings: Oswald (the distinctive condensed look the rebuild had lost) */
h1, h2, h3, h4, h5, h6,
.uk-article-title {
    font-family: 'Oswald', 'Roboto', sans-serif;
    font-weight: 500;
    color: var(--ig-fg);
    letter-spacing: 0.01em;
}

/* Links: warrior-gold, gentle hover */
a {
    color: var(--ig-accent);
    text-decoration: none;
    transition: color 120ms ease;
}
a:hover, a:focus {
    color: var(--ig-accent-hover);
    text-decoration: underline;
}
/* UIkit's .uk-light (on <body>) sets `a { color:#fff }` at specificity (0,1,1),
   which outranks the plain `a` rule above and washes our link colour to white.
   Reclaim the accent here at matching specificity (this sheet loads after UIkit
   so it wins the tie). Class-coloured names override even this — see the
   .uk-light .wow-class.wow-X rules (0,3,0) in roster.css, which keep a
   character's class colour in every state, including hover/focus (UIkit's
   `.uk-light a:hover{color:#fff}` is only 0,2,1). Their hover cue is the
   class-coloured underline from a.ig-char-link:hover. */
.uk-light a { color: var(--ig-accent); }
.uk-light a:hover, .uk-light a:focus { color: var(--ig-accent-hover); }

/* --- Header / logo -------------------------------------------------------- */
.ig-header {
    padding: 2.5em 1em 1em;
}
.ig-header a { display: inline-block; line-height: 0; }
.ig-logo {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    height: auto;
    /* Canvas is 720x134 (14px transparent + feathered top baked into the PNG),
       so this is a touch taller than the 100px used for the 720x120 source —
       keeps the visible artwork at roughly the same size. */
    max-height: 112px;
}

/* --- Nav (UIkit uk-subnav, restyled) -------------------------------------
   Animated centre-out underline on hover/active, with an ornamental ◆ diamond
   separator between items, vertically centred on the text. We override UIkit's
   negative-margin gap system (margin-left / per-item padding-left) with a flex
   layout so the diamond can sit as a centred flex child between items. */
.ig-nav {
    border-bottom: 1px solid var(--ig-border);
    padding: 0.25em 1em 1em;
}
.ig-nav .uk-subnav {
    align-items: center;
    margin-left: 0;              /* cancel UIkit's -20px gutter */
}
.ig-nav .uk-subnav > * {
    display: flex;
    align-items: center;        /* centres the link AND the ::before diamond */
    padding-left: 0;            /* cancel UIkit's per-item gutter */
}
/* Diamond separator before every item after the first, centred on the text */
.ig-nav .uk-subnav > * + *::before {
    content: "\25C6";           /* ◆ */
    color: var(--ig-accent);
    opacity: 0.45;
    font-size: 0.6rem;
    line-height: 1;
    margin: 0 1.4rem;          /* the inter-item spacing lives here */
}
.ig-nav .uk-subnav > * > a {
    position: relative;
    font-family: 'Oswald', sans-serif;
    font-weight: 400;
    font-size: 1.22rem;          /* ~+2px over the previous 1.05rem */
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ig-accent);
    padding: 0.15em 0;          /* symmetric, so the diamond lines up with the text */
    transition: color 150ms ease;
}
/* Underline grows from the centre outward */
.ig-nav .uk-subnav > * > a::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -2px;
    height: 2px;
    width: 0;
    background: var(--ig-accent);
    transform: translateX(-50%);
    transition: width 250ms ease;
}
.ig-nav .uk-subnav > * > a:hover {
    color: var(--ig-accent-hover);
    text-decoration: none;
}
.ig-nav .uk-subnav > * > a:hover::after {
    width: 100%;
}
.ig-nav .uk-subnav > .uk-active > a {
    color: var(--ig-fg);
}
.ig-nav .uk-subnav > .uk-active > a::after {
    width: 100%;                /* active page stays fully underlined */
}
/* Disabled (not-yet-built) nav items — visible but inert */
.ig-nav .ig-nav-disabled > a {
    color: var(--ig-muted);
    cursor: not-allowed;
    pointer-events: none;
}
.ig-nav .ig-nav-disabled > a::after { width: 0 !important; }

/* --- Main / article ------------------------------------------------------ */
main.uk-container {
    padding-top: 1em;
    padding-bottom: 2em;
}
.ig-article {
    max-width: 760px;
    margin: 0 auto;
}
/* Page titles — one shared treatment across About + Roster so they match:
   Oswald small caps with a subtle divider rule under the heading. */
.ig-article h1,
.ig-roster-head h1 {
    font-size: 2.1rem;
    margin: 1em 0 0.8em;
    font-variant: small-caps;
    letter-spacing: 0.02em;
    padding-bottom: 0.25em;
    border-bottom: 1px solid var(--ig-border);
}
.ig-article p {
    margin: 0 0 1.2em;
}
.ig-article strong { color: var(--ig-fg); font-weight: 400; }

/* --- Footer -------------------------------------------------------------- */
.ig-footer {
    border-top: 1px solid var(--ig-border);
    color: var(--ig-muted);
    font-size: 0.9rem;
    margin-top: 2em;
    padding: 1.5em 1em;
}
.ig-footer p { margin: 0; }

/* --- Footer theme switcher -----------------------------------------------
   The toggle is a real (UIkit) button themed to the palette; the popover is
   forced dark (overriding UIkit's white .uk-dropdown default — selectors are
   footer-scoped so they comfortably out-specify the framework); each row
   previews its scheme with a ground/surface/accent/text dot cluster. */
.ig-theme-switch { margin-top: 0.8em; }

.ig-footer .ig-theme-toggle.uk-button {
    font-family: 'Oswald', sans-serif;
    font-weight: 400;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ig-accent);
    background: var(--ig-bg-elevated);
    border: 1px solid var(--ig-border);
    border-radius: 3px;
    height: 30px;
    line-height: 28px;
    padding: 0 0.95em;
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}
.ig-footer .ig-theme-toggle.uk-button:hover,
.ig-footer .ig-theme-toggle.uk-button[aria-expanded="true"] {
    color: var(--ig-bg);
    background: var(--ig-accent);
    border-color: var(--ig-accent);
}
.ig-theme-toggle .ig-caret { font-size: 0.7em; line-height: 1; }

/* Swatch dots — a single accent pip on the button, a 4-dot cluster per row */
.ig-sw-dot {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
    flex: none;
}
.ig-sw { display: inline-flex; align-items: center; gap: 3px; flex: none; }

/* Popover — forced dark, regardless of UIkit's #fff/25px defaults */
.ig-footer .ig-theme-drop.uk-dropdown {
    background: var(--ig-bg-elevated);
    color: var(--ig-fg);
    border: 1px solid var(--ig-border);
    border-radius: 5px;
    padding: 6px;
    min-width: 230px;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
}
.ig-footer .ig-theme-list { margin: 0; }
.ig-footer .ig-theme-list > li > a {
    display: flex;
    align-items: center;
    gap: 0.7em;
    font-family: 'Oswald', sans-serif;
    font-weight: 300;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
    color: var(--ig-fg);
    text-transform: none;
    padding: 0.5em 0.6em;
    border-radius: 3px;
    transition: background 120ms ease, color 120ms ease;
}
.ig-footer .ig-theme-list > li > a:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--ig-accent);
    text-decoration: none;
}
.ig-footer .ig-theme-list > li > a[aria-checked="true"] { color: var(--ig-accent); }
.ig-footer .ig-theme-list > li > a[aria-checked="true"] .ig-theme-name { font-weight: 400; }
.ig-footer .ig-theme-list > li > a[aria-checked="true"]::after {
    content: "\2713";          /* ✓ */
    margin-left: auto;
    color: var(--ig-accent);
    font-size: 0.9em;
}

/* --- Themed tooltip ------------------------------------------------------
   Pure-CSS, themed to match the site (native title tooltips can't be styled).
   Any element with data-tip="…" shows it on hover/focus. No JS, so the strict
   CSP is unaffected; zero per-element cost, so it scales to table rows. */
[data-tip] { position: relative; }
[data-tip]:hover::after,
[data-tip]:focus-visible::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 40;
    width: max-content;
    max-width: 250px;
    white-space: pre-line;   /* honour \n in data-tip (e.g. the secure-rank label) */
    text-align: left;
    /* reset any inherited heading/uppercase styling to readable body text */
    font-family: 'Roboto', sans-serif;
    font-weight: 300;
    font-size: 0.78rem;
    line-height: 1.45;
    letter-spacing: normal;
    text-transform: none;
    color: var(--ig-fg);
    background: var(--ig-bg-elevated);
    border: 1px solid var(--ig-border);
    border-radius: 4px;
    padding: 0.5em 0.7em;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}
[data-tip]:hover::before,
[data-tip]:focus-visible::before {
    content: "";
    position: absolute;
    bottom: calc(100% + 3px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--ig-border);
    z-index: 40;
    pointer-events: none;
}

/* --- Responsive ---------------------------------------------------------- */
@media (max-width: 600px) {
    body { font-size: 16px; }
    .ig-header { padding-top: 1.5em; }
    .ig-article h1,
    .ig-roster-head h1 { font-size: 1.7rem; }
}
