/* ==========================================================================
   Master of Chaos — site styles

   Palette is taken off the key art: violet cave dark, pale stone lettering,
   crystal cyan and magenta, lava orange in the cracks, a little moss green.
   ========================================================================== */

@font-face {
  font-family: 'Noto Sans';
  src: url('../fonts/NotoSans-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Noto Sans';
  src: url('../fonts/NotoSans-Black.ttf') format('truetype');
  font-weight: 900;
  font-display: swap;
}

:root {
  --void:      #0d0616;
  --deep:      #14091f;
  --panel:     #1c1029;
  --raised:    #261638;
  --line:      #3a2352;
  --line-soft: #2b1a3d;

  --text:      #efe7f7;
  --muted:     #a794bd;
  --faint:     #7a6890;

  --crystal:   #45d7ff;  /* the blue crystals */
  --bloom:     #ff4fd1;  /* the pink crystals */
  --lava:      #ff8a3d;  /* the cracks */
  --moss:      #9ed36a;  /* the growth on the stone */

  /* Rarity ladder. Shifted one step up from the usual ARPG scale — there is
     no white tier in this game, so Common already carries a colour. */
  --r-common:    #6fbf73;
  --r-magic:     #4aa8ee;
  --r-rare:      #a96ef0;
  --r-epic:      #ff4fd1;
  --r-legendary: #ff9a3c;

  --shell: 1180px;
  --radius: 14px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  background: var(--deep);
  color: var(--text);
  font-family: 'Noto Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* A faint violet haze so the flat background is not dead flat. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60rem 40rem at 15% -10%, rgba(255, 79, 209, .10), transparent 65%),
    radial-gradient(55rem 40rem at 90% 8%,  rgba(69, 215, 255, .09), transparent 65%),
    radial-gradient(70rem 50rem at 50% 105%, rgba(255, 138, 61, .07), transparent 60%);
}

/* height:auto is load-bearing: without it a width/height attribute pair on an
   element whose width CSS overrides will stretch it to the attribute height. */
img, video { max-width: 100%; height: auto; display: block; }

a { color: var(--crystal); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -.02em;
  margin: 0 0 .5em;
}

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

.shell {
  width: min(var(--shell), 100% - 3rem);
  margin-inline: auto;
}

/* ---------- skip link ---------------------------------------------------- */

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--bloom);
  color: var(--void);
  padding: .7rem 1.2rem;
  font-weight: 900;
  border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

/* ---------- nav ---------------------------------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(13, 6, 22, .82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 64px;
}

.nav-mark {
  font-weight: 900;
  font-size: .82rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
}
.nav-mark:hover { text-decoration: none; color: var(--bloom); }

.nav-links {
  display: flex;
  gap: 1.4rem;
  margin-left: auto;
  list-style: none;
  padding: 0;
  margin-block: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-links a {
  color: var(--muted);
  font-size: .88rem;
  font-weight: 400;
  white-space: nowrap;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }

/* ---------- buttons ------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  padding: .85rem 1.6rem;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-weight: 900;
  font-size: .95rem;
  letter-spacing: .01em;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }

.btn-primary {
  background: linear-gradient(135deg, var(--bloom), #c73bd8);
  color: #200a1c;
  box-shadow: 0 8px 26px rgba(255, 79, 209, .3);
}
.btn-primary:hover { box-shadow: 0 12px 34px rgba(255, 79, 209, .42); }

.btn-ghost {
  background: rgba(255, 255, 255, .05);
  border-color: var(--line);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--crystal); color: var(--crystal); }

/* ---------- hero --------------------------------------------------------- */

.hero {
  position: relative;
  min-height: min(88vh, 780px);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 5rem 0 4.5rem;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: url('../img/hero.jpg') center/cover no-repeat;
  opacity: .5;
  transform: scale(1.05);
}
.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(13,6,22,.55) 0%, rgba(13,6,22,.2) 35%, var(--deep) 96%);
}

.hero-inner { position: relative; }

.hero-logo {
  width: min(660px, 84vw);
  margin: 0 auto 1.2rem;
  filter: drop-shadow(0 18px 44px rgba(0, 0, 0, .65));
}

.hero-tag {
  font-size: clamp(1rem, 2.4vw, 1.32rem);
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--bloom);
  margin-bottom: 1rem;
}

