/* The High-Craft app (highcraft.overthrive.com). Colors and type follow the site's DESIGN.md (Paul, 2026-12-03:
   "Follow the site's DESIGN.md"); the High-Craft bronze appears only in the SAVE badge and the wordmark's hyphen, as in
   the post graphics. */
:root {
  --red: #A30B12; --red-hot: #8C0910; --red-on-black: #EF1C24;
  --ink: #141417; --text: #34373D; --muted: #596069; --black: #030507; --carbon: #151719;
  --line: rgba(20,20,23,.11); --line-strong: rgba(20,20,23,.18); --alt: #F5F5F6;
  --bronze: #AA8053; --bronze-deep: #8A6540; --chalk: #F3F1EB;
  --pad: clamp(16px, 4vw, 32px); --col: 1120px; --top: 64px; --tabs: 0px;
  --shadow: 0 1px 2px rgba(20,20,23,.04), 0 12px 32px rgba(20,20,23,.05);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: #fff; color: var(--text); font: 400 16px/1.7 'Inter', system-ui, sans-serif; -webkit-font-smoothing: antialiased; min-height: 100vh; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.in { width: min(var(--col), calc(100% - 2 * var(--pad))); margin: 0 auto; }

/* ── App bar ─────────────────────────────────────────── */
.top { position: sticky; top: 0; z-index: 20; background: var(--black); color: #fff; padding-top: env(safe-area-inset-top); }
.top .in { display: flex; align-items: center; justify-content: space-between; height: var(--top); }
.mark { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; font: 700 15px/1 'Inter', sans-serif; letter-spacing: .3em; color: #fff; }
.mark i { font-style: normal; color: var(--bronze); }
.nav { display: flex; gap: 8px; }
.nav a { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; text-decoration: none; font: 600 13px/1 'Inter', sans-serif; letter-spacing: .14em; text-transform: uppercase; color: #B9BCC2; }
.nav a:hover { color: #fff; }
.nav a[aria-current="page"] { color: #fff; }
.nav a[aria-current="page"]::after { content: ''; position: absolute; left: 14px; right: 14px; bottom: 6px; height: 2px; background: var(--red-on-black); }
.n { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--bronze); color: #fff; font: 700 12px/1 'Inter', sans-serif; letter-spacing: 0; }
.n:empty { display: none; }

/* Phone tab bar */
.tabs { display: none; }
@media (max-width: 760px) {
  :root { --top: 56px; --tabs: 64px; }
  .top .in { justify-content: center; }
  .nav { display: none; }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(3, 1fr);
    background: var(--black); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid #1F2226;
  }
  .tabs a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; height: var(--tabs); text-decoration: none; color: #8E939A; font: 600 13px/1 'Inter', sans-serif; letter-spacing: .04em; }
  .tabs a[aria-current="page"] { color: #fff; }
  .tabs a[aria-current="page"]::before { content: ''; position: absolute; top: 0; left: 30%; right: 30%; height: 2px; background: var(--red-on-black); }
  .tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .tabs .n { position: absolute; top: 7px; left: calc(50% + 6px); min-width: 20px; height: 20px; font-size: 11.5px; }
}

main { padding: clamp(24px, 4vw, 48px) 0 calc(var(--tabs) + env(safe-area-inset-bottom) + clamp(56px, 7vw, 96px)); }

/* ── SAVE badge: one mark everywhere, a bronze bookmark hanging from the top edge ── */
.save {
  position: absolute; top: 0; right: 18px; z-index: 2; width: 52px; height: 68px; padding: 0; background: none; border: 0; cursor: pointer;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.35)); transition: transform .15s ease;
}
.save:hover { transform: translateY(2px); }
.save svg { display: block; width: 100%; height: 100%; }
.save .rib { fill: var(--bronze); }
.save[aria-pressed="true"] .rib { fill: var(--bronze-deep); }
.save .t { fill: #fff; font: 700 11.5px 'Inter', sans-serif; letter-spacing: .12em; }
.save .ck { fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.save.lg { width: 68px; height: 89px; right: 24px; }
.save:focus-visible { outline-offset: 0; }

/* ── Library ─────────────────────────────────────────── */
.regions { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.reg {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 124px; padding: 20px;
  background: #fff; border: 1px solid var(--line); border-top: 2px solid transparent; cursor: pointer; text-align: center; color: var(--ink); box-shadow: var(--shadow);
}
.reg:hover { border-color: var(--line-strong); }
.reg[aria-pressed="true"] { background: var(--black); border-color: var(--black); border-top-color: var(--red-on-black); color: #fff; }
.reg-n { font: 400 clamp(40px, 4vw, 52px)/1 'Forum', Georgia, serif; }
.reg-name { font: 600 13px/1.3 'Inter', sans-serif; letter-spacing: .16em; text-transform: uppercase; }
.reg[aria-pressed="true"] .reg-name { color: #E7E4E0; }

.filters { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.inp {
  display: block; width: 100%; height: 52px; background: #fff; color: var(--ink); border: 1px solid rgba(20,20,23,.2); border-radius: 0;
  font: 400 16px/1.5 'Inter', sans-serif; padding: 0 15px;
}
.inp:focus { outline: none; border-color: var(--ink); }
.search { position: relative; }
.search .inp { padding-left: 46px; }
.search svg { position: absolute; left: 15px; top: 15px; width: 22px; height: 22px; stroke: var(--muted); fill: none; stroke-width: 1.8; stroke-linecap: round; pointer-events: none; }
select.inp {
  appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer; text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, #596069 50%), linear-gradient(135deg, #596069 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat;
}

.bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 44px 0 24px; min-height: 44px; }
.count { font: 400 clamp(26px, 2.6vw, 32px)/1.1 'Forum', Georgia, serif; text-transform: uppercase; letter-spacing: .03em; color: var(--ink); }
.count b { font-weight: 400; color: var(--red); }
.link {
  min-height: 44px; padding: 0 4px; background: none; border: 0; cursor: pointer;
  font: 600 13px/1 'Inter', sans-serif; letter-spacing: .14em; text-transform: uppercase; color: var(--ink);
  text-decoration: underline; text-underline-offset: 5px; text-decoration-color: var(--red);
}
.link:hover { color: var(--red); }

/* Cards: three across, two, then one. Every row fills (app.js): a leftover one runs the full row, a leftover two split it. */
.grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 24px; list-style: none; }
.grid > .card { grid-column: span 2; }
.grid > .card.h3 { grid-column: span 3; }
.grid > .card.f3 { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.f3 .body { justify-content: center; padding: clamp(32px, 4vw, 56px); }
.f3 .title { font-size: clamp(28px, 2.8vw, 38px); }
.card { position: relative; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); }
.pic { position: relative; display: block; aspect-ratio: 1 / 1; background: var(--carbon); overflow: hidden; }
.pic img { width: 100%; height: 100%; object-fit: cover; }
.body { display: flex; flex-direction: column; flex: 1; padding: 26px 28px 28px; text-decoration: none; }
.series { font: 600 13px/1.4 'Inter', sans-serif; letter-spacing: .16em; text-transform: uppercase; color: var(--red); }
.title { margin-top: 12px; font: 400 24px/1.18 'Forum', Georgia, serif; text-transform: uppercase; letter-spacing: .04em; color: var(--ink); text-wrap: balance; }
a.body:hover .title { color: var(--red); }
.rule { width: 28px; height: 2px; background: var(--red); margin: 18px 0 16px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font: 500 14px/1.5 'Inter', sans-serif; color: var(--muted); }
.new { padding: 3px 8px; background: var(--red); color: #fff; font: 700 12px/1.2 'Inter', sans-serif; letter-spacing: .12em; text-transform: uppercase; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin-top: 14px; }
.tags li { padding: 5px 10px; border: 1px solid var(--line-strong); font: 500 13px/1.3 'Inter', sans-serif; color: var(--ink); white-space: nowrap; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 72px 24px; text-align: center; border: 1px solid var(--line); background: var(--alt); }
.empty p { font: 400 26px/1.2 'Forum', Georgia, serif; text-transform: uppercase; letter-spacing: .03em; color: var(--ink); }
.empty svg { width: 44px; height: 58px; }
.empty .rib { fill: none; stroke: var(--bronze); stroke-width: 2.5; }

.groups { margin-top: clamp(64px, 8vw, 112px); padding-top: clamp(40px, 5vw, 64px); border-top: 1px solid var(--line); }
.h2 { font: 400 clamp(26px, 3vw, 36px)/1.1 'Forum', Georgia, serif; text-transform: uppercase; letter-spacing: .03em; color: var(--ink); }
.group-list { display: grid; gap: 16px; margin-top: 24px; }
.group { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px 40px; padding: 26px 28px; border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); }
.group-k { font: 600 13px/1.4 'Inter', sans-serif; letter-spacing: .16em; text-transform: uppercase; color: var(--red); }
.group-n { margin-top: 8px; font: 400 24px/1.15 'Forum', Georgia, serif; text-transform: uppercase; letter-spacing: .04em; color: var(--ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 54px; padding: 0 30px;
  background: var(--red); border: 1px solid var(--red); border-radius: 2px; color: #fff; text-decoration: none; cursor: pointer;
  font: 600 14px/1.2 'Inter', sans-serif; letter-spacing: .14em; text-transform: uppercase;
}
.btn:hover { background: var(--red-hot); border-color: var(--red-hot); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { border-color: var(--ink); background: #fff; }
.btn.wide { width: 100%; }
.group .btn { min-width: 240px; }

/* ── Post ────────────────────────────────────────────── */
.back { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: -6px 0 18px -10px; color: var(--ink); }
.back svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.post { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); align-items: start; }
.post .pic { box-shadow: var(--shadow); position: sticky; top: calc(var(--top) + 24px); }
.post .post-text { align-self: center; }
.post .title { margin-top: 14px; font-size: clamp(30px, 3.4vw, 46px); }
.post .rule { width: 48px; margin: 24px 0 18px; }
.post-text { display: flex; flex-direction: column; }
.post-body { margin-top: 24px; color: var(--text); font-size: 17px; }
.post-body p + p { margin-top: 14px; }
.post-body ul { margin: 10px 0 0 20px; }
.srcs { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 18px; }
.srcs h2 { font: 600 13px/1.4 'Inter', sans-serif; letter-spacing: .16em; text-transform: uppercase; color: var(--ink); }
.srcs ul { list-style: none; margin-top: 8px; }
.srcs li { padding: 6px 0; font-size: 15px; line-height: 1.5; }
.srcs a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; overflow-wrap: anywhere; }
.srcs a:hover { color: var(--red); text-decoration-color: var(--red); }
.post-acts { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.post-acts .btn { flex: 1 1 220px; }

/* ── Account ─────────────────────────────────────────── */
.acct { width: min(560px, 100%); margin: 0 auto; }
.panel { border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow); padding: clamp(26px, 4vw, 40px); }
.panel + .panel { margin-top: 20px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 52px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.k { font: 600 13px/1.4 'Inter', sans-serif; letter-spacing: .14em; text-transform: uppercase; color: #4A4F57; }
.v { font: 500 15px/1.4 'Inter', sans-serif; color: var(--ink); overflow-wrap: anywhere; text-align: right; }
.lbl { display: block; margin: 22px 0 8px; font: 600 13px/1.4 'Inter', sans-serif; letter-spacing: .14em; text-transform: uppercase; color: #4A4F57; }
.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.chip {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 14px; text-align: left; cursor: pointer;
  background: #fff; border: 1px solid var(--line-strong); font: 500 14px/1.3 'Inter', sans-serif; color: var(--ink);
}
.chip b { font-weight: 700; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--black); border-color: var(--black); color: #fff; }
.chip[aria-pressed="true"] b { color: var(--red-on-black); }
.foot { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 24px; margin-top: 32px; font: 500 13px/1.6 'Inter', sans-serif; color: var(--muted); }
.foot a { color: var(--muted); text-underline-offset: 3px; }

/* ── Sign-in ─────────────────────────────────────────── */
.sign { display: flex; flex-direction: column; align-items: center; text-align: center; }
.sign .ico { width: 46px; height: 60px; }
.sign .ico .rib { fill: var(--bronze); }
.sign h2 { margin-top: 18px; font: 400 32px/1.1 'Forum', Georgia, serif; text-transform: uppercase; letter-spacing: .04em; color: var(--ink); }
.sign form { width: 100%; margin-top: 22px; text-align: left; }
.sign .inp { height: 56px; font-size: 17px; }
.sign .code { text-align: center; font: 600 26px/1 'Inter', sans-serif; letter-spacing: .4em; padding-left: calc(15px + .4em); }
.sign .btn { width: 100%; margin-top: 14px; }
.sent { margin-top: 10px; font: 500 14px/1.5 'Inter', sans-serif; color: var(--muted); text-align: center; overflow-wrap: anywhere; }
.err { margin-top: 12px; font: 600 14px/1.5 'Inter', sans-serif; color: var(--red); text-align: center; }
.alt { display: flex; justify-content: center; gap: 24px; margin-top: 10px; }

dialog.sheet {
  width: min(460px, calc(100% - 2 * var(--pad))); max-width: none; margin: auto; padding: clamp(28px, 4vw, 40px);
  border: 0; background: #fff; box-shadow: 0 30px 80px rgba(3,5,7,.35);
}
dialog.sheet::backdrop { background: rgba(3,5,7,.6); }
.x { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: none; border: 0; cursor: pointer; color: var(--muted); }
.x svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
@media (max-width: 760px) {
  dialog.sheet { width: 100%; margin: auto 0 0; padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
}

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs) + env(safe-area-inset-bottom) + 20px); z-index: 30; transform: translate(-50%, 12px);
  padding: 12px 22px; background: var(--black); color: #fff; font: 600 14px/1.2 'Inter', sans-serif; letter-spacing: .06em;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; white-space: nowrap;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1100px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid > .card, .grid > .card.h3 { grid-column: span 1; }
  .grid > .card.f3 { grid-column: span 1; display: flex; }
  .f3 .body { justify-content: flex-start; padding: 26px 28px 28px; }
  .f3 .title { font-size: 24px; }
  .grid > .card.f2 { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .f2 .body { justify-content: center; padding: clamp(32px, 4vw, 56px); }
  .f2 .title { font-size: clamp(28px, 2.8vw, 38px); }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters .search { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .post { grid-template-columns: minmax(0, 1fr); }
  .post .pic { position: relative; top: 0; }
  .back { margin-bottom: 8px; }
}
@media (max-width: 640px) {
  .regions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .regions[data-n="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .reg { min-height: 100px; padding: 14px 6px; gap: 8px; }
  .reg-name { letter-spacing: .08em; }
  .filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .filters .wide { grid-column: 1 / -1; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .grid > .card.f2 { grid-column: span 1; display: flex; }
  .f2 .body { justify-content: flex-start; padding: 22px 22px 24px; }
  .f2 .title { font-size: 24px; }
  .body { padding: 22px 22px 24px; }
  .bar { margin-top: 32px; }
  .group { padding: 24px 22px; }
  .group .btn { flex: 1 1 100%; min-width: 0; }
  .chips { grid-template-columns: minmax(0, 1fr); }
}
