/* OpenTM2 website: one stylesheet for every page.
   The colors and the font come from brand/STYLE.md (the game's own menus). */

@font-face {
  font-family: "Averia Serif Libre";
  src: url("../brand/fonts/AveriaSerifLibre-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  /* Menu text colors: top and bottom of the letters */
  --white-top: #ffffff;   --white-bottom: #c4c4cc;
  --title-top: #ececf2;   --title-bottom: #9696a2;
  --orange-top: #ffce46;  --orange-bottom: #ec7612;
  --copper-top: #eea44a;  --copper-bottom: #b05e22;
  --gray-top: #78787c;    --gray-bottom: #54545a;
  --pale-top: #e6e6e6;    --pale-bottom: #bababe;
  --sky-top: #96d6ff;     --sky-bottom: #5496d6;

  /* Surfaces */
  --bg: #0e0e12;
  --panel: #16161b;
  --field: #1e1e24;
  --button: #34343c;
  --line: #2c2c34;
  --frame: #bcbcc4;
  --copper: #d67b29;
  --progress: #e68c28;

  --text: #d8d8de;
  --muted: #9a9aa4;

  --font-title: "Averia Serif Libre", Georgia, serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --width: 1100px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(214, 123, 41, 0.14), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
}

img { max-width: 100%; display: block; }

a { color: var(--orange-top); }
a:hover { color: var(--white-top); }

.wrap {
  max-width: var(--width);
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Metallic menu lettering ---------- */

h1, h2, h3, .logo, .nav a, .button, .eyebrow {
  font-family: var(--font-title);
  font-weight: 700;
}

h1, h2, h3, .logo {
  /* The game's letters: a top-to-bottom gradient with a black outline and a soft shadow */
  background: linear-gradient(var(--title-top), var(--title-bottom));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 1px #000) drop-shadow(0 2px 0 #000) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.6));
  line-height: 1.15;
  margin: 0 0 0.5em;
}

h1 { font-size: clamp(2.2rem, 6vw, 3.6rem); text-transform: uppercase; letter-spacing: 0.02em; }
h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); text-transform: uppercase; letter-spacing: 0.02em; margin-top: 0.4em; }
h3 { font-size: 1.3rem; background-image: linear-gradient(var(--white-top), var(--white-bottom)); }

.orange { background-image: linear-gradient(var(--orange-top), var(--orange-bottom)); }
.copper { background-image: linear-gradient(var(--copper-top), var(--copper-bottom)); }

.eyebrow {
  display: inline-block;
  color: var(--copper-top);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.85rem;
  margin-bottom: 0.4em;
}

.lead { font-size: 1.15rem; color: var(--pale-top); max-width: 46em; }
.muted { color: var(--muted); }

/* ---------- Header and navigation ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(10, 10, 13, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  padding-top: 10px;
  padding-bottom: 10px;
}

/* Logo and menu on the left, Discord and Download on the right */
.header-actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

@media (max-width: 900px) {
  /* The menu drops to its own line under the logo and buttons */
  .site-header .nav { order: 3; width: 100%; }
}

/* The OPENTM2 logo is a picture (images/opentm2-logo-*.png, drawn in Flexure by tools/make-logo.ps1) */
.logo {
  display: inline-block;
  line-height: 0;
  margin: 0;
  filter: none;
}
.logo img { height: 30px; width: auto; }

/* Page titles are pictures too (images/title-*.png); they shrink to fit narrow screens */
.title-picture { filter: none; line-height: 0; }
.title-picture img { max-width: 100%; height: auto; }

.hero-logo { filter: none; line-height: 0; }
.hero-logo img { width: 100%; max-width: 563px; height: auto; }

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
}

.nav a {
  color: var(--white-bottom);
  text-decoration: none;
  text-transform: uppercase;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  border-radius: 3px;
}

.nav a:hover { color: var(--white-top); background: var(--field); }

/* The page you are on: the menus' copper selection bar */
.nav a[aria-current="page"] {
  color: var(--white-top);
  background: linear-gradient(90deg, var(--copper), #100c0a);
}

/* ---------- Buttons ---------- */

.button {
  display: inline-block;
  padding: 12px 26px;
  border-radius: 4px;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 1.05rem;
  color: #fff;
  background: var(--button);
  border: 1px solid #000;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 3px 8px rgba(0, 0, 0, 0.5);
  text-shadow: 0 1px 0 #000, 0 0 2px #000;
}

.button:hover { color: #fff; filter: brightness(1.15); }

.button.primary {
  background: linear-gradient(var(--copper-top), var(--copper-bottom));
}

.button.small { padding: 7px 16px; font-size: 0.9rem; }

.button.outline {
  background: transparent;
  border-color: var(--frame);
  box-shadow: none;
}
.button.outline:hover { background: var(--field); filter: none; }

.buttons { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 10px; }

/* ---------- Page sections ---------- */

main section { padding: 48px 0; scroll-margin-top: 60px; /* clear the sticky header when a link jumps here */ }
main section + section { border-top: 1px solid var(--line); }

.page-head { padding: 56px 0 24px; }

.hero { padding: 72px 0 56px; }
.hero h1 { font-size: clamp(3rem, 10vw, 5.5rem); margin-bottom: 0.2em; }
.hero .tagline {
  font-family: var(--font-title);
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  color: var(--pale-top);
  margin: 0 0 0.6em;
}

.grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

/* Two columns, for groups of four cards */
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 22px 24px;
}

.card h3 { margin-bottom: 0.35em; }
.card p { margin: 0; color: var(--pale-bottom); }
.card p + p, .card ul { margin-top: 0.6em; }

a.card { display: block; text-decoration: none; color: inherit; transition: border-color 0.15s; }
a.card:hover { border-color: var(--copper); }

/* A picture frame: light gray on black, as the menus frame their pictures */
.shot {
  aspect-ratio: 16 / 9;
  background: #000;
  border: 2px solid var(--frame);
  border-radius: 3px;
  display: grid;
  place-items: center;
  color: var(--gray-top);
  font-family: var(--font-title);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.9rem;
  overflow: hidden;
}

.shot img { width: 100%; height: 100%; object-fit: cover; }

.shot.wide { aspect-ratio: 21 / 9; margin: 8px 0 28px; }

/* Two pictures on top of each other, beside a section's text */
.shot-stack { display: grid; gap: 12px; }

/* Text beside a picture; stacked on narrow screens */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: center;
}
.split .lead { margin-top: 0; }

