/* The 5% Club — fivepercent.club */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
/* Layout: a printed-circuit board. The hero is a DIMM stick (chips, a silkscreen label, gold contact fingers);
   the feed below is a single readable column of posts, each tagged like a RAM module sticker. */
:root {
  --bg: #eef3ef;
  --surface: #ffffff;
  --ink: #10261d;
  --muted: #4f6b5e;
  --line: #cfdcd4;
  --pcb: #1b5a3f;
  --pcb-deep: #134530;
  --silk: #f3f6f0;
  --silk-ink: #10261d;
  --chip: #121715;
  --chip-line: #2a332f;
  --gold: #c6922f;
  --gold-hi: #e9c068;
  --action: #1b5a3f;
  --action-ink: #f3f6f0;
  --warn: #9a3412;
  --warn-bg: #fdeee6;
  --ok: #166534;
  --ok-bg: #e5f3ea;
  --focus: #c6922f;

  --f-display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --f-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --r: 6px;
  --col: 720px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1c15; --surface: #10271d; --ink: #e5eee8; --muted: #93ab9f; --line: #24453a;
    --pcb: #17503a; --pcb-deep: #0f3a29; --silk: #eef2ea; --silk-ink: #0f2219;
    --chip: #0a0d0c; --chip-line: #26302b; --gold: #d6a142; --gold-hi: #f0cb79;
    --action: #d6a142; --action-ink: #13200f;
    --warn: #fdba8c; --warn-bg: #3a1d10; --ok: #86efac; --ok-bg: #0f3320; --focus: #f0cb79;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1c15; --surface: #10271d; --ink: #e5eee8; --muted: #93ab9f; --line: #24453a;
  --pcb: #17503a; --pcb-deep: #0f3a29; --silk: #eef2ea; --silk-ink: #0f2219;
  --chip: #0a0d0c; --chip-line: #26302b; --gold: #d6a142; --gold-hi: #f0cb79;
  --action: #d6a142; --action-ink: #13200f;
  --warn: #fdba8c; --warn-bg: #3a1d10; --ok: #86efac; --ok-bg: #0f3320; --focus: #f0cb79;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--f-body); font-size: 16px; line-height: 1.55;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--pcb-deep); }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { text-wrap: balance; }
.wrap {
  max-width: var(--col); margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Top bar */
.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--pcb-deep); color: var(--silk); }
.bar .wrap { display: flex; align-items: center; gap: 16px; padding-block: 10px; flex-wrap: wrap; }
.brand { font-family: var(--f-display); font-weight: 900; font-size: 1.5rem; letter-spacing: .02em; text-transform: uppercase; text-decoration: none; display: flex; align-items: baseline; gap: 6px; }
.brand b { color: var(--gold-hi); }
nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
nav a {
  font-family: var(--f-mono); font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  text-decoration: none; padding: 6px 10px; border-radius: var(--r); color: var(--silk); opacity: .78;
  display: inline-flex; align-items: center; gap: 6px;
}
nav a:hover { opacity: 1; background: rgba(255,255,255,.08); }
nav a[aria-current="page"] { opacity: 1; background: rgba(255,255,255,.14); }
.badge { background: var(--gold); color: #13200f; border-radius: 99px; padding: 0 7px; font-size: .72rem; line-height: 1.5; }

/* Hero: the DIMM */
.hero { background: var(--pcb); color: var(--silk); padding-block: 28px 0; overflow: hidden; }
.hero .wrap { display: grid; gap: 18px; }
.eyebrow { font-family: var(--f-mono); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; opacity: .8; }
.hero h1 { font-family: var(--f-display); font-weight: 900; font-size: clamp(2.6rem, 9vw, 4.4rem); line-height: .92; margin: 0; text-transform: uppercase; letter-spacing: .01em; }
.hero p { margin: 0; max-width: 60ch; opacity: .92; }
.hero p cite, .hero p q { font-style: normal; font-weight: 700; }
.hero .club-def { border-left: 3px solid var(--gold-hi); padding-left: 12px; font-size: .95rem; }
.hero .club-def strong { color: var(--gold-hi); }

.dimm {
  position: relative; margin-top: 10px; background: var(--pcb-deep);
  border-radius: 8px 8px 0 0; padding: 18px 16px 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.dimm::before { /* trace lines */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: .18;
  background-image: repeating-linear-gradient(90deg, transparent 0 22px, var(--gold-hi) 22px 23px);
  mask-image: linear-gradient(to bottom, transparent 0 62%, #000 62% 82%, transparent 82%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0 62%, #000 62% 82%, transparent 82%);
}
.dimm-top { display: grid; position: relative; }
.dimm-top > * { grid-area: 1 / 1; }
.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; align-self: stretch; }
.chips span { min-height: 90px; background: var(--chip); border-radius: 2px; box-shadow: inset 0 0 0 1px var(--chip-line); }
.chips span:nth-child(n+5) { display: none; }
@media (min-width: 560px) { .chips { grid-template-columns: repeat(8, 1fr); } .chips span:nth-child(n+5) { display: block; } }
.label {
  position: relative; align-self: center; justify-self: center; margin-block: 14px; width: min(calc(100% - 24px), 460px);
  background: var(--silk); color: var(--silk-ink); border-radius: 3px;
  padding: 14px 16px 12px; box-shadow: 0 6px 18px rgba(0,0,0,.28);
  display: grid; gap: 2px;
}
.label .k { font-family: var(--f-mono); font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--silk-ink); opacity: .72; }
.label .v { font-family: var(--f-display); font-weight: 900; font-size: clamp(2.6rem, 11vw, 4rem); line-height: 1; font-variant-numeric: tabular-nums; }
.label .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-family: var(--f-mono); font-size: .74rem; font-variant-numeric: tabular-nums; border-top: 1px dashed currentColor; padding-top: 6px; margin-top: 4px; opacity: .85; }
.contacts {
  position: relative; height: 26px; margin: 18px -16px 0;
  background:
    repeating-linear-gradient(90deg, var(--gold) 0 9px, var(--gold-hi) 9px 10px, transparent 10px 14px);
  background-color: var(--pcb-deep);
}
.contacts::after { /* key notch */
  content: ""; position: absolute; bottom: 0; left: 58%; width: 14px; height: 15px; background: var(--bg); border-radius: 7px 7px 0 0;
}

