:root {
  --bg-core: #0c0020;
  --fg: #f4f4f4;
  --muted: #cbd5e1;
  --line: rgba(255, 255, 255, 0.15);
  --font-display: Outfit, system-ui, sans-serif;
  --font-body: Trispace, ui-monospace, monospace;
  --radius: 24px;
  --tilt-x: 0deg;
  --tilt-y: 0deg;
  color-scheme: dark;
  background: radial-gradient(45.83% 70.9% at 50% 50%, var(--bg-core) 0%, #000 100%);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  padding: 80px 10vw 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
  color: var(--fg);
  font-family: var(--font-body);
}

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

.top { width: 100%; max-width: 1200px; display: flex; flex-direction: column; gap: 16px; }
.back { align-self: flex-start; color: #c4b5fd; text-decoration: none; font-size: 14px; letter-spacing: 0.04em; }
.back:hover, .back:focus-visible { color: #fff; }
.top h1 { font-size: 48px; line-height: 1.1; }
.lede { font-size: 16px; font-weight: 300; line-height: 1.5; color: var(--muted); max-width: 560px; }

main { width: 100%; max-width: 1200px; }

.grid > li { display: flex; }

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

.card {
  --accent: #a855f7;
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 16px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),
    color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--fg);
  text-decoration: none;
  transform: perspective(900px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) translateY(0);
  transition: transform 200ms ease-out, box-shadow 300ms;
}
.card:hover, .card:focus-visible {
  transform: perspective(900px) rotateX(var(--tilt-x)) rotateY(var(--tilt-y)) translateY(-4px);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45);
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 500ms;
  pointer-events: none;
  background: radial-gradient(600px circle at var(--mouse-x) var(--mouse-y), rgba(255, 255, 255, 0.08), transparent 40%);
}
.card:hover::before { opacity: 1; }
.card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  border-radius: 12px;
  background: #0f1117;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.card h2 { font-size: 24px; padding: 0 8px; }
.card p { font-size: 14px; font-weight: 300; line-height: 1.4; color: var(--muted); padding: 0 8px; }

.empty { color: #9ca3af; font-weight: 300; }

.enter { opacity: 0; transform: translateY(12px); animation: rise 500ms ease-out forwards; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes rise { to { opacity: 1; transform: none; } }

@media (max-width: 768px) {
  body { padding: 40px 24px 40px; gap: 32px; }
  .top h1 { font-size: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  .card, .card:hover, .card:focus-visible { transform: none; }
  .card:hover { transform: translateY(-4px); }
  .enter { animation: none; opacity: 1; transform: none; }
}

/* ---------- Preview sheet ---------- */
.sheet {
  border: 0;
  padding: 0;
  background: transparent;
  width: min(100%, 760px);
  max-width: 100%;
  max-height: 85vh;
  margin: auto auto 0;
  color: var(--fg);
}
.sheet::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); }
.sheet[open] { animation: sheet-up 300ms cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.sheet-inner {
  position: relative;
  max-height: 85vh;
  overflow-y: auto;
  background: #14101f;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  clip-path: inset(0 round var(--radius) var(--radius) 0 0);
}
.sheet-handle { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 2; margin: 0; width: 40px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.3); }
.sheet-close, .lb-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.5);
  color: var(--fg);
  font-size: 16px;
  cursor: pointer;
}
.sheet-heroBtn { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.sheet-hero { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 630; object-fit: cover; }
.sheet-body { padding: 24px 28px 32px; display: flex; flex-direction: column; gap: 16px; }
.sheet-icon { width: 56px; height: 56px; border-radius: 14px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); }
.sheet-icon[hidden] { display: none; }
.sheet-kind { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: #c4b5fd; }
.sheet-body h2 { font-size: 32px; line-height: 1.1; }
.prose { font-size: 16px; font-weight: 300; line-height: 1.55; color: var(--muted); display: flex; flex-direction: column; gap: 12px; }
.prose[hidden] { display: none; }
.prose p { margin: 0; }
.prose h3, .prose h4, .prose h5 { font-family: var(--font-display); font-weight: 700; color: var(--fg); margin: 8px 0 0; }
.prose h3 { font-size: 22px; } .prose h4 { font-size: 18px; } .prose h5 { font-size: 16px; }
.prose a { color: #c4b5fd; }
.prose code { background: rgba(255, 255, 255, 0.08); padding: 1px 6px; border-radius: 4px; font-size: 14px; }
.prose ul { margin: 0; padding-left: 20px; }
.prose figure { margin: 4px 0; }
.prose img { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); cursor: zoom-in; }
.prose figcaption { font-size: 13px; color: #9ca3af; margin-top: 6px; }
.gallery {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  list-style: none;
  margin: 0 -28px;
  padding: 4px 28px;
}
.gallery:empty { display: none; }
.gallery li { flex: 0 0 240px; scroll-snap-align: start; }
.gallery button { display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #0f1117; cursor: zoom-in; }
.gallery img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.sheet-more { align-self: flex-start; background: none; border: 0; padding: 0; color: #e9d5ff; font: inherit; font-weight: 500; cursor: pointer; border-bottom: 1px solid currentColor; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.sheet-actions a {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: transform 200ms, border-color 200ms;
}
.sheet-actions a:hover, .sheet-actions a:focus-visible { transform: translateY(-2px); border-color: #fff; }
.sheet-actions a.primary { background: var(--accent, #a855f7); border-color: transparent; }

/* ---------- Lightbox ---------- */
.lightbox { border: 0; padding: 0; background: transparent; width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; color: var(--fg); }
.lightbox::backdrop { background: rgba(0, 0, 0, 0.92); }
.lb-figure { margin: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 48px 72px; }
.lb-figure img { max-width: 100%; max-height: calc(100vh - 140px); object-fit: contain; border-radius: 8px; }
.lb-figure figcaption { font-size: 14px; color: var(--muted); text-align: center; }
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.5);
  color: var(--fg);
  font-size: 24px;
  cursor: pointer;
}
.lb-prev { left: 14px; } .lb-next { right: 14px; }
.lb-nav[hidden] { display: none; }

@media (max-width: 768px) {
  .sheet { width: 100%; }
  .sheet-body { padding: 20px 20px 28px; }
  .gallery { margin: 0 -20px; padding: 4px 20px; }
  .lb-figure { padding: 48px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .sheet[open] { animation: none; }
}
