/* Ristra: one small stylesheet, phone first. System fonts, no web fonts. */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1f1d1a;
  --muted: #6b665e;
  --line: #e4e0d8;
  --strip: #f2efe8;
  --red: #b3261e;      /* red chile */
  --green: #3d7a2e;    /* green chile */
  --accent: #b3261e;
  --link: #1f1d1a;
  --sponsor-bg: #fff6e8;
  --focus: #1a5fb4;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151412;
    --surface: #1d1b19;
    --text: #ece8e1;
    --muted: #a49d92;
    --line: #34312c;
    --strip: #221f1c;
    --red: #e5675d;
    --green: #7fbf6a;
    --accent: #e5675d;
    --link: #ece8e1;
    --sponsor-bg: #2a231a;
    --focus: #7aa7ff;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--link); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---- Header ---- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.brand-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 20px; text-decoration: none; color: var(--text); white-space: nowrap; flex: none; }
.brand-pod { --red-fill: #c0281f; --red-stroke: #6e1712; --stem: #2f6a24; --shine: .35; --pod-line: .55; }
.menu { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.menu a.submit-btn {
  min-height: 40px; padding: 0 14px; border-radius: 8px; background: #b3261e; color: #fff; font-weight: 600; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; flex: none;
}
.menu a.submit-btn:hover { filter: brightness(1.08); }

/* Hamburger menu */
.hamburger { position: relative; }
.hamburger summary {
  list-style: none; cursor: pointer; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px; color: var(--text);
}
.hamburger summary::-webkit-details-marker { display: none; }
.hamburger summary svg { stroke: currentColor; stroke-width: 2; stroke-linecap: round; fill: none; }
.hamburger[open] summary { background: var(--strip); }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
  display: flex; flex-direction: column;
}
.menu-panel a, .menu-item {
  display: flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 6px;
  color: var(--text); text-decoration: none; font: inherit; font-size: 15px; text-align: left;
  background: none; border: 0; cursor: pointer; width: 100%;
}
.menu-panel a:hover, .menu-item:hover { background: var(--strip); }
.menu-panel hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; width: auto; }
.auth-in, .auth-out { display: flex; flex-direction: column; }
.auth-in[hidden], .auth-out[hidden], .admin-link[hidden] { display: none; }
.linklike { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--muted); }

.tabs { display: flex; gap: 4px; padding: 0 10px; overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--line); }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  flex: none; padding: 11px 10px; min-height: 44px; text-decoration: none; color: var(--muted);
  border-bottom: 3px solid transparent; font-weight: 600; font-size: 15px;
}
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

.about-strip { background: var(--strip); padding: 8px 14px; font-size: 14px; }
.about-strip p { margin: 0; }
.byline { color: var(--muted); }
.byline a { color: var(--muted); }

.sponsor {
  display: flex; align-items: baseline; gap: 10px; margin: 10px 14px 12px; padding: 10px 12px;
  background: var(--sponsor-bg); border: 1px solid var(--line); border-radius: 8px; font-size: 15px;
}
.sponsor-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); flex: none; }
.sponsor-text { flex: 1; text-decoration: none; }
.sponsor-text:hover { text-decoration: underline; }
.sponsor-cta { flex: none; font-size: 13px; color: var(--muted); }

