/* ==========================================================================
   RHODES — rhodes.hankelsner.tech
   A site about not knowing what somebody likes yet.

   House rules this file obeys:
     · light default, dark under BOTH prefers-color-scheme and [data-theme]
     · system fonts only, no @font-face, no @import, no url() to anywhere
     · hairline rules instead of boxes; one shadow token, on card hover only
     · generated hue touches exactly three things (card top rule, plate band,
       plate wash) and NEVER text or UI
   ========================================================================== */

/* ---------- tokens ------------------------------------------------------ */

:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef2f8;
  --ink: #0d1420;
  --muted: #566276;
  --line: #dfe5ee;
  --accent: #1f5ed0;
  --accent-ink: #17489e;
  --accent-wash: rgba(31, 94, 208, .08);
  --shadow: 0 6px 24px rgba(13, 20, 32, .09);

  /* plate hue. --h is set per card inline; --plate must be re-declared on the
     card itself (below) or it would resolve once here and every card would
     come out trust-blue. */
  --h: 214;
  --plate-l: 48%;
  --plate-s: 62%;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --ease: cubic-bezier(.2, .7, .3, 1);
  --container: 1120px;
  --bleed: 1440px;
  --prose: 620px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0d14;
    --surface: #141a25;
    --surface-2: #1b2230;
    --ink: #e9edf4;
    --muted: #98a4b6;
    --line: #232c3b;
    --accent: #74a6ff;
    --accent-ink: #9dc0ff;
    --accent-wash: rgba(116, 166, 255, .12);
    --shadow: 0 6px 24px rgba(0, 0, 0, .5);
    --plate-l: 62%;
    --plate-s: 55%;
  }
}

:root[data-theme="dark"] {
  --bg: #0a0d14;
  --surface: #141a25;
  --surface-2: #1b2230;
  --ink: #e9edf4;
  --muted: #98a4b6;
  --line: #232c3b;
  --accent: #74a6ff;
  --accent-ink: #9dc0ff;
  --accent-wash: rgba(116, 166, 255, .12);
  --shadow: 0 6px 24px rgba(0, 0, 0, .5);
  --plate-l: 62%;
  --plate-s: 55%;
}

/* ---------- reset ------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.7 var(--sans);
  overflow-x: hidden;
}

h1, h2, h3, p, figure, table { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }

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

.vh {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 60;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 16px; text-decoration: none;
  transition: top .16s var(--ease);
}
.skip:focus { top: 12px; }

/* ---------- layout ------------------------------------------------------ */

.wrap { width: min(100% - 48px, var(--container)); margin-inline: auto; }
.bleed { width: min(100% - 48px, var(--bleed)); margin-inline: auto; }
.prose { max-width: var(--prose); }
.prose p + p { margin-top: 1.1em; }

.section { padding: 104px 0; border-top: 1px solid var(--line); }
.section:first-of-type { border-top: 0; }

@media (max-width: 700px) {
  .wrap, .bleed { width: calc(100% - 40px); }
  .section { padding: 64px 0; }
}

/* ---------- type -------------------------------------------------------- */

h1 {
  overflow-wrap: anywhere;
  font-size: clamp(2.6rem, 7vw, 5.25rem);
  font-weight: 300; letter-spacing: -.035em; line-height: 1.02;
  text-wrap: balance;
}
h2 {
  font-size: clamp(1.65rem, 3.4vw, 2.4rem);
  font-weight: 400; letter-spacing: -.02em; line-height: 1.15;
  text-wrap: balance;
}
h3 { font-size: 1.15rem; font-weight: 600; letter-spacing: -.01em; }

.deck {
  font-size: clamp(1.125rem, 1.6vw, 1.3rem);
  line-height: 1.55; color: var(--muted); max-width: 34em;
}
.mono {
  font-family: var(--mono);
  font-size: 13px; letter-spacing: .12em; text-transform: uppercase;
}
.muted { color: var(--muted); }
.note { font-size: 15px; color: var(--muted); max-width: 62ch; }

/* ---------- buttons ----------------------------------------------------- */

