/* Forma — swatch system. Each category owns a colour and a shape. */

:root {
  --ink: #12211f;
  --ink-soft: #3f4f4b;
  --paper: #f1f2ee;
  --paper-2: #e5e8e1;
  --white: #fbfcfa;
  --teal: #0e5566;
  --teal-deep: #0a3f4d;
  --on-teal: #f4faf9;
  --on-teal-soft: rgba(244, 250, 249, 0.8);
  --line: rgba(18, 33, 31, 0.18);

  --ceramics: #9dbbe0;
  --painting: #f28db2;
  --floristry: #ffbe1f;
  --baking: #d9a25e;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --pad: clamp(18px, 4vw, 56px);
  --display: "Avenir Next", "Helvetica Neue", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --text: system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

[data-cat="Ceramics"] { --c: var(--ceramics); }
[data-cat="Painting"] { --c: var(--painting); }
[data-cat="Floristry"] { --c: var(--floristry); }
[data-cat="Baking"] { --c: var(--baking); }

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 16px;
  scrollbar-gutter: stable;
  scrollbar-color: var(--teal) var(--paper-2);
  -webkit-text-size-adjust: 100%;
}
html.has-dialog { overflow: hidden; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.55 var(--text);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  accent-color: var(--teal);
  caret-color: var(--teal);
}

::selection { background: var(--floristry); color: var(--ink); }

h1, h2, h3, p, dl, dd, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 3px;
  border-radius: 6px;
}
.hero :focus-visible,
.detail-close:focus-visible { outline-color: var(--floristry); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.ico { width: 20px; height: 20px; flex: none; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--ink); color: var(--white); padding: 10px 16px; border-radius: 8px;
  text-decoration: none; font-weight: 600;
}
.skip:focus { top: 12px; }

/* ---------- Header ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px var(--pad);
  background: var(--paper);
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; border-radius: 8px; }
.brand-mark { width: 84px; height: 18px; overflow: visible; }
.brand-mark use { stroke: var(--ink); stroke-width: 1.6; stroke-linejoin: round; }
.m-ceramics { fill: var(--ceramics); }
.m-painting { fill: var(--painting); }
.m-floristry { fill: var(--floristry); }
.m-baking { fill: var(--baking); }
.brand-name { font: 800 1.6rem/1 var(--display); letter-spacing: -0.03em; }
.header-note { color: var(--ink-soft); font-size: 0.95rem; }

/* ---------- Hero ---------- */
.hero {
  background: var(--teal);
  color: var(--on-teal);
}
.hero-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.62fr);
  align-items: stretch;
}
.hero-copy {
  padding: clamp(32px, 5vw, 64px) var(--pad) clamp(28px, 4vw, 48px);
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 22px;
}
.hero h1 {
  font: 800 clamp(2.6rem, 6.4vw, 5.6rem)/0.95 var(--display);
  letter-spacing: -0.035em;
  text-wrap: balance;
  max-width: 13ch;
}
.lede { max-width: 52ch; font-size: clamp(1.02rem, 1.4vw, 1.2rem); color: var(--on-teal-soft); text-wrap: pretty; }
.hero-photo { min-height: 260px; position: relative; overflow: hidden; background: var(--teal-deep); }
.hero-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 40% 55%; }