/* Home: the title beside a big picture */
.hero .split { grid-template-columns: 1.1fr 1fr; }

/* A big picture with buttons to pick between a few (js/gallery.js) */
.gallery { margin: 8px 0 8px; }
.gallery .shot[hidden] { display: none; }
.gallery-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.gallery-tabs button {
  font-family: var(--font-title);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--white-bottom);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 8px 14px;
  cursor: pointer;
}
.gallery-tabs button:hover { color: var(--white-top); }
.gallery-tabs button[aria-pressed="true"] {
  color: var(--white-top);
  background: linear-gradient(90deg, var(--copper), #100c0a);
  border-color: #000;
}

.card ul { padding-left: 1.1em; color: var(--pale-bottom); margin-bottom: 0; }
.card li { margin: 0.2em 0; }

/* Numbered steps */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps > li {
  counter-increment: step;
  position: relative;
  padding: 0 0 22px 56px;
}
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-title);
  font-size: 1.2rem;
  color: #fff;
  text-shadow: 0 1px 0 #000;
  background: linear-gradient(var(--copper-top), var(--copper-bottom));
  border: 1px solid #000;
}
.steps h3 { margin-bottom: 0.25em; }
.steps p { margin: 0.3em 0; }

/* Challenge Match mode symbols (white on black, game-icons.net) */
.mode {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 16px;
  align-items: start;
}
.mode img {
  width: 72px;
  height: 72px;
  border: 2px solid var(--frame);
  border-radius: 4px;
}

.note {
  border-left: 4px solid var(--progress);
  background: var(--field);
  padding: 14px 18px;
  border-radius: 0 4px 4px 0;
  margin: 20px 0;
}
.note p { margin: 0; }
.note p + p { margin-top: 0.5em; }

kbd {
  font-family: var(--font-body);
  font-size: 0.85em;
  background: var(--button);
  border: 1px solid #000;
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 1px 6px;
  color: #fff;
}

code {
  font-size: 0.9em;
  background: var(--field);
  padding: 1px 5px;
  border-radius: 3px;
}

.checks { padding-left: 1.2em; }
.checks li { margin: 0.3em 0; }
.checks li::marker { color: var(--copper-top); }

table { width: 100%; border-collapse: collapse; margin: 12px 0; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--font-title); color: var(--gray-top); text-transform: uppercase; font-size: 0.85rem; letter-spacing: 0.06em; }

/* FAQ: questions that open and close */
details {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 20px;
  margin: 10px 0;
}
details[open] { border-color: var(--copper); }
summary {
  cursor: pointer;
  font-family: var(--font-title);
  font-size: 1.1rem;
  color: var(--white-top);
  padding: 16px 0;
  list-style-position: outside;
}
summary::marker { color: var(--copper-top); }
details > *:not(summary) { margin-top: 0; }
details > *:last-child { padding-bottom: 16px; margin-bottom: 0; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: #09090c;
  padding: 44px 0 40px;
  margin-top: 40px;
  font-size: 0.9rem;
  color: var(--muted);
}
.site-footer p { margin: 0.4em 0; }

.footer-columns {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 28px 40px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.footer-about p { max-width: 26em; margin-top: 10px; }
.footer-columns h4 {
  font-family: var(--font-title);
  color: var(--copper-top);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.85rem;
  margin: 4px 0 12px;
}
.footer-columns div > a:not(.logo) {
  display: block;
  font-family: var(--font-title);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--white-bottom);
  text-decoration: none;
  margin: 0 0 8px;
}
.footer-columns div > a:not(.logo):hover { color: var(--white-top); }
.footer-legal { font-size: 0.82rem; }

@media (max-width: 700px) {
  .footer-columns { grid-template-columns: 1fr 1fr; }
  .footer-about { grid-column: 1 / -1; }
}

@media (max-width: 800px) {
  .split, .hero .split { grid-template-columns: 1fr; gap: 24px; }
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  .hero { padding: 44px 0 36px; }
  main section { padding: 36px 0; }
  .nav a { padding: 5px 8px; font-size: 0.85rem; }
  .logo img { height: 20px; }
  .header-actions { gap: 6px; }
  .header-actions .button.small { padding: 6px 10px; font-size: 0.8rem; }
  .card { padding: 18px; }
  .mode { grid-template-columns: 56px 1fr; }
  .mode img { width: 56px; height: 56px; }
}
