/* ————— Forma design system ————— */
:root {
  --paper: #faf5ec;
  --paper-deep: #f2e9d8;
  --card: #fffdf8;
  --ink: #241c13;
  --muted: #71654f;
  --line: #e5d9c1;
  --clay: #bc4b23;
  --clay-deep: #96370f;
  --clay-soft: #f6d9cc;
  --focus: #1d5bbf;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(46, 30, 12, 0.06), 0 10px 28px -18px rgba(46, 30, 12, 0.45);
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1100px 500px at 85% -10%, #f6e8d2 0%, transparent 60%),
    var(--paper);
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1120px; margin: 0 auto; padding-inline: clamp(16px, 4vw, 32px); }

/* Focus */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: #fff; padding: 10px 16px;
  z-index: 100; border-radius: 0 0 10px 0; text-decoration: none; font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ————— Header ————— */
.site-header { border-bottom: 1px solid var(--line); background: rgba(250, 245, 236, 0.92); backdrop-filter: blur(6px); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 14px; }
.brand { display: flex; align-items: center; gap: 14px; }
.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 30px;
  letter-spacing: -0.02em;
  color: var(--clay);
  line-height: 1;
  transform: translateY(2px);
}
.wordmark.small { font-size: 20px; }
.brand-text { margin: 0; line-height: 1.25; border-left: 1px solid var(--line); padding-left: 14px; color: var(--muted); font-size: 13.5px; }
.header-note { margin: 0; color: var(--muted); font-size: 13.5px; letter-spacing: 0.01em; }
@media (max-width: 560px) { .header-note { display: none; } }

/* ————— Hero ————— */
.hero { margin-top: clamp(18px, 3.5vw, 34px); }
.hero-media {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  max-height: 400px;
}
.hero-media img { width: 100%; height: clamp(220px, 32vw, 400px); object-fit: cover; display: block; }
.hero-copy { max-width: 660px; padding: clamp(20px, 3.5vw, 36px) 6px 0; }
.hero-copy h1 {
  font-family: var(--font-display);
  font-size: clamp(34px, 6vw, 56px);
  line-height: 1.04;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 14px;
}
.hero-copy h1 em { font-style: normal; color: var(--clay); }
.hero-copy > p { font-size: clamp(15px, 2vw, 17px); color: #4b4030; margin: 0 0 22px; }

/* ————— Buttons ————— */
.button {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 15px;
  padding: 11px 20px; border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: var(--card); color: var(--ink);
  cursor: pointer; text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.button:hover { background: var(--paper-deep); }
.button:active { transform: translateY(1px); }
.button.primary { background: var(--clay); border-color: var(--clay); color: #fff; }
.button.primary:hover { background: var(--clay-deep); border-color: var(--clay-deep); }

/* ————— Controls ————— */
.controls {
  display: flex; flex-wrap: wrap; align-items: end; gap: 14px 18px;
  padding-block: clamp(26px, 4vw, 44px) 22px;
}
.control { display: flex; flex-direction: column; gap: 6px; }
.control label { font-size: 12.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.search-control { flex: 1 1 240px; max-width: 340px; }

input[type="search"], select {
  font: inherit; font-size: 15px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink);
  min-width: 0;
}
input[type="search"] { width: 100%; }
input[type="search"]:hover, select:hover { border-color: #c9b990; }
select { cursor: pointer; padding-right: 34px; }

#savedToggle {
  font: inherit; font-weight: 600; font-size: 15px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--card); color: var(--ink);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
#savedToggle:hover { border-color: #c9b990; }
#savedToggle[aria-pressed="true"] {
  background: var(--clay-soft);
  border-color: var(--clay);
  color: var(--clay-deep);
}
.saved-count {
  font-size: 12.5px; font-weight: 700;
  background: var(--paper-deep); color: var(--muted);
  border-radius: 999px; padding: 1px 8px; min-width: 22px; text-align: center;
}
#savedToggle[aria-pressed="true"] .saved-count { background: var(--clay); color: #fff; }

.result-count { margin: 0 0 2px auto; color: var(--muted); font-size: 14px; font-style: italic; }
@media (max-width: 640px) { .result-count { width: 100%; margin-left: 0; } }

/* ————— Grid & cards ————— */
.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  padding-bottom: 60px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 2px 3px rgba(46,30,12,.06), 0 18px 36px -20px rgba(46,30,12,.5); }

.card-media { position: relative; }
.card-media img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.saved-badge {
  position: absolute; top: 10px; right: 10px;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--clay); color: #fff;
  box-shadow: 0 4px 10px rgba(0,0,0,.25);
}
.saved-badge svg { width: 18px; height: 18px; }