/* Panels */
main { padding-block: 26px 64px; }
.view[hidden] { display: none; }
.view { display: grid; gap: 18px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head h2 { font-family: var(--f-display); font-weight: 800; font-size: 2rem; line-height: 1; margin: 0; text-transform: uppercase; letter-spacing: .01em; }
.section-head p { margin: 4px 0 0; color: var(--muted); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--muted); font-family: var(--f-mono); font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 7px 12px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--action); color: var(--action-ink); }

.notice { border-radius: var(--r); padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: .95rem; }
.notice.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.notice.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }

/* Posts */
.feed { display: grid; gap: 14px; }
.post { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: grid; gap: 10px; min-width: 0; }
.post.example { border-style: dashed; opacity: .78; }
.post-head { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; font-size: .85rem; color: var(--muted); }
.module {
  font-family: var(--f-mono); font-size: .74rem; font-weight: 700; letter-spacing: .04em;
  background: var(--pcb); color: var(--silk); padding: 3px 8px; border-radius: 3px; font-variant-numeric: tabular-nums;
  border-bottom: 3px solid var(--gold);
}
.rank { font-family: var(--f-mono); font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.who { font-weight: 700; color: var(--ink); }
.post-head time { margin-left: auto; font-family: var(--f-mono); font-size: .74rem; }
.post-text { margin: 0; font-size: 1.08rem; overflow-wrap: anywhere; white-space: pre-wrap; }
.post-img { border-radius: 4px; border: 1px solid var(--line); max-width: 100%; max-height: 520px; width: auto; justify-self: start; background: var(--bg); }
.post-img.missing { width: 100%; height: 120px; display: grid; place-items: center; color: var(--muted); font-size: .85rem; }
.post-foot { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.vote {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  border-radius: var(--r); padding: 6px 12px; font: 700 .85rem var(--f-body);
}
.vote b { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.vote[aria-pressed="true"] { background: var(--action); color: var(--action-ink); border-color: var(--action); }
.vote:disabled { cursor: default; opacity: .6; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  border: 1px solid var(--action); background: var(--action); color: var(--action-ink);
  border-radius: var(--r); padding: 10px 18px; font: 700 .95rem var(--f-body);
}
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.danger { background: transparent; color: var(--warn); border-color: currentColor; }
.btn.small { padding: 6px 12px; font-size: .82rem; }
.btn:disabled { opacity: .55; cursor: default; }
.spacer { flex: 1; }
.more { justify-self: center; margin-top: 6px; }

.empty { text-align: left; padding: 22px; border: 1px dashed var(--line); border-radius: var(--r); display: grid; gap: 8px; }
.empty h3 { font-family: var(--f-display); font-weight: 800; font-size: 1.5rem; text-transform: uppercase; margin: 0; }
.empty p { margin: 0; color: var(--muted); }

/* Form */
form { display: grid; gap: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label, .field .lbl { font-family: var(--f-mono); font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
input[type="text"], input[type="number"], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px;
}
textarea { resize: vertical; min-height: 96px; }
.counter { font-family: var(--f-mono); font-size: .78rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.counter.over { color: var(--warn); font-weight: 700; }
.hint { font-size: .85rem; color: var(--muted); margin: 0; }
.drop {
  border: 1px dashed var(--line); border-radius: var(--r); padding: 14px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  background: var(--bg);
}
.drop img { max-height: 120px; max-width: 100%; border-radius: 4px; }
.drop input { max-width: 100%; }

/* Scoreboard */
.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.board li {
  display: grid; grid-template-columns: 3.2rem minmax(0, 1fr) auto; align-items: center; gap: 4px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px;
}
.board li.podium { border-left: 4px solid var(--gold); }
.board .pos { font-family: var(--f-display); font-weight: 900; font-size: 2.2rem; line-height: 1; font-variant-numeric: tabular-nums; color: var(--muted); }
.board li.podium .pos { color: var(--gold); }
.board .entry { min-width: 0; display: grid; gap: 4px; }
.board .entry a { font-weight: 700; text-decoration: none; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.board .entry a:hover { text-decoration: underline; }
.board .sub { display: flex; gap: 6px 10px; flex-wrap: wrap; align-items: center; font-size: .82rem; color: var(--muted); }
.board .score { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.board .score b { display: block; font-size: 1.4rem; color: var(--ink); }
.board .score span { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* Single post page */
.back { font-family: var(--f-mono); font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; color: var(--muted); justify-self: start; }
.back:hover { color: var(--ink); }
.solo { padding: 20px; gap: 14px; }
.solo .post-text { font-size: clamp(1.25rem, 3.6vw, 1.6rem); line-height: 1.4; font-weight: 700; }
.solo .vote { padding: 12px 20px; font-size: 1.05rem; }
.solo .vote b { font-size: 1.1rem; }
.ranks { display: flex; gap: 8px; flex-wrap: wrap; }
.rank-chip { font-family: var(--f-mono); font-size: .74rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 4px 9px; border-radius: 99px; background: var(--ok-bg); color: var(--ok); }
.share { display: grid; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.share h3 { margin: 0; font-family: var(--f-display); font-weight: 800; font-size: 1.3rem; text-transform: uppercase; }
.share code { font-family: var(--f-mono); font-size: .8rem; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; overflow-wrap: anywhere; user-select: all; display: block; }
.permalink { font-family: var(--f-mono); font-size: .76rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); text-decoration: none; }
.permalink:hover { color: var(--ink); text-decoration: underline; }

/* Mod queue */
.mod-item { border-left: 4px solid var(--gold); }
.mod-meta { font-family: var(--f-mono); font-size: .74rem; color: var(--muted); }

/* Card generator */
.card-wrap { display: grid; gap: 16px; }
.card-preview { width: 100%; max-width: 100%; height: auto; border-radius: var(--r); border: 1px solid var(--line); display: block; }

footer { color: var(--muted); font-size: .85rem; padding-block: 0 40px; }
footer p { margin: 0 0 6px; max-width: 65ch; }

@media (prefers-reduced-motion: no-preference) {
  .label .v { transition: color .3s; }
  .post { animation: rise .25s ease-out both; }
  @keyframes rise { from { transform: translateY(4px); } to { transform: none; } }
}

/* Hosted-site additions */
.loading-more { justify-self: center; color: var(--muted); font-size: .9rem; }
.cf-turnstile { min-height: 65px; }
footer p + p { font-size: .8rem; }
