/* ============================================================
   KINWEL · Review — design system
   Dark-first, light-capable. No external assets.
   ============================================================ */

:root {
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, -apple-system, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  /* Dark palette (default) */
  --bg: #0d0e10;
  --bg-soft: #121316;
  --surface: #17181c;
  --surface-2: #1d1f24;
  --hairline: rgba(255, 255, 255, 0.08);
  --hairline-strong: rgba(255, 255, 255, 0.16);
  --text: #e9e6df;
  --text-muted: #9b978d;
  --text-faint: #6a675f;
  --brass: #c9a96a;
  --brass-soft: rgba(201, 169, 106, 0.14);
  --chosen: #7fb78b;
  --chosen-soft: rgba(127, 183, 139, 0.14);
  --reject: #c2635b;
  --reject-soft: rgba(194, 99, 91, 0.13);
  --scrim: rgba(8, 9, 10, 0.78);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 32px -12px rgba(0,0,0,.55);
  --shadow-pop: 0 2px 6px rgba(0,0,0,.45), 0 24px 64px -16px rgba(0,0,0,.7);
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--brass);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f4f2ed;
  --bg-soft: #ece9e2;
  --surface: #fbfaf7;
  --surface-2: #f1eee7;
  --hairline: rgba(28, 25, 18, 0.10);
  --hairline-strong: rgba(28, 25, 18, 0.22);
  --text: #201d17;
  --text-muted: #6d685d;
  --text-faint: #a19b8d;
  --brass: #9a7838;
  --brass-soft: rgba(154, 120, 56, 0.12);
  --chosen: #3d7d4c;
  --chosen-soft: rgba(61, 125, 76, 0.12);
  --reject: #a8453d;
  --reject-soft: rgba(168, 69, 61, 0.10);
  --scrim: rgba(30, 27, 20, 0.55);
  --shadow: 0 1px 2px rgba(30,27,20,.08), 0 10px 28px -14px rgba(30,27,20,.25);
  --shadow-pop: 0 2px 6px rgba(30,27,20,.12), 0 24px 60px -18px rgba(30,27,20,.35);
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--brass);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
img, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus-ring); border-radius: 6px; }
::selection { background: var(--brass-soft); }

.wrap { max-width: 1480px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 40px); }

/* ---------- Header ---------- */
.site-header {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding: 26px 0 0;
}
.wordmark {
  font-family: var(--serif);
  font-size: 20px; letter-spacing: 0.42em; text-transform: uppercase;
  color: var(--text);
}
.wordmark .tag {
  font-family: var(--sans); font-size: 11px; letter-spacing: 0.24em;
  color: var(--brass); margin-left: 14px; vertical-align: 2px;
}
.header-actions { display: flex; gap: 6px; align-items: center; }
.ghost-btn {
  font-size: 12.5px; color: var(--text-muted);
  padding: 7px 12px; border-radius: 8px; border: 1px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
}
.ghost-btn:hover { color: var(--text); border-color: var(--hairline); background: var(--surface); }

/* ---------- Hero: the five numerals ---------- */
.hero { padding: clamp(36px, 7vh, 84px) 0 clamp(28px, 5vh, 64px); text-align: center; }
.hero-kicker {
  font-size: 11px; letter-spacing: 0.34em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: clamp(14px, 3vh, 30px);
}
.numerals { display: flex; justify-content: center; gap: clamp(10px, 4vw, 56px); flex-wrap: wrap; }
.numeral {
  font-family: var(--serif);
  font-size: clamp(64px, 11vw, 148px);
  line-height: 1; font-weight: 400;
  color: var(--text);
  padding: 0.06em 0.22em 0.14em;
  border-radius: 12px;
  position: relative;
  transition: color .18s ease, transform .3s cubic-bezier(.2,.9,.25,1.2);
}
.numeral::after {
  content: ""; position: absolute; left: 18%; right: 18%; bottom: 0.02em;
  height: 2px; background: var(--brass);
  transform: scaleX(0); transform-origin: center;
  transition: transform .25s ease;
}
.numeral:hover, .numeral:focus-visible { color: var(--brass); transform: translateY(-4px); }
.numeral:hover::after, .numeral:focus-visible::after { transform: scaleX(1); }
.hero-note { margin-top: clamp(12px, 2.5vh, 24px); font-size: 12.5px; color: var(--text-faint); letter-spacing: 0.06em; }

