/* Reset, page shell, masthead (emblem, wordmark, emblem), banners, footer. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* `hidden` must win over the display: grid/flex of .page, .columns, canvas... */
[hidden] {
  display: none !important;
}

main:focus {
  outline: none;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* The site bar stays at the top: jumps to an anchor land below it. */
  scroll-padding-top: 3.6rem;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.55;
  color: var(--text);
  background-color: var(--stone-950);
  background-image:
    radial-gradient(120% 70% at 50% -10%, rgba(154, 123, 255, 0.2), transparent 60%),
    radial-gradient(90% 55% at 8% 8%, rgba(255, 138, 43, 0.1), transparent 55%),
    radial-gradient(80% 50% at 95% 25%, rgba(85, 168, 255, 0.09), transparent 60%),
    linear-gradient(180deg, var(--stone-900) 0%, var(--stone-950) 45%, #05040a 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  font-variant-numeric: lining-nums;
}

/* Stone grain. The SVG is drawn here, not downloaded: data: images only. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(0, 0, 0, 0.72) 100%);
}

.masthead,
.banners,
.page,
.footer {
  position: relative;
  z-index: 3;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.05em;
  margin: 0;
  line-height: 1.2;
}

p {
  margin: 0;
}

a {
  color: var(--text-gold-bright);
  text-decoration: none;
}

a:hover {
  color: var(--text-strong);
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--gold-bright);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

ol,
ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

canvas {
  display: block;
}

/* Shared gradients for the cartoon icons: in the page, not display:none. */
.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -4rem;
  left: 1rem;
  z-index: 50;
  padding: 0.55rem 1rem;
  font-size: var(--fs-text);
  background: var(--stone-800);
  border: 2px solid var(--gold);
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  top: 0.6rem;
}

.muted {
  color: var(--text-muted);
}

/* --- masthead: emblem, wordmark, mirrored emblem ---------------------------- */

/* The site bar: a gold-rimmed band across the top with the page tabs (the
   dashboard, and greyed "soon" tabs for the pages planned for later). It
   stays at the top while the page scrolls (owner, 2026-10-31): above the page
   (3), below the dev bar (40), the skip link (50), tooltips and confetti (60)
   and the level-up curtain (70). On a phone the tabs scroll sideways inside
   the band, never the page. */
.sitebar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 2px solid var(--gold-line);
  background: linear-gradient(180deg, var(--stone-800), var(--stone-950));
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.sitebar-tabs {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  gap: 0.2rem;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}

.sitebar-tabs::-webkit-scrollbar {
  display: none;
}

.sitebar-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.9rem;
  padding: 0.5rem 0.95rem;
  margin-bottom: -2px;
  border-bottom: 3px solid transparent;
  font-family: var(--font-display);
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text-muted);
}

.sitebar-tab .icon {
  width: 1.15rem;
  height: 1.15rem;
}

.sitebar-tab[aria-current="page"] {
  color: var(--text-gold-bright);
  border-bottom-color: var(--gold);
  background: linear-gradient(180deg, transparent, var(--tint-gold));
}

a.sitebar-tab[href]:hover {
  color: var(--text-gold-bright);
}

.sitebar-soon {
  color: var(--text-faint);
  cursor: default;
}

.sitebar-soon .icon {
  opacity: 0.55;
}

.sitebar-tag {
  padding: 0 0.45rem;
  border: 1px solid var(--gold-line);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: var(--fs-label);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-faint);
}

/* Phones and small tablets: the seven tabs share the band, each an icon
   over a short label (.tab-short), so none is cut off and nothing scrolls.
   Each tab is at least as wide as its label and the room left over is shared
   out evenly, so two long labels never touch (2026-11-11: equal grid columns
   of ~63 px at 390 px ran "Crafting" into "Market" and "Auctions" into
   "BiS"). The short labels take over below 960 px, where the seven long ones
   (about 920 px with the band's gutters, 2026-11-14 with Items; six tabs
   needed 840 px) no longer fit; up to 1023 px the long ones sit closer.
   Below 365 px "Crafting" and "Auctions" shorten again (.tab-shrink gives
   way to .tab-tiny: "Craft", "AH"), so the seven fit a 320 px phone. Measured from 320 px up; on a
   phone narrower still, the band scrolls sideways as above. */
@media (max-width: 1100px) {
  .sitebar-tab .icon {
    display: none;
  }
}

@media (max-width: 1023px) {
  .sitebar-tab {
    padding: 0.5rem 0.7rem;
  }
}

.tab-short,
.tab-tiny {
  display: none;
}

