/* =========================================================
   Forma — Creative Workshops
   Palette: warm cream + deep burgundy/terracotta + craft amber
   Type: serif display (system serif stack) + clean sans body
   ========================================================= */

:root {
  /* Color tokens */
  --bg: #fbf6ee;
  --bg-soft: #f3eada;
  --surface: #ffffff;
  --surface-2: #fffdf9;
  --ink: #2a1a12;
  --ink-soft: #5c4a3d;
  --ink-mute: #8a7563;
  --line: #e7d8c2;
  --line-strong: #d8c3a6;

  --primary: #7c2d12;       /* deep burgundy/terracotta */
  --primary-press: #5a2010;
  --on-primary: #fff8f1;
  --accent: #a16207;       /* craft amber/ochre */
  --accent-soft: #e9c98f;
  --heart: #b4452f;

  --ring: #7c2d12;
  --shadow-sm: 0 1px 2px rgba(60, 32, 12, .08);
  --shadow-md: 0 10px 30px -12px rgba(60, 32, 12, .22);
  --shadow-lg: 0 30px 60px -20px rgba(60, 32, 12, .35);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --maxw: 1200px;

  --font-display: "Iowan Old Style", "Palatino Linotype", "Hoefler Text", Georgia, "Times New Roman", serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px; --space-9: 96px;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

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

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -64px;
  background: var(--primary); color: var(--on-primary);
  padding: 10px 16px; border-radius: var(--radius-sm); z-index: 100;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

.icon { display: inline-block; vertical-align: middle; flex: none; }
.icon-sm { width: 18px; height: 18px; }

.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 10px;
}
.section-title { font-size: clamp(28px, 4vw, 40px); }

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--primary); --btn-fg: var(--on-primary); --btn-bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--btn-bg); color: var(--btn-fg); border: 1px solid var(--btn-bd);
  padding: 12px 20px; border-radius: var(--radius-pill);
  font-weight: 600; font-size: 15px; cursor: pointer;
  transition: transform .15s ease, background-color .15s ease, box-shadow .15s ease, color .15s ease;
  text-decoration: none; min-height: 44px;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn--primary { --btn-bg: var(--primary); --btn-fg: var(--on-primary); }
.btn--primary:hover { background: var(--primary-press); box-shadow: var(--shadow-md); }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--primary); --btn-bd: var(--line-strong); }
.btn--ghost:hover { background: var(--bg-soft); border-color: var(--primary); }
.btn--sm { padding: 9px 16px; min-height: 40px; font-size: 14px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  max-width: var(--maxw); margin: 0 auto; padding: 14px clamp(16px, 4vw, 32px);
  display: flex; align-items: center; gap: 16px; justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--primary); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand__mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: var(--primary); color: var(--on-primary);
  font-family: var(--font-display); font-size: 20px; font-weight: 700;
}
.brand__name { font-family: var(--font-display); font-size: 22px; letter-spacing: .01em; }
.brand--sm { font-size: 15px; }
.brand--sm .brand__mark { width: 28px; height: 28px; font-size: 16px; }
.brand--sm .brand__name { font-size: 17px; }

