/* Forma — "Kiln Night" direction: deep green ink, apricot accents, condensed labels */
:root {
  --ink: #0f1f1a;
  --ink-2: #162b24;
  --ink-3: #1f372f;
  --paper: #f3ead8;
  --paper-dim: #c9bfa9;
  --apricot: #f2a25c;
  --apricot-strong: #ffb97a;
  --clay: #d9644a;
  --line: rgba(243, 234, 216, 0.14);
  --focus: #ffe08a;
  --display: "Arial Narrow", "Avenir Next Condensed", "Franklin Gothic Medium", "Roboto Condensed", "Helvetica Neue", Arial, sans-serif;
  --text: "Avenir Next", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 4px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { background: var(--ink); }

body {
  margin: 0;
  font-family: var(--text);
  font-size: 16px;
  line-height: 1.5;
  color: var(--paper);
  background:
    radial-gradient(1200px 500px at 90% -10%, rgba(242, 162, 92, 0.12), transparent 60%),
    var(--ink);
  min-height: 100vh;
}

img { display: block; max-width: 100%; }

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  background: var(--apricot);
  color: var(--ink);
  padding: 8px 14px;
  z-index: 10;
}
.skip-link:focus { top: 12px; }

.wrap {
  width: min(1200px, calc(100% - 40px));
  margin: 0 auto;
}

/* ---------- Masthead ---------- */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-family: var(--display);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
}

.brand span { color: var(--apricot); }

.meta-label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper-dim);
}

.shortlist-count {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  background: var(--apricot);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: end;
  padding: 56px 0 40px;
}

.hero h1 {
  font-family: var(--display);
  font-size: clamp(48px, 7vw, 96px);
  line-height: 0.92;
  font-weight: 700;
  text-transform: uppercase;
  margin: 12px 0 0;
  letter-spacing: -0.01em;
}

.hero h1 em {
  font-style: normal;
  color: var(--apricot);
}

.hero-copy p {
  margin: 0;
  max-width: 44ch;
  color: var(--paper-dim);
  font-size: 18px;
}

.hero-photo {
  position: relative;
  margin: 0;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--radius);
}

.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-photo figcaption {
  position: absolute;
  left: 12px;
  bottom: 12px;
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(15, 31, 26, 0.85);
  padding: 4px 8px;
  border-radius: var(--radius);
}

/* ---------- Toolbar ---------- */
.toolbar {
  background: var(--ink);
  border-block: 1px solid var(--line);
  padding: 14px 0;
}

.toolbar-inner {
  display: grid;
  grid-template-columns: 1fr 200px auto;
  gap: 12px;
  align-items: end;
}

.field label {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper-dim);
  margin-bottom: 6px;
}

.field input,
.field select {
  width: 100%;
  min-height: 44px;
  font: inherit;
  font-size: 16px;
  color: var(--paper);
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 12px;
}

.field input::placeholder { color: #8e9a90; }

.field input:focus,
.field select:focus {
  border-color: var(--apricot);
  outline: 3px solid var(--focus);
  outline-offset: 0;
}

.toggle {
  min-height: 44px;
  font: inherit;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--paper);
  background: transparent;
  border: 1px solid var(--paper-dim);
  border-radius: 999px;
  padding: 8px 16px;
  cursor: pointer;
  white-space: nowrap;
}

.toggle[aria-pressed="true"] {
  background: var(--apricot);
  border-color: var(--apricot);
  color: var(--ink);
}

.toggle:hover { border-color: var(--apricot-strong); }

/* ---------- Results ---------- */
.results-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 28px 0 16px;
}

.results-head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 28px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.grid {
  list-style: none;
  margin: 0;
  padding: 0 0 80px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-media {
  position: relative;
  aspect-ratio: 16 / 11;
  overflow: hidden;
  background: var(--ink-3);
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--clay);
  color: #fff;
  padding: 3px 8px;
  border-radius: var(--radius);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  flex: 1;
}

.card-title {
  margin: 0;
  font-family: var(--display);
  font-size: 30px;
  line-height: 1;
  text-transform: uppercase;
}

.card-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin: 0;
  font-size: 14px;
  color: var(--paper-dim);
}

.card-facts div { display: flex; flex-direction: column; }

.card-facts dt {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8e9a90;
}

.card-facts dd { margin: 0; color: var(--paper); }

.card-foot {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.price {
  font-family: var(--display);
  font-size: 26px;
  font-weight: 700;
}

.shortlist-badge {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--apricot-strong);
  border: 1px solid var(--apricot);
  border-radius: 999px;
  padding: 2px 8px;
  margin-right: auto;
}

.btn {
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  color: var(--ink);
  background: var(--apricot);
  border: 1px solid var(--apricot);
  border-radius: var(--radius);
  padding: 8px 16px;
  cursor: pointer;
}

.btn:hover { background: var(--apricot-strong); }

.btn-ghost {
  background: transparent;
  color: var(--paper);
  border-color: var(--paper-dim);
}

.btn-ghost:hover { background: var(--ink-3); }

/* ---------- Empty state ---------- */
.empty {
  grid-column: 1 / -1;
  padding: 56px 24px;
  border: 1px dashed var(--paper-dim);
  border-radius: var(--radius);
  text-align: center;
}

.empty h3 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-size: 32px;
  text-transform: uppercase;
}

.empty p { margin: 0 0 20px; color: var(--paper-dim); }

/* ---------- Detail dialog ---------- */
.detail {
  width: min(960px, calc(100% - 24px));
  max-height: calc(100vh - 32px);
  padding: 0;
  margin: auto;
  color: var(--paper);
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.detail::backdrop {
  background: rgba(5, 12, 10, 0.78);
}

.detail-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.detail-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 280px;
}

.detail-text {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 28px;
}

.detail-text h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 44px;
  line-height: 0.95;
  text-transform: uppercase;
}

.detail-text .lede {
  margin: 0;
  font-size: 18px;
  color: var(--paper);
}

.detail-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0;
  padding: 16px 0;
  border-block: 1px solid var(--line);
}

.detail-facts div { display: flex; flex-direction: column; }
.detail-facts dt { font-family: var(--mono); font-size: 11px; text-transform: uppercase; color: #8e9a90; }
.detail-facts dd { margin: 0; }

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: auto;
}

.detail-actions .btn { flex: 1 1 auto; }

.detail .btn-close {
  align-self: flex-start;
}

/* ---------- Footer ---------- */
.site-foot {
  border-top: 1px solid var(--line);
  padding: 24px 0 40px;
  color: var(--paper-dim);
  font-size: 14px;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 24px; padding-top: 32px; }
  .toolbar-inner { grid-template-columns: 1fr 1fr; }
  .toolbar-inner .field-search { grid-column: 1 / -1; }
  .detail-inner { grid-template-columns: 1fr; }
  .detail-media img { min-height: 0; aspect-ratio: 16 / 10; }
}

@media (max-width: 600px) {
  .wrap { width: calc(100% - 28px); }
  .brand { font-size: 24px; }
  .masthead .meta-label { display: none; }
  .hero h1 { font-size: 56px; }
  .toolbar-inner { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .detail-text { padding: 20px; }
  .detail-text h2 { font-size: 36px; }
  .detail { width: calc(100% - 16px); max-height: calc(100vh - 16px); }
  .detail-inner { max-height: calc(100vh - 16px); }
}

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