/* ==========================================================================
   Nocturne — jeffraben.com
   Design tokens are the source of truth. Retune here, not in the markup.
   ========================================================================== */

/* — fonts —
   Inter is loaded from the Google Fonts CDN via a <link> in the page <head>,
   not from here.

   The repo still carries self-hosted Inter variable subsets in fonts/ (they
   were extracted from the original bundle). To switch back to self-hosting —
   one fewer third party, one fewer connection — upload the fonts/ folder to
   the server, drop the Google <link> from index.html and 404.html, and
   restore the two @font-face rules documented in README.md. */

/* — tokens — */
:root {
  --color-bg: #161826;
  --color-surface: #232532;
  --color-text: #e9e9ed;
  --color-accent: #9184d9;
  --color-accent-2: #a7a1db;
  --color-divider: color-mix(in srgb, #e9e9ed 16%, transparent);

  /* Tonal ramps — generated in OKLCH on one shared lightness scale, so the
     same step of any role matches the others in visual value. */
  --color-neutral-100: #f3f5fe;
  --color-neutral-200: #e4e7f5;
  --color-neutral-300: #cfd3e5;
  --color-neutral-400: #b2b6ca;
  --color-neutral-500: #9397ab;
  --color-neutral-600: #75798c;
  --color-neutral-700: #595d6c;
  --color-neutral-800: #3f424d;
  --color-neutral-900: #292b31;

  --color-accent-100: #f5f4ff;
  --color-accent-200: #e7e5fe;
  --color-accent-300: #d2cefd;
  --color-accent-400: #b5abfc;
  --color-accent-500: #968ae0;
  --color-accent-600: #796cbf;
  --color-accent-700: #5d5294;
  --color-accent-800: #423a6a;
  --color-accent-900: #2b2741;

  --font-heading: 'Inter', system-ui, sans-serif;
  --font-heading-weight: 500;
  --font-body: 'Inter', system-ui, sans-serif;

  /* Spacing scale — 2.8px base unit. */
  --space-1: 2.8px;
  --space-2: 5.6px;
  --space-3: 8.4px;
  --space-4: 11.2px;
  --space-5: 14px;
  --space-6: 16.8px;
  --space-8: 22.4px;

  /* Vertical section rhythm. */
  --rhythm: 28px;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;

  --shadow-sm: 0 0 0 1px #3f424d;
  --shadow-md: 0 0 0 1px #595d6c, 0 6px 18px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 0 0 1px #9397ab, 0 16px 40px rgba(0, 0, 0, 0.65);
}

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 400;
  color: var(--color-text);
  background:
    radial-gradient(1200px 720px at 82% -160px, color-mix(in srgb, var(--color-accent-900) 75%, transparent), transparent 60%),
    radial-gradient(1100px 800px at -10% 100%, color-mix(in srgb, black 30%, transparent), transparent 55%),
    var(--color-bg);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 var(--space-2);
}

p { margin: 0 0 var(--space-3); }
img { display: block; max-width: 100%; }

a { color: var(--color-accent-300); text-decoration: none; text-underline-offset: 3px; }
a:hover { color: var(--color-accent); text-decoration: underline; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }

/* Respect users who ask for reduced motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Visually hidden but available to screen readers. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Skip link — first tab stop, so keyboard users can jump the nav. */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface); color: var(--color-text);
  border-radius: 0 0 var(--radius-md) 0;
}
.skip-link:focus { left: 0; }

/* — layout — */
.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 72px);
}

.rule {
  height: 1px;
  border: 0;
  margin: 0;
  background: linear-gradient(to right,
    transparent, var(--color-divider) 48px,
    var(--color-divider) calc(100% - 48px), transparent);
}

/* — nav — */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: var(--space-4) clamp(20px, 5vw, 72px);
}
.nav-brand {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 18px;
}
.nav-links { display: flex; gap: var(--space-6); align-items: center; }
.nav-links a { color: inherit; font-size: 14px; }
.nav-links a:hover,
.nav-links a[aria-current='page'] { color: var(--color-accent); text-decoration: none; }

/* — sections — */
.section { padding: calc(2.5 * var(--rhythm)) 0; }

.kicker {
  display: block;
  font-size: 13px;
  line-height: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin: 0 0 14px;
}

.section-title {
  font-size: 28px;
  line-height: 1.3;
  margin: 0 0 16px;
}

.prose {
  font-size: 16px;
  line-height: 28px;
  max-width: 62ch;
  margin: 0 0 16px;
  color: color-mix(in srgb, var(--color-text) 85%, transparent);
}
.prose:last-child { margin-bottom: 0; }

/* — hero — */
.hero {
  padding: calc(4 * var(--rhythm)) 0 calc(2.5 * var(--rhythm));
  animation: fadeUp 0.5s ease both;
}
.hero-title {
  font-size: clamp(40px, 6vw, 76px);
  line-height: 1.1;
  margin: 0;
}
.hero-title span { display: block; }
.hero-lede {
  font-size: 17px;
  line-height: 28px;
  max-width: 58ch;
  margin: 24px 0 0;
  color: color-mix(in srgb, var(--color-text) 85%, transparent);
}
.hero-actions { display: flex; gap: var(--space-3); margin-top: 24px; flex-wrap: wrap; }

