/* Towers of Pelagos: the game's own world. The kingdom banner (sea-blue, gold border and waves, the cyan stone),
   night sea and basalt for the ground, the game's two typefaces.
   Layout: one column like a hung banner; a full-bleed film still on top, the gold wave line between sections. */
:root {
  --abyss: #08131f;      /* the page: night sea */
  --deep: #0e2036;       /* raised bands */
  --sea: #163564;        /* the banner's blue */
  --basalt: #1a1e24;     /* dark stone */
  --gold: #d8a948;       /* the banner's gold */
  --gold-hi: #f2c45a;    /* gold catching light, for focus and hover */
  --ink: #efe9dc;        /* text */
  --dim: #b4ae9f;        /* quiet text */
  --stone: #5ff0ff;      /* the cyan stone, used once or twice only */
  --line: rgba(216, 169, 72, 0.28);
  --display: "IM Fell English SC", Georgia, "Times New Roman", serif;
  --script: "IM Fell English", Georgia, "Times New Roman", serif;
  --body: "Alegreya Sans", "Segoe UI", system-ui, sans-serif;
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --step-1: clamp(1.2rem, 1.1rem + 0.5vw, 1.45rem);
  --step-2: clamp(1.6rem, 1.3rem + 1.2vw, 2.25rem);
  --step-4: clamp(2.6rem, 1.6rem + 5vw, 5.4rem);
  --wrap: 68rem;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--abyss);
  color: var(--ink);
  font: 400 var(--step-0)/1.6 var(--body);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--gold); text-underline-offset: 0.18em; }
a:hover { color: var(--gold-hi); }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; }

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.1; text-wrap: balance; margin: 0; }
h2 { font-size: var(--step-2); color: var(--gold); }
p { margin: 0; }

/* the gold waves along the banner's foot, as a divider */
.waves {
  height: 14px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='14' viewBox='0 0 40 14'%3E%3Cpath d='M0 9 Q5 1 10 7 T20 7 Q25 1 30 7 T40 7' fill='none' stroke='%23d8a948' stroke-width='2'/%3E%3C/svg%3E") repeat-x center / 40px 14px;
  opacity: 0.85;
}

/* ---------- hero ---------- */
.hero { position: relative; background: var(--basalt); isolation: isolate; }
.hero-art { position: relative; }
.hero-art img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: 30% 60%; }
.hero-art::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(8, 19, 31, 0) 45%, var(--abyss) 100%);
}
.hero-text { position: relative; display: grid; gap: 1.1rem; padding-block: 0 2.5rem; margin-top: -1.6rem; }
.crest { width: clamp(2.6rem, 2rem + 2vw, 3.6rem); height: auto; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.5)); }
.eyebrow { font: 700 0.8rem/1 var(--body); letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }
.hero h1 { font-size: var(--step-4); color: var(--ink); text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55); }
.hero h1 .of { font-size: 0.55em; color: var(--gold); vertical-align: 0.12em; }
.tagline { font: italic 400 var(--step-1)/1.3 var(--script); color: var(--gold); }

@media (min-width: 60rem) {
  .hero-art img { aspect-ratio: auto; height: min(78vh, 46rem); }
  .hero-text { position: absolute; inset: auto 0 0 0; margin: 0; padding-block: 0 3rem; }
  .hero-text > * { margin-left: 42%; }
}

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; padding-top: 0.4rem; }
.btn {
  display: inline-grid; gap: 0.1rem; justify-items: start;
  padding: 0.7rem 1.15rem 0.6rem;
  border: 1.5px solid var(--gold); border-radius: 3px;
  font: 700 1rem/1.2 var(--body); text-decoration: none;
  color: var(--ink); background: rgba(22, 53, 100, 0.72);
}
.btn.primary { background: var(--gold); color: var(--abyss); }
.btn small { font-weight: 400; font-size: 0.78rem; opacity: 0.8; }
.btn[aria-disabled="true"] { cursor: default; }
.btn:not([aria-disabled="true"]):hover { border-color: var(--gold-hi); }
.btn.primary:not([aria-disabled="true"]):hover { background: var(--gold-hi); color: var(--abyss); }

/* ---------- sections ---------- */
section { padding-block: 3.5rem; }
.section-head { display: grid; gap: 0.5rem; margin-bottom: 1.6rem; }
.section-head p { color: var(--dim); max-width: 40rem; }