/* ---------- Featured designs (pinned strip) ---------- */
.featured-designs { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; padding: 0 0 clamp(28px, 5vh, 56px); }
.featured-tile { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 150px; }
.featured-media {
  width: 150px; height: 150px; border-radius: 12px; overflow: hidden;
  background: var(--bg-soft); border: 1px solid var(--hairline); box-shadow: var(--shadow);
  transition: border-color .15s, transform .18s;
}
.featured-media img { width: 100%; height: 100%; object-fit: cover; }
.featured-media .missing { display: grid; place-items: center; height: 100%; color: var(--text-faint); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.featured-tile:hover .featured-media { border-color: var(--brass); transform: translateY(-2px); }
.featured-label { font-family: var(--serif); font-size: 13px; letter-spacing: .05em; color: var(--text-muted); text-align: center; }
.featured-tile:hover .featured-label { color: var(--brass); }

/* ---------- Toolbar ---------- */
.toolbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  padding: 10px 0;
}
.toolbar-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.seg { display: inline-flex; border: 1px solid var(--hairline); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button {
  font-size: 12.5px; padding: 6px 13px; color: var(--text-muted);
  border-right: 1px solid var(--hairline);
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); font-weight: 600; }
.seg button .count { color: var(--text-faint); font-size: 11px; margin-left: 5px; font-variant-numeric: tabular-nums; }
.seg button[aria-pressed="true"] .count { color: var(--brass); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font-size: 12px; letter-spacing: 0.03em; padding: 5px 12px;
  border: 1px solid var(--hairline); border-radius: 999px; color: var(--text-muted);
  transition: all .15s; text-transform: capitalize;
}
.chip:hover { color: var(--text); border-color: var(--hairline-strong); }
.chip[aria-pressed="true"] { background: var(--brass-soft); border-color: var(--brass); color: var(--brass); }

.toolbar-spacer { flex: 1; }
.result-count { font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.kbd-hint { font-size: 12px; color: var(--text-faint); }
.kbd-hint kbd, .help-table kbd {
  font-family: var(--mono); font-size: 11px;
  border: 1px solid var(--hairline-strong); border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 5px; color: var(--text-muted);
  background: var(--surface);
}

/* ---------- Sectioned gallery ---------- */
.gallery-groups { display: flex; flex-direction: column; gap: clamp(36px, 6vh, 60px); padding: 22px 0 80px; }
.design-group { scroll-margin-top: 70px; }
.group-header {
  font-family: var(--serif); font-weight: 400; font-size: clamp(20px, 2.6vw, 26px);
  letter-spacing: .03em; color: var(--text);
  margin: 0 0 16px; padding-bottom: 10px; border-bottom: 1px solid var(--hairline-strong);
}
.new-group .group-header { color: var(--brass); }
.subgroup + .subgroup { margin-top: 26px; }
.subgroup-header {
  font-size: 11.5px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--text-faint); margin: 0 0 12px;
}
.empty-state {
  text-align: center; padding: 90px 20px; color: var(--text-faint);
  font-family: var(--serif); font-size: 18px; letter-spacing: 0.04em;
}

/* ---------- Grid (used inside each subgroup) ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr));
  gap: 14px;
}

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform .22s cubic-bezier(.2,.8,.3,1), box-shadow .22s, border-color .22s, opacity .25s;
  position: relative;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-pop); border-color: var(--hairline-strong); }
.card.is-selected { border-color: var(--brass); box-shadow: 0 0 0 1px var(--brass), var(--shadow-pop); }

.card .media {
  position: relative; aspect-ratio: 1 / 1; background: var(--bg-soft);
  cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  overflow: hidden;
}
.card .media img, .card .media video { width: 100%; height: 100%; object-fit: cover; }
.card .media .missing {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--text-faint); font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
}

.badge-id {
  position: absolute; top: 10px; left: 10px; z-index: 3;
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em;
  padding: 3px 8px; border-radius: 6px;
  background: var(--scrim); color: #efece4;
  backdrop-filter: blur(4px);
}
:root[data-theme="light"] .badge-id { color: #fbfaf7; }

.badge-video {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--scrim); color: #efece4;
  display: grid; place-items: center;
  backdrop-filter: blur(4px);
}
.badge-video svg { width: 11px; height: 11px; margin-left: 1px; }
.badge-video.quick-play { cursor: pointer; z-index: 4; transition: transform .12s, background .15s; }
.badge-video.quick-play:hover { background: var(--brass); color: #16120a; }
.badge-video.quick-play:active { transform: scale(.92); }

.badge-new {
  position: absolute; bottom: 10px; left: 10px; z-index: 3;
  font-size: 10px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  padding: 4px 8px; border-radius: 5px;
  background: var(--brass); color: #16120a;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.media img.hidden-for-inline { display: none; }
.inline-video {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%; object-fit: cover; background: #000;
}

/* Status treatments */
.card[data-status="rejected"] { opacity: 0.55; }
.card[data-status="rejected"] .media img,
.card[data-status="rejected"] .media video { filter: grayscale(.9) brightness(.72); }
.card[data-status="rejected"]:hover { opacity: 0.8; }