.hero-blurb {
  max-width: 40rem;
  margin: 0 auto 2rem;
  color: #d9cde8;
  font-size: 1.09rem;
}

.hero-cta {
  display: flex;
  gap: .9rem;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-meta {
  margin-top: 2.2rem;
  color: var(--faint);
  font-size: .84rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  font-weight: 900;
}

/* ---------- section scaffolding ------------------------------------------ */

.section { padding: 5.5rem 0; }
.section-tint { background: rgba(0, 0, 0, .22); }

.section-head { max-width: 44rem; margin-bottom: 3rem; }
.section-head.center { margin-inline: auto; text-align: center; }

.kicker {
  display: block;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--crystal);
  margin-bottom: .75rem;
}

.section-head h2 { font-size: clamp(1.9rem, 4.2vw, 2.75rem); }
.section-head p { color: var(--muted); font-size: 1.06rem; }

.lede { font-size: 1.14rem; color: #ddd2ea; }

/* ---------- trailer ------------------------------------------------------ */

.trailer-frame {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .5);
}
.trailer-frame video { width: 100%; height: auto; }
.trailer-frame iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
}

/* Click-to-load poster. A button, not a div, so it is reachable by keyboard
   and announces itself. */
.trailer-play {
  display: block;
  position: relative;
  width: 100%;
  padding: 0;
  border: 0;
  background: #000;
  cursor: pointer;
  line-height: 0;
}
.trailer-play img {
  display: block;
  width: 100%;
  height: auto;
  opacity: .88;
  transition: opacity .25s ease, transform .4s ease;
}
.trailer-play:hover img,
.trailer-play:focus-visible img { opacity: 1; transform: scale(1.012); }

.trailer-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: var(--bloom);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .55);
  transition: transform .25s ease;
}
/* The triangle, drawn with a border so no asset is needed. Nudged right
   because a triangle's optical centre sits left of its bounding box. */
.trailer-play-icon::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-40%, -50%);
  border-style: solid;
  border-width: 15px 0 15px 25px;
  border-color: transparent transparent transparent var(--void);
}
.trailer-play:hover .trailer-play-icon { transform: translate(-50%, -50%) scale(1.08); }
.trailer-play:focus-visible { outline: 2px solid var(--crystal); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  .trailer-play img,
  .trailer-play-icon { transition: none; }
  .trailer-play:hover img,
  .trailer-play:focus-visible img { transform: none; }
  .trailer-play:hover .trailer-play-icon { transform: translate(-50%, -50%); }
}

.clip-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

/* ---------- clip (a small looping video) --------------------------------- */

.clip {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel);
}
.clip video { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000; }
.clip figcaption {
  padding: .7rem .9rem;
  font-size: .84rem;
  color: var(--muted);
}
.clip figcaption b { color: var(--text); font-weight: 900; display: block; }

/* ---------- portrait clips ----------------------------------------------- */

/* Most of the tooltip captures are 9:16. Cropping them into the 16:9 frame
   showed a narrow band out of the middle, blown up — so give them a tall frame
   and let the whole shot through instead. */
.feature-media.clip-portrait,
.clip.clip-portrait {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #000;
}

.feature-media.clip-portrait video,
.clip.clip-portrait video {
  aspect-ratio: 9 / 16;
  width: auto;
  height: auto;
  object-fit: contain;
}

.feature-media.clip-portrait video { max-height: 560px; }
.clip.clip-portrait video { max-height: 420px; }

.clip.clip-portrait figcaption { align-self: stretch; }

/* ---------- feature blocks ----------------------------------------------- */

.feature {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  padding: 3rem 0;
  border-top: 1px solid var(--line-soft);
}
.feature:first-of-type { border-top: 0; padding-top: 0; }

/* Every other block puts the video on the left without reordering the DOM. */
.feature:nth-child(even) .feature-media { order: -1; }

.feature-media {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  box-shadow: 0 20px 48px rgba(0, 0, 0, .4);
}
.feature-media video { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }

.feature h3 { font-size: 1.6rem; }
.feature-body p { color: var(--muted); }


/* ---------- break section ------------------------------------------------ */

.break {
  background:
    linear-gradient(rgba(13, 6, 22, .9), rgba(13, 6, 22, .96)),
    url('../img/page-bg.jpg') center/cover fixed no-repeat;
  border-block: 1px solid var(--line-soft);
}

.era-ladder {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 2.5rem;
  counter-reset: era;
}

