/* Styles for the scrolling pages: Official Editions archive and the admin page. */
:root {
  --ink: #12161a;
  --ink-soft: #58616b;
  --paper: #f5f5f2;
  --card: #ffffff;
  --line: #d9dcdf;
  --accent: #1f8f3a;
  --alien: #6ee05a;
  --danger: #b3261e;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 70px; }
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; background: var(--paper); line-height: 1.45; }
main { flex: 1; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: 52px; overflow: hidden;
  padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  background: var(--ink); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: inherit; text-decoration: none; font-weight: 800; font-size: 1.1rem; }
.brand img { display: block; flex: none; height: 22px; width: auto; }
.brand-name { padding-left: 12px; border-left: 1.5px solid rgb(255 255 255 / 0.35); white-space: nowrap; }
.nav-cta {
  flex: none; padding: 7px 14px; border: 0; border-radius: 999px;
  background: var(--alien); color: var(--ink); font-weight: 700; font-size: 0.9rem; text-decoration: none; white-space: nowrap;
}
.nav-cta:hover { filter: brightness(1.08); }

/* ---------- Shared pieces ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 6px 14px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 10px;
  color: var(--ink); font-weight: 650; font-size: 0.9rem; text-decoration: none; white-space: nowrap;
}
.button:hover { border-color: var(--ink-soft); }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button.primary:hover { filter: brightness(1.08); }
.button.danger { color: var(--danger); }
.button:disabled { opacity: 0.6; cursor: default; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 5px 14px; border-radius: 999px; border: 1.5px solid rgb(255 255 255 / 0.3);
  color: #fff; text-decoration: none; font-weight: 650; font-variant-numeric: tabular-nums;
}
.chip:hover { border-color: var(--alien); color: var(--alien); }
.empty { margin: 0; padding: 48px 16px; text-align: center; color: var(--ink-soft); }

.spec-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; font-size: 0.875rem; }
.spec-list li { display: flex; align-items: center; gap: 8px; }
.dot {
  flex: none; width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgb(0 0 0 / 0.3);
  background: repeating-linear-gradient(45deg, #e9ebed 0 4px, #cfd3d7 4px 8px);
}
.dot.filled { background-image: none; }
.spec-name { color: var(--ink-soft); }
.spec-value { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- Editions archive ---------- */
.hero {
  padding: clamp(36px, 7vw, 84px) max(20px, env(safe-area-inset-left)) clamp(28px, 5vw, 56px);
  background: radial-gradient(120% 140% at 15% 0%, #1d3a26 0%, var(--ink) 55%);
  color: #fff;
}
.hero > * { max-width: 1160px; margin-left: auto; margin-right: auto; }
.eyebrow { margin-top: 0; margin-bottom: 8px; color: var(--alien); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.8rem; }
.gallery-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 0; margin-bottom: 22px; }
.gallery-tabs a {
  padding: 8px 16px; border-radius: 999px; border: 1.5px solid rgb(255 255 255 / 0.3);
  color: #fff; font-weight: 700; font-size: 0.9rem; text-decoration: none; white-space: nowrap;
}
.gallery-tabs a:hover { border-color: var(--alien); }
.gallery-tabs a[aria-current="page"] { background: var(--alien); border-color: var(--alien); color: var(--ink); }
.hero h1 { margin-top: 0; margin-bottom: 12px; font-size: clamp(2.4rem, 7vw, 4.5rem); line-height: 1; letter-spacing: -0.02em; }
.hero-lede { margin-top: 0; margin-bottom: 0; color: #c9d1d6; font-size: clamp(1rem, 2vw, 1.2rem); max-width: 1160px; }
.hero .chips { margin-top: 24px; }

.editions { width: 100%; max-width: 1200px; margin: 0 auto; padding: 8px 20px 56px; }
.year { padding-top: 40px; }
.year-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; border-bottom: 2px solid var(--ink); }
.year-head h2 { margin: 0; font-size: clamp(2.6rem, 8vw, 4.5rem); line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.year-count { color: var(--ink-soft); font-weight: 600; }
.edition-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 22px; }
.edition-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.05);
  transition: transform 0.18s, box-shadow 0.18s;
}
.edition-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgb(0 0 0 / 0.12); }
.edition-figure, .row-figure {
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 42%, #eef0f1, #c6cace);
}
.edition-figure { aspect-ratio: 1 / 1; padding: 18px; }
.edition-figure img, .row-figure img {
  display: block; width: 100%; height: 100%; object-fit: contain;
  opacity: 0; transition: opacity 0.3s;
  filter: drop-shadow(0 10px 14px rgb(0 0 0 / 0.22));
}
.edition-figure img.ready, .row-figure img.ready { opacity: 1; }
.edition-body { display: flex; flex-direction: column; gap: 14px; padding: 18px; flex: 1; }
.edition-body h3 { margin: 0; font-size: 1.25rem; line-height: 1.2; overflow-wrap: anywhere; }
.byline { margin: -8px 0 0; color: var(--ink-soft); font-size: 0.9rem; }
.year:not([id]) { padding-top: 28px; }
.edition-body .button { margin-top: auto; }

