/*
  Shared pages (home, contact, privacy index, 404) use the site theme on :root.
  Each project's pages set a body class that swaps in that app's own palette and type,
  taken from the app's source:
    .theme-run      STEUD      app/src/constants/theme.ts (Barlow Condensed + Inter)
    .theme-armoire  Armoire    Features/Shared/Brand.swift (Lora titles, olive accent)
    .theme-mot      MOT & TAX  system colours, green tint, UK plate yellow
    .theme-mnemonic Mnemonic   colors.ts (slate gradient, indigo-violet button)
*/

:root {
  --text: #111827;
  --text-secondary: #5b6270;
  --background: #f5f6f8;
  --page: var(--background);
  --surface: #ffffff;
  --border: #e2e5ea;
  --accent: #0e7c6b;
  --button-text: #ffffff;
  --badge: var(--text);
  --badge-text: #ffffff;
  --display: "Space Grotesk", system-ui, sans-serif;
  --display-weight: 700;
  --display-transform: none;
  --display-spacing: -0.02em;
  --body: "Inter", system-ui, -apple-system, sans-serif;
  --radius: 16px;
  color-scheme: light;
}

.theme-run {
  --text: #141414;
  --text-secondary: #6e675c;
  --background: #f1ece2;
  --border: #ddd5c6;
  --accent: #2447d6;
  --badge: #141414;
  --badge-text: #f1ece2;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --display-transform: uppercase;
  --display-spacing: 0.01em;
  --radius: 20px;
}

.theme-armoire {
  --text: #292923;
  --text-secondary: #77776e;
  --background: #faf9f6;
  --border: #ddddd4;
  --accent: #353d32;
  --badge: #353d32;
  --display: "Lora", Georgia, serif;
  --display-weight: 600;
  --display-spacing: -0.01em;
  --radius: 12px;
}

.theme-mot {
  --text: #1c1c1e;
  --text-secondary: #6c6c70;
  --background: #f2f2f7;
  --border: #e0e0e5;
  --accent: #248a3d;
  --badge: #1c1c1e;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, sans-serif;
  --display-weight: 800;
  --display-spacing: -0.02em;
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  --radius: 14px;
}

.theme-mnemonic {
  --text: #ffffff;
  --text-secondary: #c3cad6;
  --background: #23293a;
  --page: linear-gradient(180deg, #3e4b61 0%, #23293a 70%) fixed, #23293a;
  --surface: rgba(255, 255, 255, 0.07);
  --border: #4a5568;
  --accent: #a5b4fc;
  --button: linear-gradient(135deg, #667eea, #764ba2);
  --badge: #374151;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, sans-serif;
  --display-weight: 800;
  --display-spacing: -0.02em;
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--background); }

body {
  margin: 0;
  --button: var(--accent); /* here, not on :root, so each theme's accent applies */
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.6;
}

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

.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

/* Header and footer */
.site-header { border-bottom: 1px solid var(--border); }
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 64px; flex-wrap: wrap;
}
.brand {
  font-family: "Space Grotesk", system-ui, sans-serif; font-weight: 700; font-size: 20px;
  letter-spacing: -0.01em; color: var(--text); text-decoration: none;
}
.site-header nav { display: flex; gap: 20px; }
.site-header nav a { color: var(--text); text-decoration: none; font-weight: 500; font-size: 15px; }
.site-header nav a:hover, .site-header nav a[aria-current] { color: var(--accent); }

.site-footer {
  border-top: 1px solid var(--border); margin-top: 72px; padding: 24px 0 40px;
  color: var(--text-secondary); font-size: 14px;
}
.site-footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--text-secondary); }

/* Type */
h1, h2, h3 {
  font-family: var(--display); font-weight: var(--display-weight); line-height: 1.1;
  text-transform: var(--display-transform); letter-spacing: var(--display-spacing);
}
h1 { font-size: clamp(40px, 8vw, 64px); margin: 56px 0 16px; }
h2 { font-size: 28px; margin: 48px 0 12px; }
h3 { font-size: 21px; margin: 28px 0 8px; }
.theme-run h1 { font-size: clamp(44px, 9vw, 72px); }
.theme-run h2 { font-size: 30px; }
.lede { font-size: 20px; color: var(--text-secondary); max-width: 34em; }
.muted { color: var(--text-secondary); }

/* Project cards */
.cards { display: grid; gap: 16px; }
.card {
  display: flex; gap: 20px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; text-decoration: none; color: var(--text);
}
.card:hover { border-color: var(--text-secondary); }
.card img { width: 88px; height: 88px; border-radius: 20px; flex: none; box-shadow: 0 0 0 1px var(--border); }
.card h3 { margin: 0 0 4px; }
.card p { margin: 0; color: var(--text-secondary); }

/* App page */
.app-hero { display: flex; gap: 24px; align-items: center; margin-top: 56px; }
.app-hero img {
  width: 120px; height: 120px; border-radius: 27px; flex: none;
  box-shadow: 0 0 0 1px var(--border), 0 6px 20px rgba(20, 20, 20, 0.08);
}
.app-hero h1 { margin: 0 0 4px; }
.app-hero p { margin: 0; }
.theme-mot .app-hero h1, .theme-mnemonic .app-hero h1 { font-size: clamp(36px, 6vw, 50px); }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; padding: 0; list-style: none; }
.features li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.features strong {
  display: block; font-family: var(--display); font-weight: var(--display-weight);
  text-transform: var(--display-transform); font-size: 19px; margin-bottom: 2px;
}
.theme-run .features strong { font-size: 20px; }

.badge {
  display: inline-block; margin-top: 20px; padding: 10px 18px; border-radius: 999px;
  background: var(--badge); color: var(--badge-text); font-weight: 600; font-size: 15px;
}

.button {
  display: inline-block; padding: 14px 24px; border-radius: 999px;
  background: var(--button); color: var(--button-text); font-weight: 600; text-decoration: none;
}

/* MOT & TAX: a UK number plate under the title */
.plate {
  display: inline-flex; align-items: stretch; margin-top: 14px;
  border-radius: 6px; overflow: hidden; border: 2px solid #1c1c1e;
  font-family: "Arial Narrow", "Helvetica Neue", Arial, sans-serif; font-weight: 700;
}
.plate .band { background: #00388c; color: #fbbc01; font-size: 12px; padding: 6px 7px; display: flex; align-items: flex-end; }
.plate .reg { background: #fbbc01; color: #000; font-size: 28px; letter-spacing: 0.06em; padding: 2px 16px; }

/* Long-form documents */
.doc h2 { font-size: 26px; }
.doc li { margin-bottom: 6px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 15px; margin: 12px 0; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 10px 8px; border-bottom: 1px solid var(--border); }
.doc th { font-weight: 600; }
.table-scroll { overflow-x: auto; }
.callout { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 20px; }

@media (max-width: 520px) {
  body { font-size: 16px; }
  .app-hero { flex-direction: column; align-items: flex-start; }
  .app-hero img { width: 96px; height: 96px; border-radius: 22px; }
  .card { flex-direction: column; align-items: flex-start; }
}
