/* Forma — dark craft-poster theme */

:root {
  --ink: #14110f;
  --ink-raised: #1a1613;
  --surface: #1e1914;
  --surface-2: #262019;
  --hairline: rgba(245, 239, 230, 0.14);
  --hairline-strong: rgba(245, 239, 230, 0.24);
  --text: #f5efe6;
  --text-muted: #b3a794;
  --text-faint: #857a68;
  --accent: #e2793c;
  --accent-strong: #f2a35f;
  --accent-ink: #1a1108;
  --focus: #ffd166;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --font-display: "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, Consolas, monospace;
  --shadow-panel: 0 24px 60px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 {
  font-family: var(--font-display);
  margin: 0;
}

p {
  margin: 0;
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  z-index: 200;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 12px;
}

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

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 18px clamp(20px, 4vw, 56px);
  background: rgba(20, 17, 15, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent-strong);
}

.brand-mark {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.02em;
  color: var(--text);
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  display: none;
}

@media (min-width: 640px) {
  .brand-tag {
    display: block;
  }
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: 380px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border-bottom: 1px solid var(--hairline);
}

.hero-media {
  position: absolute;
  inset: 0;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.85) contrast(1.05);
}

.hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    rgba(10, 9, 7, 0.97) 0%,
    rgba(10, 9, 7, 0.94) 48%,
    rgba(10, 9, 7, 0.72) 68%,
    rgba(10, 9, 7, 0.45) 100%
  );
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: 48px clamp(20px, 4vw, 56px) 44px;
  max-width: 620px;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-strong);
  margin-bottom: 14px;
}

.hero-title {
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--text);
}

.hero-sub {
  margin-top: 18px;
  font-size: 17px;
  line-height: 1.6;
  color: #cfc3b0;
  max-width: 48ch;
}

.hero-stats {
  display: flex;
  gap: 28px;
  margin: 28px 0 0;
}

.hero-stat dt {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.hero-stat dd {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  color: var(--accent-strong);
}

/* ---------- Controls ---------- */

.controls {
  padding: 28px clamp(20px, 4vw, 56px) 0;
  max-width: 1280px;
  margin: 0 auto;
}

.control-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

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

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.icon-search {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--text-faint);
  pointer-events: none;
}

#search-input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 40px;
  background: var(--ink-raised);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
}

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

#search-input:focus-visible {
  border-color: var(--accent);
}

.field-filter {
  flex: 0 1 200px;
}

#filter-select {
  height: 44px;
  padding: 0 36px 0 14px;
  background: var(--ink-raised)
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M6 9l6 6 6-6" fill="none" stroke="%23b3a794" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>')
    no-repeat right 12px center;
  background-size: 16px;
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 15px;
  appearance: none;
  -webkit-appearance: none;
}

.toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  background: var(--ink-raised);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.toggle-btn .icon-star {
  width: 16px;
  height: 16px;
}

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

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

.toggle-btn:hover {
  border-color: var(--accent);
}

.result-count {
  margin: 14px 2px 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}

/* ---------- Items grid ---------- */

.items-section {
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px clamp(20px, 4vw, 56px) 80px;
}

.items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
}

.item-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.item-card:hover {
  border-color: var(--hairline-strong);
}

.item-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--ink-raised);
}

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

.item-category {
  position: absolute;
  left: 12px;
  top: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  background: rgba(20, 17, 15, 0.72);
  border: 1px solid var(--hairline-strong);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  backdrop-filter: blur(4px);
}

.quick-save {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 17, 15, 0.72);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  backdrop-filter: blur(4px);
}

.quick-save .icon-star {
  width: 17px;
  height: 17px;
}

.quick-save[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

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

.item-content {
  padding: 16px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.item-title {
  font-size: 18px;
}

.item-open {
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 19px;
  color: var(--text);
  line-height: 1.25;
}

.item-open:hover {
  color: var(--accent-strong);
}

.item-meta {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-strong);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.item-instructor {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 4px;
}

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

.empty-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-muted);
}

.empty-icon {
  width: 48px;
  height: 48px;
  color: var(--text-faint);
  margin-bottom: 16px;
}

.empty-state p {
  font-size: 16px;
  margin-bottom: 18px;
}

#reset-filters {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  min-height: 44px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 14px;
}

#reset-filters:hover {
  background: var(--accent-strong);
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--hairline);
  padding: 22px clamp(20px, 4vw, 56px);
}

.site-footer p {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
}

/* ---------- Detail panel ---------- */

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(8, 7, 6, 0.72);
  z-index: 90;
}

.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(480px, 100vw);
  background: var(--ink);
  border-left: 1px solid var(--hairline-strong);
  box-shadow: var(--shadow-panel);
  z-index: 100;
  overflow-y: auto;
}

.detail-panel-inner {
  position: relative;
  min-height: 100%;
  padding-bottom: 40px;
}

.close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 17, 15, 0.72);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  backdrop-filter: blur(4px);
}

.close-btn:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.close-btn svg {
  width: 18px;
  height: 18px;
}

.detail-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--ink-raised);
}

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

.detail-category {
  position: absolute;
  left: 20px;
  bottom: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  background: rgba(20, 17, 15, 0.78);
  border: 1px solid var(--hairline-strong);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
}

.detail-body {
  padding: 26px 28px 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#detail-title {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.15;
}

.detail-instructor {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-strong);
  margin-top: -8px;
}

.detail-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  padding: 16px 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  margin: 0;
}

.detail-meta div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-meta dt {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.detail-meta dd {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.detail-desc {
  font-size: 15.5px;
  line-height: 1.65;
  color: var(--text-muted);
}

.save-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 50px;
  padding: 0 24px;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 15px;
  margin-top: 4px;
}

.save-btn .icon-star {
  width: 18px;
  height: 18px;
}

.save-btn[aria-pressed="true"] {
  background: var(--ink-raised);
  color: var(--accent-strong);
  border: 1px solid var(--accent);
}

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

.save-btn:hover {
  background: var(--accent-strong);
}

.save-btn[aria-pressed="true"]:hover {
  background: var(--surface-2);
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  .detail-panel {
    animation: slide-in 0.28s ease;
  }
  .scrim {
    animation: fade-in 0.2s ease;
  }
  .item-card {
    transition: border-color 0.2s ease, transform 0.15s ease;
  }
  .item-card:hover {
    transform: translateY(-2px);
  }
}

@keyframes slide-in {
  from {
    transform: translateX(24px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

body.detail-open {
  overflow: hidden;
}

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  .hero {
    min-height: 320px;
  }

  .hero-content {
    padding: 32px 20px 32px;
  }

  .hero-stats {
    gap: 20px;
  }

  .control-bar {
    flex-direction: column;
    align-items: stretch;
  }

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

  .toggle-btn {
    justify-content: center;
  }

  .items {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    width: 100vw;
  }

  .detail-body {
    padding: 22px 20px 8px;
  }
}
