/* ============================================================
   Forma — the sample wall
   Visual world: a working studio's specimen shelf — glaze
   tiles, paint chips, dried botanicals, proofed loaves — each
   workshop rendered as a labeled sample pulled off the bench.
   ============================================================ */

:root {
  /* paper + ink */
  --paper: #e7e1d3;
  --paper-deep: #dbd3bf;
  --paper-panel: #efeadd;
  --ink: #241f18;
  --ink-soft: #5a5346;
  --ink-faint: #625b4c;
  --line: #c7bda3;

  /* material inks, one per craft */
  --c-baking: #a8451f;
  --c-baking-tint: #f0ded2;
  --c-ceramics: #375659;
  --c-ceramics-tint: #d9e3e2;
  --c-floristry: #4c5e28;
  --c-floristry-tint: #dfe4cd;
  --c-painting: #313a72;
  --c-painting-tint: #dcdcec;

  --accent: var(--c-baking);

  --radius-s: 3px;
  --radius-m: 8px;
  --shadow-tile: 0 1px 2px rgba(36, 31, 24, 0.12), 0 10px 24px -14px rgba(36, 31, 24, 0.4);
  --shadow-tile-hover: 0 2px 4px rgba(36, 31, 24, 0.14), 0 20px 34px -16px rgba(36, 31, 24, 0.45);
  --shadow-panel: -18px 0 44px -18px rgba(20, 16, 10, 0.4);

  --font-display: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Noto Serif', serif;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', ui-monospace, 'Menlo', Consolas, 'Liberation Mono', monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

button, input, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

::selection {
  background: var(--c-baking);
  color: var(--paper-panel);
}

* {
  caret-color: var(--c-painting);
}

::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}
::-webkit-scrollbar-track {
  background: var(--paper);
}
::-webkit-scrollbar-thumb {
  background-color: var(--line);
  border-radius: 8px;
  border: 3px solid var(--paper);
}
html {
  scrollbar-color: var(--line) var(--paper);
  scrollbar-width: thin;
}

:focus {
  outline: none;
}
:focus-visible {
  outline: 3px solid var(--c-painting);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.75em 1.25em;
  z-index: 100;
  border-radius: 0 0 6px 0;
}
.skip-link:focus {
  left: 0;
}

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

/* ---------------- header ---------------- */

.site-header {
  padding: 2rem clamp(1.25rem, 4vw, 3.5rem) 0.5rem;
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.9rem;
  letter-spacing: -0.02em;
}

.tagline {
  margin-top: 0.4rem;
  max-width: 46ch;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

/* ---------------- hero ---------------- */

.hero {
  position: relative;
  margin: 1.25rem clamp(1.25rem, 4vw, 3.5rem) 0;
  border-radius: var(--radius-m);
  overflow: hidden;
  height: clamp(220px, 32vw, 360px);
  isolation: isolate;
}

.hero-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 62%;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(24, 19, 13, 0.82) 0%, rgba(24, 19, 13, 0.55) 42%, rgba(24, 19, 13, 0.12) 75%);
}

.hero-copy {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.85rem;
  padding: 1.5rem clamp(1.5rem, 5vw, 3rem);
  max-width: 40rem;
}

.hero-copy h1 {
  color: #f4efe3;
  font-size: clamp(1.7rem, 3.4vw, 2.6rem);
  line-height: 1.08;
}

.hero-copy p {
  color: #e4dccb;
  max-width: 38ch;
  font-size: 1.02rem;
}

/* ---------------- intake bar ---------------- */

.intake {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 1rem;
  margin: 1.75rem clamp(1.25rem, 4vw, 3.5rem) 0;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--line);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.field-search {
  flex: 1 1 260px;
  min-width: 220px;
}

#search-input {
  background: var(--paper-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 0.62rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  color: var(--ink);
}

#search-input::placeholder {
  color: var(--ink-faint);
}

#search-input:focus-visible {
  outline-offset: 1px;
}

.field-filter {
  flex: 0 0 auto;
}

#category-filter {
  appearance: none;
  background: var(--paper-panel) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%23241f18' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat right 0.85rem center;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 0.62rem 2.2rem 0.62rem 0.85rem;
  font-size: 0.92rem;
  min-width: 12rem;
}

.saved-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 0.62rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-soft);
  transition: background-color 0.15s var(--ease-out), color 0.15s var(--ease-out), border-color 0.15s var(--ease-out);
}

.saved-toggle .icon-bookmark {
  width: 12px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.saved-toggle:hover {
  border-color: var(--ink-soft);
  color: var(--ink);
}

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

.saved-toggle[aria-pressed="true"] .icon-bookmark {
  fill: var(--paper-panel);
}

/* ---------------- main / result list ---------------- */

main {
  padding: 0 clamp(1.25rem, 4vw, 3.5rem) 4rem;
}

.result-count {
  margin: 1.25rem 0 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-faint);
  letter-spacing: 0.01em;
}

.specimen-wall {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 2.25rem 1.75rem;
}

.tile {
  position: relative;
  background: var(--paper-panel);
  border-radius: var(--radius-m);
  overflow: hidden;
  box-shadow: var(--shadow-tile);
  transition: transform 0.22s var(--ease-out), box-shadow 0.22s var(--ease-out);
  display: flex;
  flex-direction: column;
}

.tile:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-tile-hover);
}

.tile-media {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-m) var(--radius-m) 0 0;
  overflow: hidden;
}

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

