/* ==========================================================================
   Base: reset, typography, atmosphere, and the shared "PoE chrome" parts
   (frames, nodes, buttons, chips, dividers).
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-0);
  color: var(--ash-200);
  font: 400 1.0625rem/1.65 var(--f-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
body.menu-open { overflow: hidden; }

/* ember haze that follows the viewport */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1200px 700px at 80% -10%, rgba(169, 58, 8, 0.2), transparent 62%),
    radial-gradient(900px 640px at 4% 42%, rgba(94, 30, 5, 0.16), transparent 66%),
    linear-gradient(180deg, #0a0706 0%, #070504 100%);
}
/* film grain */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  background: url("../assets/img/grain.png") repeat;
  opacity: 0.4;
}

::selection { background: var(--ember-500); color: #fff3de; }

/* scrollbar */
html { scrollbar-color: var(--gold-500) var(--bg-1); }
::-webkit-scrollbar { width: 11px; }
::-webkit-scrollbar-track { background: var(--bg-1); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--gold-500), var(--gold-600));
  border: 2px solid var(--bg-1);
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 700;
  font-synthesis: none;
  letter-spacing: 0.02em;
  color: var(--gold-100);
  text-wrap: balance;
}
p { margin: 0; }
a { color: inherit; }
ul { margin: 0; padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

:focus-visible {
  outline: 2px solid var(--ember-300);
  outline-offset: 3px;
}

.container {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  left: 12px; top: -64px;
  z-index: 300;
  padding: 0.7em 1.1em;
  background: var(--bg-3);
  color: var(--gold-100);
  border: 1px solid var(--gold-400);
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico {
  width: 1em; height: 1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- section scaffolding ---------- */
.section { position: relative; padding-block: clamp(72px, 10vw, 128px); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.8em;
  font: 700 0.72rem/1 var(--f-display);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ember-300);
}
.eyebrow::before {
  content: "";
  width: 7px; height: 7px;
  background: var(--ember-300);
  transform: rotate(45deg);
  box-shadow: 0 0 10px var(--ember-400);
}

.h2 {
  font-size: clamp(2rem, 4.4vw, 3.3rem);
  line-height: 1.04;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.dot { color: var(--ember-300); }

.sec-head {
  display: grid;
  gap: 16px;
  margin-bottom: clamp(32px, 5vw, 56px);
}
.sec-head__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.sec-num {
  font: 700 0.72rem/1 var(--f-display);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--ash-400);
}

/* ornament: ——◆—— */
.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--gold-400);
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-500));
}
.divider::after { background: linear-gradient(270deg, transparent, var(--gold-500)); }
.divider i {
  width: 9px; height: 9px;
  border: 1px solid currentColor;
  transform: rotate(45deg);
  box-shadow: 0 0 0 3px var(--bg-0), 0 0 0 4px var(--gold-600);
}

/* ---------- ornate frame: gold corner brackets + rivets ---------- */
.frame {
  position: relative;
  background: linear-gradient(180deg, rgba(26, 20, 15, 0.94), rgba(12, 9, 7, 0.97));
  border: 1px solid var(--line-2);
  box-shadow:
    inset 0 0 0 1px #000,
    inset 0 0 0 2px rgba(201, 164, 90, 0.09),
    0 34px 80px -24px rgba(0, 0, 0, 0.85);
}
.frame::before,
.frame::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.frame::before {
  --c: var(--gold-300);
  --s: 18px;
  inset: -1px;
  background:
    linear-gradient(var(--c), var(--c)) 0 0 / var(--s) 1px no-repeat,
    linear-gradient(var(--c), var(--c)) 0 0 / 1px var(--s) no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 0 / var(--s) 1px no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 0 / 1px var(--s) no-repeat,
    linear-gradient(var(--c), var(--c)) 0 100% / var(--s) 1px no-repeat,
    linear-gradient(var(--c), var(--c)) 0 100% / 1px var(--s) no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 100% / var(--s) 1px no-repeat,
    linear-gradient(var(--c), var(--c)) 100% 100% / 1px var(--s) no-repeat;
}
.frame::after {
  inset: 6px;
  background:
    radial-gradient(circle, var(--gold-300) 0 1.4px, transparent 2.2px) 0 0 / 7px 7px no-repeat,
    radial-gradient(circle, var(--gold-300) 0 1.4px, transparent 2.2px) 100% 0 / 7px 7px no-repeat,
    radial-gradient(circle, var(--gold-300) 0 1.4px, transparent 2.2px) 0 100% / 7px 7px no-repeat,
    radial-gradient(circle, var(--gold-300) 0 1.4px, transparent 2.2px) 100% 100% / 7px 7px no-repeat;
  opacity: 0.8;
}

