:root {
  --ink: #201b17;
  --accent: #d5462b;
  --accent-dark: #a8331d;
  --cork-1: #7a5636;
  --cork-2: #5c3f28;

  --paper-ceramics: #d9a877;
  --paper-baking: #f0c94a;
  --paper-floristry: #a3c091;
  --paper-painting: #8fc2da;

  --font-display: "Arial Black", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Courier New", monospace;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  background-color: var(--cork-2);
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.06) 1px, transparent 1.6px),
    radial-gradient(circle at 68% 62%, rgba(0, 0, 0, 0.2) 1px, transparent 1.6px),
    radial-gradient(circle at 42% 82%, rgba(255, 255, 255, 0.05) 1px, transparent 1.6px),
    radial-gradient(circle at 86% 18%, rgba(0, 0, 0, 0.16) 1px, transparent 1.6px);
  background-size: 42px 42px;
}

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

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: #fff;
  color: #000;
  padding: 0.75rem 1rem;
  z-index: 100;
  border-radius: 0 0 6px 0;
}
.skip-link:focus {
  left: 0;
}

/* ---------- Toolbar ---------- */

.toolbar {
  position: relative;
  background:
    linear-gradient(rgba(18, 12, 8, 0.8), rgba(18, 12, 8, 0.8)),
    url("assets/studio.jpg") center 30% / cover;
  color: #fff;
  padding: 1.5rem clamp(1rem, 4vw, 3rem);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  border-bottom: 10px solid var(--cork-1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 480px;
}

.stamp-logo {
  width: 62px;
  height: 62px;
  color: var(--accent);
  flex-shrink: 0;
  transform: rotate(-6deg);
}
.stamp-logo__word {
  font: 900 16px/1 var(--font-display);
  fill: currentColor;
  letter-spacing: 1px;
}
.stamp-logo__sub {
  font: 700 6px/1 var(--font-mono);
  fill: currentColor;
  letter-spacing: 2px;
}

.brand__tagline {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.45;
  color: #f4ede1;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.field label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #f4ede1;
}
.field input,
.field select {
  font: 500 0.95rem var(--font-body);
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  border: 2px solid #fff;
  background: #fff;
  color: var(--ink);
  min-width: 210px;
}
.field input::placeholder {
  color: #6b6259;
}

.board-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #fff;
  color: var(--ink);
  border: 2px solid #fff;
  border-radius: 999px;
  padding: 0.62rem 1.15rem;
  font: 700 0.9rem var(--font-body);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.board-toggle .pin-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  transition: stroke 0.15s ease, fill 0.15s ease;
}
.board-toggle[aria-pressed="true"] {
  background: var(--accent-dark);
  color: #fff;
  border-color: var(--accent-dark);
}
.board-toggle[aria-pressed="true"] .pin-icon {
  stroke: #fff;
  fill: #fff;
}
.board-toggle:hover {
  transform: translateY(-2px);
}
.board-toggle:active {
  transform: translateY(0) scale(0.97);
}
@media (prefers-reduced-motion: reduce) {
  .board-toggle,
  .board-toggle .pin-icon {
    transition: none;
  }
}

/* ---------- Board ---------- */

main {
  padding: 2.5rem clamp(1rem, 4vw, 3rem) 4rem;
  max-width: 1400px;
  margin: 0 auto;
}

.result-count {
  color: #f1e8da;
  font: 700 0.82rem var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 1.5rem;
}

.board {
  list-style: none;
  margin: 0;
  padding: 0;
  column-count: 3;
  column-gap: 2.25rem;
}
@media (max-width: 1080px) {
  .board { column-count: 2; }
}
@media (max-width: 640px) {
  .board { column-count: 1; }
}

.flyer {
  break-inside: avoid;
  margin: 0 0 3rem;
  position: relative;
}

.flyer__pin {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ff9c86, var(--accent) 60%, var(--accent-dark) 100%);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.45);
  z-index: 2;
}
.flyer__pin::after {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
}

.flyer__card {
  position: relative;
  padding: 1.5rem 1.35rem 0;
  box-shadow: 0 10px 20px rgba(15, 9, 5, 0.35);
  border-radius: 2px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
@media (prefers-reduced-motion: reduce) {
  .flyer__card { transition: none; }
}

.flyer:nth-child(6n + 1) .flyer__card { transform: rotate(-2.2deg); }
.flyer:nth-child(6n + 2) .flyer__card { transform: rotate(1.6deg); }
.flyer:nth-child(6n + 3) .flyer__card { transform: rotate(-1deg); }
.flyer:nth-child(6n + 4) .flyer__card { transform: rotate(2deg); }
.flyer:nth-child(6n + 5) .flyer__card { transform: rotate(-1.6deg); }
.flyer:nth-child(6n + 6) .flyer__card { transform: rotate(1.1deg); }

.flyer__card:hover,
.flyer__card:focus-within {
  transform: rotate(0deg) translateY(-6px);
  box-shadow: 0 18px 30px rgba(15, 9, 5, 0.45);
  z-index: 5;
}

.flyer--ceramics .flyer__card { background: var(--paper-ceramics); }
.flyer--baking .flyer__card { background: var(--paper-baking); }
.flyer--floristry .flyer__card { background: var(--paper-floristry); }
.flyer--painting .flyer__card { background: var(--paper-painting); }

.flyer__pinned-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font: 800 0.68rem var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fff;
  background: var(--accent-dark);
  padding: 0.2rem 0.55rem;
  border-radius: 3px;
  margin: 0 0 0.6rem;
}

