/* Optimancer - shared design (adapted from gw2_ceo/static/style.css):
   dark theme, Libertinus serif with small caps, panels and segmented
   controls. Three theme roles per page/character:
     --theme-dark   backgrounds   --theme-mid  buttons, borders   --theme-bright  headings */

/* ---------- font: Libertinus Serif ---------- */

@font-face {
  font-family: "Libertine";
  src: local("Linux Libertine O"), local("Libertinus Serif"),
       url("/static/fonts/LibertinusSerif-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Libertine";
  src: local("Linux Libertine O Semibold"), local("Libertinus Serif Semibold"),
       url("/static/fonts/LibertinusSerif-Semibold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Libertine";
  src: local("Linux Libertine O Italic"), local("Libertinus Serif Italic"),
       url("/static/fonts/LibertinusSerif-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* ---------- palette ---------- */

:root {
  /* the GW2 palette comes from optimancer/custom_colors.py, served as /theme.css:
     the three theme roles default to phthalo blue / ruby red / aureus (as on
     gw2ceo); games switch them per character (e.g. /e33/theme.css) */
  --gold: var(--theme-bright, var(--aureus, #edb227));
  --accent: var(--theme-mid, var(--ruby-red, #bd000b));
  --bg: color-mix(in srgb, var(--theme-dark, #001c67) var(--alpha-soft, 30%), var(--shadow-abyss, #000));
  --bg-glow: color-mix(in srgb, var(--theme-glow, var(--theme-dark, #001c67)) var(--glow-mix, var(--alpha-strong, 70%)), var(--shadow-abyss, #000));
  --bg-card: color-mix(in srgb, var(--theme-dark, #001c67) 35%, #12141c);
  --border: color-mix(in srgb, var(--theme-mid, #28304a) var(--alpha-soft, 30%), #262b3a);
  --text: #e8e4da;
  --text-dim: #9a958a;
  /* status colours: GW2 dyes too */
  --good: color-mix(in srgb, var(--growth, #009400) 60%, white);
  --warn: var(--sunfire-lava, #ff9303);
  --bad: color-mix(in srgb, var(--ruby-red, #bd000b) 60%, white);
  --crit: color-mix(in srgb, var(--destroyer-orange, #f05000) 75%, white);
}

* { box-sizing: border-box; }

html { background-color: var(--bg); color-scheme: dark; scrollbar-color: var(--border) transparent; }
* { scrollbar-color: var(--border) transparent; scrollbar-width: thin; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% -20%, var(--bg-glow) 0%, var(--bg) 60%);
  background-color: var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Libertine", "Linux Libertine", Georgia, serif;
  padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  transition: background .3s ease;
}

.hidden { display: none !important; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }

/* ---------- headings ---------- */

.brand {
  font-size: clamp(1.7rem, 4vw, 2.8rem);
  letter-spacing: .05em;
  margin: 0 0 4px;
  color: var(--gold);
  font-variant: small-caps;
  font-weight: 400;
}
.brand .versal, .site-brand .versal { font-size: 1.4em; line-height: 0; }
.tagline { color: var(--text-dim); margin: 0 0 36px; }
.question {
  font-weight: 500;
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  letter-spacing: .04em;
  margin: 0 0 36px;
}

/* ---------- top bar ---------- */

.site-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  max-width: 1280px;
  margin: 18px auto 0;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.site-left, .site-right { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; min-width: 0; }
.site-brand {
  color: var(--gold);
  text-decoration: none;
  font-variant: small-caps;
  letter-spacing: .05em;
  font-size: 1.25rem;
  white-space: nowrap;
}
.site-selection {
  padding-left: 14px;
  border-left: 1px solid var(--border);
  color: var(--text);
  letter-spacing: .03em;
  white-space: nowrap;
}
.site-nav { display: flex; gap: 8px; }
.site-nav a {
  color: var(--text-dim);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  letter-spacing: .02em;
  transition: color .15s, border-color .15s;
}
.site-nav a:hover { color: var(--text); border-color: var(--gold); }
.site-nav a.active {
  color: var(--gold);
  border-color: color-mix(in srgb, var(--gold) var(--alpha-soft), var(--border));
  background: color-mix(in srgb, var(--gold) var(--alpha-faint), transparent);
}

.main { max-width: 1280px; margin: 20px auto; }

/* ---------- panels & controls ---------- */

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px 18px;
}
.panel + .panel { margin-top: 16px; }
.panel h2 {
  margin: 0 0 6px;
  font-weight: 500;
  font-variant: small-caps;
  letter-spacing: .05em;
  color: var(--gold);
  font-size: 1.35rem;
}
.panel h3 {
  margin: 14px 0 8px;
  font-weight: 500;
  font-variant: small-caps;
  letter-spacing: .05em;
  color: var(--gold);
  font-size: 1.05rem;
}
.hint { color: var(--text-dim); font-size: .88rem; margin: 0 0 14px; }

.segmented { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.segmented button {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 8px 10px;
}
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button:hover { color: var(--text); }
.segmented button.active {
  background: color-mix(in srgb, var(--gold) var(--alpha-faint), transparent);
  color: var(--gold);
}

a.ghost-button { text-decoration: none; }
.ghost-button {
  background: none;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 14px;
  transition: color .15s, border-color .15s;
}
.ghost-button:hover:not(:disabled) { color: var(--text); border-color: var(--gold); }
.ghost-button:disabled { opacity: .5; cursor: default; }

.mini-button {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 6px;
  font-size: .78rem;
  padding: 2px 8px;
}
.mini-button:hover { color: var(--gold); border-color: var(--gold); }
.mini-button.on {
  color: var(--gold);
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) var(--alpha-faint), transparent);
}

.cta {
  width: 100%;
  margin-top: 4px;
  background: color-mix(in srgb, var(--accent) var(--alpha-strong), black);
  border: 1px solid var(--accent);
  color: var(--text);
  font-size: 1.05rem;
  letter-spacing: .08em;
  font-variant: small-caps;
  border-radius: 8px;
  padding: 10px;
  transition: background .15s ease;
}
.cta:hover { background: var(--accent); }
.cta:disabled { opacity: var(--alpha-strong); cursor: wait; }
.cta.busy::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 10px;
  vertical-align: -2px;
  border: 2px solid color-mix(in srgb, var(--text) 40%, transparent);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.text-input {
  background: color-mix(in srgb, var(--bg-card) var(--alpha-strong), transparent);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 7px 10px;
}
.text-input::placeholder { color: var(--text-dim); }
.text-input:focus { outline: none; border-color: var(--gold); }

/* ---------- themed dropdowns (static/select.js) ---------- */

.cselect { position: relative; display: inline-block; min-width: 0; }
.cselect-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.cselect-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: color-mix(in srgb, var(--bg-card) var(--alpha-strong), transparent);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 7px 10px;
  text-align: left;
}
.cselect-button:hover, .cselect.open .cselect-button { border-color: var(--gold); }
.cselect-button:focus-visible { outline: none; border-color: var(--gold); box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) var(--alpha-soft), transparent); }
.cselect-button:disabled { opacity: .5; cursor: default; }
.cselect-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cselect-button::after {
  content: "";
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  margin: -3px 2px 0 0;
  border-right: 1.5px solid var(--gold);
  border-bottom: 1.5px solid var(--gold);
  transform: rotate(45deg);
  transition: transform .15s ease;
}
.cselect.open .cselect-button::after { transform: rotate(-135deg); margin-top: 3px; }
.cselect-list {
  display: none;
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: min(420px, 90vw);
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: color-mix(in srgb, var(--bg-card) 92%, black);
  border: 1px solid color-mix(in srgb, var(--gold) var(--alpha-soft), var(--border));
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .55);
}
.cselect.up .cselect-list { top: auto; bottom: calc(100% + 4px); }
.cselect.open .cselect-list { display: block; }
.cselect-option {
  padding: 6px 12px 6px 26px;
  border-radius: 5px;
  color: var(--text);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
}
.cselect-option.in-group { padding-left: 34px; }
.cselect-option.focus { background: color-mix(in srgb, var(--gold) var(--alpha-faint), transparent); color: var(--gold); }
.cselect-option.selected { color: var(--gold); }
.cselect-option.selected::before { content: "✓"; position: absolute; left: 9px; }
.cselect-option.in-group.selected::before { left: 17px; }
.cselect-group {
  padding: 8px 12px 3px;
  font-variant: small-caps;
  letter-spacing: .06em;
  font-size: .85rem;
  color: color-mix(in srgb, var(--gold) 70%, var(--text-dim));
  cursor: default;
}
.cselect-group:not(:first-child) { border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent); margin-top: 4px; }

.badge {
  font-size: .7rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  line-height: 1.3;
  white-space: nowrap;
}

.warnings {
  border: 1px solid color-mix(in srgb, var(--warn) var(--alpha-strong), transparent);
  background: color-mix(in srgb, var(--warn) var(--alpha-faint), transparent);
  border-radius: 8px;
  padding: 4px 12px;
  margin: 12px 0;
  font-size: .88rem;
}
.warnings p { margin: 8px 0; }
.warnings p::before { content: "⚠ "; color: var(--warn); }

/* ---------- landing (hub) ---------- */

.landing-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(40px, 10vh, 110px) 0 60px;
  text-align: center;
}
.doors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
  max-width: 860px;
  margin: 0 auto;
}
.door {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 34px 28px 30px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
a.door:hover, a.door:focus-visible {
  transform: translateY(-4px);
  border-color: var(--gold);
  box-shadow: 0 12px 34px color-mix(in srgb, var(--gold) var(--alpha-faint), transparent);
  outline: none;
}
.door.soon { opacity: .55; border-style: dashed; }

/* game logos: an alpha mask painted in the theme colour (GW2 palette) */
.game-logo {
  display: block;
  background: var(--gold);
  -webkit-mask: var(--logo) center / contain no-repeat;
  mask: var(--logo) center / contain no-repeat;
}
.e33-logo { --logo: url("/static/e33/logo-mask.png"); aspect-ratio: 1600 / 920; }
.lol-logo { --logo: url("/static/lol/logo-mask.svg"); aspect-ratio: 600 / 229.42; }   /* vector: sharp at any size */
.bar-logo.lol-logo { height: 34px; margin: 0; }
/* GW2: the flat wordmark (564 × 85), centred in the LoL logo's box, so the doors line up */
.gw2-logo { --logo: url("/static/gw2/logo-mask.svg"); aspect-ratio: 600 / 229.42; }
.door .game-logo {
  width: min(100%, 290px);
  margin: -6px 0 8px;
  filter: drop-shadow(0 0 18px color-mix(in srgb, var(--gold) var(--alpha-soft), transparent));
  transition: transform .18s ease;
}
a.door:hover .game-logo, a.door:focus-visible .game-logo { transform: scale(1.03); }
.bar-logo { height: 52px; margin: -8px 0; }
a.site-selection { display: flex; align-items: center; text-decoration: none; }
a.site-selection:hover .game-logo { background: color-mix(in srgb, var(--gold) 80%, white); }
.door-art {
  width: 84px;
  height: 84px;
  color: var(--gold);
  filter: drop-shadow(0 0 16px color-mix(in srgb, var(--gold) var(--alpha-soft), transparent));
}
.door-art svg { width: 100%; height: 100%; }
.door-title { font-size: 1.4rem; font-variant: small-caps; letter-spacing: .05em; color: var(--gold); }
.door-text { color: var(--text-dim); line-height: 1.5; }
.door-cta { margin-top: 6px; color: var(--gold); letter-spacing: .04em; }

.site-footer {
  max-width: 1280px;
  margin: 48px auto 24px;
  text-align: center;
  font-size: .85rem;
  letter-spacing: .04em;
  color: var(--text-dim);
}
.site-footer a { color: var(--text-dim); }

@media (prefers-reduced-motion: reduce) {
  *, *::before { transition: none !important; animation: none !important; }
}

/* a game's own front door (/e33): its logo above the doors */
.landing-main > .site-brand { display: inline-block; margin-bottom: 8px; }
.landing-game-logo {
  width: min(80%, 440px);
  margin: 10px auto 28px;
  filter: drop-shadow(0 0 18px color-mix(in srgb, var(--gold) var(--alpha-soft), transparent));
}

/* ---------- legal notice & privacy (/impressum; from gw2ceo) ---------- */

.legal { max-width: 860px; }
.legal h1 { color: var(--gold); font-weight: 400; font-variant: small-caps; letter-spacing: .05em; margin: 28px 0 10px; }
.legal h2 { font-weight: 500; font-size: 1.1rem; letter-spacing: .04em; margin: 22px 0 6px; }
.legal h3 { font-weight: 500; font-size: 1rem; margin: 14px 0 4px; }
.legal p, .legal address { line-height: 1.55; max-width: 75ch; margin: 0 0 10px; font-style: normal; }
.legal a, .site-footer a:hover { color: var(--gold); }
.legal a { text-decoration: none; }
.legal a:hover { text-decoration: underline; }
.site-footer .riot-legal { display: inline-block; max-width: 760px; margin-top: 8px; font-size: .75rem; line-height: 1.4; }