/* — buttons — */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 14px;
  line-height: 1.2;
  color: var(--color-text);
  background: transparent;
  border: 1px solid transparent;
  padding: var(--space-2) calc(var(--space-3) * 1.2);
  border-radius: var(--radius-md);
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { color: var(--color-accent); border-color: var(--color-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--color-accent) 12%, transparent); color: var(--color-accent); }
.btn-primary:active { background: color-mix(in srgb, var(--color-accent) 22%, transparent); }

.btn-ghost { color: var(--color-accent); padding-inline: var(--space-1); }
.btn-ghost:hover { background: color-mix(in srgb, var(--color-accent) 10%, transparent); color: var(--color-accent); }
.btn-ghost:active { background: color-mix(in srgb, var(--color-accent) 18%, transparent); }

/* — cards — */
.card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}
.card-kicker {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin: 0;
}
.card-title {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  font-size: 17px;
  line-height: 1.2;
  margin: 0;
}
.card-body { margin: 0; font-size: 13px; opacity: 0.8; flex: 1; }
.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  margin: 0;
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
}

/* Link cards — the whole card is the hit target. */
a.card { color: inherit; transition: box-shadow 0.2s ease, transform 0.2s ease; }
a.card:hover {
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Placeholder cards — no destination yet, so they must not look clickable. */
.card-soon { opacity: 0.62; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-6);
}

/* — tags — */
.tag {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  font-size: 11px;
  letter-spacing: 0.02em;
  padding: 3px 10px;
  border-radius: calc(var(--radius-md) * 0.75);
}
.tag-outline { border: 1px solid var(--color-accent); color: var(--color-accent); }
.tag-neutral { background: var(--color-neutral-800); color: var(--color-neutral-100); }

/* — forms — */
.form { display: grid; gap: var(--space-6); max-width: 480px; }
.field > label {
  display: block;
  font-size: 12px;
  margin-bottom: 5px;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
}
.input {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  font: inherit;
  font-size: 14px;
  color: var(--color-text);
  caret-color: var(--color-accent);
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
}
.input:hover { border-color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.input:focus-visible { border-color: var(--color-accent); outline-offset: 0; }
textarea.input { min-height: 90px; resize: vertical; }

/* — footer — */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  padding: calc(2 * var(--rhythm)) 0;
  font-size: 13px;
  line-height: 28px;
  color: color-mix(in srgb, var(--color-text) 55%, transparent);
}
.footer-links { display: flex; gap: var(--space-6); }

/* — persistent link bar —
   Fixed to the bottom on every page. Replaces the old Linktree link: the
   social/profile links live on-site instead of sending visitors away.
   body gets padding-bottom so page content never hides behind it. */
.linkbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(2px, 1.5vw, 10px);
  padding: 9px clamp(10px, 4vw, 24px);
  /* keep clear of the iPhone home indicator */
  padding-bottom: max(9px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--color-surface) 90%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--color-divider);
}
.linkbar a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  color: color-mix(in srgb, var(--color-text) 78%, transparent);
  transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.linkbar a:hover {
  color: var(--color-accent);
  background: color-mix(in srgb, var(--color-accent) 12%, transparent);
  transform: translateY(-2px);
  text-decoration: none;
}
.linkbar a:active { transform: translateY(0); }
.linkbar svg { width: 20px; height: 20px; display: block; fill: currentColor; }

/* Room so the fixed bar never covers the footer / last section. */
body { padding-bottom: 64px; }

/* — US states map —
   Real geographic state outlines (SVG paths). Visited states take the
   accent fill; the rest stay muted surface. */
.usmap-svg {
  display: block;
  width: 100%;
  max-width: 720px;
  height: auto;
  margin: 0 0 var(--space-6);
}
.usmap-svg .state {
  fill: var(--color-surface);
  stroke: var(--color-divider);
  stroke-width: 1.5;
  stroke-linejoin: round;
}
.usmap-svg .state.on {
  fill: var(--color-accent-800);
  stroke: var(--color-accent);
}
/* Editable variant (admin): states respond to hover/focus. */
.usmap-svg .state[role="button"] { cursor: pointer; transition: fill 0.12s ease; }
.usmap-svg .state[role="button"]:hover { stroke: var(--color-accent); fill: color-mix(in srgb, var(--color-accent) 25%, var(--color-surface)); }
.usmap-svg .state[role="button"].on:hover { fill: color-mix(in srgb, var(--color-accent) 65%, var(--color-accent-800)); }
.usmap-svg .state[role="button"]:focus-visible { outline: none; stroke: var(--color-accent); stroke-width: 2.5; }

.usmap-legend { display: flex; gap: var(--space-4); font-size: 12px; color: color-mix(in srgb, var(--color-text) 55%, transparent); margin: 0 0 var(--space-4); flex-wrap: wrap; }
.usmap-legend .swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 5px; }
.usmap-count { font-size: 20px; font-weight: 500; color: var(--color-text); }

/* — small screens — */
@media (max-width: 560px) {
  .nav { justify-content: center; }
  .nav-links { gap: var(--space-4); }
  .nav-links a { font-size: 13px; }
  .hero { padding-top: calc(2.5 * var(--rhythm)); }
  .footer { justify-content: center; text-align: center; }
  .linkbar a { width: 38px; height: 38px; }
  .linkbar svg { width: 19px; height: 19px; }
}