.site-nav { display: flex; align-items: center; gap: clamp(8px, 2vw, 22px); }
.site-nav__link { color: var(--ink-soft); font-weight: 500; font-size: 15px; padding: 8px 4px; }
.site-nav__link:hover { color: var(--primary); }
.site-nav__saved {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 1px solid var(--line-strong);
  color: var(--ink); padding: 8px 12px; border-radius: var(--radius-pill);
  cursor: pointer; transition: background-color .15s ease, color .15s ease, border-color .15s ease;
  min-height: 40px;
}
.site-nav__saved:hover { border-color: var(--primary); color: var(--primary); }
.site-nav__saved[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.site-nav__saved .icon { color: currentColor; }
.site-nav__saved[aria-pressed="false"] .icon { color: var(--ink-mute); }

.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  background: var(--accent-soft); color: #4a2e07; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 700; line-height: 1;
}
.site-nav__saved[aria-pressed="true"] .badge { background: color-mix(in srgb, var(--on-primary) 22%, transparent); color: var(--on-primary); }
.badge[data-count="0"] { display: none; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; }
.hero__media { position: absolute; inset: 0; }
.hero__media img { width: 100%; height: 100%; object-fit: cover; object-position: center 40%; }
.hero__veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(42,26,18,.62) 0%, rgba(42,26,18,.42) 40%, rgba(42,26,18,.78) 100%);
}
.hero__content {
  position: relative; max-width: var(--maxw); margin: 0 auto;
  padding: clamp(64px, 12vw, 132px) clamp(16px, 4vw, 32px) clamp(48px, 8vw, 88px);
  color: #fff8f1;
}
.hero__eyebrow {
  font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: #f0d9a8; margin: 0 0 14px;
}
.hero__title { font-size: clamp(38px, 6.4vw, 72px); color: #fff8f1; max-width: 16ch; }
.hero__lede { margin: 18px 0 28px; font-size: clamp(17px, 1.6vw, 20px); max-width: 56ch; color: #f3e7d6; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; }
.hero .btn--ghost { --btn-fg: #fff8f1; --btn-bd: rgba(255,248,241,.55); }
.hero .btn--ghost:hover { background: rgba(255,248,241,.12); border-color: #fff8f1; }

/* ---------- Browse ---------- */
.browse { max-width: var(--maxw); margin: 0 auto; padding: clamp(40px, 6vw, 72px) clamp(16px, 4vw, 32px) 0; }
.browse__head { display: flex; flex-direction: column; gap: 24px; margin-bottom: 24px; }

.controls {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-mute); }
.field--search { flex: 1 1 280px; min-width: 220px; }
.field--filter { flex: 0 1 auto; }
.field--saved { flex: 0 0 auto; }
.field__control { position: relative; display: flex; align-items: center; }

.search-box {
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill); padding: 0 16px; gap: 10px;
  min-height: 48px; box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 15%, transparent); }
.search-box .icon { color: var(--ink-mute); }
.search-input {
  border: none; background: transparent; outline: none; width: 100%;
  font-size: 16px; color: var(--ink); padding: 10px 0; min-width: 0;
}
.search-input::placeholder { color: var(--ink-mute); }

.filter-select {
  appearance: none; -webkit-appearance: none;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill); color: var(--ink);
  font-size: 16px; font-weight: 500; padding: 12px 40px 12px 18px;
  min-height: 48px; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.filter-select:hover { border-color: var(--primary); }
.filter-select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 15%, transparent); outline: none; }
.chevron { position: absolute; right: 14px; pointer-events: none; color: var(--ink-mute); }
.field__control > .chevron { right: 16px; }

.toggle {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill); color: var(--ink);
  padding: 0 18px; min-height: 48px; font-weight: 600; font-size: 15px; cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.toggle .icon { color: var(--ink-mute); transition: color .15s ease; }
.toggle:hover { border-color: var(--primary); color: var(--primary); }
.toggle:hover .icon { color: var(--primary); }
.toggle[aria-pressed="true"] {
  background: var(--primary); border-color: var(--primary); color: var(--on-primary);
  box-shadow: var(--shadow-md);
}
.toggle[aria-pressed="true"] .icon { color: var(--on-primary); }

.result-meta { font-size: 14px; color: var(--ink-mute); margin: 4px 0 18px; min-height: 20px; }

/* ---------- Grid / Cards ---------- */
.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: clamp(16px, 2vw, 26px);
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.card {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }

.card__media {
  position: relative; display: block; width: 100%; border: none; padding: 0;
  background: var(--bg-soft); cursor: pointer; aspect-ratio: 4 / 3; overflow: hidden;
}
.card__img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card__media:hover .card__img { transform: scale(1.04); }
.card__category {
  position: absolute; top: 12px; left: 12px;
  background: color-mix(in srgb, var(--primary) 92%, transparent);
  color: var(--on-primary); font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; padding: 6px 12px; border-radius: var(--radius-pill);
  backdrop-filter: blur(2px);
}

.card__body { display: flex; flex-direction: column; gap: 12px; padding: 20px; flex: 1; }
.card__title { font-size: 22px; }
.card__desc { margin: 0; color: var(--ink-soft); font-size: 14.5px; line-height: 1.55; }
.card__facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 4px 0 0; }
.card__facts div { display: flex; flex-direction: column; gap: 1px; }
.card__facts dt { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-mute); }
.card__facts dd { margin: 0; font-size: 14px; font-weight: 500; color: var(--ink); }
.card__foot { margin-top: auto; padding-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card__price { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--primary); }
.card__price::before { content: "$"; font-size: 14px; vertical-align: super; margin-right: 1px; color: var(--accent); }
.card__open { flex: none; }

/* ---------- Empty state ---------- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
  padding: clamp(40px, 8vw, 72px) 24px;
  border: 1px dashed var(--line-strong); border-radius: var(--radius-lg);
  background: var(--surface-2); color: var(--ink-soft);
}
.empty-state__icon { color: var(--accent); margin-bottom: 6px; }
.empty-state__title { font-size: 22px; color: var(--ink); }
.empty-state__text { margin: 0 0 8px; max-width: 44ch; }
.empty-state[hidden] { display: none; }

/* ---------- About ---------- */
.about { max-width: var(--maxw); margin: clamp(64px, 9vw, 112px) auto 0; padding: 0 clamp(16px, 4vw, 32px); }
.about__grid { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: clamp(24px, 4vw, 56px); align-items: center; }
.about__media { border-radius: var(--radius-lg); overflow: hidden; aspect-ratio: 4 / 5; box-shadow: var(--shadow-md); }
.about__media img { width: 100%; height: 100%; object-fit: cover; }
.about__copy p { color: var(--ink-soft); }
.about__copy > p { font-size: 17px; max-width: 52ch; }
.about__steps { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.about__steps li { display: flex; gap: 16px; align-items: flex-start; }
.step__num {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg-soft); color: var(--primary); border: 1px solid var(--line-strong);
  font-family: var(--font-display); font-weight: 700; font-size: 17px;
}
.about__steps h3 { font-size: 17px; margin-bottom: 2px; }
.about__steps p { margin: 0; color: var(--ink-soft); font-size: 14.5px; }

