/* Shared Shelf. One wide column: wordmark header, who-bar, sticky category tabs,
   member cards over a recommendation scoreboard. Fonts are self-hosted (SIL OFL). */

@font-face { font-family: "Bricolage Grotesque"; font-weight: 700; font-display: swap; src: url("/static/fonts/bricolage-grotesque-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 800; font-display: swap; src: url("/static/fonts/bricolage-grotesque-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-weight: 400; font-display: swap; src: url("/static/fonts/dm-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-weight: 500; font-display: swap; src: url("/static/fonts/dm-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "DM Sans"; font-weight: 700; font-display: swap; src: url("/static/fonts/dm-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url("/static/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap; src: url("/static/fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  --bg: #edeff7;
  --surface: #ffffff;
  --ink: #12142b;
  --muted: #5b6082;
  --line: #d9dceb;
  --accent: #3347ff;
  --on-accent: #ffffff;
  --pos: #12744a;
  --mix: #9a6200;
  --bad: #b3261e;
  --m1: #e2552b; --m2: #138a64; --m3: #7a4bf0; --m4: #c98900;
  --m5: #2467c9; --m6: #c2285f; --m7: #0e8794; --m8: #5f7a1c;
  --font-display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f20;
    --surface: #161935;
    --ink: #edeefa;
    --muted: #9aa0c8;
    --line: #282c55;
    --accent: #8795ff;
    --on-accent: #0d0f20;
    --pos: #56e0a0;
    --mix: #f5c451;
    --bad: #ff8f86;
    --m1: #ff8a63; --m2: #4cd9a8; --m3: #b394ff; --m4: #f5c451;
    --m5: #6fb0ff; --m6: #ff7fae; --m7: #4fd6e3; --m8: #b5d16a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  padding-block: max(28px, env(safe-area-inset-top, 0px)) max(56px, env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.wrap { max-width: 1080px; margin: 0 auto; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
code { font-family: var(--font-mono); font-size: .9em; }

/* ---------- Header ---------- */
header.site { display: flex; flex-direction: column; gap: 14px; padding-bottom: 18px; }
.eyebrow { font-family: var(--font-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0; }
h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3rem, 11vw, 6.5rem);
  line-height: .92;
  letter-spacing: -.035em;
  margin: 0;
  text-wrap: balance;
}
.dots { display: inline-flex; gap: .09em; margin-left: .12em; vertical-align: .08em; }
.dots i { width: .2em; height: .2em; border-radius: 50%; display: block; }
.dots .d1 { background: var(--m1); } .dots .d2 { background: var(--m2); }
.dots .d3 { background: var(--m3); } .dots .d4 { background: var(--m4); }
.lede { max-width: 56ch; color: var(--muted); margin: 0; font-size: 1.05rem; }
.lede-sm { color: var(--muted); margin: 0 0 18px; max-width: 60ch; }
.stats { display: flex; flex-wrap: wrap; gap: 8px 24px; font-family: var(--font-mono); font-size: 13px; color: var(--muted); margin: 0; padding: 0; list-style: none; font-variant-numeric: tabular-nums; }
.stats b { color: var(--ink); font-weight: 500; }

header.mini { padding-bottom: 20px; }
.brand { font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; letter-spacing: -.02em; color: var(--ink); text-decoration: none; }

/* ---------- Who bar and notices ---------- */
.who { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.who p { margin: 0; font-size: 15px; }
.who .grow { flex: 1 1 260px; min-width: 0; }
.notice { margin: 0 0 14px; padding: 10px 14px; border-radius: 10px; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); font-size: 15px; }
.notice.err { background: color-mix(in srgb, var(--bad) 10%, var(--surface)); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); color: var(--bad); }
.hint { color: var(--muted); font-weight: 400; }

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-weight: 700; font-size: 14px; line-height: 1.2;
  padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--on-accent);
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--accent); filter: none; }
.btn.small { padding: 5px 12px; font-size: 13px; }
.linkbtn { font: inherit; font-size: 13px; color: var(--muted); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn:hover { color: var(--ink); }
.linkbtn.danger:hover { color: var(--bad); }
input[type="text"], input[type="password"], select {
  font: inherit; font-size: 16px; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; min-width: 0; max-width: 100%;
}
input:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
form.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
form.inline input[type="text"] { flex: 1 1 220px; }
form.stack { display: flex; flex-direction: column; gap: 14px; }
form.stack label { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 15px; }
form.stack .hint { font-size: 13px; }
.edit-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.edit-actions form { margin: 0; }
.htmx-request .btn, .htmx-request.btn { opacity: .6; }

/* ---------- Tabs ---------- */
nav.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  padding-block: 12px 10px;
  margin-bottom: 14px;
}
.tablist { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-block: 2px; }
.tablist::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
}
.tab small { font-family: var(--font-mono); font-weight: 400; font-size: 11px; color: var(--muted); }
.tab:hover { border-color: var(--accent); }
.tab[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tab[aria-current="page"] small { color: inherit; opacity: .8; }

/* ---------- Category panel ---------- */
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin: 8px 0 16px; }
.section-head h2, main.narrow h2, main > h2 { font-family: var(--font-display); font-size: clamp(1.7rem, 4vw, 2.3rem); letter-spacing: -.02em; margin: 0; line-height: 1.1; }
main.narrow h2, main > h2 { margin-bottom: 12px; }
.section-head p { margin: 0; font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }

