/* Roof Tycoon wiki. Colors are the game's interface tokens (art/tokens.ts). */
@font-face {
  font-family: 'Fredoka';
  font-weight: 500;
  font-display: swap;
  src: url('fonts/fredoka-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Fredoka';
  font-weight: 600;
  font-display: swap;
  src: url('fonts/fredoka-600.woff2') format('woff2');
}

:root {
  --bg: #fff6e9;
  --surface: #ffffff;
  --surface-alt: #f4e9d8;
  --ink: #1e2230;
  --ink-muted: #4d5266;
  --line: #d9c9af;
  --link: #1f4e8c;
  --focus: #1f4e8c;
  --display: 'Fredoka', 'Trebuchet MS', system-ui, sans-serif;
  --body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171a26;
    --surface: #22263a;
    --surface-alt: #2b3048;
    --ink: #f4efe6;
    --ink-muted: #b8b9c9;
    --line: #3a3f58;
    --link: #9cc2f0;
    --focus: #9cc2f0;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--body);
}

a {
  color: var(--link);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: 16px;
  top: 8px;
  z-index: 2;
  background: var(--surface);
  padding: 8px 12px;
}

header.site {
  background: var(--surface);
  border-bottom: 2px solid var(--line);
}
.brand img {
  display: block;
  width: 100%;
  max-width: 1200px;
  height: auto;
  margin: 0 auto;
}
header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  justify-content: center;
  padding: 8px 16px;
}
header nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-family: var(--display);
  font-weight: 500;
  text-decoration: none;
  color: var(--ink);
}
header nav a[aria-current='page'] {
  background: var(--surface-alt);
  box-shadow: inset 0 0 0 2px var(--line);
}

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.2;
}
h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
}
h2 {
  margin-top: 2em;
  border-bottom: 2px solid var(--line);
  padding-bottom: 4px;
}

.lead {
  font-size: 1.1rem;
}
.note,
.intro {
  color: var(--ink-muted);
}
.reveal-all {
  font: inherit;
  margin-left: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.cards {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.cards a {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 2px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  height: 100%;
}
.cards strong {
  font-family: var(--display);
}

.entries {
  display: grid;
  gap: 12px;
}
.entry {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 16px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 2px solid var(--line);
}
.entry h3 {
  margin: 0 0 4px;
}
.entry p {
  margin: 4px 0;
}
.thumb {
  width: 96px;
  height: 96px;
  object-fit: contain;
}
.thumb.none {
  display: block;
  border-radius: 10px;
  background: var(--surface-alt);
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 8px 0 0;
}
.facts div {
  display: flex;
  gap: 6px;
}
.facts dt {
  color: var(--ink-muted);
}
.facts dt::after {
  content: ':';
}
.facts dd {
  margin: 0;
}

table {
  border-collapse: collapse;
  margin-top: 8px;
  width: 100%;
  font-size: 0.92rem;
}
th,
td {
  text-align: left;
  padding: 4px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
thead th {
  color: var(--ink-muted);
  font-weight: 600;
}

details.spoiler {
  border-radius: 12px;
  border: 2px dashed var(--line);
  background: var(--surface-alt);
}
details.spoiler > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  cursor: pointer;
  list-style: none;
}
details.spoiler > summary::-webkit-details-marker {
  display: none;
}
details.spoiler > summary img {
  border-radius: 6px;
}
details.spoiler .show {
  margin-left: auto;
  font-weight: 600;
  color: var(--link);
}
details.spoiler[open] .show {
  display: none;
}
details.spoiler[open] > summary {
  border-bottom: 2px dashed var(--line);
}
details.spoiler > .entry,
details.spoiler > figure {
  border: 0;
  margin: 0;
}

figure {
  margin: 16px 0 8px;
}
.entry details.spoiler {
  margin-top: 8px;
}
.covered-part {
  padding: 8px 12px;
}
section > details.spoiler > h2,
section > details.spoiler > .intro,
section > details.spoiler > .entries {
  margin-left: 12px;
  margin-right: 12px;
}
figure svg,
figure img.diagram {
  display: block;
  width: 100%;
  height: auto;
  max-width: 1040px;
}
figure svg.chart {
  max-width: 560px;
}
.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 0 16px;
}
figcaption {
  color: var(--ink-muted);
  font-size: 0.92rem;
  margin-top: 6px;
}
details.data > summary {
  cursor: pointer;
  color: var(--link);
}

footer {
  border-top: 2px solid var(--line);
  text-align: center;
  color: var(--ink-muted);
  padding: 16px;
}

.h-icon {
  vertical-align: -6px;
}

@media (max-width: 560px) {
  header nav {
    gap: 2px 4px;
    padding: 6px 8px;
  }
  header nav a {
    padding: 4px 8px;
    font-size: 0.95rem;
  }
  header nav img {
    width: 22px;
    height: 22px;
  }
  .entry {
    grid-template-columns: 64px 1fr;
    gap: 12px;
  }
  .thumb {
    width: 64px;
    height: 64px;
  }
  table {
    display: block;
    overflow-x: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