/* ---------- Footer ---------- */
.site-footer { margin-top: clamp(72px, 10vw, 120px); border-top: 1px solid var(--line); background: var(--bg-soft); }
.site-footer__inner { max-width: var(--maxw); margin: 0 auto; padding: 28px clamp(16px, 4vw, 32px); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-footer__note { margin: 0; color: var(--ink-mute); font-size: 13px; }

/* ---------- Detail dialog ---------- */
.dialog { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: clamp(12px, 3vw, 40px); }
.dialog[hidden] { display: none; }
.dialog__backdrop { position: absolute; inset: 0; background: rgba(28, 16, 10, .55); backdrop-filter: blur(3px); animation: fade .2s ease; }
.dialog__panel {
  position: relative; width: min(760px, 100%); max-height: calc(100dvh - 24px);
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
  display: flex; flex-direction: column;
  animation: dialog-in .28s cubic-bezier(.2,.7,.2,1);
}
.dialog__close {
  position: absolute; top: 14px; right: 14px; z-index: 5;
  display: inline-flex; align-items: center; gap: 6px;
  background: color-mix(in srgb, var(--on-primary) 88%, transparent);
  border: 1px solid rgba(0,0,0,.06); color: var(--ink);
  padding: 8px 12px; border-radius: var(--radius-pill); cursor: pointer;
  font-size: 13px; font-weight: 600; min-height: 40px;
  box-shadow: var(--shadow-sm);
  transition: background-color .15s ease, transform .12s ease;
}
.dialog__close:hover { background: #fff; transform: translateY(-1px); }

.dialog__content { overflow-y: auto; }
.detail__hero { position: relative; aspect-ratio: 16 / 9; background: var(--bg-soft); }
.detail__hero img { width: 100%; height: 100%; object-fit: cover; }
.detail__hero .chip { position: absolute; top: 16px; left: 16px; }
.chip {
  display: inline-flex; align-items: center;
  background: color-mix(in srgb, var(--primary) 92%, transparent); color: var(--on-primary);
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 6px 12px; border-radius: var(--radius-pill); backdrop-filter: blur(2px);
}
.detail__body { padding: clamp(20px, 3vw, 32px); }
.detail__title { font-size: clamp(26px, 3.6vw, 38px); }
.detail__instructor { color: var(--accent); font-weight: 600; font-size: 14px; margin: 8px 0 0; }
.detail__lead { color: var(--ink-soft); font-size: 16.5px; margin: 14px 0 22px; max-width: 60ch; }

.detail__facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 24px; }
.detail__facts .f { background: var(--surface-2); padding: 14px 16px; }
.detail__facts .f dt { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-mute); margin: 0 0 4px; }
.detail__facts .f dd { margin: 0; font-weight: 600; font-size: 15px; color: var(--ink); }

.detail__section { margin: 0 0 24px; }
.detail__section h2 { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 0 0 10px; }
.detail__section p { margin: 0; color: var(--ink-soft); }

.detail__actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding-top: 8px; border-top: 1px solid var(--line); }
.detail__price { font-family: var(--font-display); font-size: 30px; font-weight: 700; color: var(--primary); margin-right: auto; }
.detail__price .cur { font-size: 16px; vertical-align: super; color: var(--accent); }

.save-btn {
  display: inline-flex; align-items: center; gap: 10px;
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); border-radius: var(--radius-pill); padding: 0 22px; min-height: 48px;
  font-weight: 600; font-size: 15px; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: background-color .15s ease, color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.save-btn:hover { border-color: var(--heart); color: var(--heart); }
.save-btn .icon { color: var(--ink-mute); transition: color .15s ease; }
.save-btn:hover .icon { color: var(--heart); }
.save-btn[aria-pressed="true"] {
  background: var(--heart); border-color: var(--heart); color: #fff8f1; box-shadow: var(--shadow-md);
}
.save-btn[aria-pressed="true"] .icon { color: #fff8f1; }
.save-btn[aria-pressed="true"]:hover { background: #9a3624; border-color: #9a3624; }

/* ---------- Animations ---------- */
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(.985) } to { opacity: 1; transform: none } }
@keyframes card-in { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }
.card { animation: card-in .3s ease both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .card__media:hover .card__img { transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .about__grid { grid-template-columns: 1fr; }
  .about__media { aspect-ratio: 16 / 10; order: -1; max-width: 520px; }
  .detail__facts { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .site-nav__link { display: none; }
  .site-nav__saved span:not(.badge) { display: none; }
  .site-nav__saved { padding: 8px 10px; }
  .controls { gap: 10px; }
  .field--search { flex-basis: 100%; }
  .field--filter { flex: 1 1 160px; }
  .filter-select { width: 100%; }
  .field--saved { flex: 1 1 100%; }
  .field--saved .toggle { width: 100%; justify-content: center; }
  .grid { grid-template-columns: 1fr; }
  .card__facts { grid-template-columns: 1fr 1fr; }
  .detail__actions { flex-direction: column; align-items: stretch; }
  .detail__price { margin-right: 0; text-align: center; }
  .save-btn, .detail__actions .btn { width: 100%; justify-content: center; }
  .dialog__close span { display: none; }
}
