/* Layout: one reading column — a ranked ledger of cacaos, each row led by its label, scored 1–5 in place; comments open beneath; suggestion form closes the page. */
:root {
  --bg: #f6f0f2;
  --surface: #fffafb;
  --ink: #2a1720;
  --muted: #6c5560;
  --line: #e3d3da;
  --accent: #862a52;
  --accent-ink: #fff7fa;
  --accent-soft: #f1dfe7;
  --gold: #8a6206;
  --gold-soft: #f5e6bd;
  --bar: #eadbe1;
  --danger: #a3341f;
  --ok: #2f6b3c;
  --ok-soft: #dcebdc;
  --leaf: #8ea56f; --leaf-vein: #6c8452; --pod: #d9ab47; --pod-ridge: #b98a2c; --pod-alt: #a24a6c; --pod-alt-ridge: #7f3352; --bean: #7a4a33; --bean-line: #4f2e1f; --branch: #7a5a43; --deco-opacity: 0.55;
  --font-display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1015; --surface: #24161e; --ink: #f4e7ed; --muted: #b59ca8; --line: #3b2731;
    --accent: #e27fa9; --accent-ink: #1a1015; --accent-soft: #3d2130; --gold: #e6bd55; --gold-soft: #3b2f12;
    --bar: #3a2430; --danger: #f08a6f; --ok: #8fcf98; --ok-soft: #1f3424; --leaf: #50663f; --leaf-vein: #6f8a5a; --pod: #9b7425; --pod-ridge: #7a5a1a; --pod-alt: #7e3352; --pod-alt-ridge: #5e2440; --bean: #5b3725; --bean-line: #3a2217; --branch: #5c4232; --deco-opacity: 0.45; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1a1015; --surface: #24161e; --ink: #f4e7ed; --muted: #b59ca8; --line: #3b2731;
  --accent: #e27fa9; --accent-ink: #1a1015; --accent-soft: #3d2130; --gold: #e6bd55; --gold-soft: #3b2f12;
  --bar: #3a2430; --danger: #f08a6f; --ok: #8fcf98; --ok-soft: #1f3424; --leaf: #50663f; --leaf-vein: #6f8a5a; --pod: #9b7425; --pod-ridge: #7a5a1a; --pod-alt: #7e3352; --pod-alt-ridge: #5e2440; --bean: #5b3725; --bean-line: #3a2217; --branch: #5c4232; --deco-opacity: 0.45; color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.55; }
.wrap { max-width: 820px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 40px 96px; display: grid; gap: 36px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; text-wrap: balance; margin: 0; letter-spacing: 0.005em; }
p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.eyebrow { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

header { display: grid; gap: 18px; }
header h1 { font-size: clamp(2.5rem, 7vw, 4.1rem); line-height: 1.02; }
header h1 em { color: var(--accent); }
.lede { max-width: 58ch; color: var(--muted); font-size: 1.05rem; }
.head-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.myvote { font-size: 0.95rem; color: var(--muted); }
.myvote strong { color: var(--ink); font-weight: 600; }
.scale-key { display: inline-flex; gap: 8px; align-items: center; font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
.scale-key b { color: var(--ink); font-weight: 500; }

.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 0.95rem; cursor: pointer; text-decoration: none; transition: transform .12s ease, background .12s ease; }
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.quiet { background: transparent; border-color: var(--line); color: var(--ink); font-weight: 500; }
.btn.small { padding: 6px 12px; font-size: 0.85rem; }

.notice { border: 1px dashed var(--line); padding: 14px 16px; border-radius: 12px; color: var(--muted); }

.toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; gap: 2px; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: 0.88rem; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.total { font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }

#list { display: grid; }
.cacao { display: grid; grid-template-columns: 2.4rem 112px minmax(0, 1fr); column-gap: 18px; padding-block: 28px; border-bottom: 1px solid var(--line); align-items: start; }
.rank { font-family: var(--font-display); font-size: 2.3rem; line-height: 1; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.rank.lead { color: var(--accent); font-style: italic; }
.label { position: relative; width: 112px; max-width: 100%; aspect-ratio: 5 / 7; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--accent-soft); display: grid; place-items: center; }
.label.has-img { background: #fff; }
.label img { width: 100%; height: 100%; object-fit: contain; display: block; }
.label .mono { font-family: var(--font-display); font-size: 3rem; color: var(--accent); line-height: 1; }
.label .mono-origin { position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding-inline: 6px; }
.label.house { background: var(--gold-soft); }
.label.house .mono { color: var(--gold); }
.img-btn { margin-top: 8px; width: 112px; max-width: 100%; justify-content: center; }
.media { display: grid; justify-items: start; }
.body { display: grid; gap: 12px; min-width: 0; }
.title-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: baseline; }
.title-row h2 { font-size: 2rem; line-height: 1.05; }
.meta { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.04em; color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; }
.badge.house { background: var(--gold-soft); color: var(--gold); }
.badge.out { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.desc { max-width: 64ch; }

.scoreline { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; }
.avg { display: flex; align-items: baseline; gap: 8px; }
.avg .big { font-family: var(--font-display); font-size: 2.2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.avg .of { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
.dist { display: grid; grid-template-columns: repeat(5, 14px); gap: 3px; align-items: end; height: 30px; }
.dist span { background: var(--bar); border-radius: 2px; min-height: 3px; }
.dist span.hi { background: var(--accent); }
.yours { display: grid; gap: 4px; }
.yours .lbl { font-size: 0.78rem; color: var(--muted); }
.pick { display: inline-flex; gap: 6px; }
.pick button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-family: var(--font-mono); font-weight: 500; font-size: 0.95rem; font-variant-numeric: tabular-nums; transition: background .12s ease, color .12s ease; }
.pick button:hover:not(:disabled) { border-color: var(--accent); }
.pick button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pick button.under { background: var(--accent-soft); border-color: var(--accent-soft); }
.pick button:disabled { cursor: not-allowed; opacity: .6; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.link-out { font-size: 0.88rem; color: var(--accent); }
.aff { font-size: 0.75rem; color: var(--muted); }
.links { display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; min-width: 0; }
.links h3 { font-size: 1.35rem; }
.tbl { overflow-x: auto; }
.tbl table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tbl th, .tbl td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { color: var(--muted); font-weight: 500; font-size: 0.8rem; }
.tbl .n { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl input { min-width: 200px; padding: 6px 10px; }
.row.nowrap { flex-wrap: nowrap; }

.reviews { display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.review { display: grid; gap: 4px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.review:last-of-type { border-bottom: 0; padding-bottom: 0; }
.review-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; font-size: 0.9rem; }
.review-head .who { font-weight: 600; }
.review-head .sc { font-family: var(--font-mono); font-size: 0.78rem; background: var(--accent-soft); color: var(--accent); padding: 1px 8px; border-radius: 999px; }
.review-head time { font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); }
.review p { white-space: pre-wrap; overflow-wrap: anywhere; }
.empty-reviews { color: var(--muted); font-size: 0.92rem; }
.rform { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.rform h3 { font-size: 1.3rem; }
textarea, input[type="text"] { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 10px 12px; }
textarea { min-height: 90px; resize: vertical; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.admin { border: 1px solid var(--gold); background: var(--gold-soft); border-radius: 16px; padding: 18px; display: grid; gap: 14px; }
.admin h2 { font-size: 1.7rem; }
.admin .hint { color: var(--muted); font-size: 0.92rem; }
.sub { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 6px; min-width: 0; }
.sub h3 { font-size: 1.35rem; }
.sub dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 12px; margin: 0; font-size: 0.9rem; }
.sub dt { color: var(--muted); }
.sub dd { margin: 0; overflow-wrap: anywhere; }

#suggest { display: grid; gap: 16px; scroll-margin-top: 24px; }
#suggest h2 { font-size: clamp(2rem, 5vw, 2.8rem); }
.sform { display: grid; gap: 14px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
label { display: grid; gap: 6px; font-size: 0.9rem; font-weight: 500; }
label .opt { color: var(--muted); font-weight: 400; }
.mysubs { display: grid; gap: 8px; }
.mysub { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-block: 8px; }
.pill { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; padding: 3px 9px; border-radius: 999px; background: var(--bar); color: var(--muted); }
.pill.approved { background: var(--ok-soft); color: var(--ok); }
.pill.declined { color: var(--danger); }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 0.92rem; z-index: 20; max-width: calc(100% - 32px); }
footer { color: var(--muted); font-size: 0.85rem; }
@media (max-width: 560px) {
  .cacao { grid-template-columns: 1.6rem 84px minmax(0, 1fr); column-gap: 12px; }
  .label, .img-btn { width: 84px; }
  .label .mono { font-size: 2.3rem; }
  .rank { font-size: 1.6rem; }
  .title-row h2 { font-size: 1.65rem; }
  .cacao .wide { grid-column: 1 / -1; }
  .pick button { width: 38px; height: 38px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* page basics (standalone site) */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--accent); }
footer { display: grid; gap: 8px; }
footer p { max-width: 70ch; }
.owner { display: grid; gap: 12px; border: 1px solid var(--line); border-radius: 16px; padding: 18px; background: var(--surface); }
.owner h2 { font-size: 1.7rem; }
.owner .row input { flex: 1 1 240px; }

/* Cacao illustrations: a pod branch top-right, leaves and beans bottom-left, drawn behind the content */
.deco-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.deco { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; opacity: var(--deco-opacity); }
.deco svg { position: absolute; display: block; height: auto; max-width: none; }
.deco-tr { top: -28px; right: -70px; width: min(48vw, 560px); }
.deco-bl { bottom: -36px; left: -60px; width: min(40vw, 470px); }
.wrap { position: relative; z-index: 1; }
.bean-rule { display: flex; justify-content: center; gap: 14px; padding-block: 4px; }
.bean-rule svg { width: 30px; height: 18px; }
.bean-rule svg:nth-child(2) { transform: rotate(14deg); }
.bean-rule svg:nth-child(3) { transform: rotate(-10deg); }
header h1 em { position: relative; }
@media (max-width: 900px) {
  .deco { opacity: calc(var(--deco-opacity) * 0.55); }
  .deco-tr { width: 300px; right: -110px; top: -40px; }
  .deco-bl { width: 260px; left: -90px; }
}

.yours { justify-items: stretch; width: max-content; }
.scale-hint { display: flex; justify-content: space-between; gap: 12px; font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); padding-inline: 4px; }

@media (max-width: 560px) {
  .deco-tr { width: 240px; right: -150px; top: -60px; }
  .deco-bl { width: 220px; left: -100px; }
}