.btn-primary {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  background: var(--floristry); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 999px;
  font-weight: 700; text-decoration: none;
  transition: transform 0.25s var(--ease-out), background-color 0.2s;
}
.btn-primary:hover { transform: translateY(-2px); background: #ffd052; }
.btn-primary .ico { transition: transform 0.25s var(--ease-out); }
.btn-primary:hover .ico { transform: translateX(4px); }
.hero .btn-primary { border-color: var(--floristry); }

/* ---------- Date ruler ---------- */
.ruler-wrap { padding: 8px 0 clamp(20px, 3vw, 32px); border-top: 1px solid rgba(244, 250, 249, 0.28); }
.ruler-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 24px;
  padding: 16px var(--pad) 10px;
}
.ruler-head h2 { font: 800 1.15rem/1.2 var(--display); letter-spacing: -0.01em; }
.ruler-status { color: var(--on-teal-soft); font-size: 0.95rem; min-height: 1.5em; }
.ruler-scroll {
  overflow-x: auto; padding: 4px var(--pad) 6px;
  scrollbar-width: thin; scrollbar-color: rgba(244, 250, 249, 0.5) transparent;
}
.ruler {
  display: grid;
  grid-template-columns: repeat(31, minmax(38px, 1fr));
  min-width: 1180px;
}
.day { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.day .wd { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; color: var(--on-teal-soft); text-transform: uppercase; }
.day.weekend .wd { color: var(--on-teal); }
.day .plain {
  height: 44px; display: grid; place-items: center;
  font-size: 0.95rem; color: var(--on-teal-soft);
}
.day-marker {
  position: relative; width: 46px; height: 44px; padding: 0; border: 0; background: none;
  display: grid; place-items: center; color: var(--ink);
}
.day-marker svg { position: absolute; inset: 0; margin: auto; width: 44px; height: 44px; fill: var(--c); stroke: var(--ink); stroke-width: 1.2; transition: transform 0.3s var(--ease-out); }
.day-marker span { position: relative; font-weight: 800; font-size: 0.95rem; }
.day-marker:hover svg, .day-marker.is-hot svg { transform: scale(1.14) translateY(-2px); }
.day-marker.is-off { opacity: 0.38; }
.day-marker.is-saved::after {
  content: ""; position: absolute; right: -1px; top: -3px; width: 12px; height: 12px;
  background: var(--ink); border: 2px solid var(--on-teal); border-radius: 50%;
}

/* ---------- Controls ---------- */
.browse { padding: 0 var(--pad) 40px; max-width: 1440px; margin: 0 auto; }
.controls {
  display: grid;
  grid-template-columns: auto minmax(220px, 1.5fr) minmax(160px, 0.7fr) minmax(190px, 0.8fr) auto;
  align-items: end; gap: 16px;
  padding: 24px 0 20px;
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
}
.controls-title { font: 800 clamp(1.8rem, 3vw, 2.4rem)/1 var(--display); letter-spacing: -0.03em; padding-bottom: 8px; padding-right: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 0.85rem; font-weight: 600; color: var(--ink-soft); }
.input-wrap { position: relative; }
.input-wrap .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--ink-soft); }
input[type="search"], select {
  width: 100%; height: 48px; padding: 0 14px;
  background: var(--white); border: 2px solid var(--ink); border-radius: 12px;
  appearance: none; -webkit-appearance: none;
}
input[type="search"] { padding-left: 44px; }
input[type="search"]::placeholder { color: #5a6a65; opacity: 1; }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
select {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%2312211f' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px;
}
input[type="search"]:hover, select:hover { background-color: #fff; }
input[type="search"]:focus-visible, select:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 12px; }

.saved-toggle {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 48px; padding: 0 18px; white-space: nowrap;
  background: var(--white); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 999px; font-weight: 700;
  transition: background-color 0.2s, color 0.2s, transform 0.25s var(--ease-out);
}
.saved-toggle:hover { transform: translateY(-2px); }
.saved-toggle .count {
  min-width: 26px; height: 26px; padding: 0 7px; display: inline-grid; place-items: center;
  border-radius: 999px; background: var(--ink); color: var(--white); font-size: 0.85rem;
}
.saved-toggle[aria-pressed="true"] { background: var(--ink); color: var(--white); }
.saved-toggle[aria-pressed="true"] .count { background: var(--floristry); color: var(--ink); }

.results-bar {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px;
  padding: 14px 0 6px; color: var(--ink-soft); font-size: 0.95rem;
}
.shortlist-summary { font-weight: 600; color: var(--ink); }

/* ---------- Rows ---------- */
.rows { display: block; }
.row {
  position: relative;
  display: grid;
  grid-template-columns: 104px 200px minmax(0, 1fr) 190px 128px;
  align-items: stretch; gap: 0 28px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  transition: background-color 0.25s;
}
.row:hover, .row.is-hot { background: rgba(255, 255, 255, 0.55); }
.row.enter { animation: rise 0.6s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.date-chip {
  background: var(--c); color: var(--ink); border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  padding: 10px 6px; text-align: center; line-height: 1;
}
.date-chip .wd, .date-chip .mo { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.date-chip .dn { font: 800 3.4rem/1.05 var(--display); letter-spacing: -0.04em; margin: 4px 0; }

.thumb { border-radius: 14px; overflow: hidden; background: var(--paper-2); min-height: 132px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.7s var(--ease-out); }
.row:hover .thumb img { transform: scale(1.06); }

.info { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; justify-content: center; min-width: 0; }
.tag {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 11px 3px 8px; border-radius: 999px;
  background: var(--c); color: var(--ink); font-size: 0.85rem; font-weight: 700;
}
.tag svg { width: 15px; height: 15px; fill: var(--ink); }
.title { font: 800 clamp(1.5rem, 2.2vw, 2rem)/1.1 var(--display); letter-spacing: -0.025em; }
.open {
  all: unset; cursor: pointer; display: inline; border-radius: 6px;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0 3px; background-repeat: no-repeat; background-position: 0 96%;
  transition: background-size 0.35s var(--ease-out);
}
.open::after { content: ""; position: absolute; inset: 0; border-radius: 4px; }
.row:hover .open { background-size: 100% 3px; }
.open:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
.row:has(.open:focus-visible) { background: rgba(255, 255, 255, 0.7); }
.desc { color: var(--ink-soft); max-width: 62ch; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-wrap: pretty; }
.by { font-size: 0.9rem; color: var(--ink-soft); }

.facts { display: flex; flex-direction: column; justify-content: center; gap: 10px; font-size: 0.92rem; }
.facts dt { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.facts dd { font-weight: 600; }

.price-col { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 8px; text-align: right; }
.price { font: 800 2.2rem/1 var(--display); letter-spacing: -0.03em; }
.go { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.95rem; }
.go .ico { width: 18px; height: 18px; transition: transform 0.3s var(--ease-out); }
.row:hover .go .ico { transform: translateX(5px); }
.saved-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  background: var(--ink); color: var(--white); border-radius: 999px; font-size: 0.82rem; font-weight: 700;
}
.saved-badge .ico { width: 14px; height: 14px; }
.price-col .spacer { min-height: 24px; }

/* ---------- Empty / error ---------- */
.empty, .load-error {
  margin: 28px 0; padding: 40px 24px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: var(--paper-2); border-radius: 20px;
}
.empty[hidden], .load-error[hidden], .rows[hidden], .shortlist-summary[hidden] { display: none; }
.empty-mark { width: 56px; height: 56px; fill: var(--floristry); stroke: var(--ink); stroke-width: 1.2; }
.empty h3, .load-error h3 { font: 800 1.6rem/1.15 var(--display); letter-spacing: -0.02em; }
.empty p, .load-error p { color: var(--ink-soft); max-width: 46ch; }
.empty .btn-primary, .load-error .btn-primary { margin-top: 8px; }

/* ---------- Footer ---------- */
.site-footer {
  padding: 28px var(--pad) 40px; background: var(--ink); color: rgba(251, 252, 250, 0.82);
  display: grid; gap: 6px; font-size: 0.92rem;
}
.site-footer strong { color: var(--white); }
.noscript { padding: 16px var(--pad); background: var(--floristry); }

/* ---------- Detail dialog ---------- */
.detail {
  padding: 0; border: 0; background: var(--paper); color: var(--ink);
  width: min(1000px, calc(100vw - 48px)); max-width: none;
  height: min(700px, calc(100dvh - 48px)); max-height: none;
  border-radius: 22px; overflow: hidden;
  box-shadow: 0 40px 90px -24px rgba(6, 28, 34, 0.6), 0 10px 28px rgba(6, 28, 34, 0.28);
}
.detail[open] {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  animation: pop 0.45s var(--ease-out);
}
.detail::backdrop { background: rgba(6, 36, 44, 0.66); animation: fade 0.3s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(18px) scale(0.98); } }
@keyframes fade { from { opacity: 0; } }

.detail-close {
  position: absolute; top: 16px; right: 16px; z-index: 3;
  width: 46px; height: 46px; display: grid; place-items: center;
  background: var(--ink); color: var(--white); border: 2px solid var(--white); border-radius: 50%;
  transition: transform 0.25s var(--ease-out), background-color 0.2s;
}
.detail-close:hover { transform: rotate(90deg); background: var(--teal-deep); }
.detail-media { position: relative; background: var(--c, var(--paper-2)); min-height: 0; }
.detail-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.detail-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.detail-scroll { flex: 1; overflow-y: auto; padding: 64px 40px 28px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; overscroll-behavior: contain; }
.detail h2 { font: 800 clamp(2rem, 3.4vw, 3rem)/1 var(--display); letter-spacing: -0.035em; text-wrap: balance; }
.detail-when { font-weight: 700; font-size: 1.05rem; }
.detail-body { font-size: 1.1rem; max-width: 56ch; text-wrap: pretty; }
.detail-facts {
  width: 100%; margin-top: 8px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px;
  border-top: 2px solid var(--ink);
}
.detail-facts > div { padding: 12px 0; border-bottom: 1px solid var(--line); }
.detail-facts dt { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.detail-facts dd { font-weight: 700; font-size: 1.05rem; }
.detail-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 40px 20px; background: var(--c); border-top: 2px solid var(--ink);
}
.detail-price { font: 800 2.2rem/1 var(--display); letter-spacing: -0.03em; }
.detail-price small { font: 600 0.85rem var(--text); letter-spacing: 0; margin-left: 4px; }
.save-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 24px;
  background: var(--ink); color: var(--white); border: 2px solid var(--ink); border-radius: 999px;
  font-weight: 700; font-size: 1.02rem;
  transition: transform 0.25s var(--ease-out), background-color 0.2s, color 0.2s;
}
.save-btn:hover { transform: translateY(-2px); }
.save-btn[aria-pressed="true"] { background: var(--white); color: var(--ink); }
.save-btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; box-shadow: 0 0 0 3px var(--white); }