/* ---------- passive-tree style node (rotated square + rune) ---------- */
.node {
  position: relative;
  flex: none;
  width: 48px; height: 48px;
  display: grid;
  place-items: center;
}
.node::before {
  content: "";
  position: absolute;
  inset: 6px;
  transform: rotate(45deg);
  border: 1px solid var(--gold-400);
  background: radial-gradient(circle at 50% 30%, #30251b, #0d0a08 75%);
  box-shadow:
    inset 0 0 0 2px #000,
    inset 0 0 0 3px rgba(201, 164, 90, 0.24),
    0 0 0 4px rgba(0, 0, 0, 0.35);
  transition: border-color 0.3s, box-shadow 0.3s, background 0.3s;
}
.node .ico {
  position: relative;
  width: 22px; height: 22px;
  color: var(--gold-200);
  transition: color 0.3s, filter 0.3s;
}
.node.is-lit::before,
:hover > .node::before,
:hover > .group__lead .node::before {
  border-color: var(--ember-300);
  box-shadow:
    inset 0 0 0 2px #000,
    inset 0 0 0 3px rgba(255, 138, 42, 0.35),
    0 0 18px 2px rgba(255, 106, 26, 0.35);
}
:hover > .node .ico { color: var(--ember-200); filter: drop-shadow(0 0 6px rgba(255, 138, 42, 0.8)); }

/* ---------- buttons ---------- */
.btn {
  --btn-bg-1: #2b2118;
  --btn-bg-2: #140f0b;
  --btn-line: var(--gold-400);
  --btn-ink: var(--gold-100);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75em;
  min-height: 48px;
  padding: 0.95em 1.8em;
  font: 700 0.8rem/1 var(--f-display);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  color: var(--btn-ink);
  background: linear-gradient(180deg, var(--btn-bg-1), var(--btn-bg-2));
  border: 1px solid var(--btn-line);
  cursor: pointer;
  isolation: isolate;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(243, 223, 174, 0.16),
    inset 0 0 0 1px #000,
    0 8px 22px -6px rgba(0, 0, 0, 0.8);
  transition: transform 0.25s var(--ease), box-shadow 0.3s var(--ease),
    border-color 0.3s, filter 0.3s;
}
.btn::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(201, 164, 90, 0.22);
  pointer-events: none;
}
.btn::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: 0;
  width: 60%;
  z-index: -1;
  background: linear-gradient(100deg, transparent, rgba(255, 226, 170, 0.3), transparent);
  transform: translateX(-130%) skewX(-18deg);
  transition: transform 0.7s var(--ease);
}
.btn:hover {
  transform: translateY(-2px);
  border-color: var(--gold-200);
  box-shadow:
    inset 0 1px 0 rgba(243, 223, 174, 0.25),
    inset 0 0 0 1px #000,
    0 12px 30px -8px rgba(0, 0, 0, 0.9),
    0 0 24px -6px rgba(255, 138, 42, 0.35);
}
.btn:hover::after { transform: translateX(230%) skewX(-18deg); }
.btn:active { transform: translateY(0); }
.btn .ico { font-size: 1.3em; stroke-width: 1.8; }

.btn--primary {
  --btn-bg-1: #c4500f;
  --btn-bg-2: #6c2406;
  --btn-line: #e8a458;
  --btn-ink: #fff3de;
  text-shadow: 0 1px 0 rgba(58, 17, 0, 0.8);
}
.btn--primary::before { border-color: rgba(255, 226, 170, 0.28); }
.btn--primary:hover {
  filter: brightness(1.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 200, 0.35),
    inset 0 0 0 1px #000,
    0 12px 30px -8px rgba(0, 0, 0, 0.9),
    0 0 36px -4px rgba(255, 106, 26, 0.6);
}
.btn--sm { min-height: 40px; padding: 0.75em 1.3em; font-size: 0.7rem; }
.btn--block { display: flex; width: 100%; }

/* ---------- chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.5em 0.95em;
  font: 700 0.64rem/1 var(--f-display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ash-200);
  background: rgba(20, 16, 13, 0.85);
  border: 1px solid var(--line-2);
}
.chip--ember { color: var(--ember-200); border-color: var(--ember-500); background: rgba(94, 30, 5, 0.35); }
.chip--gold { color: var(--gold-200); border-color: var(--gold-500); }
.chip--dim { color: var(--ash-400); border-style: dashed; }

/* ---------- reveal on scroll (only when JS is on) ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
  transition-delay: var(--d, 0s);
}
.js .reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%; bottom: 28px;
  z-index: 250;
  max-width: min(92vw, 460px);
  padding: 14px 20px;
  background: var(--bg-3);
  border: 1px solid var(--gold-400);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  color: var(--ash-100);
  font-size: 0.95rem;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 24px);
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s var(--ease);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* single character inside a .node (marketplace logo) */
.node__ch {
  position: relative;
  font: 700 1rem/1 var(--f-display);
  color: var(--gold-200);
}

/* Non-Russian visitors: hide the page until i18n.js has translated it (no flash of Russian).
   The animation reveals it anyway after 2.5s so a failed script can never leave a blank page. */
.i18n-wait body {
  visibility: hidden;
  animation: i18n-reveal 0s linear 2.5s forwards;
}
@keyframes i18n-reveal { to { visibility: visible; } }

/* Chinese text does not need the wide tracking used for small caps */
:lang(zh) :is(.eyebrow, .sec-num, .chip, .btn, .nav a, .buy__label, .tier__rarity, .group__cat,
    .count-big small, .gallery__cap strong, .lightbox__bar strong, .legal__title,
    .footer-col h3, .lang-switch button) {
  letter-spacing: 0.08em;
}
