/* ==========================================================================
   Tyler's Project Repository
   Dark by default (the old site used minima's dark skin); follows the
   visitor's system setting when they prefer light.
   ========================================================================== */

:root {
  color-scheme: dark light;
  --bg: #0e1116;
  --surface: #161b22;
  --surface-2: #1d232c;
  --border: #2a313c;
  --text: #e6e9ef;
  --muted: #9aa3b2;
  --accent: #7ab7ff;
  --accent-strong: #a9d1ff;
  --radius: 12px;
  --wrap: 56rem;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fbfbfa;
    --surface: #ffffff;
    --surface-2: #f1f3f5;
    --border: #e1e4e8;
    --text: #1a1d23;
    --muted: #596273;
    --accent: #1a5fd0;
    --accent-strong: #0f47a1;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1.0625rem/1.7 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; padding-top: 2.5rem; padding-bottom: 4rem; }

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--accent-strong); }

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

img { max-width: 100%; height: auto; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding-inline: 1.25rem; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--accent); color: #000; padding: 0.5rem 0.9rem; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

/* ---------- header / footer ---------- */

.site-header {
  position: sticky; top: 0; z-index: 10;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem 1.5rem; flex-wrap: wrap; min-height: 3.75rem;
}

.brand { font-weight: 700; letter-spacing: -0.01em; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--accent); }

.site-header nav { display: flex; gap: 1.4rem; }
.site-header nav a {
  color: var(--muted); text-decoration: none; font-size: 0.95rem;
  padding: 0.25rem 0; border-bottom: 2px solid transparent;
}
.site-header nav a:hover { color: var(--text); }
.site-header nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted); font-size: 0.9rem;
  padding: 1.75rem 0 2.25rem;
}
.site-footer p { margin: 0.2rem 0; max-width: 60ch; }
.site-footer strong { color: var(--text); }

/* ---------- prose ---------- */

.prose h1 {
  font-size: clamp(2rem, 5.5vw, 2.9rem);
  line-height: 1.12; letter-spacing: -0.025em; margin: 0 0 1.25rem;
}
.prose h2 { font-size: 1.55rem; line-height: 1.25; letter-spacing: -0.015em; margin: 3rem 0 0.75rem; }
.prose h3 { font-size: 1.2rem; line-height: 1.3; margin: 2rem 0 0.5rem; }
.prose h4, .prose h5, .prose h6 { margin: 1.5rem 0 0.4rem; }
.prose h2 a, .prose h3 a { text-decoration: none; }
.prose h2 a:hover, .prose h3 a:hover { text-decoration: underline; }

.prose p, .prose li { max-width: 70ch; }
.prose p { margin: 0 0 1.1em; }
.prose ul, .prose ol { padding-left: 1.4rem; margin: 0 0 1.25em; }
.prose li + li { margin-top: 0.3rem; }
.prose li > p { margin: 0.2rem 0; }
.prose li > ul, .prose li > ol { margin: 0.3rem 0 0; }

.prose hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

.prose img { border-radius: var(--radius); border: 1px solid var(--border); }

.prose code {
  font-family: var(--mono); font-size: 0.9em;
  background: var(--surface-2); padding: 0.1em 0.35em; border-radius: 5px;
}
.prose pre { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }

.prose blockquote { margin: 1.25rem 0; padding: 0.1rem 1.1rem; border-left: 3px solid var(--accent); color: var(--muted); }

.prose table { border-collapse: collapse; width: 100%; margin: 1.25rem 0; }
.prose th, .prose td { padding: 0.65rem 0.85rem; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.prose thead th { background: var(--surface); }

.prose details {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 0 1.1rem; margin: 1.5rem 0;
}
.prose details > summary { cursor: pointer; font-weight: 600; padding: 0.7rem 0; }
.prose details[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: 0.75rem; }
.prose details > ul { margin-bottom: 1rem; }

.empty-note { color: var(--muted); font-style: italic; }

/* a link with no destination yet */
.planned { color: var(--muted); }
.planned::after {
  content: "planned"; margin-left: 0.55rem; vertical-align: 0.1em;
  font: 600 0.65rem/1 var(--mono); letter-spacing: 0.05em; text-transform: uppercase;
  border: 1px solid var(--border); border-radius: 999px; padding: 0.2rem 0.5rem;
}

/* footnotes */
.prose .footnotes { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.92rem; }
.prose .footnotes ol { margin: 0; }
.prose .footnotes p { margin: 0.2rem 0; }
.prose sup.footnote-ref a { text-decoration: none; padding: 0 0.1em; }

/* ---------- home ---------- */

.hero { padding: 1.5rem 0 0.5rem; }
.hero .eyebrow {
  margin: 0 0 0.6rem; color: var(--accent);
  font: 600 0.85rem/1.2 var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
}
.hero h1 { margin-bottom: 1rem; }
.hero .lead { margin: 0; font-size: 1.2rem; color: var(--muted); max-width: 58ch; }

.cards {
  display: grid; gap: 1rem; margin: 1.5rem 0;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 23rem), 1fr));
}