.card-body { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px 18px; flex: 1; }
.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; }
.card h3 { font-family: var(--font-display); font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.card .desc { margin: 0; color: var(--muted); font-size: 14.5px; flex: 1; }

.facts { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 10px 0; border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line); }
.facts > div { display: flex; align-items: center; gap: 6px; font-size: 13.5px; color: #4b4030; }
.facts svg { width: 15px; height: 15px; color: var(--clay); flex: none; }
.facts dt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.price { font-family: var(--font-display); font-size: 24px; font-weight: 600; }
.price span { font-family: var(--font-body); font-size: 12px; color: var(--muted); display: block; letter-spacing: 0.04em; }

.open-btn {
  font: inherit; font-weight: 600; font-size: 14.5px;
  padding: 9px 16px; border-radius: 999px;
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.open-btn:hover { background: var(--ink); color: var(--paper); }

/* Category chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px;
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-Baking { background: #f4e4c0; color: #7a4a10; }
.chip-Ceramics { background: #efe0d2; color: #8a4322; }
.chip-Floristry { background: #dfe9d2; color: #45622c; }
.chip-Painting { background: #e6e0f1; color: #514178; }

/* ————— Empty state ————— */
.empty {
  text-align: center; color: var(--muted);
  padding: clamp(40px, 8vw, 80px) 20px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.empty[hidden] { display: none; }
.empty svg { color: #c2ab84; margin-bottom: 6px; }
.empty h2 { font-family: var(--font-display); font-size: 26px; margin: 0; color: var(--ink); }
.empty p { margin: 0 0 12px; }

/* ————— Footer ————— */
.site-footer { border-top: 1px solid var(--line); background: var(--paper-deep); }
.footer-row { display: flex; flex-wrap: wrap; gap: 8px 28px; justify-content: space-between; padding-block: 22px; font-size: 13px; color: var(--muted); }
.footer-row p { margin: 0; }
.footer-row a { color: var(--clay-deep); }

/* ————— Detail dialog ————— */
dialog#detail {
  width: min(780px, calc(100vw - 32px));
  max-width: 100%;
  max-height: calc(100dvh - 40px);
  border: none; border-radius: var(--radius);
  padding: 0;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 24px 80px -20px rgba(20, 10, 0, 0.55);
  overflow: auto;
  overscroll-behavior: contain;
}
dialog#detail::backdrop { background: rgba(30, 20, 8, 0.55); backdrop-filter: blur(3px); }

.detail-media { position: relative; }
.detail-media img { display: block; width: 100%; aspect-ratio: 16 / 8.5; object-fit: cover; }
.detail-close {
  position: absolute; top: 12px; right: 12px;
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 14px;
  padding: 9px 14px; border-radius: 999px;
  border: none; cursor: pointer;
  background: rgba(255, 253, 248, 0.94); color: var(--ink);
  box-shadow: 0 4px 14px rgba(20, 10, 0, 0.3);
  transition: background-color 0.15s ease;
}
.detail-close:hover { background: #fff; }
@media (max-width: 480px) { .detail-close span { display: none; } }

.detail-body { padding: clamp(18px, 3.5vw, 30px) clamp(18px, 4vw, 34px) clamp(22px, 4vw, 34px); }
.detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.detail-body h2 { font-family: var(--font-display); font-size: clamp(26px, 5vw, 34px); font-weight: 600; margin: 0; letter-spacing: -0.01em; flex: 1 1 auto; }
.detail-desc { font-size: 16.5px; color: #4b4030; margin: 14px 0 0; }

.detail-facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 4px 18px; margin: 22px 0 6px;
  border-top: 1px dashed var(--line); border-bottom: 1px dashed var(--line);
  padding: 14px 0;
}
.detail-facts > div { display: flex; flex-direction: column; gap: 1px; padding: 5px 0; }
.detail-facts dt { font-size: 11.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.detail-facts dd { margin: 0; font-size: 15px; font-weight: 500; }
.detail-facts dd strong { font-family: var(--font-display); font-size: 20px; font-weight: 600; }

.detail-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 18px; }
.save-btn {
  font: inherit; font-weight: 600; font-size: 15.5px;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 12px 22px; border-radius: 999px;
  border: 1.5px solid var(--clay); background: transparent; color: var(--clay-deep);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.save-btn:hover { background: var(--clay-soft); }
.save-btn[aria-pressed="true"] { background: var(--clay); color: #fff; }
.save-btn[aria-pressed="true"]:hover { background: var(--clay-deep); border-color: var(--clay-deep); }
.save-btn svg { width: 18px; height: 18px; }
.save-note { font-size: 13.5px; color: var(--muted); margin: 0; }
