/* Forma. One accent (vermilion) on cool neutrals, one radius (12px), system type. */
:root {
  --bg: #eef1f0;
  --surface: #f9faf9;
  --ink: #14211f;
  --muted: #475855;
  --line: #cdd7d4;
  --accent: #c23d17;
  --accent-ink: #ffffff;
  --shadow: 0 1px 2px rgb(20 33 31 / .06), 0 12px 32px -12px rgb(20 60 52 / .22);
  --radius: 12px;
  --font: "Avenir Next", "Segoe UI Variable Display", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --header-h: 64px;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1715;
    --surface: #16231f;
    --ink: #edf3f1;
    --muted: #a6b6b2;
    --line: #2b3c37;
    --accent: #ff7d55;
    --accent-ink: #1a0b06;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 16px 36px -14px rgb(0 0 0 / .6);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); -webkit-text-size-adjust: 100%; }
html.is-locked { overflow: hidden; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  min-height: 100dvh;
}
img { display: block; max-width: 100%; }
h1, h2, h3, p, dl, dd { margin: 0; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 6px; }

.wrap { width: min(1320px, 100% - 3rem); margin-inline: auto; }

.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: var(--radius);
}
.skip:focus { top: 1rem; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 20;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.bar { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.wordmark {
  font-weight: 800; font-size: 1.6rem; letter-spacing: -.045em; text-decoration: none; color: var(--ink);
}
.wordmark.small { font-size: 1.3rem; margin-bottom: .35rem; }
.bar-link { color: var(--ink); text-decoration: none; font-weight: 600; padding: .5rem .25rem; border-bottom: 2px solid var(--accent); }

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 7fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
  padding-block: clamp(2rem, 5vw, 4rem) clamp(2.5rem, 5vw, 4.5rem);
  min-height: min(620px, calc(100dvh - var(--header-h)));
}
h1 {
  font-size: clamp(2.4rem, 3.9vw, 3.6rem);
  line-height: 1.04;
  letter-spacing: -.045em;
  font-weight: 800;
  text-wrap: balance;
}
.lede { margin-block: 1.4rem 2rem; font-size: 1.15rem; color: var(--muted); max-width: 38ch; }
.hero-media { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); aspect-ratio: 4 / 3; background: var(--line); }
.hero-media img { width: 100%; height: 100%; object-fit: cover; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .6rem;
  min-height: 48px; padding: .6rem 1.35rem;
  border: 1.5px solid var(--ink); border-radius: var(--radius);
  background: transparent; color: var(--ink);
  font-weight: 650; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .2s var(--ease), background-color .2s, color .2s, border-color .2s;
}
.btn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-toggle .count {
  min-width: 1.6rem; padding: 0 .4rem; border-radius: 8px; text-align: center; font-size: .85rem; line-height: 1.6rem;
  background: var(--ink); color: var(--bg); font-variant-numeric: tabular-nums;
}
.btn-toggle[aria-pressed="true"] .count { background: var(--accent-ink); color: var(--accent); }

/* Catalog */
.catalog { padding-bottom: 5rem; }
h2 { font-size: clamp(1.75rem, 3vw, 2.5rem); letter-spacing: -.035em; line-height: 1.1; font-weight: 800; scroll-margin-top: calc(var(--header-h) + 12px); }
h2:focus { outline: none; }

.toolbar {
  display: grid; grid-template-columns: minmax(0, 1fr) 240px auto; gap: 1rem; align-items: end;
  margin-top: 1.5rem; padding: 1rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.field { display: grid; gap: .4rem; }
.field label { font-size: .9rem; font-weight: 650; }
input[type="text"], select {
  width: 100%; min-height: 48px; padding: .55rem .9rem;
  background: var(--bg); border: 1.5px solid var(--muted); border-radius: var(--radius);
}
input::placeholder { color: var(--muted); opacity: 1; }
select { appearance: none; -webkit-appearance: none; padding-right: 2.5rem; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 1.15rem) 55%, calc(100% - .8rem) 55%;
  background-size: .35rem .35rem; background-repeat: no-repeat;
}
input[type="text"]:focus-visible, select:focus-visible { outline-offset: 2px; border-radius: var(--radius); }

.status-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1.5rem; margin: 1.5rem 0 1rem; min-height: 1.6rem; }
.result-count { color: var(--muted); font-weight: 550; }
.shortlist-total { font-weight: 650; }
.shortlist-total strong { color: var(--accent); }

/* Grid: 12 columns, alternating 7 / 5 spans for rhythm */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1.5rem; }
.grid > .card { grid-column: span 6; }
.grid > .card:nth-child(6n+1), .grid > .card:nth-child(6n+4), .grid > .card:nth-child(6n+5) { grid-column: span 7; }
.grid > .card:nth-child(6n+2), .grid > .card:nth-child(6n+3), .grid > .card:nth-child(6n) { grid-column: span 5; }

.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card:focus-within { box-shadow: var(--shadow); }
.card-media { position: relative; flex: 1 1 auto; min-height: clamp(220px, 22vw, 320px); overflow: hidden; background: var(--line); }
.card-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.card:hover .card-media img { transform: scale(1.04); }
.card-body { padding: 1.25rem 1.4rem 1.4rem; display: grid; gap: .6rem; }
.card-cat { font-size: .9rem; font-weight: 650; color: var(--muted); }
.card-title { font-size: 1.6rem; line-height: 1.12; letter-spacing: -.03em; font-weight: 800; }
.card-desc { color: var(--muted); max-width: 52ch; }
.card-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-top: .4rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.card-when { font-weight: 650; }
.card-when span { display: block; font-weight: 450; color: var(--muted); font-size: .92rem; }
.card-price { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; color: var(--accent); font-variant-numeric: tabular-nums; }