.stamp {
  position: absolute; inset: 0; z-index: 2; display: none;
  place-items: center; pointer-events: none;
}
.stamp span {
  font-family: var(--serif); font-size: 13px; letter-spacing: 0.3em; text-transform: uppercase;
  padding: 7px 16px 6px; border: 1px solid currentColor; border-radius: 3px;
  transform: rotate(-7deg); background: var(--scrim); backdrop-filter: blur(3px);
}
.card[data-status="rejected"] .stamp { display: grid; color: color-mix(in srgb, var(--reject) 80%, white 20%); }

.card[data-status="chosen"] { border-color: var(--chosen); }
.card[data-status="chosen"] .media::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  box-shadow: inset 0 0 0 3px var(--chosen);
  border-radius: 0;
}
.chosen-check {
  position: absolute; bottom: 10px; right: 10px; z-index: 3; display: none;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--chosen); color: #0d1a10;
  place-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.chosen-check svg { width: 13px; height: 13px; }
.card[data-status="chosen"] .chosen-check { display: grid; }

/* Card footer */
.card-foot {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 10px;
  border-top: 1px solid var(--hairline);
}
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
  color: var(--text-faint);
  transition: color .15s, background .15s, transform .1s;
  position: relative;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn:active { transform: scale(.9); }
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn.fav[aria-pressed="true"] { color: var(--brass); }
.icon-btn.note.has-note { color: var(--brass); }
.icon-btn.note.has-note::after {
  content: ""; position: absolute; top: 5px; right: 5px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--brass);
}

/* "M" move / "A" add-to-page dropdowns, before the star button */
.mini-select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  font-family: var(--sans); font-size: 10.5px; letter-spacing: .02em;
  color: var(--text-faint); background-color: var(--surface-2);
  border: 1px solid var(--hairline); border-radius: 6px;
  padding: 4px 16px 4px 6px; max-width: 62px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M1 2.5l3 3 3-3' fill='none' stroke='%236a675f' stroke-width='1.2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 5px center; background-size: 8px;
  cursor: pointer; transition: color .15s, border-color .15s;
}
.mini-select:hover { color: var(--text); border-color: var(--hairline-strong); }
.mini-select:focus-visible { outline: 2px solid var(--brass); outline-offset: 1px; }
.icon-btn.fav { margin-left: auto; } /* pushes fav/note/zoom to the right of the two selects */

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: none; place-items: center;
  background: var(--scrim);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: clamp(14px, 4vw, 48px);
}
.lightbox.open { display: grid; animation: fadeIn .18s ease; }
.lightbox-body { position: relative; max-width: min(1100px, 100%); max-height: 100%; display: grid; gap: 10px; }
.lightbox-media { border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-pop); background: #000; }
.lightbox-media img, .lightbox-media video { max-height: min(78dvh, 900px); max-width: 100%; width: auto; margin: 0 auto; }
.lightbox-bar {
  display: flex; align-items: center; gap: 10px;
  color: var(--text); font-size: 13px;
}
.lightbox-bar .badge-id { position: static; }
.lightbox-bar .spacer { flex: 1; }
.lightbox-close {
  position: absolute; top: -6px; right: -6px; transform: translate(50%, -50%);
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--hairline-strong);
  display: grid; place-items: center; color: var(--text-muted);
  box-shadow: var(--shadow);
}
.lightbox-close:hover { color: var(--text); }
@keyframes fadeIn { from { opacity: 0; } }