.card {
  display: flex; flex-direction: column; gap: 0.5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  transition: border-color 0.15s ease;
}
.card:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); }

.prose .card h3 {
  margin: 0; font-size: 1.05rem; letter-spacing: 0.04em; text-transform: uppercase;
}
.card h3 a { color: var(--text); text-decoration: none; }
.card h3 a:hover { color: var(--accent); }

.card p, .card li { max-width: none; }
.card p { margin: 0; }
.card .note { color: var(--muted); font-size: 0.95rem; }
.card .details { margin-top: 0.4rem; padding-top: 0.75rem; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.97rem; }
.card .details p + p { margin-top: 0.6rem; }
.card img { margin: 0.4rem 0; width: 100%; }

/* ---------- about ---------- */

.about .prose > p:nth-of-type(1) img {
  width: 9.5rem; height: 9.5rem; object-fit: cover; border-radius: 50%;
  border: 3px solid var(--border);
}
.about .prose > hr { margin: 1.75rem 0; }

/* ---------- homebrew ---------- */

/* Each class family is named after a colour; show it. */
.homebrew .prose h2[id$="-classes"]::before,
.classpage .prose h2[id$="-classes"]::before {
  content: ""; display: inline-block; width: 0.8em; height: 0.8em; margin-right: 0.55em;
  border-radius: 50%; background: var(--swatch, var(--muted));
  box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--text) 40%, transparent);
  vertical-align: 0.02em;
}
#silver-classes { --swatch: #c0c4cc; }
#ebon-classes { --swatch: #2b2b2e; }
#ochre-classes { --swatch: #cc7722; }
#viridescant-classes { --swatch: #40826d; }
#perse-classes { --swatch: #4d6d9a; }
#carmine-classes { --swatch: #c3173b; }
#xanthous-classes { --swatch: #eeb513; }
#cerulean-classes { --swatch: #2a6fd6; }

.homebrew .prose h3 { color: var(--text); }

/* weapon profiles: one card per weapon */
.weapons .prose > ul {
  list-style: none; padding: 0; margin: 1rem 0 2rem;
  display: grid; gap: 0.8rem; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
}
.weapons .prose > ul > li {
  max-width: none; margin: 0; padding: 0.9rem 1.1rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.weapons .prose > ul > li > p, .weapons .prose > ul > li { font-weight: 700; }
.weapons .prose > ul > li > p { margin: 0 0 0.25rem; }
.weapons .prose li li { font-weight: 400; color: var(--muted); }
.weapons .prose li li:first-child { color: var(--accent); font-weight: 600; }
.weapons .prose li > ul { list-style: none; padding: 0; margin: 0; }
.weapons .prose li li + li { margin-top: 0.05rem; }

/* tooltips used for "Reactive" on the Monk page */
.hover-text {
  position: relative; display: inline-block; cursor: help;
  text-decoration: underline dotted; text-underline-offset: 0.22em;
}
.hover-text .popup-text {
  visibility: hidden; opacity: 0; position: absolute; z-index: 5;
  bottom: 130%; left: 50%; transform: translateX(-50%);
  width: 13rem; max-width: 70vw; padding: 0.45rem 0.65rem;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  font: 400 0.8rem/1.4 var(--font); font-style: normal; text-align: center; text-decoration: none;
  transition: opacity 0.15s ease;
}
.hover-text:hover .popup-text,
.hover-text:focus .popup-text,
.hover-text:focus-within .popup-text { visibility: visible; opacity: 1; }

/* ---------- QR pages (signup sheet / donations) ---------- */

.qr .prose table { table-layout: fixed; }
.qr .prose th {
  text-align: center; border: 0; background: none;
  font-size: clamp(1.7rem, 6.5vw, 4.7rem); line-height: 1.15; letter-spacing: -0.02em;
}
.qr .prose td { text-align: center; border: 0; }
/* QR codes need a light quiet zone around them to scan reliably on a dark page. */
.qr .prose td img {
  width: min(100%, 26rem); background: #fff; padding: 0.9rem; border: 0; border-radius: 6px;
}

/* ---------- small screens ---------- */

@media (max-width: 34rem) {
  body { font-size: 1rem; }
  main { padding-top: 1.75rem; }
  .site-header nav { gap: 1rem; }
  .prose th, .prose td { padding: 0.5rem 0.55rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card, .hover-text .popup-text { transition: none; }
}
