/* Forma — kiln-window programme.
   Signature: arch-topped frames (the kiln window / doorway) for every photograph,
   a category colour pulled from each photo, and a mono-labelled "ticket stub" date. */

:root {
  --paper: #f5efe4;
  --paper-2: #ece3d1;
  --field: #fbf8f2;
  --ink: #221d17;
  --muted: #5b5246;
  --rule: rgba(34, 29, 23, 0.22);
  --terra: #b3441f;
  --terra-dark: #8f3416;
  --on-terra: #ffffff;

  --c-baking: #d9a877;
  --c-ceramics: #b8ccdd;
  --c-floristry: #f6c453;
  --c-painting: #9ed3d0;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --gutter: clamp(20px, 4vw, 56px);
  --max: 1360px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
}
body.modal-open { overflow: hidden; }
img { display: block; max-width: 100%; }
h1, h2, h3, p, dl, dd, ol { margin: 0; padding: 0; }
ol { list-style: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

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

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 4px;
}
.skip:focus { top: 12px; }

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

/* ---------- header ---------- */
.site-head {
  max-width: var(--max); margin: 0 auto;
  padding: 22px var(--gutter);
  display: flex; align-items: center; gap: 24px;
}
.wordmark {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--serif); font-size: 30px; line-height: 1; letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none; font-weight: 600;
}
.head-note {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); margin-left: auto;
}
.head-link {
  color: var(--ink); font-weight: 600; font-size: 15px;
  text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1.5px;
  padding: 10px 0;
}
.head-link:hover { color: var(--terra); }

/* ---------- hero ---------- */
.hero {
  max-width: var(--max); margin: 0 auto;
  padding: 24px var(--gutter) 56px;
  display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr);
  gap: clamp(32px, 5vw, 80px); align-items: end;
}
.hero-copy { padding-bottom: 8px; }
.eyebrow {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--terra-dark); margin-bottom: 22px;
}
h1 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(46px, 6vw, 92px); line-height: 0.98; letter-spacing: -0.025em;
  text-wrap: balance;
}
h1 em { font-style: italic; color: var(--terra); }
.lede { font-size: 19px; line-height: 1.55; max-width: 34em; margin: 26px 0 32px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 26px; border-radius: 4px;
  font-weight: 600; font-size: 16px; text-decoration: none;
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn-primary { background: var(--terra); border-color: var(--terra); color: var(--on-terra); }
.btn-primary:hover { background: var(--terra-dark); border-color: var(--terra-dark); }
.btn-ghost:hover { background: var(--ink); color: var(--paper); }

.arches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(8px, 1.2vw, 16px); align-items: end; }
.arch {
  display: flex; flex-direction: column; gap: 10px;
  background: none; border: 0; padding: 0; text-align: left; color: var(--ink);
}
.arch:nth-child(1) .arch-frame { height: clamp(150px, 31vw, 440px); }
.arch:nth-child(2) .arch-frame { height: clamp(130px, 25vw, 350px); }
.arch:nth-child(3) .arch-frame { height: clamp(140px, 28vw, 395px); }
.arch:nth-child(4) .arch-frame { height: clamp(120px, 22vw, 310px); }
.arch-frame {
  display: block; width: 100%; overflow: hidden; position: relative;
  border-radius: 999px 999px 0 0; background: var(--cat);
  outline-offset: 0;
}
.arch-frame img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.arch:hover .arch-frame img { transform: scale(1.05); }
.arch-label { display: flex; flex-direction: column; border-top: 5px solid var(--cat); padding-top: 8px; }
.arch-name { font-family: var(--serif); font-size: 19px; line-height: 1.1; font-weight: 600; }
.arch-count { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: 0.04em; }
.arch[aria-pressed="true"] .arch-label { border-top-width: 5px; border-top-color: var(--ink); }
.arch[aria-pressed="true"] .arch-name { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }
.arch:focus-visible { outline: none; }
.arch:focus-visible .arch-frame { outline: 3px solid var(--ink); outline-offset: 3px; }