.members { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.member { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 16px 10px; min-width: 0; display: flex; flex-direction: column; margin: 0; }
.member.add { background: transparent; border-style: dashed; justify-content: center; align-items: flex-start; gap: 12px; padding-bottom: 16px; }
.member.add p { margin: 0; color: var(--muted); font-size: 15px; }
.member.editing { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); padding-bottom: 16px; }
.member-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.who-name { min-width: 0; display: flex; flex-direction: column; }
.member-head h3 { font-family: var(--font-display); font-size: 1.15rem; margin: 0; line-height: 1.1; overflow-wrap: anywhere; }
.handle { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.member-head .n { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.avatar {
  width: 32px; height: 32px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 15px;
  color: var(--bg);
}
.c1 { background: var(--m1); } .c2 { background: var(--m2); } .c3 { background: var(--m3); } .c4 { background: var(--m4); }
.c5 { background: var(--m5); } .c6 { background: var(--m6); } .c7 { background: var(--m7); } .c8 { background: var(--m8); }
.picks { list-style: none; margin: 0; padding: 0; }
.picks li { padding: 9px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; font-size: 15px; }
.card-foot { display: flex; align-items: center; gap: 10px; padding: 8px 0 6px; border-top: 1px solid var(--line); margin-top: auto; }
.pick-inputs { display: flex; flex-direction: column; gap: 8px; }
.pick-inputs input { width: 100%; }
.edit-note { font-size: 13px; color: var(--muted); margin: 8px 0 10px; }
.note { font-size: 14px; color: var(--muted); margin: 0; }
.inline-note { font-size: 14px; }

.watch { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border: 1px dashed var(--line); border-radius: 14px; }
.watch-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.watch .label { font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
.inline-rm { display: inline; margin: 0; }
.inline-rm button { font: inherit; font-size: 15px; line-height: 1; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 2px; }
.inline-rm button:hover { color: var(--bad); }

/* ---------- Recommendations ---------- */
.recs { margin-top: 36px; display: flex; flex-direction: column; gap: 12px; }
.recs-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 20px; }
.recs-head h3 { font-family: var(--font-display); font-size: 1.4rem; letter-spacing: -.01em; margin: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.table-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
table { border-collapse: collapse; width: 100%; min-width: 560px; font-variant-numeric: tabular-nums; }
th, td { padding: 11px 14px; text-align: left; border-top: 1px solid var(--line); vertical-align: middle; }
thead th { border-top: 0; font-family: var(--font-mono); font-weight: 500; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
tbody th { font-weight: 500; overflow-wrap: anywhere; }
td.from { font-size: 14px; color: var(--muted); white-space: nowrap; }
th.c, td.c { text-align: center; width: 1%; white-space: nowrap; }
td.actions { white-space: nowrap; text-align: right; }
td.actions form { display: inline; margin-left: 12px; }
.rec-title { display: inline; }
.voters { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 3px; font-size: 12.5px; font-weight: 400; color: var(--muted); }
.v-pos::first-letter { color: var(--pos); }
.v-mix { color: var(--mix); }
form.rm { margin: 4px 0 0; }
.r { display: inline-grid; place-items: center; min-width: 34px; height: 26px; padding-inline: 8px; border-radius: 8px; font-family: var(--font-mono); font-size: 13px; font-weight: 500; font-style: normal; margin-inline: 2px; }
.r.pos { background: color-mix(in srgb, var(--pos) 16%, var(--surface)); color: var(--pos); }
.r.mix { background: color-mix(in srgb, var(--mix) 18%, var(--surface)); color: var(--mix); }
.r.none { color: var(--muted); opacity: .6; }
form.vote { display: inline-flex; gap: 4px; margin: 0; }
.vb { font-family: var(--font-mono); font-size: 13px; min-width: 38px; height: 30px; padding-inline: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; }
.vb:hover { border-color: var(--accent); }
.vb[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tag { margin-left: 8px; padding: 2px 8px; border-radius: 999px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; background: var(--accent); color: var(--on-accent); white-space: nowrap; vertical-align: 2px; }

/* ---------- Profile, join and admin pages ---------- */
main.narrow { max-width: 620px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.card h3 { font-family: var(--font-display); font-size: 1.2rem; margin: 0 0 8px; }
.card p { margin: 0 0 12px; }
.copy-row { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.copy-row input { flex: 1 1 240px; font-family: var(--font-mono); font-size: 14px; }

footer { margin-top: 44px; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }

@media (max-width: 520px) {
  th, td { padding: 10px; }
  .watch, .member { padding-inline: 14px; }
}

/* Phones: each recommendation becomes a small card, so reactions and vote buttons stay in view. */
@media (max-width: 640px) {
  .recs table { min-width: 0; }
  .recs thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .recs tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 6px 8px;
    padding: 12px 14px;
    border-top: 1px solid var(--line);
  }
  .recs tbody tr:first-child { border-top: 0; }
  .recs tbody th, .recs tbody td { padding: 0; border: 0; width: auto; }
  .recs tbody th { grid-column: 1 / -1; }
  .recs td.from { font-size: 13px; }
  .recs td.from::before { content: "from "; }
  .recs td.tally { text-align: right; }
  .vb { min-width: 44px; height: 36px; }
}
@media (prefers-reduced-motion: no-preference) {
  .tab, .btn, .vb { transition: background-color .15s, border-color .15s, opacity .15s; }
}
