/*
 * One stylesheet for all five pages.
 *
 * The colours are copied from `src/theme/colors.ts` and the display font from
 * `src/theme/typography.ts` so the site and the app look like the same product.
 * They are copied rather than imported because this directory is deliberately
 * build-free: GitHub Pages serves it as-is, so there is no step that could
 * read a TypeScript file. If the app's palette changes, this is the second
 * place to change.
 *
 * Body text uses the system font stack for the same reason the app leaves
 * `fontFamily` undefined on body text — it renders in SF on Apple platforms,
 * which is what the app looks like, and costs no download.
 */

:root {
  --bg: #0b0d10;
  --surface: #14171c;
  --surface-elevated: #1d2127;
  --border: #2a2f37;
  --accent: #00e5c0;
  --accent-pressed: #00c2a3;
  --accent-tint: rgba(0, 229, 192, 0.12);
  --text-primary: #f5f7f9;
  --text-secondary: #9ba3ae;
  --text-muted: #848e9c;
  --warning: #ffb454;

  --font-display: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica,
    Arial, sans-serif;

  --measure: 42rem;
  --gutter: 1.5rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  /* Anchor links land below the sticky header rather than under it. */
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Skip link ---------- */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  border-radius: 0 0 8px 0;
}

.skip-link:focus {
  left: 0;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 13, 16, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0.875rem var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  text-decoration: none;
}

.wordmark img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.site-nav {
  display: flex;
  gap: 1.25rem;
  font-size: 0.9375rem;
}

.site-nav a {
  color: var(--text-secondary);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--text-primary);
}

.site-nav a[aria-current='page'] {
  color: var(--accent);
}

/* ---------- Layout ---------- */

main {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.prose {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

section {
  margin: 0 0 3.5rem;
}

/* ---------- Type ---------- */

h1,
h2,
h3 {
  font-family: var(--font-display);
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 {
  font-size: clamp(2rem, 6vw, 3.25rem);
  font-weight: 700;
  margin: 0 0 1rem;
}

h2 {
  font-size: clamp(1.375rem, 3.5vw, 1.75rem);
  font-weight: 700;
  margin: 3rem 0 1rem;
}

h3 {
  font-size: 1.125rem;
  font-weight: 500;
  margin: 2rem 0 0.5rem;
}

p {
  margin: 0 0 1.125rem;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover,
a:focus-visible {
  color: var(--accent-pressed);
}

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

.lede {
  font-size: 1.1875rem;
  color: var(--text-secondary);
  max-width: 34rem;
}

.meta {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0 0 2.5rem;
}

.muted {
  color: var(--text-secondary);
}

.small {
  font-size: 0.9375rem;
}

ul,
ol {
  margin: 0 0 1.125rem;
  padding-left: 1.375rem;
}

li {
  margin-bottom: 0.5rem;
}

li > strong {
  color: var(--text-primary);
}

code {
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 0.875em;
  background: var(--surface-elevated);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* ---------- Hero ---------- */

.hero {
  padding: clamp(3.5rem, 10vw, 6.5rem) 0 clamp(2.5rem, 6vw, 4rem);
  text-align: center;
}

.hero .lede {
  margin-left: auto;
  margin-right: auto;
}

.hero__icon {
  width: 88px;
  height: 88px;
  border-radius: 22px;
  margin: 0 auto 2rem;
  display: block;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.eyebrow {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-tint);
  padding: 0.3125rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 1.5rem;
}

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

.cta-row {
  display: flex;
  gap: 0.875rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8125rem 1.5rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
}

.btn--primary {
  background: var(--accent);
  color: var(--bg);
}

.btn--primary:hover,
.btn--primary:focus-visible {
  background: var(--accent-pressed);
  color: var(--bg);
}

.btn--ghost {
  border-color: var(--border);
  color: var(--text-primary);
  background: transparent;
}

.btn--ghost:hover,
.btn--ghost:focus-visible {
  border-color: var(--text-secondary);
  color: var(--text-primary);
  background: var(--surface);
}

/* ---------- Feature grid ---------- */

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  margin: 0 0 4rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
}

.card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.0625rem;
  font-weight: 700;
}

.card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

/* ---------- Callout ---------- */

.callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  padding: 1.25rem 1.5rem;
  margin: 0 0 2rem;
}

.callout > :last-child {
  margin-bottom: 0;
}

.callout--warning {
  border-left-color: var(--warning);
}

/* A block the repo owner must fill in before publishing. Deliberately loud. */
.todo {
  background: rgba(255, 180, 84, 0.1);
  border: 1px dashed var(--warning);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin: 0 0 2rem;
  font-size: 0.9375rem;
  color: var(--warning);
}

.todo > :last-child {
  margin-bottom: 0;
}

.todo strong {
  color: var(--warning);
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
  margin: 0 0 2rem;
  border: 1px solid var(--border);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  min-width: 30rem;
}

th,
td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

thead th {
  background: var(--surface-elevated);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text-primary);
  white-space: nowrap;
}

tbody tr:last-child td {
  border-bottom: none;
}

td:first-child {
  color: var(--text-primary);
  font-weight: 500;
}

/* ---------- Table of contents ---------- */

.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin: 0 0 3rem;
}

.toc h2 {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
  font-weight: 600;
}

.toc ol {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.9375rem;
  columns: 2;
  column-gap: 2rem;
}

@media (max-width: 34rem) {
  .toc ol {
    columns: 1;
  }
}

/* ---------- Details / FAQ ---------- */

details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 0.75rem;
  overflow: hidden;
}

summary {
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: '+';
  color: var(--accent);
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

details[open] summary::after {
  content: '\2212';
}

details > *:not(summary) {
  padding: 0 1.25rem;
}

details > *:not(summary):last-child {
  padding-bottom: 1rem;
}

/* ---------- Definition-style contact block ---------- */

.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.75rem;
  margin: 0 0 2.5rem;
}

.contact-card p:last-child {
  margin-bottom: 0;
}

.contact-card__email {
  font-family: var(--font-display);
  font-size: clamp(1.125rem, 3vw, 1.5rem);
  font-weight: 700;
  word-break: break-all;
}

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

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding: 2.5rem var(--gutter) 3rem;
  font-size: 0.9375rem;
  color: var(--text-muted);
}

.site-footer__inner {
  max-width: 64rem;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.site-footer nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.site-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--text-primary);
}

.site-footer p {
  margin: 0;
}

/* ---------- Reduced motion ---------- */

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