/* ---------- programme ---------- */
.programme { max-width: var(--max); margin: 0 auto; padding: 24px var(--gutter) 96px; scroll-margin-top: 8px; }
.prog-head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 24px; }
h2 { font-family: var(--serif); font-weight: 500; font-size: clamp(34px, 4vw, 52px); line-height: 1; letter-spacing: -0.02em; }
.prog-sub { color: var(--muted); max-width: 34em; }

.toolbar {
  display: grid; grid-template-columns: minmax(0, 1fr) 260px auto; gap: 16px; align-items: end;
  padding: 20px 0; border-top: 2px solid var(--ink);
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.field input, .field select {
  height: 52px; width: 100%; padding: 0 14px;
  border: 1.5px solid var(--ink); border-radius: 4px; background: var(--field);
  font-size: 16px;
}
.field select {
  appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%23221d17' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.field input { -webkit-appearance: none; appearance: none; }
.field input::-webkit-search-cancel-button { cursor: pointer; }
.field input::placeholder { color: #6a6054; }

.saved-toggle {
  height: 52px; display: inline-flex; align-items: center; gap: 10px; padding: 0 18px;
  border: 1.5px solid var(--ink); border-radius: 4px; background: var(--field); font-weight: 600; font-size: 16px;
  transition: background-color .15s, color .15s;
}
.saved-toggle svg { color: var(--terra); }
.saved-toggle .count {
  min-width: 26px; height: 26px; padding: 0 7px; border-radius: 999px; display: inline-grid; place-items: center;
  font-family: var(--mono); font-size: 13px; background: var(--paper-2); color: var(--ink);
}
.saved-toggle:hover { background: var(--paper-2); }
.saved-toggle[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.saved-toggle[aria-pressed="true"] svg { color: var(--c-floristry); }
.saved-toggle[aria-pressed="true"] .count { background: var(--paper); color: var(--ink); }

.results-bar {
  display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap;
  padding: 0 0 14px; min-height: 40px;
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.04em; color: var(--muted);
}
.shortlist-total { color: var(--ink); }
.link-btn {
  background: none; border: 0; padding: 8px 0; margin-left: auto; font-size: 14px; font-weight: 600; color: var(--terra-dark);
  text-decoration: underline; text-underline-offset: 4px; font-family: var(--sans); letter-spacing: 0;
}
.link-btn:hover { color: var(--ink); }

/* ---------- rows ---------- */
.list { border-bottom: 2px solid var(--ink); }
.item {
  display: grid;
  grid-template-columns: 88px 112px minmax(0, 1fr) 210px 168px;
  column-gap: 32px; align-items: center;
  padding: 28px 12px; border-top: 1px solid var(--rule);
  transition: background-color .15s;
}
.item:first-child { border-top-color: var(--ink); }
.item:hover { background: var(--paper-2); }

.stub {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  border-top: 6px solid var(--cat); padding-top: 8px; width: 88px;
}
.stub .mon, .stub .dow { font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.stub .day { font-family: var(--serif); font-size: 56px; line-height: 0.95; font-weight: 500; letter-spacing: -0.03em; }

.thumb { width: 112px; height: 142px; border-radius: 999px 999px 0 0; background: var(--cat); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

.main { min-width: 0; }
.chip {
  display: inline-block; font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--cat); color: var(--ink); padding: 3px 11px; border-radius: 999px; margin-bottom: 10px;
}
h3.title { font-family: var(--serif); font-weight: 500; font-size: clamp(28px, 2.6vw, 38px); line-height: 1.05; letter-spacing: -0.015em; margin-bottom: 8px; }
.summary { color: var(--muted); max-width: 40em; font-size: 16.5px; }

.facts { display: grid; gap: 2px; font-size: 15px; }
.facts .price { font-family: var(--serif); font-size: 34px; line-height: 1; font-weight: 500; margin-bottom: 6px; }
.facts .line { color: var(--muted); }
.facts .line b { color: var(--ink); font-weight: 600; }

.actions { display: grid; gap: 10px; }
.btn-open { min-height: 48px; padding: 0 18px; }
.btn-open:hover { background: var(--ink); color: var(--paper); }
.quick-save {
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: transparent; border: 0; border-radius: 4px; font-weight: 600; font-size: 15px; color: var(--ink);
  text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1.5px;
}
.quick-save svg { color: var(--terra); }
.quick-save svg path { fill: none; }
.quick-save[aria-pressed="true"] svg path { fill: currentColor; }
.quick-save:hover { color: var(--terra-dark); }

/* ---------- empty / error ---------- */
.empty { padding: 72px 0 56px; text-align: center; display: grid; justify-items: center; gap: 12px; border-bottom: 2px solid var(--ink); }
.empty svg { color: var(--terra); }
.empty h3 { font-family: var(--serif); font-weight: 500; font-size: 36px; line-height: 1.1; }
.empty p { color: var(--muted); max-width: 30em; margin-bottom: 12px; }
.load-error { padding: 32px 0; color: var(--terra-dark); font-weight: 600; }

/* ---------- footer ---------- */
.site-foot { background: var(--ink); color: var(--paper); }
.site-foot {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(28px, 6vw, 96px); align-items: end;
  padding: 72px max(var(--gutter), calc((100vw - var(--max)) / 2 + var(--gutter))) 0;
}
.foot-img { height: clamp(220px, 28vw, 380px); border-radius: 999px 999px 0 0; overflow: hidden; }
.foot-img img { width: 100%; height: 100%; object-fit: cover; }
.foot-copy { padding-bottom: 56px; display: grid; gap: 14px; max-width: 34em; }
.foot-mark { font-family: var(--serif); font-size: clamp(48px, 7vw, 96px); line-height: 0.95; letter-spacing: -0.03em; }
.foot-copy .fine { font-size: 14px; color: #cfc6b6; }

/* ---------- detail dialog ---------- */
.detail {
  padding: 0; border: 0; background: var(--paper); color: var(--ink);
  width: min(1040px, calc(100vw - 48px)); max-width: none; max-height: calc(100dvh - 48px);
  overflow: auto; border-radius: 6px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}
.detail::backdrop { background: rgba(34, 29, 23, 0.6); }
.detail[open] { display: block; animation: rise .22s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.d-bar {
  position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 16px 12px 24px; background: var(--paper); border-bottom: 1px solid var(--rule);
}
.d-kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.close-btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 16px;
  background: var(--ink); color: var(--paper); border: 0; border-radius: 4px; font-weight: 600; font-size: 15px;
}
.close-btn:hover { background: var(--terra-dark); }
.close-btn:focus-visible { outline-color: var(--terra); }

.d-body { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
.d-media { background: var(--cat); padding: 40px 40px 0; display: flex; align-items: flex-end; }
.d-arch { width: 100%; height: min(520px, 62vh); border-radius: 999px 999px 0 0; overflow: hidden; background: var(--paper-2); }
.d-arch img { width: 100%; height: 100%; object-fit: cover; }
.d-info { padding: 36px 40px 40px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.d-info h2 { font-size: clamp(36px, 4vw, 54px); }
.d-body-text { font-size: 19px; line-height: 1.6; max-width: 32em; }
.d-facts { border-top: 2px solid var(--ink); }
.d-facts div { display: grid; grid-template-columns: 120px 1fr; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--rule); }
.d-facts dt { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding-top: 3px; }
.d-facts dd { font-size: 17px; }
.d-facts dd.big { font-family: var(--serif); font-size: 30px; line-height: 1.1; }
.d-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 4px; }
.save-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 54px; padding: 0 26px;
  border-radius: 4px; border: 1.5px solid var(--terra); background: var(--terra); color: var(--on-terra); font-weight: 600; font-size: 16px;
  transition: background-color .15s, color .15s;
}
.save-btn svg path { fill: none; }
.save-btn:hover { background: var(--terra-dark); border-color: var(--terra-dark); }
.save-btn[aria-pressed="true"] { background: transparent; color: var(--terra-dark); }
.save-btn[aria-pressed="true"] svg path { fill: currentColor; }
.save-btn[aria-pressed="true"]:hover { background: var(--paper-2); color: var(--terra-dark); border-color: var(--terra-dark); }
.save-status { font-family: var(--mono); font-size: 13px; color: var(--muted); }

/* ---------- tablet ---------- */
@media (max-width: 1100px) {
  .item { grid-template-columns: 80px 96px minmax(0, 1fr) 160px; row-gap: 18px; column-gap: 24px; }
  .stub { width: 80px; }
  .thumb { width: 96px; height: 124px; }
  .actions { grid-column: 3 / -1; grid-row: 2; grid-template-columns: auto auto; justify-content: start; gap: 16px; }
  .toolbar { grid-template-columns: minmax(0, 1fr) 220px auto; }
}

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-bottom: 40px; }
  .arches { order: 2; }
  .head-note { display: none; }
  .head-link { margin-left: auto; }
  .d-body { grid-template-columns: 1fr; }
  .d-media { padding: 24px 24px 0; }
  .d-arch { height: 260px; }
  .d-info { padding: 28px 24px 32px; }
}

/* ---------- mobile ---------- */
@media (max-width: 720px) {
  body { font-size: 16px; }
  .site-head { padding-top: 16px; padding-bottom: 8px; }
  .wordmark { font-size: 26px; }
  .hero { padding-top: 12px; gap: 28px; }
  .eyebrow { font-size: 11.5px; margin-bottom: 16px; }
  .lede { font-size: 17px; margin: 18px 0 24px; }
  .hero-copy .btn { width: 100%; }
  .arches { gap: 8px; }
  .arch-name { font-size: 16px; }
  .arch-count { font-size: 11.5px; }

  .programme { padding-bottom: 64px; }
  .toolbar { grid-template-columns: 1fr; gap: 14px; }
  .saved-toggle { justify-content: center; width: 100%; }

  .item {
    grid-template-columns: 62px minmax(0, 1fr) 76px; column-gap: 16px; row-gap: 16px;
    padding: 24px 0; align-items: start;
  }
  .stub { width: 62px; grid-column: 1; grid-row: 1; }
  .stub .day { font-size: 42px; }
  .main { grid-column: 2; grid-row: 1; }
  .thumb { grid-column: 3; grid-row: 1; width: 76px; height: 100px; }
  .facts { grid-column: 1 / -1; grid-row: 2; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
  .facts .price { font-size: 30px; margin: 0; }
  .actions { grid-column: 1 / -1; grid-row: 3; grid-template-columns: 1fr 1fr; gap: 10px; }
  .btn-open { min-height: 48px; }
  .quick-save { min-height: 48px; border: 1.5px solid var(--rule); text-decoration: none; }
  .quick-save[aria-pressed="true"] { border-color: var(--terra); }
  h3.title { font-size: 28px; }

  .site-foot { grid-template-columns: 1fr; padding-top: 48px; gap: 32px; }
  .foot-img { order: 2; height: 240px; }
  .foot-copy { padding-bottom: 0; }

  .detail {
    width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; margin: 0;
  }
  .d-bar { padding: 8px 12px 8px 20px; }
  .d-facts div { grid-template-columns: 96px 1fr; }
  .d-actions { flex-direction: column; align-items: stretch; }
  .save-btn { width: 100%; }
  .save-status { text-align: center; min-height: 1.2em; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .arch:hover .arch-frame img { transform: none; }
}
