/* ==========================================================================
   site.css - shared by every page (the Gateway included).
   Variables and the page base, the #gateway-container base box (the registry pages reuse
   it), the visual-quality UI (fx-quality.js), the portal-arrival veil and the travel
   plaques (travel.js). Gateway-only looks are in gateway.css.
   Link order in a page: site.css first, then (Gateway only) gateway.css.
   ========================================================================== */

:root {
    --bg-color: #05050a;
    --gold: #ffd700;
    --blue: #00f2ff;
    --text-color: #e0e0e0;
    --glow-gold: 0 0 20px rgba(255, 215, 0, 0.7);
    --glow-amber: 0 0 20px rgba(255, 140, 0, 0.6);
    --fire: rgba(255, 150, 40, 0.75);   /* the portal's burning glow */
    --font-fantasy: 'Cinzel', serif;
    --font-body: 'Almendra', serif;
}

body, html {
    margin: 0; padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-body);
    height: 100vh; width: 100vw;
    overflow: hidden;
}

#gateway-container {
    display: flex;
    width: 100%; height: 100%;
    /* The sea is lit at the centre; towards the edges it falls into the dark of non-existence */
    background: radial-gradient(ellipse at center, #0a0a2e 0%, #05050a 70%, #020205 100%);
    position: relative;
    z-index: 2;
}


/* ==========================================================================
   Visual quality (fx-quality.js). The panel and its glyph exist only on the
   Gateway (they are built inside #gateway-container); the note and the debug
   meter can appear on any page.
   ========================================================================== */