.site-footer { padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); text-align: center; background: var(--ink); }
.site-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 28px; }
.site-footer a { color: var(--alien); font-weight: 700; }
.site-footer a.quiet { color: #c9d1d6; font-weight: 500; }

/* ---------- About page ---------- */
.story { width: 100%; max-width: 720px; margin: 0 auto; padding: clamp(28px, 6vw, 56px) 20px 64px; font-size: clamp(1.05rem, 2.2vw, 1.2rem); line-height: 1.65; }
.story p { margin: 0 0 1.2em; }
.story .signoff { font-size: 1.5em; font-weight: 800; letter-spacing: -0.01em; color: var(--accent); margin-top: 1.4em; }
.story .maker { margin-top: 1.6em; padding-top: 1.2em; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 0.95em; }
.story a { color: var(--accent); font-weight: 650; }
.story-actions a.button { color: var(--ink); }
.story-actions a.button.primary { color: #fff; }
.story-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.story-actions .button { min-height: 46px; padding: 8px 18px; font-size: 1rem; }
@media (max-width: 560px) { .story-actions .button { flex: 1 1 100%; } }

/* ---------- Admin ---------- */
.admin-main { width: 100%; max-width: 980px; margin: 0 auto; padding: 24px 16px 64px; }
.login-card {
  display: grid; gap: 10px; max-width: 380px; margin: 8vh auto 0; padding: 28px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.login-card h1 { margin: 0 0 6px; font-size: 1.4rem; }
.login-card p { margin: 0; color: var(--ink-soft); }
.login-card label { font-weight: 650; font-size: 0.9rem; }
.login-card input {
  width: 100%; min-height: 46px; padding: 8px 12px; font-size: 1rem;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 10px;
}
.login-card .button { min-height: 46px; margin-top: 6px; }
.form-status { margin: 0; min-height: 1.4em; color: var(--ink-soft); font-size: 0.9rem; }

.warnings { display: grid; gap: 8px; margin-bottom: 16px; }
.warning { margin: 0; padding: 10px 14px; background: #fff3cd; border: 1px solid #e6c65c; border-radius: 10px; font-size: 0.9rem; }
.tabs { display: flex; gap: 4px; padding: 4px; background: #e7e9eb; border-radius: 12px; }
.tabs button { flex: 1; min-height: 42px; border: 0; border-radius: 9px; background: transparent; font-weight: 650; }
.tabs button[aria-selected="true"] { background: var(--card); box-shadow: 0 1px 3px rgb(0 0 0 / 0.2); }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0; }
.panel-head p { margin: 0; color: var(--ink-soft); max-width: 46ch; }
.panel-actions, .row-actions, .pager { display: flex; flex-wrap: wrap; gap: 8px; }
.year-title { margin: 26px 0 10px; font-size: 1.6rem; border-bottom: 2px solid var(--ink); }
.row {
  display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; margin-bottom: 12px; padding: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
}
.row-figure { aspect-ratio: 1 / 1; padding: 8px; border-radius: 10px; align-self: start; }
.row-body { display: grid; gap: 8px; min-width: 0; align-content: start; }
.row-body h3 { margin: 0; font-size: 1.1rem; }
.row-body .spec-list { max-width: 340px; }
.who, .meta { margin: 0; overflow-wrap: anywhere; }
.who a { color: var(--accent); }
.meta { color: var(--ink-soft); font-size: 0.85rem; }
.showcase { margin: 0; font-size: 0.85rem; color: var(--ink-soft); }
.showcase.live { color: var(--accent); font-weight: 700; }
.pager { margin-top: 12px; }

@media (max-width: 560px) {
  .site-header { gap: 16px; padding-left: 12px; padding-right: 12px; }
  .brand-name { padding-left: 8px; font-size: 1rem; }
  .brand { gap: 8px; }
  .brand img { height: 18px; }
  .wide-only { display: none; }
  .nav-cta { padding: 7px 16px; }
  .hero { padding-left: 16px; padding-right: 16px; }
  .gallery-tabs { gap: 6px; }
  .gallery-tabs a { flex: 1 1 auto; padding: 9px 10px; font-size: 0.85rem; text-align: center; }
  .editions { padding-left: 14px; padding-right: 14px; }
  .year-head { flex-wrap: wrap; gap: 4px 12px; }
  .row-actions .button, .panel-actions .button { flex: 1 1 auto; }
  .lines { grid-template-columns: minmax(0, 1fr); }
  .line-label { width: 92px; }
  .row { grid-template-columns: 96px minmax(0, 1fr); gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Admin: editions, one pencil per detail ---------- */
.lines { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 2px 24px; }
.line {
  display: flex; align-items: center; gap: 8px; min-height: 40px; min-width: 0;
  border-bottom: 1px solid #eceeef; font-size: 0.9rem;
}
.line.wide { grid-column: 1 / -1; }
.line.title { border-bottom: 0; font-size: 1.15rem; }
.line.title .line-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.line-label { flex: none; width: 104px; color: var(--ink-soft); }
.line-value { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-width: 0; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.line .icon-button {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
  background: transparent; border: 1.5px solid transparent; border-radius: 8px; color: var(--ink-soft);
}
.line .icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.line .pencil { margin-left: auto; }
.line .pencil:hover { background: #eef0f1; color: var(--ink); }
.line .ok { background: var(--accent); border-color: var(--accent); color: #fff; }
.line .ok:hover { filter: brightness(1.08); }
.line .cancel { border-color: var(--line); }
.line.editing { flex-wrap: wrap; padding: 4px 0; }
.line.editing input, .line.editing select {
  flex: 1 1 90px; min-width: 0; min-height: 38px; padding: 5px 10px; font-size: 1rem;
  background: var(--card); border: 1.5px solid var(--accent); border-radius: 9px; font-variant-numeric: tabular-nums;
}
.line.editing input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 2px var(--danger); }
.line-error { flex: 1 1 100%; color: var(--danger); font-size: 0.85rem; }
.line-error:empty { display: none; }
.state { padding: 2px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 800; }
.state.on { background: var(--accent); color: #fff; }
.state.off { background: var(--ink); color: #fff; }
.muted { color: var(--ink-soft); font-weight: 400; }
.buy-url { color: var(--accent); font-weight: 600; }
.line .dot { width: 18px; height: 18px; border-radius: 5px; }

/* ---------- Community: sort + thumbs up ---------- */
.sort { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.sort-label { color: var(--ink-soft); font-size: 0.9rem; font-weight: 600; margin-right: 2px; }
.sort button {
  min-height: 40px; padding: 6px 16px; border-radius: 999px;
  background: var(--card); border: 1.5px solid var(--line); font-weight: 650; font-size: 0.9rem;
}
.sort button:hover { border-color: var(--ink-soft); }
.sort button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.gallery-note { margin: 0 0 10px; min-height: 1.3em; color: var(--danger); font-size: 0.9rem; }
.edition-body { position: relative; }
.edition-body h3 { padding-right: 84px; }
.like {
  position: absolute; top: 14px; right: 14px;
  display: inline-flex; align-items: center; gap: 6px;
  min-width: 64px; min-height: 40px; padding: 6px 12px; justify-content: center;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 999px;
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.like svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.like:hover { border-color: var(--accent); color: var(--accent); }
.like[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.like[aria-pressed="true"] svg { fill: rgb(255 255 255 / 0.25); }
.like:active { transform: scale(0.94); }

/* ---------- Official editions: availability ---------- */
.edition-figure { position: relative; }
.stamp {
  position: absolute; top: 12px; left: 12px; padding: 5px 12px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  background: var(--ink); color: #fff; box-shadow: 0 2px 8px rgb(0 0 0 / 0.2);
}
.stamp.available { background: var(--alien); color: var(--ink); }
.stamp.retired { background: var(--ink); color: var(--alien); }
.edition-body .buy { margin-top: auto; min-height: 46px; font-size: 1rem; }
.edition-body .buy + .button { margin-top: 0; }
.gone { margin: auto 0 0; padding: 10px 12px; border-radius: 10px; background: #eef0f1; color: var(--ink-soft); font-size: 0.875rem; font-style: italic; }
.gone + .button { margin-top: 0; }

/* ---------- Admin: visit counts and new-submission badge ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { display: grid; gap: 2px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.stat-label { color: var(--ink-soft); font-size: 0.85rem; font-weight: 600; }
.stat-number { font-size: 2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--ink-soft); font-size: 0.8rem; }
.badge {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; margin-left: 8px; padding: 0 6px;
  border-radius: 999px; background: #d92d20; color: #fff; font-size: 0.78rem; font-weight: 800; vertical-align: middle;
}
.new-tag { margin-left: 8px; padding: 2px 8px; border-radius: 999px; background: #d92d20; color: #fff; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; vertical-align: middle; }
