/* robford.org stylesheet. No frameworks.
   Dark first; light palette via prefers-color-scheme. */

/* Fonts (self-hosted, variable) ------------------------------------ */
@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/space-grotesk-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

/* Tokens ------------------------------------------------------------ */
:root {
  --bg: #0c141c;
  --surface: #131f2a;
  --text: #e6ecf1;
  --muted: #8fa1b0;
  --accent: #e08a2c;
  --accent-contrast: #10161c;
  --line: #22374a;
  --live: #4cc38a;

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  --step-0: 1.0625rem;
  --step-1: clamp(1.15rem, 0.5vw + 1rem, 1.3rem);
  --step-2: clamp(1.4rem, 1.2vw + 1.05rem, 1.75rem);
  --step-3: clamp(1.8rem, 2.2vw + 1.2rem, 2.5rem);
  --step-4: clamp(2.4rem, 4.5vw + 1.2rem, 4rem);

  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --text: #18242f;
    --muted: #4f6272;
    --accent: #a85a10;
    --accent-contrast: #ffffff;
    --line: #d5dde4;
    --live: #157a4d;
    color-scheme: light;
  }
}

/* Base --------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Hide the native scrollbar; a themed overlay one is drawn by site.js.
   No width is reserved, so expanding content never shifts the page. */
html {
  scrollbar-width: none; /* Firefox */
  scroll-padding-top: 4.5rem; /* keep anchors clear of the sticky header */
}

html::-webkit-scrollbar {
  width: 0;
  height: 0;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
}

/* Overlay scrollbar ------------------------------------------------------ */
.ov-scrollbar {
  position: fixed;
  top: 0;
  right: 3px;
  bottom: 0;
  width: 12px;
  z-index: 1040;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.ov-scrollbar.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.ov-thumb {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  border-radius: 6px;
  background: var(--muted);
  cursor: grab;
  transition: width 0.15s ease, background-color 0.15s ease;
}

.ov-scrollbar:hover .ov-thumb {
  width: 12px;
  background: var(--accent);
}

.ov-thumb:active {
  cursor: grabbing;
  background: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .ov-scrollbar { transition: none; }
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0 0 0.5em;
}

h1 { font-size: var(--step-4); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: var(--step-3); font-weight: 700; }
h3 { font-size: var(--step-1); font-weight: 500; }

p { margin: 0 0 1em; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

img { max-width: 100%; height: auto; display: block; }

.wrap {
  max-width: 68rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

/* Header / nav -------------------------------------------------------- */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.5em 1em;
  z-index: 10;
}

.skip-link:focus { left: 0; }

.site-head {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

@supports (backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px)) {
  .site-head {
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
}

.site-head nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  text-decoration: none;
}

.brand-mark {
  display: block;
  width: 2.3rem;
  height: 2.3rem;
  color: var(--accent);
  transition: transform 0.2s ease, filter 0.2s ease;
}

.brand:hover .brand-mark,
.brand:focus-visible .brand-mark {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.site-head ul {
  display: flex;
  gap: clamp(0.75rem, 3vw, 1.75rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-head li a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
}

.site-head li a:hover,
.site-head li a[aria-current="page"] {
  color: var(--accent);
}

.site-head li a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 0.35em;
}

/* Hero ----------------------------------------------------------------- */
.hero {
  padding-block: clamp(4rem, 12vh, 8rem) clamp(3rem, 8vh, 5rem);
}

.hero .tagline {
  font-size: var(--step-2);
  color: var(--muted);
  max-width: 34ch;
  margin-bottom: 1.75em;
}

/* Expandable About (native details/summary, no JS) --------------------- */
.about-toggle {
  max-width: 62ch;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.about-toggle summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75em;
  padding: 0.85em 1.1em;
  cursor: pointer;
  list-style: none; /* hide default disclosure triangle */
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
}

.about-toggle summary::-webkit-details-marker { display: none; }

.about-toggle summary:hover { color: var(--text); }

.about-chevron {
  width: 0.55em;
  height: 0.55em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.25s ease;
}

.about-toggle[open] .about-chevron { transform: rotate(-135deg); }

.about-content {
  overflow: hidden;
}

.about-content p {
  margin: 0;
  padding: 0 1.1em 1.1em;
  color: var(--text);
}

/* Signature element: live-status pulse ---------------------------------- */
.live-dot {
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  background: var(--live);
  flex-shrink: 0;
  animation: live-pulse 2.4s ease-out infinite;
}

@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--live) 55%, transparent); }
  70%  { box-shadow: 0 0 0 0.55em transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--live);
  margin: 0;
}

.status.soon { color: var(--muted); }

/* Sections --------------------------------------------------------------- */
section { padding-block: clamp(2.5rem, 6vh, 4.5rem); }

.section-kicker {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin-bottom: 0.75em;
}

/* Project cards ------------------------------------------------------------ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  grid-auto-rows: 1fr; /* every row equal height, so all cards in a section match */
  gap: 1.5rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.card-grid > li {
  display: grid; /* let the card stretch to fill the equal-height row */
}