.era {
  position: relative;
  padding: 1.4rem 1.2rem;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--panel);
}
.era::before {
  counter-increment: era;
  content: counter(era);
  font-weight: 900;
  font-size: .74rem;
  letter-spacing: .18em;
  color: var(--lava);
}
.era h4 { font-size: 1.05rem; margin: .4rem 0 .35rem; }
.era p { font-size: .88rem; color: var(--muted); margin: 0; }

.break-modes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.2rem;
  margin-top: 2.5rem;
}
.mode {
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(38, 22, 56, .55);
}
.mode h4 { font-size: 1.05rem; color: var(--lava); }
.mode p { font-size: .93rem; color: var(--muted); margin: 0; }

/* ---------- items -------------------------------------------------------- */

.items-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .8rem;
  margin-bottom: 2.5rem;
}

.rarity-card {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--panel);
  border-left: 3px solid var(--tint, var(--line));
}
.rarity-card .n { font-size: 1.7rem; font-weight: 900; line-height: 1; }
.rarity-card .l {
  display: block;
  margin-top: .3rem;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--tint, var(--muted));
}

/* Filter bar. Type chips on top, search under them: the chips are the coarse
   cut most people want and the search narrows whatever they landed on. */
.filters {
  position: sticky;
  top: 64px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: .7rem;
  padding: .9rem 0;
  margin-bottom: 1.5rem;
  background: rgba(20, 9, 31, .94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

.filter-line {
  display: flex;
  align-items: center;
  gap: .6rem;
}

.search {
  flex: 1 1 230px;
  min-width: 0;
  padding: .65rem .95rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--void);
  color: var(--text);
  font: inherit;
  font-size: .92rem;
}
.search::placeholder { color: var(--faint); }
.search:focus { outline: 2px solid var(--crystal); outline-offset: 1px; }

.chip {
  padding: .5rem .85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .82rem;
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: var(--faint); }
.chip[aria-pressed='true'] {
  background: var(--tint, var(--bloom));
  border-color: var(--tint, var(--bloom));
  color: var(--void);
}

/* All reads as a reset, not as a seventeenth type, so it stays quiet while a
   real filter is on and only lights up when it is the thing in effect. */
.chip-all { color: var(--faint); }
.chip-all[aria-pressed='true'] {
  background: transparent;
  border-color: var(--faint);
  color: var(--text);
}

.filter-count {
  margin-left: auto;
  font-size: .82rem;
  color: var(--faint);
  font-weight: 400;
  white-space: nowrap;
}

/* category block */
.cat { margin-bottom: 3rem; }
.cat-head {
  display: flex;
  align-items: baseline;
  gap: .8rem;
  flex-wrap: wrap;
  padding-bottom: .7rem;
  border-bottom: 2px solid var(--line);
  margin-bottom: 0;
}
.cat-head h3 { font-size: 1.35rem; margin: 0; }
.cat-head .n {
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .1em;
  color: var(--faint);
}
.cat-head .blurb {
  width: 100%;
  color: var(--muted);
  font-size: .92rem;
  margin: .35rem 0 0;
}

.table-wrap { overflow-x: auto; }

table.items {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}

table.items th {
  text-align: left;
  padding: .8rem .8rem;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}

table.items td {
  padding: .85rem .8rem;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}

table.items tbody tr:hover { background: rgba(255, 255, 255, .028); }

/* The icon column. The cell is always drawn, and the <img> sits on top of it
   when the item has art. Items without art keep the bare hatched frame, which
   is why the placeholder is styled rather than hidden. Dropping
   assets/img/icons/<item-id>.png in later needs no change here. */
.col-icon { width: 56px; }

.icon-cell {
  position: relative;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--raised);
  overflow: hidden;
}
.icon-cell img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--raised);
}
.icon-cell::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(45deg,
      transparent 0 5px,
      rgba(255, 255, 255, .045) 5px 10px);
}
.icon-cell img { z-index: 1; }

.col-name { min-width: 260px; }
.col-stats { min-width: 180px; }
.col-rarity { width: 110px; }
.col-price { width: 80px; text-align: right; }
table.items td.col-price { text-align: right; font-variant-numeric: tabular-nums; }