.pitch { display: grid; gap: 2rem; }
.pitch .section-head { margin-bottom: -0.8rem; }
.pitch .lead { font-size: var(--step-1); line-height: 1.5; max-width: 40rem; }
.pitch .lead em { font-family: var(--script); color: var(--gold); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.fact { background: var(--abyss); padding: 1.1rem 1.2rem 1.2rem; display: grid; gap: 0.3rem; align-content: start; min-width: 0; }
.fact b { font: 400 var(--step-2)/1 var(--display); color: var(--gold); }
.fact span { color: var(--dim); font-size: 0.95rem; line-height: 1.45; }

/* ---------- screenshots ---------- */
.shots { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 1rem; margin: 0; padding: 0; list-style: none; }
.shots figure { margin: 0; display: grid; gap: 0.45rem; }
.shots a { display: block; border: 1px solid var(--line); background: var(--basalt); }
.shots a:hover { border-color: var(--gold); }
.shots img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.shots figcaption { font-size: 0.9rem; color: var(--dim); }
.shots figcaption b { color: var(--ink); font-weight: 700; }

/* ---------- trailer ---------- */
.band { background: var(--deep); }
.trailer { position: relative; aspect-ratio: 20 / 9; max-width: 100%; border: 1px solid var(--line); background: var(--basalt); overflow: hidden; }
.trailer img, .trailer video { width: 100%; height: 100%; object-fit: cover; }
.trailer .soon {
  position: absolute; inset: auto 0 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.8rem;
  padding: 0.8rem 1rem; background: linear-gradient(to top, rgba(8, 19, 31, 0.92), rgba(8, 19, 31, 0));
  font: 700 0.8rem/1 var(--body); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold);
}

/* ---------- join ---------- */
.join { display: grid; gap: 1.2rem; justify-items: start; }
.join p { color: var(--dim); max-width: 36rem; }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--line); padding-block: 1.6rem 2.2rem; color: var(--dim); font-size: 0.92rem; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 0.6rem 1.6rem; align-items: center; justify-content: space-between; }
footer nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; }

/* ---------- the picture viewer ---------- */
dialog.viewer { padding: 0; border: 1px solid var(--gold); background: var(--abyss); color: var(--ink); max-width: min(96vw, 100rem); }
dialog.viewer::backdrop { background: rgba(4, 10, 18, 0.88); }
dialog.viewer img { width: 100%; height: auto; max-height: 82vh; object-fit: contain; }
dialog.viewer .bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.6rem 0.9rem; font-size: 0.9rem; }
dialog.viewer button { font: 700 0.9rem var(--body); color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 3px; padding: 0.35rem 0.8rem; cursor: pointer; }

/* ---------- privacy page ---------- */
.doc-head { padding-block: 2rem 0; display: flex; align-items: center; gap: 0.8rem; }
.doc-head a { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; color: var(--ink); font: 400 1.25rem/1 var(--display); }
.doc-head svg { width: 2.2rem; height: auto; }
.doc { padding-block: 2.2rem 3.5rem; }
.doc article { max-width: 42rem; display: grid; gap: 1rem; }
.doc h1 { font-size: var(--step-2); color: var(--gold); }
.doc h2 { font-size: var(--step-1); margin-top: 1.2rem; }
.doc .updated { color: var(--dim); font-size: 0.92rem; }
.doc ul { margin: 0; padding-left: 1.2rem; display: grid; gap: 0.4rem; }
.doc .short { border-left: 3px solid var(--gold); padding: 0.9rem 1.1rem; background: var(--deep); display: grid; gap: 0.5rem; }

@media (prefers-reduced-motion: no-preference) {
  .hero-text { animation: rise 0.9s ease-out both; }
  @keyframes rise { from { transform: translateY(10px); } to { transform: none; } }
}

/* ---------- site header (every page) ---------- */
.site-head { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: rgba(8, 19, 31, 0.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 21; background: var(--abyss); }
.site-head .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 1.4rem; padding-block: 0.55rem; }
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; color: var(--ink); font: 400 1.2rem/1 var(--display); white-space: nowrap; }
.brand svg { width: 1.9rem; height: 1.9rem; flex: none; }
.site-nav { display: flex; flex: 0 0 auto; gap: 0.2rem; margin-left: auto; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a { padding: 0.45rem 0.7rem; border-radius: 3px; text-decoration: none; color: var(--dim); font: 700 0.9rem/1 var(--body); letter-spacing: 0.04em; white-space: nowrap; }
.site-nav a:hover { color: var(--ink); background: rgba(216, 169, 72, 0.1); }
.site-nav a[aria-current="page"] { color: var(--gold); box-shadow: inset 0 -2px 0 var(--gold); border-radius: 0; }
.site-nav .wish { color: var(--abyss); background: var(--gold); margin-left: 0.4rem; }
.site-nav .wish:hover { color: var(--abyss); background: var(--gold-hi); }
@media (max-width: 47.99rem) {
  .site-nav { margin-left: -0.7rem; width: calc(100% + 0.7rem); }
}

/* ---------- inner page opener ---------- */
.page-top { position: relative; background: var(--basalt); }
.page-top img { width: 100%; height: clamp(11rem, 32vw, 24rem); object-fit: cover; }
.page-top::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(8, 19, 31, 0.15), var(--abyss) 96%); }
.page-top .wrap { position: absolute; inset: auto 0 0 0; z-index: 1; display: grid; gap: 0.5rem; padding-block: 0 1.6rem; max-width: var(--wrap); }
.page-top h1 { font-size: var(--step-4); }
.page-top p { color: var(--ink); max-width: 38rem; font-size: var(--step-1); line-height: 1.4; }

