/*
 * One stylesheet, hand-written, no build (spec/009 W1).
 * System fonts only: nothing is fetched from another origin, so a page renders
 * before any network round trip that might not come.
 */
:root {
  /* Discord's own surfaces and blurple. Dark is the default, as it is there;
     the light values below are Discord's light theme rather than an inversion. */
  --bg: #313338;          /* chat background */
  --bg-deep: #1e1f22;     /* darkest surface, behind everything */
  --card: #2b2d31;        /* raised surface: cards, header */
  --card-hi: #383a40;     /* hover on a raised surface */
  --fg: #f2f3f5;
  --muted: #b5bac1;
  --line: #3f4147;
  --accent: #5865f2;      /* blurple */
  --accent-hover: #4752c4;
  --accent-fg: #ffffff;
  --gold: #f0b232;
  --win: #23a55a;
  --danger: #da373c;
  --radius: 16px;
  --radius-sm: 8px;
  --width: 46rem;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #ffffff;
    --bg-deep: #f2f3f5;
    --card: #f2f3f5;
    --card-hi: #ebedef;
    --fg: #060607;
    --muted: #4e5058;
    --line: #e3e5e8;
    --accent: #5865f2;
    --accent-hover: #4752c4;
    --gold: #c47f0a;
    --win: #1a7f42;
    --danger: #c03537;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  /* gg sans is Discord's and not ours to serve; this is the closest stack that
     costs no third-party request (spec/009 W1). */
  font: 16px/1.6 "gg sans", "Helvetica Neue", Helvetica, Arial, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: var(--width); margin: 0 auto; padding: 0 1.25rem 5rem; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.02em; font-weight: 800; }
h1 { font-size: clamp(2.1rem, 6vw, 3rem); margin: 0 0 .6rem; }
h2 { font-size: 1.6rem; margin: 3rem 0 .75rem; }
h3 { font-size: 1.15rem; margin: 2rem 0 .5rem; }
p { margin: 0 0 1rem; }
a { color: var(--accent); text-underline-offset: 2px; }
code, kbd {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .88em;
  background: var(--bg-deep);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: .1em .38em;
}
pre { overflow-x: auto; background: var(--bg-deep); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem; }
pre code { background: none; border: 0; padding: 0; font-size: .88em; }
.muted { color: var(--muted); }
.small { font-size: .92rem; }

/* header ------------------------------------------------------------------ */
header.site {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  margin-bottom: 3rem;
  position: sticky;
  top: 0;
  z-index: 10;
}
header.site .inner {
  max-width: var(--width);
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: baseline;
}
header.site .brand { font-weight: 800; letter-spacing: -0.03em; font-size: 1.05rem; text-decoration: none; color: var(--fg); }
header.site nav { display: flex; gap: 1.1rem; flex-wrap: wrap; }
header.site nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 500;
  padding: .3rem .7rem;
  border-radius: 999px;
  transition: background .15s ease, color .15s ease;
}
header.site nav a:hover { color: var(--fg); background: var(--card-hi); }
header.site nav a[aria-current="page"] { color: var(--fg); background: var(--card-hi); }
/* The install link is an action, not navigation — it reads as one on every
   page, including the ones a reviewer lands on directly. */
header.site nav a.install {
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
}
header.site nav a.install:hover { background: var(--accent-hover); color: var(--accent-fg); }

/* hero -------------------------------------------------------------------- */
.lede { font-size: 1.15rem; color: var(--muted); margin-bottom: 1.75rem; }
.actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.button {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-fg);
  text-decoration: none;
  font-weight: 600;
  font-size: .98rem;
  padding: .72rem 1.4rem;
  border-radius: 999px;
  transition: background .15s ease, transform .12s ease;
}
.button:hover { background: var(--accent-hover); }
.button:active { transform: translateY(1px); }
.button.secondary { background: var(--card); color: var(--fg); }
.button.secondary:hover { background: var(--card-hi); }

/* cards ------------------------------------------------------------------- */
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); }
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  transition: background .15s ease;
}
.card:hover { background: var(--card-hi); }
.card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }

/* a Discord-style message, drawn rather than photographed (spec/009) ------- */
.msg {
  background: var(--card);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: .9rem 1.05rem;
  margin: 1rem 0;
  font-size: .95rem;
}
.msg.win { border-left-color: var(--win); }
.msg.gold { border-left-color: var(--gold); }
.msg.flat { border-left-color: var(--line); }
.msg p { margin: 0 0 .4rem; }
.msg p:last-child { margin-bottom: 0; }
.msg .mention { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 4px; padding: 0 .2em; }
.msg .btn {
  display: inline-block;
  background: var(--card-hi);
  border-radius: var(--radius-sm);
  padding: .3rem .85rem;
  font-size: .85rem;
  font-weight: 500;
  margin: .5rem .35rem 0 0;
}
.msg .btn.primary { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.illustration { color: var(--muted); font-size: .85rem; margin-top: -.5rem; }

/* tables ------------------------------------------------------------------ */
table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .95rem; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 700; }
/* Commands are long and unbreakable; let them wrap rather than widen the page,
   and break inside the token if a single word still will not fit. */
td code { overflow-wrap: anywhere; }

figure { margin: 1.5rem 0; }
figure img { width: 100%; height: auto; border-radius: var(--radius); background: var(--card); }
figcaption { color: var(--muted); font-size: .9rem; margin-top: .5rem; }

footer.site { background: var(--bg-deep); margin-top: 4rem; padding: 2.5rem 0 3rem; color: var(--muted); font-size: .92rem; }
footer.site nav { display: flex; gap: 1.1rem; flex-wrap: wrap; margin-bottom: .75rem; }
/* Inline `style` attributes are blocked by this site's own CSP (style-src
   'self'), so anything positional needs a class. */
footer.site .inner { max-width: var(--width); margin: 0 auto; padding: 0 1.25rem; }
.card h3.tight { margin-top: 0; }
.msg.danger { border-left-color: var(--danger); }
.last { margin-bottom: 0; }

/* ── the hero band ───────────────────────────────────────────────────────
   Discover opens with a dark banner carrying the heading and the primary
   action, then drops into content on the page background. Same idea here. */
.hero {
  background: var(--bg-deep);
  border-bottom: 1px solid var(--line);
  margin: -3rem 0 3rem;   /* swallow the header's bottom margin */
  padding: 3.5rem 0 3rem;
}
.hero .inner { max-width: var(--width); margin: 0 auto; padding: 0 1.25rem; }
.hero h1 { max-width: 20ch; }
.hero .lede { max-width: 60ch; margin-bottom: 1.75rem; }

/* Discover's category pills. */
.pills { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 2rem; }
.pill {
  display: inline-block;
  background: var(--card);
  color: var(--fg);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  padding: .4rem .95rem;
  border-radius: 999px;
  transition: background .15s ease;
}
.pill:hover { background: var(--card-hi); }
.pill[aria-current="true"] { background: var(--accent); color: var(--accent-fg); }

/* ── small screens ───────────────────────────────────────────────────────
   Checked at 360px, the narrowest phone worth designing for. Nothing may
   scroll the page sideways: the bracket SVG, the command tables and the
   header nav are the three that would. */
svg { max-width: 100%; height: auto; }

@media (max-width: 40rem) {
  body { font-size: 15px; }
  main { padding: 0 1rem 4rem; }
  h1 { font-size: clamp(1.75rem, 8vw, 2.2rem); }
  h2 { font-size: 1.35rem; margin-top: 2.25rem; }

  /* The nav is eight items; wrapping makes a header four rows tall, so it
     scrolls sideways instead — the way Discord's own category pills do. */
  header.site .inner { flex-wrap: nowrap; align-items: center; gap: .75rem; padding: .75rem 1rem; }
  header.site nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    gap: .35rem;
    margin-right: -1rem;
    padding-right: 1rem;
  }
  header.site nav::-webkit-scrollbar { display: none; }
  header.site nav a { white-space: nowrap; padding: .4rem .7rem; }

  .hero { padding: 2.25rem 0 2rem; margin-bottom: 2rem; }
  .hero .inner { padding: 0 1rem; }
  .actions { gap: .6rem; }
  .button { width: 100%; text-align: center; padding: .8rem 1rem; }

  table { font-size: .9rem; }
  th, td { padding: .5rem .4rem; }

  footer.site .inner { padding: 0 1rem; }
}

/* Coarse pointers get targets big enough to hit. */
@media (pointer: coarse) {
  header.site nav a, .pill { padding-block: .5rem; }
  .msg .btn { padding: .45rem .95rem; }
}