/* ---- Main ---- */
main { padding: 6px 14px 32px; max-width: 860px; margin: 0 auto; }
.list-blurb { color: var(--muted); font-size: 14px; margin: 8px 0 4px; }
.periods { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.periods a {
  padding: 8px 12px; min-height: 40px; border: 1px solid var(--line); border-radius: 999px;
  text-decoration: none; color: var(--muted); font-size: 14px; display: inline-flex; align-items: center;
}
.periods a[aria-current="page"] { color: var(--text); border-color: var(--red); font-weight: 600; }
.empty { color: var(--muted); }

.stories { list-style: none; margin: 0; padding: 0; }
.story { display: grid; grid-template-columns: auto auto 1fr; align-items: start; gap: 4px 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rank { color: var(--muted); font-size: 14px; min-width: 1.6em; text-align: right; padding-top: 12px; }
/* The chile button: outline until you've given it a chile, then filled red. */
.chile-btn {
  background: none; border: 1px solid transparent; border-radius: 8px; padding: 0; cursor: pointer;
  width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
}
.chile-btn:hover { border-color: var(--line); }
.chile-btn[disabled] { opacity: .6; cursor: wait; }
.pod {
  /* Not voted yet: an outline of the chile. */
  --red-fill: var(--surface); --red-stroke: #c0281f;
  --stem: var(--green); --shine: 0; --pod-line: 1.1;
}
.chile-btn:hover .pod { --red-fill: color-mix(in srgb, #c0281f 22%, var(--surface)); }
/* Voted: a filled red chile. */
.chile-btn.voted .pod { --red-fill: #c0281f; --red-stroke: #6e1712; --stem: #2f6a24; --shine: .35; --pod-line: .55; }
.story-body { min-width: 0; padding-top: 4px; }
.title { font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.title:visited { color: var(--muted); }
.title:hover { text-decoration: underline; }
.src { color: var(--muted); font-size: 13px; white-space: nowrap; }
.paywall { color: var(--red); }
.paywall.metered { color: var(--muted); }
.meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.meta a { color: var(--muted); }
.points { font-weight: 600; color: var(--text); }
.staff { color: var(--green); font-weight: 600; }
.pager { display: flex; align-items: center; gap: 6px; margin: 18px 0 8px; }
.pager-num, .pager-arrow {
  min-width: 40px; height: 40px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--text); font-weight: 600; font-size: 15px;
}
.pager-arrow { font-size: 20px; line-height: 1; }
.pager a:hover { border-color: var(--red); }
.pager-num.current { background: var(--red); border-color: var(--red); color: #fff; }
.pager-arrow.off { color: var(--line); }

.also h2 { font-size: 17px; margin-top: 24px; }
.also li { margin: 8px 0; }

/* ---- Comments ---- */
.story-flag { margin: 4px 0 0; font-size: 13px; }
.comments-section { margin-top: 24px; max-width: 720px; }
.comments-section h2 { font-size: 17px; }
.comments { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line); }
.comments.top { padding-left: 0; border-left: 0; }
.comment { margin: 14px 0; }
.comment-meta { font-size: 13px; color: var(--muted); }
.comment-meta strong { color: var(--text); }
.comment-meta a { color: var(--muted); text-decoration: none; }
.comment-text p { margin: 4px 0; overflow-wrap: anywhere; }
.comment-actions { display: flex; gap: 14px; font-size: 13px; }
.comment-actions .linklike { margin: 0; min-height: 32px; font-size: 13px; }
.comment-actions .linklike[disabled] { cursor: default; opacity: .7; }
.comment-form { margin: 10px 0 16px; }
.comment-form textarea {
  display: block; width: 100%; padding: 10px 12px; font: inherit; font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; resize: vertical;
}
.comment-form .primary { margin-top: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Forms and text pages ---- */
.form-page, .prose { max-width: 560px; }
.prose { line-height: 1.6; }
h1 { font-size: 24px; margin: 18px 0 10px; }
h2 { font-size: 18px; margin: 22px 0 8px; }
.note, .hint { color: var(--muted); font-size: 14px; }
.hint { font-weight: 400; }
label { display: block; font-weight: 600; margin: 14px 0; }
input {
  display: block; width: 100%; margin-top: 6px; padding: 11px 12px; font: inherit; font-size: 16px;
  color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
button.primary, button.danger {
  margin-top: 8px; min-height: 46px; padding: 0 20px; font: inherit; font-weight: 600; border-radius: 8px; border: 0; cursor: pointer;
  background: var(--red); color: #fff;
}
button.danger { background: #8c1d18; }
.cf-turnstile { margin: 14px 0; }
.form-error { color: var(--red); font-weight: 600; }
.form-result { margin-top: 16px; padding: 14px; background: var(--strip); border-radius: 8px; }
.recovery { font: 600 20px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; padding: 10px 0; user-select: all; }

.site-footer { text-align: center; color: var(--muted); font-size: 14px; padding: 18px 14px 40px; border-top: 1px solid var(--line); }
.site-footer a { color: var(--muted); }

/* ---- Larger screens ---- */
@media (min-width: 768px) {
  .brand-bar, .tabs, .about-strip { padding-left: max(14px, calc((100% - 860px) / 2 + 14px)); padding-right: max(14px, calc((100% - 860px) / 2 + 14px)); }
  .sponsor { max-width: 832px; margin: 12px auto; }
  .story { padding: 8px 0; }
}
