/* Forma - in-person creative workshops
   Palette: cool paper + ink + a single cobalt accent.
   Shape lock: pills for buttons/chips/inputs-select, 16px radius for cards/dialog/images. */

:root {
  --ink: #16171b;
  --ink-soft: #52555c;
  --paper: #f1f2f4;
  --surface: #ffffff;
  --line: #dfe0e4;
  --accent: #2c46c7;
  --accent-strong: #1f34a0;
  --accent-ink: #ffffff;
  --accent-soft: #e7ebfb;

  --radius-container: 16px;
  --radius-pill: 999px;
  --radius-input: 10px;

  --font-display: "Avenir Next", "Century Gothic", Futura, "Segoe UI",
    ui-sans-serif, system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;

  --shadow-card: 0 1px 2px rgba(22, 23, 27, 0.06), 0 10px 24px -16px rgba(22, 23, 27, 0.28);
  --shadow-dialog: 0 24px 64px -20px rgba(15, 16, 20, 0.45);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #edeef1;
    --ink-soft: #b0b3ba;
    --paper: #131418;
    --surface: #1b1c22;
    --line: #2c2e36;
    --accent: #7c93ff;
    --accent-strong: #93a5ff;
    --accent-ink: #0d1120;
    --accent-soft: #1c2340;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 24px -16px rgba(0, 0, 0, 0.6);
    --shadow-dialog: 0 24px 64px -20px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  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;
  color: var(--ink);
}

p {
  margin: 0;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 12px 18px;
  border-radius: 0 0 var(--radius-input) 0;
  z-index: 100;
  font-weight: 600;
}

.skip-link:focus {
  left: 0;
}

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

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.header-inner {
  display: flex;
  align-items: baseline;
  gap: 12px;
  height: 68px;
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.brand-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  transform: translateY(-2px);
}

.header-tag {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .header-tag {
    display: none;
  }
}

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

.hero {
  padding: 56px 0 64px;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
}

.hero-copy h1 {
  font-size: clamp(2rem, 3.4vw, 2.75rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
}

.hero-sub {
  margin-top: 18px;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.55;
  max-width: 46ch;
}

.hero-copy .btn {
  margin-top: 28px;
}

.hero-media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-container);
  box-shadow: var(--shadow-card);
}

@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .hero-copy h1 {
    max-width: none;
  }

  .hero-media {
    order: -1;
  }

  .hero-media img {
    aspect-ratio: 16 / 9;
  }
}

/* ---------- Buttons & chips ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-pill);
  padding: 12px 22px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

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

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}

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

.btn-outline {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
  width: 100%;
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.chip-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  padding: 9px 16px 9px 12px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.chip-toggle .icon-bookmark {
  width: 16px;
  height: 16px;
}

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

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

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

/* ---------- Focus ---------- */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Catalog ---------- */

.catalog {
  padding: 8px 0 96px;
}

.catalog-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.catalog-header h2 {
  font-size: 1.6rem;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 16px;
  margin-bottom: 8px;
}

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

.field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.field input,
.field select {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  padding: 11px 14px;
  height: 46px;
}

.field input::placeholder {
  color: var(--ink-soft);
}

.field input:focus-visible,
.field select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
    linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 20px) center, calc(100% - 15px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 36px;
}

@media (max-width: 640px) {
  .toolbar {
    grid-template-columns: 1fr;
  }
}

.result-count {
  min-height: 1.4em;
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: 16px 0 20px;
}

/* ---------- Grid & cards ---------- */

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-container);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card:hover {
  transform: translateY(-3px);
}

.card-media {
  position: relative;
  aspect-ratio: 4 / 3;
}

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

.card-saved-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
}

.card-body {
  padding: 18px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.tag {
  align-self: flex-start;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
}

.card-title {
  font-size: 1.15rem;
  line-height: 1.3;
  margin-top: 2px;
}

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

.card .btn-outline {
  margin-top: 10px;
}

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

.empty-state {
  text-align: center;
  padding: 64px 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-container);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty-state[hidden] {
  display: none;
}

.empty-state h3 {
  font-size: 1.2rem;
}

.empty-state p {
  color: var(--ink-soft);
  max-width: 40ch;
}

.empty-state .btn {
  margin-top: 10px;
}

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

.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
}

.footer-inner p {
  color: var(--ink-soft);
  font-size: 0.9rem;
}

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

dialog#detail-dialog {
  border: none;
  border-radius: var(--radius-container);
  padding: 0;
  width: min(640px, calc(100vw - 32px));
  max-height: min(88vh, 860px);
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-dialog);
}

dialog#detail-dialog[open] {
  display: flex;
  flex-direction: column;
  animation: dialog-in 0.2s ease-out;
}

dialog#detail-dialog::backdrop {
  background: rgba(15, 16, 20, 0.55);
  animation: backdrop-in 0.2s ease-out;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

.dialog-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}

.dialog-close svg {
  width: 16px;
  height: 16px;
}

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

#detail-content {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.detail-media {
  aspect-ratio: 16 / 9;
}

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

.detail-body {
  padding: 24px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-body h2 {
  font-size: 1.55rem;
  line-height: 1.2;
  margin-top: 4px;
}

.detail-instructor {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.detail-copy {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 60ch;
  margin-top: 4px;
}

.detail-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 10px 0 4px;
  padding: 0;
}

.fact {
  background: var(--paper);
  border-radius: var(--radius-input);
  padding: 12px 14px;
}

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

.fact dd {
  margin: 4px 0 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.save-toggle {
  margin-top: 8px;
  align-self: flex-start;
}

@media (max-width: 640px) {
  .detail-facts {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail-body {
    padding: 20px 20px 24px;
  }

  .save-toggle {
    width: 100%;
  }
}

/* ---------- Screen-reader only ---------- */

.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;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  html {
    scroll-behavior: auto;
  }
}