.fx-toggle {
    position: absolute;
    left: 22px; bottom: 66px;
    z-index: 110;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    padding: 0;
    background: rgba(5, 9, 26, 0.55);
    border: 1px solid rgba(255, 215, 0, 0.35);
    border-radius: 50%;
    color: var(--gold);
    cursor: pointer;
    transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.fx-toggle:hover, .fx-toggle:focus-visible, .fx-toggle[aria-expanded="true"] {
    background: rgba(255, 215, 0, 0.12);
    border-color: var(--gold);
    box-shadow: 0 0 18px rgba(255, 190, 60, 0.35);
    outline: none;
}
.fx-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.fx-toggle svg circle { fill: currentColor; stroke: none; }
.fx-toggle svg .fx-outer { opacity: 0.5; }

.fx-panel {
    position: absolute;
    left: 22px; bottom: 112px;
    z-index: 120;
    width: min(340px, calc(100vw - 44px));
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    box-sizing: border-box;
    padding: 18px 16px 12px;
    background: rgba(6, 10, 28, 0.95);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 14px;
    box-shadow: 0 0 40px rgba(60, 120, 255, 0.18);
    color: var(--text-color);
}
.fx-panel[hidden] { display: none; }
.fx-panel h2 {
    margin: 0 0 10px 4px;
    font-family: var(--font-fantasy);
    font-size: 0.95rem;
    font-weight: 400;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold);
}
.fx-option {
    display: flex; align-items: flex-start; gap: 12px;
    width: 100%;
    padding: 9px 10px;
    margin: 0 0 2px;
    background: none;
    border: 1px solid transparent;
    border-radius: 10px;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.fx-option:hover, .fx-option:focus-visible { background: rgba(120, 170, 255, 0.08); border-color: rgba(120, 170, 255, 0.25); outline: none; }
.fx-option[aria-checked="true"] { border-color: rgba(255, 215, 0, 0.45); background: rgba(255, 215, 0, 0.06); }
.fx-dot {
    flex: none;
    width: 12px; height: 12px; margin-top: 4px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 215, 0, 0.6);
}
.fx-option[aria-checked="true"] .fx-dot { background: var(--gold); box-shadow: 0 0 8px rgba(255, 200, 60, 0.7); }
.fx-text { display: flex; flex-direction: column; gap: 2px; }
.fx-text strong { font-family: var(--font-fantasy); font-weight: 400; letter-spacing: 0.1em; color: #f1e6b8; font-size: 0.85rem; }
.fx-text strong em { font-style: normal; color: #9fb6d8; letter-spacing: 0.04em; }
.fx-text span { font-size: 0.85rem; line-height: 1.35; color: #b9c8de; }
.fx-foot { margin: 8px 4px 0; font-size: 0.78rem; color: #8195b3; font-style: italic; }

@media (max-width: 600px) {
    .fx-toggle { left: 14px; bottom: 58px; width: 34px; height: 34px; }
    .fx-panel { left: 14px; right: 14px; width: auto; bottom: 102px; }
}

/* The one-time note when Auto lowers the quality */
.fx-note {
    position: fixed;
    left: 50%; bottom: 18px;
    transform: translate(-50%, 12px);
    z-index: 2147482000;
    max-width: calc(100vw - 32px);
    box-sizing: border-box;
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 9px 12px 9px 16px;
    background: rgba(6, 10, 28, 0.92);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 999px;
    color: #d6e2f3;
    font-family: 'Almendra', serif;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.5s, transform 0.5s;
}
.fx-note.fx-shown { opacity: 1; transform: translate(-50%, 0); }
.fx-note-change {
    background: none; border: none; padding: 0;
    color: var(--gold, #ffd700); font: inherit; text-decoration: underline; cursor: pointer;
}
.fx-note-close {
    background: none; border: none; padding: 0 4px;
    color: #9fb6d8; font-size: 1.2rem; line-height: 1; cursor: pointer;
}

/* ?fx=debug meter */
.fx-meter {
    position: fixed;
    top: 6px; right: 6px;
    z-index: 2147483000;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.75);
    border: 1px solid rgba(120, 255, 160, 0.35);
    border-radius: 6px;
    color: #9dffb8;
    pointer-events: none;
}
.fx-meter-text { margin: 0; font: 11px/1.35 ui-monospace, Consolas, monospace; white-space: pre; }
.fx-meter.fx-min .fx-meter-text { display: none; }
.fx-meter-bar { display: flex; gap: 6px; justify-content: flex-end; margin-top: 4px; }
.fx-meter-bar button {
    pointer-events: auto;
    padding: 2px 8px;
    background: rgba(120, 255, 160, 0.12);
    border: 1px solid rgba(120, 255, 160, 0.4);
    border-radius: 4px;
    color: #9dffb8;
    font: 11px ui-monospace, Consolas, monospace;
    cursor: pointer;
}

/* The quality glyph on the other pages (fx-quality.js): in the page's top bar,
   opening a panel downwards from the top right */
.fx-toggle.fx-toggle-bar {
    position: relative; left: auto; bottom: auto;
    flex: none;
    width: 28px; height: 28px;
    margin-left: auto;
    z-index: auto;
    pointer-events: auto;
    background: rgba(5, 9, 26, 0.5);
}
.fx-toggle.fx-toggle-bar svg { width: 16px; height: 16px; }
.fx-toggle.fx-toggle-corner { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); margin: 0; }
.fx-toggle.fx-toggle-fixed { position: fixed; right: 12px; top: 10px; z-index: 40; }
.fx-panel.fx-panel-drop {
    position: fixed;
    left: auto; right: 12px;
    top: 52px; bottom: auto;
    z-index: 10001;
    max-height: calc(100vh - 70px);
}
@media (max-width: 600px) {
    .fx-toggle.fx-toggle-bar { left: auto; bottom: auto; width: 28px; height: 28px; }
    .fx-panel.fx-panel-drop { left: 14px; right: 14px; top: 52px; bottom: auto; width: auto; }
}

/* Portal travel between pages (travel.js). Arriving, the page starts covered in the colour
   the vortex ended on (html.portal-arriving and --portal-wash, set by fx-quality.js in the
   <head>, before the first paint). travel.js takes this veil over with its own opening vortex;
   without it (no PixiJS, no WebGL) the veil simply fades away. */
html.portal-arriving::after {
    content: '';
    position: fixed; inset: 0;
    z-index: 10000;
    pointer-events: none;
    background: var(--portal-wash, #05050a);
    animation: portal-veil-out 0.7s ease-out 0.9s forwards;
}
html.portal-held::after { animation-play-state: paused; }
@keyframes portal-veil-out { to { opacity: 0; visibility: hidden; } }

/* ==========================================================================
   Travel plaques: the links to other pages, in each page's top bar (travel.js and
   the pages' own transitions play the portal journey). Each page sets its colours:
   --travel-accent (glow, border, glyph), --travel-ink (text), --travel-bg/--travel-bg2.
   ========================================================================== */
:root {
    --travel-accent: #ffd700;
    --travel-ink: #e0e0e0;
    --travel-bg: #05050a;
    --travel-bg2: #14142a;
}
.travel-link {
    position: relative;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 5px 14px 5px 9px;
    overflow: hidden;
    font-family: var(--font-fantasy);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none !important;
    color: color-mix(in srgb, var(--travel-ink) 88%, transparent) !important;
    border: 1px solid color-mix(in srgb, var(--travel-accent) 40%, transparent);
    border-radius: 999px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--travel-bg2) 80%, transparent), color-mix(in srgb, var(--travel-bg) 88%, transparent));
    box-shadow: 0 0 12px color-mix(in srgb, var(--travel-accent) 14%, transparent), inset 0 0 10px color-mix(in srgb, var(--travel-accent) 8%, transparent);
    backdrop-filter: blur(4px);
    transition: color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}
/* a sheen of light passing over it on hover */
.travel-link::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(100deg, transparent 35%, color-mix(in srgb, var(--travel-accent) 35%, transparent) 50%, transparent 65%);
    transform: translateX(-120%);
    transition: transform 0.7s ease;
    pointer-events: none;
}
.travel-link:hover,
.travel-link:focus-visible {
    color: var(--travel-accent) !important;
    border-color: color-mix(in srgb, var(--travel-accent) 75%, transparent);
    box-shadow: 0 0 18px color-mix(in srgb, var(--travel-accent) 32%, transparent), inset 0 0 12px color-mix(in srgb, var(--travel-accent) 14%, transparent);
    transform: translateY(-1px);
}
.travel-link:hover::after,
.travel-link:focus-visible::after { transform: translateX(120%); }