/* ---------- Note modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 110;
  display: none; place-items: center;
  background: var(--scrim); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  padding: 20px;
}
.modal.open { display: grid; animation: fadeIn .16s ease; }
.modal-card {
  width: min(520px, 100%);
  background: var(--surface); border: 1px solid var(--hairline-strong);
  border-radius: 14px; box-shadow: var(--shadow-pop);
  padding: 20px 22px 18px;
  animation: rise .2s cubic-bezier(.2,.9,.3,1.1);
}
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }
.modal-card h2 {
  margin: 0 0 4px; font-family: var(--serif); font-weight: 400;
  font-size: 17px; letter-spacing: .06em;
}
.modal-card .sub { font-size: 12px; color: var(--text-faint); margin-bottom: 14px; font-family: var(--mono); }
.modal-card textarea {
  width: 100%; min-height: 130px; resize: vertical;
  background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--hairline); border-radius: 9px;
  padding: 11px 13px; font: 14px/1.55 var(--sans);
}
.modal-card textarea:focus { border-color: var(--brass); box-shadow: none; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.btn {
  font-size: 13px; padding: 8px 16px; border-radius: 9px;
  border: 1px solid var(--hairline-strong); color: var(--text-muted);
  transition: all .15s;
}
.btn:hover { color: var(--text); border-color: var(--text-faint); }
.btn.primary { background: var(--brass); border-color: var(--brass); color: #16120a; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }

/* Help modal table */
.help-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.help-table td { padding: 6px 4px; border-bottom: 1px solid var(--hairline); color: var(--text-muted); }
.help-table td:first-child { width: 110px; }
.help-table tr:last-child td { border-bottom: 0; }

/* ---------- Toast ---------- */
.toasts {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 120; display: grid; gap: 8px; justify-items: center;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--hairline-strong);
  color: var(--text); font-size: 13px;
  padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-pop);
  animation: rise .18s ease;
}
.toast .t-id { font-family: var(--mono); font-size: 11.5px; color: var(--brass); }
.toast button { color: var(--brass); font-weight: 600; font-size: 13px; }
.toast button:hover { text-decoration: underline; }
.toast.leaving { opacity: 0; transition: opacity .25s; }

/* ============================================================
   Design landing pages (/1 … /5)
   ============================================================ */
.design-page {
  min-height: 100dvh; display: flex; flex-direction: column;
}
.design-page .site-header { align-items: center; }
.design-hero {
  flex: 1; display: grid; place-items: center; text-align: center;
  padding: 40px 20px 70px;
}
.design-hero .big-numeral {
  font-family: var(--serif);
  font-size: clamp(120px, 24vw, 300px);
  line-height: 0.95; color: var(--text);
  position: relative;
}
.design-hero .big-numeral::after {
  content: ""; display: block; margin: 18px auto 0;
  width: 64px; height: 2px; background: var(--brass);
}
.placeholder-dial {
  width: clamp(150px, 22vw, 230px); aspect-ratio: 1;
  margin: clamp(28px, 5vh, 48px) auto 0;
  border: 1.5px dashed var(--hairline-strong);
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--text-faint);
  font-size: 11px; letter-spacing: 0.28em; text-transform: uppercase;
  padding: 20px;
}
.design-hero-shot {
  width: clamp(200px, 26vw, 320px); aspect-ratio: 1;
  margin: clamp(28px, 5vh, 48px) auto 0;
  border-radius: 16px; overflow: hidden;
  border: 1px solid var(--hairline-strong); box-shadow: var(--shadow-pop);
}
.design-hero-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.design-hero .await {
  margin-top: clamp(20px, 4vh, 36px);
  font-family: var(--serif); font-size: clamp(16px, 2.2vw, 20px);
  letter-spacing: 0.08em; color: var(--text-muted);
}
.design-hero .await-sub { margin-top: 8px; font-size: 12.5px; color: var(--text-faint); letter-spacing: 0.05em; }
.design-pager {
  display: flex; justify-content: center; align-items: center; gap: 22px;
  padding: 0 0 44px; font-family: var(--serif); font-size: 15px;
}
.design-pager a { color: var(--text-faint); padding: 6px 10px; border-radius: 8px; transition: color .15s; }
.design-pager a:hover { color: var(--brass); }
.design-pager .current { color: var(--text); border-bottom: 1px solid var(--brass); padding-bottom: 3px; }

/* Items pinned to this page via the "A" dropdown (page-gallery.js).
   Sits below the hero/placeholder, above the pager - constrained the
   same way .wrap constrains everything else, since .design-hero itself
   isn't inside a .wrap. */
.pinned-page-items {
  max-width: 1480px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 40px) 40px;
}
.pinned-page-items .group-header { text-align: left; }

/* ---------- Small screens ---------- */
@media (max-width: 640px) {
  .toolbar-inner { gap: 8px; }
  .kbd-hint { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .card-foot { padding: 6px 6px; }
  .site-header { flex-wrap: wrap; }
}

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