.tile-tab {
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #fbf7ee;
  border-radius: 2px;
  box-shadow: 0 3px 8px rgba(20, 16, 10, 0.35);
  transform: rotate(-1.5deg);
}

.tile-saved-mark {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper-panel);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(20, 16, 10, 0.4);
}

.tile-saved-mark svg {
  width: 13px;
  height: 16px;
  fill: var(--c-baking);
}

.cat-baking { background: var(--c-baking); }
.cat-ceramics { background: var(--c-ceramics); }
.cat-floristry { background: var(--c-floristry); }
.cat-painting { background: var(--c-painting); }

.tile-body {
  padding: 1.1rem 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  flex: 1;
}

.tile-title {
  font-size: 1.2rem;
  line-height: 1.25;
}

.tile-meta {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

.tile-instructor {
  font-size: 0.8rem;
  color: var(--ink-faint);
}

.tile-footer {
  margin-top: auto;
  padding-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-top: 1px solid var(--paper-deep);
}

.tile-price {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
  font-weight: 700;
}

.tile-seats {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
}

.open-item-btn {
  margin-left: auto;
  background: none;
  border: none;
  padding: 0.4rem 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  border-bottom: 1.5px solid var(--ink);
  transition: color 0.15s var(--ease-out), border-color 0.15s var(--ease-out);
}

.open-item-btn:hover {
  color: var(--c-baking);
  border-color: var(--c-baking);
}

/* ---------------- empty state ---------------- */

.empty-state {
  margin: 3rem auto 0;
  max-width: 32rem;
  text-align: center;
  padding: 2.5rem 1.5rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-m);
}

.empty-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
}

.empty-subtitle {
  margin-top: 0.5rem;
  color: var(--ink-soft);
}

.empty-state button {
  margin-top: 1.25rem;
  background: var(--ink);
  color: var(--paper-panel);
  border: none;
  border-radius: var(--radius-s);
  padding: 0.65rem 1.25rem;
  font-weight: 700;
  font-size: 0.9rem;
}

.empty-state button:hover {
  background: var(--c-baking);
}

/* ---------------- footer ---------------- */

.site-footer {
  padding: 2rem clamp(1.25rem, 4vw, 3.5rem) 3rem;
  color: var(--ink-faint);
  font-size: 0.8rem;
  border-top: 1px solid var(--line);
}

/* ---------------- scrim + detail panel ---------------- */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 10, 0.45);
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
  z-index: 40;
}

.scrim.open {
  opacity: 1;
}

.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 100vw);
  background: var(--paper-panel);
  box-shadow: var(--shadow-panel);
  z-index: 50;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.38s var(--ease-out);
}

.detail-panel.open {
  transform: translateX(0);
}

.detail-inner {
  display: flex;
  flex-direction: column;
}

.detail-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
}

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

.detail-media .tile-tab {
  top: 1.1rem;
  left: 1.1rem;
  font-size: 0.72rem;
}

.close-detail-btn {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(24, 19, 13, 0.55);
  border: none;
  border-radius: 50%;
  color: #fbf7ee;
  transition: background-color 0.15s var(--ease-out);
}

.close-detail-btn:hover {
  background: var(--c-baking);
}

.close-detail-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.detail-content {
  padding: 1.75rem clamp(1.5rem, 4vw, 2.5rem) 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.detail-title {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  line-height: 1.1;
}

.detail-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem 1.5rem;
  margin: 0;
  padding: 1.1rem 1.25rem;
  background: var(--paper);
  border-radius: var(--radius-m);
  border: 1px solid var(--paper-deep);
}

.detail-facts div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.detail-facts dt {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

.detail-facts dd {
  margin: 0;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.98rem;
  font-weight: 600;
}

.detail-body {
  max-width: 68ch;
  font-size: 1.02rem;
  color: var(--ink-soft);
  line-height: 1.65;
}

.save-toggle {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--ink);
  color: var(--paper-panel);
  border: none;
  border-radius: var(--radius-s);
  padding: 0.75rem 1.35rem;
  font-size: 0.95rem;
  font-weight: 700;
  transition: background-color 0.15s var(--ease-out), transform 0.15s var(--ease-out);
}

.save-toggle .icon-bookmark {
  width: 13px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.save-toggle:hover {
  transform: translateY(-1px);
}

.save-toggle[aria-pressed="true"] {
  background: var(--c-baking);
}

.save-toggle[aria-pressed="true"] .icon-bookmark {
  fill: currentColor;
}

/* ---------------- responsive ---------------- */

@media (max-width: 640px) {
  .site-header {
    padding: 1.5rem 1.25rem 0.25rem;
  }

  .hero {
    margin: 1rem 1.25rem 0;
    height: 260px;
  }

  .intake {
    margin: 1.5rem 1.25rem 0;
    flex-direction: column;
    align-items: stretch;
  }

  .saved-toggle {
    margin-left: 0;
    justify-content: center;
  }

  .field-filter,
  #category-filter {
    width: 100%;
  }

  .specimen-wall {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    width: 100vw;
  }
}

/* ---------------- motion & contrast ---------------- */

@media (prefers-reduced-motion: reduce) {
  .tile,
  .scrim,
  .detail-panel,
  .save-toggle,
  .saved-toggle,
  .open-item-btn,
  .close-detail-btn,
  .empty-state button {
    transition-duration: 0.001ms !important;
  }

  .tile:hover {
    transform: none;
  }
}

@media (prefers-contrast: more) {
  :root {
    --line: #241f18;
    --ink-soft: #241f18;
  }
}
