:root {
  color-scheme: dark;
  --background: #0e1718;
  --surface: #172222;
  --surface-raised: #1f2e2c;
  --ink: #f4ead7;
  --muted: #bac4ba;
  --brass: #e7bd79;
  --line: #3c4b44;
  --display: Georgia, 'Times New Roman', serif;
  --text: system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-width: 260px;
  background: var(--background);
  color: var(--ink);
  font: 1rem/1.6 var(--text);
}

a { color: var(--brass); text-underline-offset: .24em; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid #ffe09d; outline-offset: 4px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.06; }
h1 { font-size: clamp(2.75rem, 6.5vw, 5.75rem); letter-spacing: -.045em; }
h2 { font-size: clamp(2.05rem, 4vw, 3.55rem); letter-spacing: -.035em; }
h3 { font-size: 1.4rem; }

.wrap { width: min(1180px, calc(100% - 64px)); margin-inline: auto; }
.wide { width: min(1460px, calc(100% - 48px)); margin-inline: auto; }
.skip-link {
  position: fixed;
  inset: 10px auto auto 10px;
  z-index: 8;
  background: var(--background);
  padding: .6rem 1rem;
}
.skip-link:not(:focus) { transform: translateY(-150%); }

.site-header { border-bottom: 1px solid #c6a26736; }
.header-inner, .footer-inner, .section-heading, .actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.header-inner { min-height: 74px; }
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: .8rem;
  color: var(--ink);
  text-decoration: none;
  font: 1.05rem var(--display);
  font-weight: bold;
  letter-spacing: .055em;
}
.compass {
  flex: 0 0 19px;
  height: 19px;
  display: grid;
  place-items: center;
  border: 1px solid var(--brass);
  margin: 0 4px;
  transform: rotate(45deg);
}
.compass::after {
  content: '';
  width: 7px;
  height: 7px;
  background: var(--brass);
}
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: clamp(.6rem, 2.2vw, 1.7rem); }
.site-nav a { text-decoration: none; color: var(--muted); font-size: .93rem; white-space: nowrap; }
.site-nav a:hover, .site-nav [aria-current="page"] { color: var(--ink); }
.site-nav [aria-current="page"]:not(.button) { text-decoration: underline; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 44px;
  padding: .65rem 1.15rem;
  border: 1px solid var(--line);
  background: var(--surface-raised);
  border-radius: 4px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
  line-height: 1.3;
}
.button:hover:not(:disabled) { border-color: var(--brass); }
.button.primary, .site-nav .button.primary { color: #20190e; background: var(--brass); border-color: var(--brass); }
.button.primary:hover:not(:disabled) { background: #ffdaa2; }
.button:disabled { opacity: .48; }
.button.compact { min-height: 36px; padding: .45rem .85rem; }

.hero {
  isolation: isolate;
  position: relative;
  min-height: min(660px, 84svh);
  display: grid;
  align-items: center;
  background: #152627 url('../artwork/maps/flooded-trade-town.webp') center right / cover no-repeat;
  border-bottom: 1px solid #c6a26755;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, #0a1214f5 2%, #0a1214c9 36%, #0a121416 78%),
    linear-gradient(0deg, #0d1719d9, transparent 48%);
}
.hero-content { padding-block: clamp(3.5rem, 10vw, 8rem); }
.eyebrow {
  margin-bottom: .8rem;
  color: var(--brass);
  font: 650 .76rem/1.3 var(--text);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.hero h1 { margin-bottom: 1.2rem; font-size: clamp(3.55rem, 8vw, 7.2rem); line-height: .91; }
.hero-copy { max-width: 33rem; margin-bottom: 1.45rem; color: var(--ink); font-size: clamp(1rem, 2.2vw, 1.25rem); }
.actions { justify-content: flex-start; }
.hero .actions { gap: .85rem; }
.hero .secondary { background: #0f191a99; border-color: #c6a267a6; }
.hero-meta { margin: 1.15rem 0 0; font-size: .88rem; color: #deded0; }

.content-section, .page { padding-block: clamp(2.6rem, 6vw, 5.4rem); }
.content-section + .content-section { border-top: 1px solid var(--line); }
.section-heading { align-items: baseline; margin-bottom: 1.6rem; }
.section-heading h2 { margin: 0; }
.section-heading a { white-space: nowrap; }
.page-intro { max-width: 47rem; margin-bottom: 2rem; }
.page-intro h1 { margin-bottom: .7rem; }
.page-intro p:last-child { color: var(--muted); margin-bottom: 0; }
.footer-inner {
  min-height: 88px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .86rem;
}
.footer-inner p { margin: 0; }

.deck-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.deck-preview {
  padding: 1.3rem;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, #202d2c, var(--surface) 75%);
}
.deck-preview h3 { margin: .5rem 0 .5rem; font-size: clamp(1.45rem, 2.8vw, 2.45rem); }
.deck-preview p { color: var(--muted); margin-bottom: .7rem; }
.deck-preview small { color: var(--brass); font-weight: 650; }

.filters { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: .8rem; margin-bottom: 1rem; }
.filters label { display: grid; min-width: 0; gap: .25rem; color: var(--muted); font-size: .88rem; }
.filters :is(input,select) {
  min-width: 0;
  min-height: 44px;
  padding: .5rem .75rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
}
.result-count { color: var(--muted); font-size: .9rem; margin-bottom: 1.15rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 208px), 1fr)); gap: .85rem; }
.card {
  display: flex;
  flex-direction: column;
  gap: .38rem;
  min-width: 0;
  min-height: 223px;
  background: linear-gradient(145deg, #293834, #172222 75%);
  border: 1px solid #586158;
  color: var(--ink);
  padding: .7rem;
  border-radius: 6px;
  text-align: left;
  line-height: 1.28;
}
.card .art {
  height: 94px;
  width: 100%;
  border-radius: 3px;
  object-fit: cover;
  background: #102023;
}
.card .sigil {
  display: grid;
  place-items: center;
  background: repeating-linear-gradient(135deg, #253632 0 8px, #20302c 8px 16px);
  color: var(--brass);
  font: 2.2rem var(--display);
}
.card-type { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .2rem .5rem; color: var(--muted); font-size: .8rem; }
.card-energy { color: var(--brass); white-space: nowrap; }
.card-name { font: bold 1.17rem/1.15 var(--display); }
.card-rules, .card-stats { font-size: .84rem; }
.card-stats { color: #f3ce93; }
.card-copy { margin-top: auto; color: var(--muted); font-size: .78rem; }

.map-figure { margin: 0 0 2rem; }
.map-figure img { width: 100%; border: 1px solid #bd9c6380; }
.map-figure figcaption { padding: .65rem 0; color: var(--muted); font-size: .91rem; }
.landmarks { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: .6rem; padding: 0; list-style: none; }
.landmarks li { border-left: 2px solid #bc945a; background: var(--surface); padding: .65rem .85rem; }
.release { max-width: 52rem; border-left: 2px solid var(--brass); padding: .2rem 0 .2rem 1.2rem; }
.release h2 { margin: .45rem 0 1rem; }
.release li { margin-bottom: .45rem; }

.play-page { padding-block: 1.6rem 2.8rem; }
.match-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .8rem; }
.match-heading h1 { margin: 0; font-size: clamp(2rem, 4.3vw, 3.5rem); }
.match-heading .eyebrow { margin-bottom: .4rem; }
.match-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  gap: .65rem;
  margin-top: 1.1rem;
}
.team {
  --team-color: #a2e0d8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  border: 1px solid var(--line);
  border-top: 2px solid var(--team-color);
  background: var(--surface);
  padding: .55rem .85rem;
}
.team[data-team="1"] { --team-color: #e9b777; }
.team.active { background: #263633; border-color: var(--team-color); }
.team-name { font-weight: 650; }
.team-points { color: var(--team-color); white-space: nowrap; }
.turn { align-self: center; text-align: center; color: var(--muted); font-size: .9rem; }
.map-tools, .hand-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .65rem; }
.map-tools { margin: .8rem 0 .45rem; }
.map-tools h2, .hand-heading h2 { margin: 0; font-size: 1.35rem; }
.zoom-tools { display: flex; align-items: center; gap: .4rem; }
.zoom-tools output { width: 3.2rem; text-align: center; font-variant-numeric: tabular-nums; }
.zoom-tools .button { padding: .3rem .65rem; }
.viewport {
  overflow: auto;
  border: 1px solid #c6a2677a;
  border-radius: 5px;
  background: #203736;
  max-height: min(69vh, 665px);
}
.viewport.panning { cursor: grabbing; user-select: none; }
.board {
  position: relative;
  isolation: isolate;
  width: calc(max(100%, 690px) * var(--zoom, 1));
  aspect-ratio: 2;
  background: #223b3a;
}
.board-art, .routes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.board-art { object-fit: fill; }
.routes line {
  stroke: #e6bb78;
  stroke-width: .55;
  stroke-dasharray: 1.4 .9;
  filter: drop-shadow(0 0 2px #0d1718);
}
.routes .closed { opacity: .35; }
.routes .open { stroke: #ffe0a0; stroke-width: .9; }

.landmark {
  position: absolute;
  transform: translate(-50%, -50%);
  width: min(18%, 195px);
  padding: .24rem;
  border: 1px solid #c6a267b5;
  border-radius: 5px;
  background: #0d1718eb;
  text-align: center;
  box-shadow: 0 2px 10px #0009;
}
.landmark[data-owner="0"] { border-color: #a2e0d8; }
.landmark[data-owner="1"] { border-color: #e9b777; }
.landmark-name {
  display: block;
  width: 100%;
  padding: .34rem .18rem;
  border: 1px solid #81928b76;
  border-radius: 3px;
  background: #243536;
  color: var(--ink);
  font: 1rem/1.14 var(--display);
}
.landmark-name:hover:not(:disabled), .piece:hover:not(:disabled) { border-color: var(--brass); }
.landmark small { display: block; color: #eac68b; font-size: .69rem; padding: .12rem 0; }
.pieces { display: flex; justify-content: center; flex-wrap: wrap; gap: .18rem; }
.piece {
  border: 1px solid #81cbd0;
  border-radius: 3px;
  padding: .16rem .35rem;
  background: #233638;
  color: #fff2dc;
  font-size: .68rem;
  line-height: 1.18;
}
.piece.enemy { border-color: #e6ad6e; }
.piece.gate { border-color: #c7a166; }
.piece:disabled { opacity: .62; }
.piece[aria-pressed="true"], .card[aria-pressed="true"] { outline: 2px solid var(--brass); outline-offset: -2px; }
.match-status { min-height: 1.65rem; margin: .5rem 0 .75rem; color: #f2d4a3; font-size: .92rem; }
.hand-heading { margin: .4rem 0; }
.hand {
  display: flex;
  gap: .58rem;
  overflow-x: auto;
  padding: .32rem 5px .7rem;
}
.hand .card { flex: 0 0 168px; min-height: 178px; cursor: pointer; }
.hand .card .art { height: 67px; }
.hand .card:hover:not(:disabled) { border-color: var(--brass); }
.hand .card:disabled { opacity: .57; cursor: default; }
.rules { border-top: 1px solid var(--line); margin-top: .8rem; padding-top: .7rem; color: var(--muted); }
.rules summary { color: var(--ink); cursor: pointer; font-weight: 650; width: fit-content; }
.rules li { margin-block: .3rem; }
dialog {
  max-width: min(420px, calc(100vw - 36px));
  padding: 1.65rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--brass);
  border-radius: 7px;
}
dialog::backdrop { background: #0b1112; }
dialog h2 { font-size: 2rem; margin-bottom: .7rem; }

@media (max-width: 720px) {
  .wrap, .wide { width: calc(100% - 32px); }
  .header-inner { padding-block: 12px; gap: .65rem; }
  .site-nav { gap: .5rem 1rem; }
  .site-nav a { font-size: .83rem; }
  .hero { min-height: 490px; background-position: 59% center; }
  .hero::before { background: linear-gradient(90deg, #0a1214f0, #0a121470), linear-gradient(0deg, #0a1214c9, transparent 75%); }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters label:first-child { grid-column: 1 / -1; }
  .match-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .turn { order: 1; grid-column: 1 / -1; }
  .team { padding-inline: .5rem; font-size: .82rem; }
}
@media (max-width: 480px) {
  .deck-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: clamp(2.8rem, 12vw, 4.5rem); }
  .landmark-name { font-size: .9rem; }
}