/* ---------- Responsive ---------- */
@media (max-width: 1099px) {
  .controls { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto; }
  .controls-title { grid-column: 1 / -1; padding-bottom: 0; }
  .row {
    grid-template-columns: 92px 160px minmax(0, 1fr) 120px;
    grid-template-areas: "date thumb info price" "date thumb facts price";
    gap: 8px 24px;
  }
  .date-chip { grid-area: date; }
  .thumb { grid-area: thumb; }
  .info { grid-area: info; justify-content: flex-end; }
  .facts { grid-area: facts; flex-direction: row; flex-wrap: wrap; gap: 4px 20px; justify-content: flex-start; }
  .facts > div:nth-child(3) { display: none; }
  .price-col { grid-area: price; }
  .date-chip .dn { font-size: 2.8rem; }
}

@media (min-width: 1100px) {
  .controls { position: sticky; top: 0; z-index: 10; }
}

@media (max-width: 759px) {
  .header-note { display: none; }
  .hero-top { grid-template-columns: 1fr; }
  .hero-photo { display: none; }
  .hero-copy { gap: 18px; padding-bottom: 28px; }
  .ruler-head h2 { font-size: 1.05rem; }

  .controls { grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 22px; }
  .controls-title, .field-search { grid-column: 1 / -1; }
  .saved-toggle { grid-column: 1 / -1; }

  .row {
    grid-template-columns: 72px minmax(0, 1fr);
    grid-template-areas: "thumb thumb" "date info" "date facts" "date price";
    gap: 10px 14px; padding: 18px 0 22px;
  }
  .thumb { grid-area: thumb; min-height: 0; aspect-ratio: 16 / 9; margin-bottom: 4px; }
  .info { justify-content: flex-start; }
  .facts > div:nth-child(3) { display: block; }
  .date-chip { grid-area: date; align-self: start; padding: 8px 4px; }
  .date-chip .dn { font-size: 2.1rem; margin: 2px 0; }
  .date-chip .wd, .date-chip .mo { font-size: 0.7rem; }
  .info { grid-area: info; }
  .title { font-size: 1.6rem; }
  .facts { display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px 18px; grid-area: facts; }
  .price-col { grid-area: price; flex-direction: row; align-items: center; justify-content: space-between; text-align: left; }
  .price { font-size: 1.8rem; }

  /* Detail becomes a full-screen sheet */
  .detail { width: 100vw; height: 100dvh; border-radius: 0; }
  .detail[open] { grid-template-columns: 1fr; grid-template-rows: minmax(150px, 30dvh) minmax(0, 1fr); animation-name: sheet; }
  @keyframes sheet { from { opacity: 0; transform: translateY(40px); } }
  .detail-scroll { padding: 22px 20px 20px; }
  .detail-actions { padding: 14px 20px calc(16px + env(safe-area-inset-bottom)); }
  .detail-price { font-size: 1.8rem; }
  .save-btn { padding: 0 18px; }
}

@media (min-width: 760px) and (max-width: 1099px) {
  .detail { width: min(860px, calc(100vw - 32px)); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
}