.flyer__stamp {
  display: inline-block;
  border: 2px solid var(--accent-dark);
  color: var(--accent-dark);
  font: 800 0.68rem var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.55rem;
  border-radius: 3px;
  transform: rotate(-3deg);
  background: #fff;
}

.flyer__photo {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  margin: 1rem 0 0;
  border: 1px solid rgba(0, 0, 0, 0.15);
  filter: saturate(0.95);
}

.flyer__title {
  font: 900 1.45rem/1.15 var(--font-display);
  margin: 0.85rem 0 0.5rem;
  color: var(--ink);
}

.flyer__meta {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  font: 600 0.85rem/1.55 var(--font-mono);
  color: var(--ink);
  display: grid;
  gap: 0.1rem;
}
.flyer__meta .label {
  text-transform: uppercase;
  font-size: 0.78em;
  letter-spacing: 0.04em;
  margin-right: 0.4em;
}

.flyer__tab {
  display: block;
  width: 100%;
  border: none;
  border-top: 2px dashed rgba(32, 27, 23, 0.45);
  background: rgba(255, 255, 255, 0.4);
  color: var(--ink);
  font: 800 0.85rem var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.9rem 0;
  margin-top: 0.35rem;
  cursor: pointer;
  border-radius: 0 0 4px 4px;
}
.flyer__tab:hover {
  background: rgba(255, 255, 255, 0.65);
}
.flyer__tab:active {
  transform: scale(0.98);
}
@media (prefers-reduced-motion: reduce) {
  .flyer__tab { transition: none; }
}

/* ---------- Empty state ---------- */

.empty-state {
  text-align: center;
  color: #f4ede1;
  padding: 4rem 1rem;
  max-width: 480px;
  margin: 0 auto;
}
.empty-state__pin {
  width: 40px;
  height: 40px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  margin-bottom: 1rem;
}
.empty-state__title {
  font: 900 1.4rem var(--font-display);
  margin: 0 0 0.5rem;
  color: #fff;
}
.empty-state__body {
  margin: 0 0 1.5rem;
  line-height: 1.5;
}
#clear-filters {
  background: var(--accent-dark);
  color: #fff;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  font: 700 0.9rem var(--font-body);
  cursor: pointer;
}
#clear-filters:hover {
  filter: brightness(1.08);
}

/* ---------- Detail dialog ---------- */

dialog#detail-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  max-width: 640px;
  width: min(90vw, 640px);
  max-height: 88vh;
  overflow-y: auto;
  background: #faf7f2;
  color: var(--ink);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}
dialog#detail-dialog::backdrop {
  background: rgba(15, 9, 5, 0.68);
}
dialog#detail-dialog[open] {
  animation: pop-in 0.18s ease;
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  dialog#detail-dialog[open] { animation: none; }
}

.detail__header {
  position: relative;
}
.detail__photo {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 14px 14px 0 0;
  display: block;
}
.detail__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: rgba(20, 14, 10, 0.68);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.detail__close:hover {
  background: rgba(20, 14, 10, 0.88);
}
.detail__close svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.4;
  fill: none;
}

.detail__body {
  padding: 1.75rem 1.75rem 2rem;
}

.detail__title {
  font: 900 1.9rem/1.15 var(--font-display);
  margin: 0.85rem 0 0.25rem;
}

.detail__instructor {
  margin: 0 0 1.1rem;
  font: 600 0.95rem var(--font-body);
  color: #5a5148;
}

.detail__meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.9rem 1rem;
  margin: 0 0 1.35rem;
  padding: 1rem;
  background: #fff;
  border-radius: 10px;
  border: 1px dashed rgba(32, 27, 23, 0.28);
}
.detail__meta dt {
  font: 700 0.68rem var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #5a5148;
  margin: 0;
}
.detail__meta dd {
  font: 800 1.02rem var(--font-body);
  margin: 0.2rem 0 0;
}

.detail__description {
  line-height: 1.65;
  margin: 0 0 1.6rem;
  max-width: 60ch;
}

.detail__save {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--accent-dark);
  color: #fff;
  border: 2px solid var(--accent-dark);
  border-radius: 999px;
  padding: 0.85rem 1.5rem;
  font: 800 0.95rem var(--font-body);
  cursor: pointer;
  width: 100%;
  justify-content: center;
}
.detail__save[aria-pressed="true"] {
  background: #fff;
  color: var(--accent-dark);
}
.detail__save svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}
.detail__save[aria-pressed="true"] svg {
  fill: currentColor;
}
.detail__save:hover {
  filter: brightness(1.05);
}
.detail__save:active {
  transform: scale(0.98);
}
@media (prefers-reduced-motion: reduce) {
  .detail__save { transition: none; }
}

/* ---------- Mobile ---------- */

@media (max-width: 700px) {
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .controls {
    flex-direction: column;
    align-items: stretch;
  }
  .field input,
  .field select {
    min-width: 0;
    width: 100%;
  }
  .board-toggle {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  dialog#detail-dialog {
    width: 94vw;
  }
  .detail__title {
    font-size: 1.55rem;
  }
}