/* ---------- feature rows (acts, classes) ---------- */
.rows { display: grid; gap: 3.2rem; }
.row { display: grid; gap: 1.2rem 2.2rem; align-items: start; }
@media (min-width: 52rem) { .row { grid-template-columns: 1.15fr 1fr; } .row.flip > :first-child { order: 2; } }
.row > * { min-width: 0; }
.row figure { margin: 0; display: grid; gap: 0.6rem; }
.row figure img { width: 100%; border: 1px solid var(--line); background: var(--basalt); }
.row .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.row h2 { font-size: var(--step-2); }
.row .kicker { font: 700 0.8rem/1 var(--body); letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }
.row .body { display: grid; gap: 0.8rem; }
.row dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 1rem; font-size: 0.95rem; }
.row dt { color: var(--dim); }
.row dd { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.chips li { border: 1px solid var(--line); border-radius: 2px; padding: 0.2rem 0.55rem; font-size: 0.85rem; color: var(--ink); background: rgba(22, 53, 100, 0.35); }

/* class castles: a narrow portrait beside the text */
.castle-row { display: grid; gap: 1.2rem 2rem; align-items: start; }
@media (min-width: 44rem) { .castle-row { grid-template-columns: minmax(9rem, 14rem) 1fr; } }
.castle-row img { width: 100%; max-width: 14rem; background: #a8b06b; border: 1px solid var(--line); }
.castle-row > * { min-width: 0; }
.role { font: italic 400 var(--step-1)/1.3 var(--script); color: var(--gold); }

/* keystones */
.keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.key { background: var(--deep); padding: 1rem 1.1rem; display: grid; gap: 0.35rem; align-content: start; }
.key b { font: 400 1.25rem/1.1 var(--display); color: var(--gold); }
.key span { color: var(--dim); font-size: 0.93rem; line-height: 1.45; }
.key .tag { font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--stone); }

/* the stone table */
.stone-kinds { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
.kind { border: 1px solid var(--line); padding: 1rem 1.1rem 1.1rem; display: grid; gap: 0.4rem; align-content: start; background: var(--deep); }
.kind b { font: 400 var(--step-1)/1.1 var(--display); color: var(--gold); }
.kind span { color: var(--dim); font-size: 0.95rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); }
table.stones { width: 100%; border-collapse: collapse; font-size: 0.92rem; min-width: 40rem; }
table.stones caption { text-align: left; padding: 0.8rem 0.9rem; font: 400 var(--step-1)/1.1 var(--display); color: var(--gold); background: var(--deep); }
table.stones caption small { font: italic 400 0.95rem var(--script); color: var(--dim); margin-left: 0.5rem; }
table.stones th, table.stones td { text-align: left; padding: 0.45rem 0.9rem; border-top: 1px solid var(--line); vertical-align: top; }
table.stones th { font-weight: 700; color: var(--dim); font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; }
table.stones td:first-child { font-weight: 700; white-space: nowrap; }
.k-gem, .k-ore, .k-runestone { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.k-gem { color: var(--stone); } .k-ore { color: #e0a46a; } .k-runestone { color: #c9c2ae; }
.tables { display: grid; gap: 1.4rem; }

/* wide single picture with caption */
.wide { margin: 0; display: grid; gap: 0.5rem; }
.wide img { width: 100%; border: 1px solid var(--line); }
.wide figcaption { color: var(--dim); font-size: 0.92rem; }
.prose { display: grid; gap: 1rem; max-width: 42rem; }
.prose p { color: var(--ink); }
.next { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.studio-logo { width: clamp(8rem, 30vw, 11rem); margin-bottom: 0.5rem; }

/* phones: the inner-page title sits under its picture, and castles stand small beside their text */
@media (max-width: 51.99rem) {
  .page-top::after { background: linear-gradient(to bottom, rgba(8, 19, 31, 0) 40%, var(--abyss) 100%); height: clamp(11rem, 32vw, 24rem); }
  .page-top .wrap { position: relative; padding-block: 1rem 0.4rem; }
  .page-top h1 { font-size: var(--step-2); color: var(--gold); }
  .page-top p { font-size: var(--step-0); color: var(--dim); }
}
@media (max-width: 43.99rem) {
  .castle-row { grid-template-columns: 5.5rem 1fr; gap: 1rem; }
  .castle-row .chips { grid-column: 1 / -1; }
}