@media (max-width: 959px) {
  .sitebar-tabs {
    gap: 0;
    padding: 0 0.25rem;
  }

  .sitebar-tabs > li {
    display: flex;
    flex: 1 0 auto;
  }

  .sitebar-tab {
    flex: 1 0 auto;
    flex-direction: column;
    justify-content: center;
    gap: 0.15rem;
    min-height: 3.3rem;
    padding: 0.35rem 0.15rem 0.3rem;
    letter-spacing: 0.02em;
  }

  .sitebar-tab .icon {
    display: block;
    width: 1.25rem;
    height: 1.25rem;
  }

  /* The short label shows ("Auctions" for "Auction House"); the long one
     stays the tab's accessible name. */
  .tab-long {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .tab-short {
    display: block;
    font-size: var(--fs-label);
    text-transform: none;
    letter-spacing: 0;
  }
}

@media (max-width: 364px) {
  .tab-shrink {
    display: none;
  }

  .tab-tiny {
    display: block;
    font-size: var(--fs-label);
    text-transform: none;
    letter-spacing: 0;
  }
}

/* The masthead: one short band (owner, 2026-11-05: half the old height). The
   brand sits on the page axis; the live pill floats left of it and the
   buttons right, on one row from 900 px up, a slim row above it below that. */
.masthead {
  position: relative;
  padding: var(--sp-3) var(--gutter) var(--sp-3);
  border-bottom: 1px solid var(--panel-rule);
  background: radial-gradient(50% 120% at 50% 0%, rgba(154, 123, 255, 0.12), transparent 70%);
}

.masthead-bar {
  max-width: var(--page-max);
  margin: 0 auto var(--sp-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

@media (min-width: 900px) {
  .masthead-bar {
    position: absolute;
    z-index: 1;
    top: 50%;
    left: var(--gutter);
    right: var(--gutter);
    translate: 0 -50%;
    margin: 0 auto;
    pointer-events: none;
  }

  .masthead-bar > * {
    pointer-events: auto;
  }
}

.masthead-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(0.5rem, 1.4vw, 1rem);
  color: inherit;
}

.brand:hover {
  color: inherit;
}

.emblem {
  flex: none;
  width: clamp(38px, 5vw, 60px);
  height: auto;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.55)) drop-shadow(0 0 12px rgba(255, 196, 90, 0.3));
  transition: rotate var(--t-mid), scale var(--t-mid);
}

/* The right one is the same drawing, mirrored. */
.emblem-right {
  scale: -1 1;
}

.brand:hover .emblem-left {
  rotate: -5deg;
  scale: 1.05;
}

.brand:hover .emblem-right {
  rotate: 5deg;
  scale: -1.05 1.05;
}

/* The wordmark: THE above, a chunky beveled FOREVER, RACE on a ribbon. */
.wordmark {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  letter-spacing: 0;
}

.wm-the {
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-size: var(--fs-label);
  font-weight: 800;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  text-transform: uppercase;
  color: var(--text-gold);
  text-shadow: 0 2px 0 var(--ink-line);
}

.wm-the::before,
.wm-the::after {
  content: "";
  width: 2.2em;
  height: 6px;
  background:
    radial-gradient(circle, var(--gold-bright) 0 2px, transparent 2.5px) right center / 6px 6px no-repeat,
    linear-gradient(90deg, transparent, var(--gold)) left center / calc(100% - 6px) 2px no-repeat;
}

.wm-the::after {
  scale: -1 1;
}

.wm-forever {
  display: block;
  margin-top: 0.04em;
  font-size: clamp(1.9rem, 1.2rem + 2vw, 2.75rem);
  font-weight: 900;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  line-height: 0.95;
  background: linear-gradient(180deg,
      var(--gold-text-top) 0%,
      #fff0b8 24%,
      var(--gold-text-mid) 47%,
      #eebc50 51%,
      var(--gold-text-low) 74%,
      #f6cf68 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter:
    drop-shadow(0 1px 0 var(--ink-line))
    drop-shadow(0 -1px 0 var(--ink-line))
    drop-shadow(1px 0 0 var(--ink-line))
    drop-shadow(-1px 0 0 var(--ink-line))
    drop-shadow(0 2px 0 #6a420b)
    drop-shadow(0 0 16px rgba(255, 186, 74, 0.32));
}

.wm-race {
  position: relative;
  margin-top: 0.3em;
  padding: 0.22em 1.4em 0.2em;
  font-size: var(--fs-label);
  font-weight: 800;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  text-transform: uppercase;
  color: var(--text-on-ribbon);
  text-shadow: 0 2px 0 rgba(40, 6, 4, 0.9);
  background: linear-gradient(180deg, var(--surface-ribbon) 0%, #8a221b 55%, #5e120e 100%);
  clip-path: polygon(0 0, 100% 0, calc(100% - 0.7em) 50%, 100% 100%, 0 100%, 0.7em 50%);
  box-shadow:
    inset 0 2px 0 #f0c75a,
    inset 0 3px 0 rgba(0, 0, 0, 0.45),
    inset 0 -2px 0 #c8952e,
    inset 0 -3px 0 rgba(0, 0, 0, 0.45);
}

/* The page's one line under the brand; the race banner says it on the dashboard. */
.masthead-sub {
  margin-top: var(--sp-2);
  text-align: center;
  font-size: var(--fs-note);
  font-style: italic;
  color: var(--text-muted);
}

/* The buttons stay together (never the sound button on its own). */
.tool-group {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

/* --- page grid ------------------------------------------------------------ */

.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: clamp(1rem, 2.4vw, 1.75rem) var(--gutter) var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.columns {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: var(--gap);
  align-items: start;
}

.column-main,
.column-side {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-width: 0;
}

@media (max-width: 1080px) {
  .columns {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* --- banners -------------------------------------------------------------- */

.banners {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.banners:empty {
  display: none;
}

.banner {
  margin-top: 0.9rem;
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 2px solid rgba(232, 178, 76, 0.6);
  background: var(--surface-banner-warn);
  font-size: var(--fs-text);
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.75rem;
  align-items: baseline;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.45), 0 6px 18px rgba(0, 0, 0, 0.4);
}

.banner-warn {
  color: var(--text-banner-warn);
}

/* a link in a banner (index.html's "the live page didn't start" notes) */
.banner a {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.banner-bad {
  border-color: rgba(226, 86, 79, 0.7);
  background: var(--surface-banner-bad);
  color: var(--text-banner-bad);
}

.banner-title {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  font-size: var(--fs-small);
  flex: none;
}

/* --- footer --------------------------------------------------------------- */

.footer {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 1.6rem var(--gutter) 3.2rem;
  text-align: center;
  color: var(--text-faint);
  font-size: var(--fs-note);
  border-top: 1px solid rgba(212, 175, 55, 0.2);
}

.footer-line + .footer-line {
  margin-top: 0.4rem;
}