.btn {
  appearance: none; cursor: pointer;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 13px 20px; font-size: 16px; font-weight: 500;
  min-height: 44px;
  transition: border-color .16s var(--ease), transform .16s var(--ease), background .16s var(--ease);
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 600;
}
:root[data-theme="dark"] .btn-primary { color: #06101f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-primary { color: #06101f; }
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-quiet {
  background: none; border: 0; padding: 11px 2px; min-height: 44px;
  color: var(--accent-ink); font-size: 15px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
.btn-quiet:hover { text-decoration-color: var(--accent); }

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }

/* ---------- top bar ----------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  height: 56px; display: flex; align-items: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.wordmark { font-family: var(--mono); font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

.themebtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; cursor: pointer;
  background: none; border: 1px solid transparent; border-radius: 10px;
  color: var(--muted);
}
.themebtn:hover { color: var(--ink); border-color: var(--line); }
.themebtn svg { width: 19px; height: 19px; display: block; }
.themebtn .moon { display: none; }
:root[data-theme="dark"] .themebtn .moon { display: block; }
:root[data-theme="dark"] .themebtn .sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .themebtn .moon { display: block; }
  :root:not([data-theme="light"]) .themebtn .sun { display: none; }
}

/* ---------- hero -------------------------------------------------------- */

.hero { position: relative; padding: clamp(72px, 12vh, 132px) 0 clamp(64px, 9vh, 104px); overflow: hidden; }
.hero .wrap { position: relative; z-index: 1; }
.hero .eyebrow { color: var(--muted); margin-bottom: 28px; }
.hero h1 { max-width: 15ch; }
.hero .deck { margin-top: 28px; }
.hero .countline { margin-top: 24px; font-size: 1.05rem; color: var(--ink); }

.lattice {
  position: absolute; inset: 0; z-index: 0;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 42%, transparent 92%);
  mask-image: linear-gradient(180deg, #000 0%, #000 42%, transparent 92%);
}
.lattice svg { width: 100%; height: 100%; display: block; }

/* ---------- the field --------------------------------------------------- */

.field-head { margin-bottom: 44px; }
.field-head h2 { margin-bottom: 22px; }

.grid {
  display: grid; gap: 20px;
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 1100px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 820px)  { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .grid { grid-template-columns: 1fr; } }

.grid-caption { margin-top: 28px; color: var(--muted); font-family: var(--mono); font-size: 13px; letter-spacing: .04em; line-height: 1.7; max-width: 72ch; text-transform: none; }

.field-empty {
  display: none; text-align: center; padding: 72px 0;
  font-size: clamp(1.3rem, 2.6vw, 1.8rem); font-weight: 300; line-height: 1.4;
  color: var(--ink); text-wrap: balance;
}
.field.is-empty .grid { display: none; }
.field.is-empty .field-empty { display: block; }
.field.is-empty .grid-caption, .field.is-empty .more-btn { display: none; }

.more-btn { margin-top: 24px; display: none; }
@media (max-width: 560px) {
  .more-btn.is-needed { display: inline-flex; }
  /* a phone gets six, and asks for the rest */
  .grid:not(.is-expanded) .card:nth-child(n+7) { display: none; }
}

/* ---------- the card ---------------------------------------------------- */

.card {
  /* re-declared here so it evaluates against this card's own --h */
  --plate: hsl(var(--h) var(--plate-s) var(--plate-l));
  position: relative; display: flex; flex-direction: column;
  text-align: left; cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 0; overflow: hidden;
  min-height: 232px;
  transition: transform .16s var(--ease), box-shadow .16s var(--ease), border-color .16s var(--ease), opacity .25s var(--ease);
}
.card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: var(--plate);
  transition: height .16s var(--ease);
}
.card:hover, .card:focus-visible { transform: translateY(-3px); box-shadow: var(--shadow); }
.card:hover::before, .card:focus-visible::before { height: 6px; }
.card.is-out { opacity: 0; }