.card-grid.dense {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-bottom: 1px solid var(--line);
}

.card-body {
  padding: 1.1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  flex-grow: 1;
}

.card-body h3 { margin: 0; }

.card .summary {
  color: var(--muted);
  margin: 0;
  font-size: 0.95rem;
}

.card .tech {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0;
}

/* Tech logos, badged onto the bottom-right of the card image */
.tech-icons {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  color: var(--muted);
  transition: color 0.2s ease;
}

.tech-icon {
  width: 1.2rem;
  height: 1.2rem;
  fill: currentColor;
  flex: none;
}

.card:hover .tech-icons {
  color: var(--accent);
}

/* Badge in the top-right corner of the card image */
.card {
  position: relative;
}

.card .tech-icons {
  position: absolute;
  top: 0;
  right: 0;
  padding: 0.35rem 0.6rem;
  border-radius: 0 0 0 10px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border: 1px solid var(--line);
  border-top: none;
  border-right: none;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.card-links {
  display: flex;
  gap: 1.1rem;
  margin: auto 0 0;
  padding-top: 0.6rem;
  font-size: 0.9rem;
}

.dense .card-body { padding: 0.9rem 1rem 1rem; }
.dense h3 { font-size: 1rem; }
.dense .summary { font-size: 0.88rem; }

.more-link {
  display: inline-block;
  margin-top: 1.75rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

/* Contact form ------------------------------------------------------------- */
.lead {
  font-size: var(--step-1);
  color: var(--muted);
  max-width: 52ch;
}

.contact-form {
  max-width: 34rem;
  margin-top: 2rem;
  display: grid;
  gap: 1.1rem;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.field input,
.field textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7em 0.85em;
  width: 100%;
  transition: border-color 0.15s ease;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.field input:user-invalid,
.field textarea:user-invalid {
  border-color: #e5533d;
}

/* Honeypot: off-screen, hidden from real users */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.button {
  justify-self: start;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--accent-contrast);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0.7em 1.3em;
  transition: filter 0.15s ease;
}

.button:hover { filter: brightness(1.08); }
.button:disabled { opacity: 0.6; cursor: default; }

.form-status {
  margin: 0;
  font-size: 0.95rem;
  min-height: 1.2em;
}

.form-status.success { color: var(--live); }
.form-status.error { color: #e5876b; }

/* D&D-style stat block (Stats page) ---------------------------------------- */
.statblock {
  max-width: 58rem;
  margin: 2.5rem auto;
  padding: 1.4rem 1.6rem 1.6rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 22px 60px -30px rgba(0, 0, 0, 0.8);
  line-height: 1.5;
}

.sb-loading,
.sb-empty {
  margin: 0;
  padding: 1.5rem 0;
  text-align: center;
  font-style: italic;
  color: var(--muted);
}

.sb-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.1;
  letter-spacing: 0.02em;
  color: var(--accent);
}

.sb-type {
  margin: 0.1rem 0 0.5rem;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--muted);
}

/* Tapered rule, the signature stat-block divider */
.sb-rule {
  display: block;
  width: 100%;
  height: 6px;
  color: var(--accent);
  margin: 0.6rem 0;
}

.sb-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 0.9rem 0 0.6rem;
}

.sb-tab {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0.45em 0.95em;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.sb-tab:hover { border-color: var(--accent); }

.sb-tab[aria-current="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

/* Ability-score boxes for the top genres */
.sb-abilities {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: 0.7rem;
  margin: 0.4rem 0 0.2rem;
}

.sb-ability {
  text-align: center;
  padding: 0.6rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.sb-ability .name {
  display: block;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.62rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  min-height: 1.4em;
}

.sb-ability .score {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.7rem;
  line-height: 1.1;
  color: var(--text);
}

/* Headline stat tiles (total, per day, avg gap) */
.sb-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin: 0.2rem 0 0.9rem;
}

.sb-stat {
  flex: 1 1 0;
  min-width: 5rem;
  text-align: center;
  padding: 0.5rem 0.4rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}

.sb-stat .name {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.sb-stat .value {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.1;
  color: var(--text);
}

/* Remaining genres as property lines with proportional bars */
.sb-props {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
}

.sb-props li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}

.sb-props .pg-name { color: var(--text); }
.sb-props .pg-name b { color: var(--accent); font-weight: 600; }

.sb-props .pg-count {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
}

.sb-props .pg-bar {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}

.sb-props .pg-bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.sb-minor {
  margin: 0.7rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.sb-flavour {
  margin: 1rem 0 0;
  font-style: italic;
  color: var(--muted);
}

.sb-flavour b { color: var(--accent); font-style: normal; }

.sb-updated {
  margin: 0.4rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: var(--muted);
}

/* Footer --------------------------------------------------------------------- */
.site-foot {
  position: sticky;
  bottom: 0;
  z-index: 1030;
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding-block: 0.15rem;
  margin-top: 2rem;
}

@supports (backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px)) {
  .site-foot {
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
}

.site-foot .wrap {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  color: var(--muted);
  font-size: 0.78rem;
}

.site-foot .wrap p { margin: 0; }

.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--accent); }