/* Their glyphs, one per destination: the Gateway's portal (a ring within a ring), the Taxonomy's
   wheel of planes, the Astral Sea's tide, Ta'asis' moon */
.travel-glyph {
    position: relative;
    flex: none;
    width: 13px; height: 13px;
    border-radius: 50%;
}
.glyph-gateway {
    border: 1.5px solid var(--travel-accent);
    box-shadow: 0 0 6px var(--travel-accent), inset 0 0 0 2px transparent, inset 0 0 0 3px color-mix(in srgb, var(--travel-accent) 70%, transparent);
    animation: glyph-breathe 3s ease-in-out infinite;
}
.glyph-planes {
    border: 1.5px dashed var(--travel-accent);
    animation: glyph-turn 12s linear infinite;
}
.glyph-planes::after {
    content: '';
    position: absolute; left: 50%; top: 50%;
    width: 4px; height: 4px;
    margin: -2px 0 0 -2px;
    border-radius: 50%;
    background: var(--travel-accent);
    box-shadow: 0 0 5px var(--travel-accent);
}
.travel-link:hover .glyph-planes { animation-duration: 3s; }
.travel-link:hover .glyph-gateway { animation-duration: 1.2s; }
@keyframes glyph-turn { to { transform: rotate(360deg); } }
@keyframes glyph-breathe { 50% { box-shadow: 0 0 10px var(--travel-accent), inset 0 0 0 2px transparent, inset 0 0 0 3px var(--travel-accent); } }
.glyph-astral {
    border: 1.5px solid transparent;
    border-top-color: var(--travel-accent);
    border-bottom-color: var(--travel-accent);
    box-shadow: 0 0 6px color-mix(in srgb, var(--travel-accent) 60%, transparent);
    animation: glyph-turn 6s linear infinite;
}
.glyph-astral::after {
    content: '';
    position: absolute; inset: 2px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--travel-accent) 0 25%, transparent 70%);
    opacity: 0.8;
}
.glyph-taasis {
    box-shadow: inset -3px -2px 0 0 var(--travel-accent), 0 0 6px color-mix(in srgb, var(--travel-accent) 45%, transparent);
    transform: rotate(-20deg);
    animation: glyph-wax 4s ease-in-out infinite;
}
.travel-link:hover .glyph-astral { animation-duration: 1.5s; }
.travel-link:hover .glyph-taasis { animation-duration: 1.4s; }
@keyframes glyph-wax { 50% { box-shadow: inset -4px -2px 0 0 var(--travel-accent), 0 0 10px var(--travel-accent); } }

/* Narrow phones: smaller plaques, and a top bar that may wrap onto a second row
   (the Gods page keeps its own sizes, in gods.css) */
@media (max-width: 600px) {
    body:not(.gods-page) .travel-link { gap: 6px; padding: 4px 10px 4px 7px; font-size: 0.62rem; letter-spacing: 0.06em; }
    body:not(.gods-page) .page-links:has(.travel-link) { flex-wrap: wrap; gap: 6px 8px; }
}
@media (prefers-reduced-motion: reduce) {
    .travel-glyph { animation: none !important; }
}
html[data-quality="light"] .travel-link { backdrop-filter: none; -webkit-backdrop-filter: none; }
html[data-quality="still"] .travel-glyph { animation: none !important; }