.card-body { padding: 22px 20px 20px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
/* side-plate skins put the body beside the drawing: it must be allowed to
   shrink, or long titles run straight off the card. */
.card[data-skin="index-card"] .card-body,
.card[data-skin="column"] .card-body { flex: 1 1 auto; }
.card-title { font-size: 17px; font-weight: 600; line-height: 1.3; letter-spacing: -.005em; color: var(--ink); }
.card-tag { font-size: 15px; line-height: 1.45; color: var(--muted); }
.card-path {
  margin-top: 6px; font-family: var(--mono); font-size: 13px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-top: 12px;
}

.plate { --plate: hsl(var(--h) var(--plate-s) var(--plate-l)); display: block; width: 100%; background: color-mix(in srgb, var(--plate) 5%, var(--surface-2)); }
.plate svg { display: block; width: 100%; height: 100%; color: var(--muted); }

/* seven skins — arrangement only */
.card[data-skin="masthead"] .plate { flex: 1 1 96px; min-height: 96px; order: 2; border-top: 1px solid var(--line); }
.card[data-skin="masthead"] .card-body { order: 1; padding-bottom: 16px; }

.card[data-skin="poster"] .plate { flex: 1 1 128px; min-height: 128px; order: 1; border-bottom: 1px solid var(--line); }
/* text-align, not align-items: centring the flex items themselves shrink-wraps
   them, and a shrink-wrapped path line overflows the card instead of ellipsing. */
.card[data-skin="poster"] .card-body { order: 2; text-align: center; }

.card[data-skin="ledger"] .plate { flex: 1 1 72px; min-height: 72px; order: 1; border-bottom: 1px solid var(--line); }
.card[data-skin="ledger"] .card-body { order: 2; }
.card[data-skin="ledger"] .card-title { font-size: 16px; }

.card[data-skin="index-card"] { flex-direction: row; align-items: stretch; }
.card[data-skin="index-card"] .plate { width: 104px; flex: 0 0 104px; height: auto; border-right: 1px solid var(--line); }
.card[data-skin="index-card"] .card-body { padding-top: 26px; }

.card[data-skin="atlas"] .plate { flex: 1 1 152px; min-height: 152px; order: 1; }
.card[data-skin="atlas"] .card-body {
  order: 2; margin: -34px 12px 0; padding: 14px 14px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  position: relative; z-index: 1;
}

.card[data-skin="column"] { flex-direction: row-reverse; }
.card[data-skin="column"] .plate { width: 84px; flex: 0 0 84px; height: auto; border-left: 1px solid var(--line); }
.card[data-skin="column"] .card-body { padding-top: 26px; }

.card[data-skin="stack"] .plate { flex: 1 1 84px; min-height: 84px; order: 1; border-bottom: 1px solid var(--line); }
.card[data-skin="stack"] .card-body { order: 2; }
.card[data-skin="stack"] .card-title { padding-bottom: 12px; border-bottom: 1px solid var(--line); }

/* ---------- the tally --------------------------------------------------- */

.tally { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tally .wrap { display: grid; grid-template-columns: repeat(3, 1fr); }
.tally-cell { padding: 40px 0; }
.tally-cell + .tally-cell { border-left: 1px solid var(--line); padding-left: 28px; }
.tally-num {
  font-size: clamp(2.25rem, 5vw, 3.75rem); font-weight: 200; line-height: 1;
  letter-spacing: -.03em; font-variant-numeric: tabular-nums;
}
.tally-label { margin-top: 14px; color: var(--muted); }
@media (max-width: 700px) {
  .tally .wrap { grid-template-columns: 1fr; }
  .tally-cell { padding: 26px 0; }
  .tally-cell + .tally-cell { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; }
}

/* ---------- the record -------------------------------------------------- */

.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 32px 0 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 0 6px 0 16px; min-height: 44px; font-size: 15px;
}
.chip button {
  width: 44px; height: 44px; border-radius: 999px; cursor: pointer;
  background: none; border: 0; color: var(--muted); font-size: 17px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.chip button:hover { background: var(--accent-wash); color: var(--ink); }

.record-scroll { overflow-x: auto; margin-top: 24px; }
table.record { width: 100%; border-collapse: collapse; font-size: 15px; }
table.record th {
  text-align: left; font-family: var(--mono); font-size: 13px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); font-weight: 400;
  padding: 0 20px 10px 0; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.record td { padding: 12px 20px 12px 0; border-bottom: 1px solid var(--line); vertical-align: baseline; }
table.record td:first-child { font-family: var(--mono); font-size: 13px; color: var(--muted); white-space: nowrap; }
table.record .kind { font-family: var(--mono); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
table.record td.when { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
table.record tr.is-back td { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.record-empty { margin-top: 24px; color: var(--muted); }

/* ---------- the naming form --------------------------------------------- */

.collapse .prose { max-width: var(--prose); }
.collapse h2 { margin-bottom: 32px; }
.namer { margin-top: 8px; }
.namer label { display: block; font-family: var(--mono); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.namer .row { display: flex; flex-wrap: wrap; gap: 12px; align-items: stretch; }
.namer input {
  flex: 1 1 260px; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 13px 16px; font-size: 18px; min-height: 52px;
}
.namer input::placeholder { color: var(--muted); }
.namer input:focus-visible { border-color: var(--accent); }
.namer .btn-primary { min-height: 52px; }
.namer .fine { margin-top: 20px; font-size: 15px; color: var(--muted); max-width: 54ch; }
.namer .back { margin-top: 8px; }

/* ---------- the blank --------------------------------------------------- */

.blank {
  display: inline-block; vertical-align: baseline;
  width: 7ch; height: 1.05em; position: relative; margin: 0 .1em;
}
.blank::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: .18em; height: 2px;
  background: var(--accent); opacity: .55;
  animation: breath 6s var(--ease) infinite;
}
@keyframes breath { 0%, 100% { opacity: .3; } 50% { opacity: .7; } }
.blank.is-filled { width: auto; height: auto; overflow-wrap: anywhere; color: var(--accent-ink); font-weight: 600; }
.blank.is-filled::after { display: none; }

/* ---------- state switching --------------------------------------------- */

.only-open { display: block; }
.only-named { display: none; }
:root[data-state="named"] .only-open { display: none; }
:root[data-state="named"] .only-named { display: block; }

/* ---------- named state ------------------------------------------------- */

.named-hero { padding: clamp(72px, 12vh, 132px) 0 clamp(56px, 8vh, 88px); }
.named-hero { --plate: hsl(var(--h) var(--plate-s) var(--plate-l)); }
:root[data-state="named"]:not(.is-ready) .named-hero,
:root[data-state="named"]:not(.is-ready) .only-named { visibility: hidden; }
.named-hero .stamp { color: var(--muted); margin-bottom: 26px; display: inline-block; padding-bottom: 10px; border-bottom: 2px solid var(--plate); }
.named-hero h1 { max-width: 16ch; overflow-wrap: anywhere; }
.named-hero .deck { margin-top: 28px; }

table.known { width: 100%; border-collapse: collapse; max-width: 720px; }
table.known caption { text-align: left; font-family: var(--mono); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding-bottom: 18px; }
table.known th {
  text-align: left; font-family: var(--mono); font-size: 13px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); font-weight: 400;
  padding: 15px 24px 15px 0; border-bottom: 1px solid var(--line); vertical-align: middle;
  width: 46%;
}
table.known td { padding: 15px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.known td.filled { font-weight: 500; }
.ruled { display: block; position: relative; height: 1.5em; }
.ruled::before {
  content: ""; position: absolute; left: 0; right: 8px; bottom: .35em;
  height: 1px; background: var(--line-strong, var(--line));
}
:root { --line-strong: #cdd6e3; }
:root[data-theme="dark"] { --line-strong: #2f3b4d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --line-strong: #2f3b4d; } }

.notes-list { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; max-width: var(--prose); }
.note-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px; display: flex; gap: 16px; align-items: flex-start;
}
.note-card p { font-size: 16px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; flex: 1; }
.note-card .when { font-family: var(--mono); font-size: 13px; color: var(--muted); display: block; margin-top: 10px; letter-spacing: .06em; }
.note-del { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 15px; padding: 10px 8px; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; }
.note-del:hover { color: var(--ink); }

.notes-form { margin-top: 26px; max-width: var(--prose); }
.notes-form textarea {
  width: 100%; min-height: 108px; resize: vertical;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; font-size: 16px; line-height: 1.6;
}
.notes-form textarea:focus-visible { border-color: var(--accent); }

.release { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 26px 0; }
.release .wrap { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; }
.release .lead { color: var(--muted); }

/* ---------- dialog ------------------------------------------------------ */

.overlay {
  position: fixed; inset: 0; z-index: 80;
  display: none; align-items: center; justify-content: center;
  padding: 24px;
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  backdrop-filter: blur(6px);
}
.overlay.is-open { display: flex; }
.dialog {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow);
  width: min(560px, 100%); max-height: min(86vh, 780px); overflow-y: auto;
  padding: 0;
}
.dialog .plate { height: 150px; border-bottom: 1px solid var(--line); border-radius: 14px 14px 0 0; }
.dialog-body { padding: 26px 28px 28px; }
.dialog h3 { font-size: 1.35rem; line-height: 1.25; letter-spacing: -.015em; }
.dialog .tag { margin-top: 10px; color: var(--muted); }
.dialog .sections { list-style: none; padding: 0; margin: 24px 0 0; border-top: 1px solid var(--line); }
.dialog .sections li { padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 15px; }
.dialog .built { margin-top: 22px; font-family: var(--mono); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.dialog .actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.dialog-close { margin-top: 4px; }

/* ---------- the sweep --------------------------------------------------- */

.sweep {
  position: fixed; left: 0; right: 0; height: 1px; z-index: 70;
  background: var(--accent); opacity: .85; pointer-events: none;
  box-shadow: 0 0 18px 1px var(--accent);
  display: none;
}
.sweep.is-on { display: block; }

.grid.is-collapsing .card {
  transition: transform .7s var(--ease), opacity .7s var(--ease);
  opacity: 0;
}

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

.foot { border-top: 1px solid var(--line); padding: 48px 0 64px; }
.foot .note { max-width: 66ch; }
.foot .row { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; margin-top: 28px; }

/* ---------- motion off -------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition-duration: .01ms !important;
  }
}