/* Whole card opens the detail via the title button */
.open-item {
  all: unset; cursor: pointer; display: block;
}
.open-item::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.open-item:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; border-radius: 6px; }
.card:has(.open-item:focus-visible) { outline: 3px solid var(--ink); outline-offset: 3px; }
.card:has(.open-item:focus-visible) .open-item { outline: none; }

.quick-save {
  position: absolute; top: .9rem; right: .9rem; z-index: 2;
  min-height: 44px; padding: .4rem 1rem;
  border: 1.5px solid var(--ink); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font-weight: 650; cursor: pointer;
  transition: transform .2s var(--ease), background-color .2s;
}
.quick-save:hover { background: var(--bg); }
.quick-save:active { transform: scale(.96); }
.quick-save[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Empty / error */
.empty {
  display: grid; justify-items: start; gap: .75rem;
  padding: clamp(2rem, 5vw, 3.5rem); background: var(--surface);
  border: 1.5px dashed var(--muted); border-radius: var(--radius);
}
.empty h3 { font-size: 1.6rem; letter-spacing: -.03em; font-weight: 800; }
.empty p { color: var(--muted); max-width: 46ch; margin-bottom: .5rem; }

/* Skeleton */
.skeleton { min-height: 360px; background: linear-gradient(100deg, var(--surface) 30%, var(--line) 50%, var(--surface) 70%); background-size: 300% 100%; }
@media (prefers-reduced-motion: no-preference) {
  .skeleton { animation: shimmer 1.6s linear infinite; }
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* Detail dialog: side panel on desktop, full screen on mobile */
dialog.detail {
  position: fixed; inset: 0 0 0 auto; margin: 0; padding: 0;
  width: min(680px, 100%); max-width: none; height: 100dvh; max-height: none;
  border: 0; border-left: 1px solid var(--line);
  background: var(--bg); color: var(--ink);
  overflow: hidden;
}
dialog.detail[open] { display: flex; flex-direction: column; }
dialog.detail::backdrop { background: rgb(8 18 16 / .55); }
.detail-scroll { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; }
.detail-top {
  position: sticky; top: 0; z-index: 3; display: flex; justify-content: flex-end; padding: .75rem 1rem;
  height: 0; padding: 0; overflow: visible;
}
.detail-top .btn { position: absolute; top: .9rem; right: .9rem; background: var(--surface); min-height: 44px; }
.detail-media { aspect-ratio: 3 / 2; background: var(--line); }
.detail-media img { width: 100%; height: 100%; object-fit: cover; }
.detail-main { padding: 1.75rem clamp(1.25rem, 4vw, 2.25rem) 2rem; display: grid; gap: 1rem; }
.detail-cat { font-weight: 650; color: var(--muted); }
.detail-title { font-size: clamp(2rem, 4vw, 2.75rem); line-height: 1.05; letter-spacing: -.04em; font-weight: 800; }
.detail-body { font-size: 1.15rem; max-width: 54ch; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin-top: .75rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.fact { padding: 1rem 1.15rem; }
.fact:nth-child(n+3) { border-top: 1px solid var(--line); }
.fact:nth-child(even) { border-left: 1px solid var(--line); }
.fact dt { font-size: .88rem; font-weight: 650; color: var(--muted); }
.fact dd { font-size: 1.1rem; font-weight: 700; letter-spacing: -.01em; }
.fact.price dd { color: var(--accent); }
.detail-actions {
  flex: 0 0 auto; display: flex; gap: .75rem; padding: 1rem clamp(1.25rem, 4vw, 2.25rem);
  background: var(--surface); border-top: 1px solid var(--line);
}
.detail-actions .btn { flex: 1 1 auto; }
.save-btn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

@media (prefers-reduced-motion: no-preference) {
  dialog.detail[open] { animation: panel-in .45s var(--ease); }
  dialog.detail[open]::backdrop { animation: fade-in .3s ease-out; }
  .intro .card { animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
  .hero-copy > * { animation: rise .7s var(--ease) both; }
  .hero-copy > .lede { animation-delay: .08s; }
  .hero-copy > .btn { animation-delay: .16s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes panel-in { from { transform: translateX(32px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding-block: 2.5rem; color: var(--muted); }
.site-footer .wordmark { color: var(--ink); }

/* Tablet */
@media (max-width: 1023px) {
  .hero { grid-template-columns: 1fr; min-height: 0; }
  .toolbar { grid-template-columns: minmax(0, 1fr) 220px auto; }
  .grid > .card, .grid > .card:nth-child(n) { grid-column: span 6; }
}

/* Mobile */
@media (max-width: 719px) {
  :root { --header-h: 56px; }
  .wrap { width: calc(100% - 2rem); }
  .hero { gap: 1.75rem; padding-block: 1.5rem 2rem; }
  h1 { font-size: 2.4rem; }
  .lede { margin-block: 1rem 1.5rem; font-size: 1.05rem; }
  .hero-media { aspect-ratio: 16 / 10; }
  .toolbar { grid-template-columns: minmax(0, 1fr) auto; padding: .9rem; }
  .field-search { grid-column: 1 / -1; }
  .grid { gap: 1.1rem; }
  .grid > .card, .grid > .card:nth-child(n) { grid-column: 1 / -1; }
  .card-media { min-height: 0; flex: none; aspect-ratio: 16 / 10; }
  .card-title { font-size: 1.45rem; }
  dialog.detail { width: 100%; border-left: 0; }
  .detail-media { aspect-ratio: 16 / 10; }
  .facts { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 380px) {
  .detail-actions { flex-direction: column; }
}
