/* So What? — styles. Ported from the approved Main.dc.html design. */
:root {
  --green: #0F2E26;
  --green-2: #163B31;
  --porcelain: #F6F7F5;
  --sage: #DDE6E0;
  --champagne: #E2C998;
  --text: #1E2A25;
  --muted: #5E6A64;
  --border: #E3E7E4;
  --soft: #F1F4F2;
  --on-dark-muted: #A9BDB4;
  --body-muted: #4A5751;
  --accent: #3D6B5C;
  --chip-off: #6F8A7F;
  --chip-off-line: #3E5C51;
  --font: 'Hanken Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --pad: 32px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--porcelain);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green); }
a:hover { color: var(--accent); }
button { cursor: pointer; }
button:disabled { cursor: default; }

/* Focus: champagne on dark surfaces, bottle green on light ones */
:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
.dark :focus-visible, .status-banner :focus-visible { outline-color: var(--champagne); }
main:focus { outline: none; }

.skip {
  position: absolute; left: 16px; top: -100px; z-index: 10;
  background: var(--champagne); color: var(--green);
  padding: 10px 16px; border-radius: 999px; font-weight: 600; text-decoration: none;
}
.skip:focus { top: 16px; }

.wrap { max-width: 1180px; margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }

/* ---------- Status banner ---------- */
.status-banner { background: var(--green-2); color: var(--champagne); border-bottom: 1px solid var(--chip-off-line); }
.status-inner {
  max-width: 1180px; margin: 0 auto; padding: 12px var(--pad);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.status-inner p { margin: 0; font-size: 15px; font-weight: 500; }
.status-close {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px;
  background: transparent; border: 0; border-radius: 999px; color: var(--champagne);
}
.status-close:hover { background: rgba(226, 201, 152, .12); }

/* ---------- Hero ---------- */
.hero { background: var(--green); color: var(--porcelain); }
.hero-inner { padding-top: 32px; padding-bottom: 96px; display: flex; flex-direction: column; gap: 96px; }
.nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.brand { font-weight: 600; font-size: 22px; letter-spacing: -0.4px; }
.nav-cta {
  color: var(--green); background: var(--champagne); text-decoration: none;
  font-weight: 600; font-size: 15px; padding: 13px 22px; border-radius: 999px;
  transition: background-color .25s ease;
}
.nav-cta:hover { color: var(--green); background: #EBD7B0; }
.hero-copy { display: flex; flex-direction: column; gap: 36px; }
.hero-lede { margin: 0; font-size: 18px; line-height: 1.55; color: var(--on-dark-muted); max-width: 520px; }
.picker {
  margin: 0; font-weight: 300; font-size: clamp(40px, 6vw, 78px); line-height: 1.12;
  letter-spacing: -2.4px; display: flex; flex-wrap: wrap; align-items: baseline;
  column-gap: 22px; row-gap: 8px; max-width: 1080px;
}
.chips { display: contents; }
.chip {
  font: inherit; letter-spacing: inherit; background: transparent; border: 0; padding: 0; margin: 0;
  line-height: 1.15; text-align: left;
  color: var(--chip-off);
  text-decoration: underline; text-underline-offset: 12px;
  text-decoration-thickness: 1px; text-decoration-color: var(--chip-off-line);
  transition: color .35s ease, text-decoration-color .35s ease;
}
.chip:hover { color: #8AA49A; }
.chip[aria-pressed="true"] {
  color: var(--champagne); font-weight: 400;
  text-decoration-thickness: 2px; text-decoration-color: var(--champagne);
}
.count-line { margin: 0; font-size: 16px; color: var(--on-dark-muted); }

/* ---------- Stories ---------- */
.stories { padding-top: 72px; padding-bottom: 24px; display: flex; flex-direction: column; gap: 24px; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 8px; }
.section-head h2 { margin: 0; font-weight: 400; font-size: 34px; letter-spacing: -1px; }
.today { font-size: 15px; color: var(--muted); }
.story-list { display: flex; flex-direction: column; gap: 24px; }

.box { background: #FFFFFF; border: 1px solid var(--border); border-radius: 28px; padding: 40px; }
.story { display: flex; flex-wrap: wrap; gap: 32px 64px; }
.story-left { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.story-meta { font-size: 14px; color: var(--muted); }
.story h3 { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.35; letter-spacing: -0.2px; overflow-wrap: anywhere; }
.story-what { margin: 0; font-size: 15px; line-height: 1.65; color: var(--body-muted); }
.story { scroll-margin-top: 16px; }
.story.is-linked { border-color: var(--champagne); box-shadow: 0 0 0 1px var(--champagne); }
.story h3:focus { outline: none; }
.story h3:focus-visible { outline: 2px solid var(--green); outline-offset: 6px; border-radius: 4px; }
.story-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0 20px; margin-top: -6px; }
.story-link { font-size: 14px; font-weight: 600; text-underline-offset: 4px; align-self: flex-start; }
.story-actions .story-link { align-self: auto; display: inline-flex; align-items: center; min-height: 44px; }
.share-btn {
  font: inherit; font-size: 14px; font-weight: 600; color: var(--green);
  background: transparent; border: 0; padding: 0; min-height: 44px;
  text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--sage); text-decoration-thickness: 2px;
}
.share-btn:hover { color: var(--accent); text-decoration-color: currentColor; }
.share-msg { font-size: 14px; color: var(--accent); overflow-wrap: anywhere; }
.share-msg:empty { display: none; }
.story-right { flex: 999 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 28px; }
.note { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.pill { background: var(--sage); color: var(--green); font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 999px; }
.note p { margin: 0; font-weight: 300; font-size: 26px; line-height: 1.35; letter-spacing: -0.5px; max-width: 32em; }
.todo { display: flex; gap: 14px; align-items: flex-start; background: var(--soft); border-radius: 18px; padding: 18px 20px; }
.todo svg { flex: none; margin-top: 1px; }
.todo p { margin: 0; font-size: 16px; line-height: 1.55; }
.todo strong { font-weight: 600; }

.message { margin: 0; font-size: 18px; line-height: 1.55; }

/* Show more */
.more { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding-top: 8px; }
.more-btn {
  font: inherit; font-size: 16px; font-weight: 600; color: var(--green);
  background: transparent; border: 1.5px solid var(--green); border-radius: 999px;
  min-height: 48px; padding: 12px 28px; transition: background-color .25s ease;
}
.more-btn:hover { background: var(--sage); }
.more-count { margin: 0; font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Loading skeletons: quiet, low-contrast */
.skeleton { display: flex; flex-direction: column; gap: 16px; min-height: 220px; }
.skeleton span { display: block; height: 14px; border-radius: 999px; background: var(--soft); animation: pulse 1.6s ease-in-out infinite; }
.skeleton span:nth-child(1) { width: 28%; }
.skeleton span:nth-child(2) { width: 62%; height: 22px; }
.skeleton span:nth-child(3) { width: 80%; height: 30px; margin-top: 18px; }
@keyframes pulse { 50% { opacity: .55; } }

/* ---------- Chart + tip ---------- */
.weekly { padding-top: 24px; padding-bottom: 24px; display: flex; flex-wrap: wrap; gap: 24px; }
.kicker { font-size: 14px; font-weight: 600; color: var(--accent); }
.chart-panel { flex: 999 1 520px; min-width: 0; background: var(--sage); border-radius: 28px; padding: 40px; display: flex; flex-direction: column; gap: 28px; }
.chart-head { display: flex; flex-direction: column; gap: 8px; }
.chart-head h2 { margin: 0; font-weight: 400; font-size: 34px; line-height: 1.15; letter-spacing: -1px; color: var(--green); }
.chart-head p { margin: 0; font-size: 15px; line-height: 1.6; color: #34433C; max-width: 520px; }
.bars { display: flex; align-items: flex-end; gap: 14px; height: 210px; }
.bar-col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 10px; }
.bar-val { font-size: 15px; font-weight: 600; color: var(--green); }
.bar { width: 100%; border-radius: 14px; background: #9FB8AC; }
.bar.is-last { background: var(--green); }
.bar-label { font-size: 13px; color: #3D4C45; }
.chart-foot { font-size: 14px; color: #34433C; }
.tip-panel { flex: 1 1 300px; min-width: 0; background: #FFFFFF; border: 1px solid var(--border); border-radius: 28px; padding: 40px; display: flex; flex-direction: column; gap: 16px; }
.tip-big { margin: 0; font-weight: 300; font-size: 28px; line-height: 1.25; letter-spacing: -0.7px; }
.tip-text { margin: 0; font-size: 15px; line-height: 1.65; color: var(--body-muted); }

/* ---------- Subscribe ---------- */
.subscribe-wrap { padding-top: 24px; padding-bottom: 64px; scroll-margin-top: 16px; }
.subscribe {
  background: var(--green); color: var(--porcelain); border-radius: 36px; padding: clamp(32px, 5vw, 64px);
  display: flex; flex-wrap: wrap; gap: 40px 72px; align-items: center;
}
.subscribe-copy { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.subscribe-copy h2 { margin: 0; font-weight: 300; font-size: clamp(34px, 4.2vw, 54px); line-height: 1.08; letter-spacing: -1.8px; }
.subscribe-copy p { margin: 0; font-size: 17px; line-height: 1.6; color: var(--on-dark-muted); }
.sub-form { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.sub-form label { font-size: 15px; font-weight: 500; color: var(--sage); }
.sub-form input {
  font: inherit; font-size: 17px; padding: 17px 20px; border: 0; border-radius: 16px;
  background: var(--porcelain); color: var(--green); width: 100%;
}
.sub-form input::placeholder { color: #6B7872; }
.sub-form input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--champagne); }
.freqs { display: flex; gap: 10px; }
.freq {
  flex: 1; font: inherit; font-size: 16px; font-weight: 500; padding: 15px; border-radius: 16px;
  background: transparent; color: var(--sage); border: 1px solid #4F6E62;
  transition: background-color .25s ease, color .25s ease;
}
.freq:hover { border-color: #7C998D; }
.freq[aria-pressed="true"] { background: var(--sage); color: var(--green); border-color: var(--sage); }
.sub-btn {
  font: inherit; font-size: 17px; font-weight: 600; background: var(--champagne); color: var(--green);
  border: 0; border-radius: 16px; padding: 17px; transition: background-color .25s ease, opacity .25s ease;
}
.sub-btn:hover { background: #EBD7B0; }
.sub-btn:disabled { opacity: .65; }
.sub-msg { margin: 0; font-size: 15px; line-height: 1.5; color: var(--champagne); }
.sub-msg:empty { display: none; }
.sub-small { font-size: 13px; color: var(--on-dark-muted); }

/* ---------- Footer ---------- */
.footer { padding-bottom: 56px; }
.footer p { margin: 0; max-width: 720px; font-size: 13px; line-height: 1.65; color: var(--muted); }

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  :root { --pad: 20px; }
  .hero-inner { padding-top: 24px; padding-bottom: 64px; gap: 56px; }
  .hero-copy { gap: 28px; }
  .hero-lede { font-size: 17px; }
  .picker { letter-spacing: -1.4px; column-gap: 14px; row-gap: 6px; }
  .chip { text-underline-offset: 8px; }
  .nav-cta { padding: 11px 18px; font-size: 14px; }
  .stories { padding-top: 48px; }
  .section-head h2, .chart-head h2 { font-size: 28px; }
  .box, .chart-panel, .tip-panel { padding: 24px; border-radius: 24px; }
  .story { gap: 24px; }
  .story-right { gap: 22px; }
  .note p { font-size: 21px; }
  .tip-big { font-size: 24px; }
  .bars { gap: 8px; height: 190px; }
  .bar { border-radius: 10px; }
  .bar-val { font-size: 13px; }
  .subscribe { border-radius: 28px; }
  .freq { padding: 14px 8px; font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ======================================================
   Admin
   ====================================================== */
.admin-hero .hero-inner { padding-bottom: 48px; gap: 40px; }
.admin-title { margin: 0; font-weight: 300; font-size: clamp(34px, 4.6vw, 54px); letter-spacing: -1.6px; line-height: 1.1; }
.key-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; max-width: 620px; }
.key-field { flex: 1 1 260px; display: flex; flex-direction: column; gap: 8px; }
.key-field label { font-size: 15px; font-weight: 500; color: var(--sage); }
.key-field input { font: inherit; font-size: 16px; padding: 14px 18px; border: 0; border-radius: 14px; background: var(--porcelain); color: var(--green); }
.btn {
  font: inherit; font-size: 15px; font-weight: 600; border-radius: 14px; padding: 14px 20px;
  border: 1px solid transparent; background: var(--champagne); color: var(--green);
}
.btn:hover { background: #EBD7B0; }
.btn:disabled { opacity: .6; }
.btn-ghost { background: transparent; color: var(--green); border-color: var(--border); }
.btn-ghost:hover { background: var(--soft); }
.dark .btn-ghost { color: var(--sage); border-color: #4F6E62; }
.dark .btn-ghost:hover { background: var(--green-2); }
.admin-msg { margin: 0; font-size: 15px; color: var(--champagne); min-height: 1.4em; }

.admin-main { padding-top: 48px; padding-bottom: 64px; display: flex; flex-direction: column; gap: 48px; }
.admin-section { display: flex; flex-direction: column; gap: 20px; }
.admin-section > h2 { margin: 0; font-weight: 400; font-size: 28px; letter-spacing: -0.8px; }
.admin-section-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: baseline; justify-content: space-between; }
.admin-section-head h2 { margin: 0; font-weight: 400; font-size: 28px; letter-spacing: -0.8px; }
.admin-hint { margin: 0; font-size: 14px; color: var(--muted); }

.warn { background: var(--green); color: var(--champagne); border-radius: 18px; padding: 16px 20px; font-weight: 500; margin: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
.stat { background: #fff; border: 1px solid var(--border); border-radius: 20px; padding: 20px 22px; display: flex; flex-direction: column; gap: 6px; }
.stat-num { font-weight: 300; font-size: 38px; letter-spacing: -1px; line-height: 1.1; color: var(--green); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 14px; color: var(--muted); }
.stat.is-alert { background: var(--sage); border-color: var(--sage); }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab {
  font: inherit; font-size: 15px; font-weight: 500; padding: 10px 18px; border-radius: 999px;
  background: transparent; color: var(--green); border: 1px solid var(--border);
}
.tab:hover { background: var(--soft); }
.tab[aria-selected="true"] { background: var(--green); color: var(--porcelain); border-color: var(--green); }

.rows { display: flex; flex-direction: column; gap: 12px; }
.row { background: #fff; border: 1px solid var(--border); border-radius: 20px; padding: 20px 22px; display: flex; gap: 16px; align-items: flex-start; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.row-title { font-size: 17px; font-weight: 600; line-height: 1.35; text-underline-offset: 4px; overflow-wrap: anywhere; }
.row-meta { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.tag { background: var(--soft); color: var(--green); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 500; }
.row-detail { font-size: 14px; line-height: 1.6; color: var(--body-muted); display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.row-detail p { margin: 0; }
.row-detail strong { color: var(--text); font-weight: 600; }
.star {
  flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 999px;
  background: transparent; border: 1px solid var(--border); color: #8A958F;
}
.star:hover { background: var(--soft); }
.star[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: var(--champagne); }
.star svg path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.star[aria-pressed="true"] svg path { fill: currentColor; }

.issue-box { background: var(--sage); border-radius: 28px; padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.issue-box textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6;
  width: 100%; min-height: 320px; resize: vertical; border: 0; border-radius: 16px; padding: 18px; background: #fff; color: var(--text);
}
.issue-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--border); border-radius: 20px; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table-wrap th, .table-wrap td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table-wrap th { font-weight: 600; color: var(--muted); font-size: 13px; background: var(--soft); }
.table-wrap tr:last-child td { border-bottom: 0; }
.table-wrap td.num { font-variant-numeric: tabular-nums; }
.table-wrap td.err { color: #8A3B2E; max-width: 360px; overflow-wrap: anywhere; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; margin-right: 6px; background: #9FB8AC; }
.dot.is-on { background: #2F7A5C; }
.dot.is-dead { background: #B4533F; }

.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nav-home, .nav-home:hover { color: var(--porcelain); text-decoration: none; }

/* Admin: row actions + inline edit */
.btn-sm { font-size: 14px; padding: 10px 18px; min-height: 44px; border-radius: 999px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.row-err { margin: 0; font-size: 14px; color: #8A3B2E; }
.row-err:empty { display: none; }
.edit-form { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; padding: 20px; background: var(--soft); border-radius: 18px; }
.edit-field { display: flex; flex-direction: column; gap: 6px; }
.edit-field label { font-size: 14px; font-weight: 600; color: var(--text); }
.edit-field textarea, .issue-box textarea#weekly-json {
  font: inherit; font-size: 15px; line-height: 1.5; width: 100%; resize: vertical;
  border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: #fff; color: var(--text);
}
.issue-box textarea#weekly-json { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; border: 0; }
.edit-field textarea:focus-visible { outline-offset: 2px; }
.edit-notes { border: 0; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.edit-notes legend { padding: 0; margin-bottom: 10px; font-size: 14px; color: var(--muted); }
textarea[aria-invalid="true"] { box-shadow: inset 0 0 0 2px #8A3B2E; }

/* Admin: saved Sunday issues */
.issue-list { display: flex; flex-direction: column; gap: 12px; }
.issue-item { background: #fff; border: 1px solid var(--border); border-radius: 20px; }
.issue-item summary {
  list-style: none; cursor: pointer; padding: 18px 22px; min-height: 44px; border-radius: 20px;
  display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline;
}
.issue-item summary::-webkit-details-marker { display: none; }
.issue-item summary::before { content: '+'; font-weight: 600; color: var(--accent); width: 12px; }
.issue-item[open] summary::before { content: '\2212'; }
.issue-item summary:hover { background: var(--soft); }
.issue-date { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.issue-subject { font-size: 17px; font-weight: 600; flex: 1 1 240px; min-width: 0; overflow-wrap: anywhere; }
.issue-body { padding: 0 22px 22px; display: flex; flex-direction: column; gap: 12px; }
.issue-body pre {
  margin: 0; max-height: 420px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6;
  background: var(--soft); border-radius: 14px; padding: 16px;
}
@media (max-width: 640px) {
  .row { padding: 18px; }
  .edit-form { padding: 14px; }
}
