/*
 * starfoundry.online
 *
 * The game's own palette — deep blue-black, one cool accent — carried onto a
 * reading site. Everything is sized in a single column with a measure a
 * person can actually read; the game is the wide thing, not the prose about
 * it.
 */
:root {
  --bg: #0a0e16;
  --bg-2: #101725;
  --panel: rgba(18, 25, 39, .72);
  --line: #223049;
  --text: #dbe4f5;
  --dim: #8fa0bd;
  --faint: #64748f;
  --accent: #6ea8ff;
  --accent-dim: #3d5680;
  --warm: #ffb454;
  --good: #7fd6a0;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --measure: 68ch;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background:
    radial-gradient(1100px 600px at 70% -10%, #16213a 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font: 16px/1.65 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.skip {
  position: absolute;
  left: -9999px;
  background: var(--accent);
  color: #05080f;
  padding: 10px 14px;
  border-radius: 0 0 var(--radius) 0;
  z-index: 100;
}
.skip:focus { left: 0; top: 0; }

/* ---- masthead ---------------------------------------------------------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 14, 22, .86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.bar {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 22px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: .01em;
  flex: none;
}
.brand:hover { text-decoration: none; color: #fff; }
.masthead nav { display: flex; gap: 18px; flex: 1; flex-wrap: wrap; }
.masthead nav a { color: var(--dim); font-size: 14.5px; }
.masthead nav a:hover { color: var(--text); text-decoration: none; }
.masthead nav a[aria-current="page"] { color: var(--text); }
.play {
  flex: none;
  padding: 7px 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #05080f;
  font-weight: 700;
  font-size: 14.5px;
}
.play:hover { background: #8dbcff; text-decoration: none; }

/* ---- layout ------------------------------------------------------------ */
main { max-width: 1120px; margin: 0 auto; padding: 0 20px 64px; }
body.wide main { max-width: none; padding: 0; }

.prose { max-width: var(--measure); }
.prose h2 { margin-top: 2.2em; }
.prose h3 { margin-top: 1.8em; color: var(--dim); font-size: 1.05rem; }
.prose li + li { margin-top: .3em; }
.prose blockquote {
  margin: 1.4em 0;
  padding: 2px 0 2px 16px;
  border-left: 2px solid var(--accent-dim);
  color: var(--dim);
}

h1 { font-size: clamp(1.9rem, 4.2vw, 2.9rem); line-height: 1.12; letter-spacing: -.015em; margin: 0 0 .35em; }
h2 { font-size: 1.45rem; line-height: 1.22; letter-spacing: -.01em; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.lede { font-size: 1.16rem; color: var(--dim); max-width: var(--measure); }
.small { font-size: 13.5px; color: var(--faint); }
code { font-family: var(--mono); font-size: .92em; background: #0d1522; padding: 1px 5px; border-radius: 4px; }

/* ---- hero -------------------------------------------------------------- */
.hero { padding: 72px 0 56px; }
.hero .lede { margin-bottom: 26px; }
.cta { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.btn {
  display: inline-block;
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #05080f;
  font-weight: 700;
}
.btn:hover { background: #8dbcff; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.ghost:hover { border-color: var(--accent-dim); background: rgba(110, 168, 255, .07); }

.shot {
  margin: 34px 0 0;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  overflow: hidden;
  background: var(--bg-2);
}
.shot img { display: block; width: 100%; height: auto; }
.shot figcaption { padding: 9px 14px; font-size: 13px; color: var(--faint); border-top: 1px solid var(--line); }

/* ---- cards ------------------------------------------------------------- */
.grid { display: grid; gap: 14px; margin: 22px 0; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.card {
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
}
.card h3 { margin: 0 0 .4em; color: var(--text); }
.card p { margin: 0; color: var(--dim); font-size: 14.5px; }
a.card { color: inherit; display: block; }
a.card:hover { border-color: var(--accent-dim); text-decoration: none; }

/* People cards carry a portrait. */
.people { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); margin: 24px 0; }
.person { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.person img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: #0d1522; display: block; }
.person .body { padding: 14px 16px 16px; }
.person .name { font-weight: 700; margin-bottom: 2px; }
.person .tag { color: var(--faint); font-size: 13.5px; }

.traits { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.trait {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px solid var(--line);
  color: var(--dim);
}
.trait.up { color: var(--good); border-color: #2c5340; }
.trait.down { color: #e2836b; border-color: #5a3128; }

/* ---- tables ------------------------------------------------------------ */
.table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 14.5px; }
.table th, .table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--faint); font-weight: 600; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
.table td:first-child { white-space: nowrap; font-weight: 600; }
.table .cost { font-family: var(--mono); color: var(--accent); white-space: nowrap; }

/* ---- advertising ------------------------------------------------------- */
/*
 * Ad slots are reserved boxes with their size fixed in CSS, so the page does
 * not jump when one fills or stays empty. They sit between sections, never
 * inside the reading column, and never where a control would be — a click on
 * an advert has to be a decision, not an accident.
 */
.ad {
  margin: 34px auto;
  max-width: 970px;
  min-height: 100px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--faint);
  font-size: 12px;
}
.ad::before { content: "Advertisement"; letter-spacing: .06em; text-transform: uppercase; font-size: 10.5px; }
.ad:empty { opacity: .45; }

/* ---- footer ------------------------------------------------------------ */
.foot { border-top: 1px solid var(--line); background: #080c14; }
.cols {
  max-width: 1120px;
  margin: 0 auto;
  padding: 34px 20px 10px;
  display: grid;
  gap: 24px;
  grid-template-columns: 2fr 1fr 1fr 1fr;
}
.cols b { display: block; margin-bottom: 8px; font-size: 14px; }
.cols a { display: block; color: var(--dim); font-size: 14px; padding: 2px 0; }
.copyright { max-width: 1120px; margin: 0 auto; padding: 8px 20px 28px; }

@media (max-width: 760px) {
  .cols { grid-template-columns: 1fr 1fr; }
  .bar { gap: 12px; }
  .masthead nav { order: 3; width: 100%; gap: 14px; }
  .hero { padding: 44px 0 36px; }
}

/* ---- game frame -------------------------------------------------------- */
/*
 * The game takes the whole window. Not "most of it under a header": the
 * controls live along the bottom edge, so anything above them pushed them off
 * the screen and left the player scrolling a page to reach End turn.
 *
 * `100dvh` rather than `100vh` because mobile browsers count the address bar
 * into `vh`, which would hide the same controls all over again.
 */
html:has(body.bare), body.bare { height: 100%; overflow: hidden; }
body.bare main { max-width: none; padding: 0; margin: 0; }
.gameframe {
  width: 100vw;
  height: 100dvh;
  border: 0;
  display: block;
}

/* ---- consent ----------------------------------------------------------- */
/*
 * A bar along the bottom rather than a sheet over the page: it has to be
 * answerable, not unavoidable, and burying the site behind it would be the
 * kind of thing that makes people click anything to get rid of it. Both
 * answers are equally easy to reach, which is the point — a "reject" hidden
 * behind a second screen is not a real choice.
 */
.consent {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 200;
  background: rgba(10, 14, 22, .97);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
/*
 * On the game page it goes along the TOP instead. The game keeps its own
 * controls — End turn, and the button that starts a game — along the bottom
 * edge, and a bar across them is a bar across the only things worth
 * clicking.
 */
body.bare .consent {
  bottom: auto;
  top: 0;
  border-top: 0;
  border-bottom: 1px solid var(--line);
}
.consent-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}
.consent-text { flex: 1; min-width: 260px; }
.consent-text b { display: block; margin-bottom: 3px; }
.consent-text p { margin: 0; font-size: 13.5px; color: var(--dim); max-width: 74ch; }
.consent-buttons { display: flex; gap: 8px; flex: none; }
.consent-buttons button {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #05080f;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.consent-buttons button.ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}
.consent-buttons button.ghost:hover { border-color: var(--accent-dim); }

/* Ad slots stay collapsed until advertising is actually allowed, so a page
   with consent refused has no empty grey boxes down it. */
html[data-consent-ads="no"] .ad { display: none; }