.item-name {
  font-weight: 900;
  color: var(--text);
  display: block;
  margin-bottom: .2rem;
}
.item-fact { color: var(--muted); font-size: .88rem; margin: 0; }
.item-flavour {
  color: var(--faint);
  font-size: .85rem;
  font-style: italic;
  margin: .35rem 0 0;
}
.item-tags { margin-top: .45rem; display: flex; flex-wrap: wrap; gap: .3rem; }
.tag {
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .04em;
  padding: .16em .5em;
  border-radius: 5px;
  border: 1px solid var(--line);
  color: var(--faint);
}
.tag.req { border-color: rgba(255, 138, 61, .45); color: var(--lava); }
.tag.syn { border-color: rgba(158, 211, 106, .4); color: var(--moss); }

.stat-line {
  display: block;
  font-variant-numeric: tabular-nums;
  font-size: .88rem;
  color: #cbbcdd;
}
.stat-line b { color: var(--crystal); font-weight: 900; }

.rarity-pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--tint);
}
.rarity-pill::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 2px;
  transform: rotate(45deg);
  background: var(--tint);
}

.empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--faint);
}

/* ---------- signup forms ------------------------------------------------- */

.signup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.card {
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(165deg, var(--panel), rgba(20, 9, 31, .6));
}
.card h3 { font-size: 1.3rem; }
.card > p { color: var(--muted); font-size: .96rem; }

.field { margin-bottom: .9rem; }
.field label {
  display: block;
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: .35rem;
}
.field input,
.field select {
  width: 100%;
  padding: .75rem .95rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--void);
  color: var(--text);
  font: inherit;
  font-size: .95rem;
}
.field input:focus,
.field select:focus { outline: 2px solid var(--crystal); outline-offset: 1px; }

.consent {
  display: flex;
  gap: .6rem;
  align-items: flex-start;
  font-size: .84rem;
  color: var(--muted);
  margin-bottom: 1.1rem;
}
.consent input { margin-top: .28rem; flex: none; }

.form-note {
  margin-top: .9rem;
  font-size: .8rem;
  color: var(--faint);
}

.form-status {
  margin-top: .9rem;
  padding: .7rem .9rem;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 400;
  display: none;
}
.form-status.show { display: block; }
.form-status.warn {
  background: rgba(255, 138, 61, .12);
  border: 1px solid rgba(255, 138, 61, .4);
  color: var(--lava);
}

/* ---------- dev ---------------------------------------------------------- */

.dev {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 3rem;
  align-items: start;
}

.dev-mark {
  padding: 1.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  text-align: center;
}
.dev-mark img { margin: 0 auto 1rem; max-width: 170px; }
.dev-mark .handle {
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: .02em;
}
.dev-mark .role {
  font-size: .78rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: .25rem;
}

blockquote.pull {
  margin: 2rem 0 0;
  padding: 1.2rem 0 1.2rem 1.5rem;
  border-left: 3px solid var(--bloom);
  font-size: 1.16rem;
  font-weight: 400;
  color: var(--text);
}

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

.footer {
  padding: 3rem 0 4rem;
  border-top: 1px solid var(--line-soft);
  background: var(--void);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: space-between;
  align-items: center;
  color: var(--faint);
  font-size: .86rem;
}
.footer-links { display: flex; gap: 1.4rem; flex-wrap: wrap; }

/* ---------- responsive --------------------------------------------------- */

@media (max-width: 860px) {
  .feature { grid-template-columns: 1fr; gap: 1.5rem; padding: 2.5rem 0; }
  .feature:nth-child(even) .feature-media { order: 0; }
  .dev { grid-template-columns: 1fr; gap: 1.75rem; }
  .section { padding: 4rem 0; }
  .filters { top: 0; }
  /* Sixteen chips wrap to four rows on a phone and the sticky bar swallows the
     screen. One scrolling line instead. */
  .chip-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    /* Bleeds into the shell's own gutter so the row scrolls edge to edge
       instead of stopping short and looking clipped. */
    margin: 0 -1rem;
    padding: 0 1rem;
  }
  .chip-row::-webkit-scrollbar { display: none; }
}

@media (max-width: 620px) {
  body { font-size: 16px; }
  .shell { width: min(var(--shell), 100% - 2rem); }
  .nav-links { gap: 1rem; }
  .hero-cta .btn { width: 100%; }
  .card { padding: 1.5rem; }
  /* The item table is dense by nature — let it scroll rather than crush. */
  table.items { min-width: 640px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn:hover { transform: none; }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
