:root {
  --bg: #111109;
  --bg-elev: #1A1914;
  --panel: #22211B;
  --line: #2E2C24;
  --text: #F4F1E8;
  --muted: #A39E8F;
  --accent: #D6FF4B;
  --accent-ink: #14140C;
  --accent-hover: #E4FF7A;
  --focus: #D6FF4B;
  --danger: #F5A89A;
  --font-display: "Syne", system-ui, sans-serif;
  --font-body: "Fraunces", Georgia, serif;
  --radius: 4px;
  --ease: ease-in-out;
  --ease-out: ease-out;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 50% at 100% -10%, rgba(214, 255, 75, 0.08), transparent 55%),
    radial-gradient(ellipse 60% 40% at -10% 80%, rgba(214, 255, 75, 0.04), transparent 50%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
img { max-width: 100%; display: block; }
button, input { font: inherit; }
kbd {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--bg-elev);
  color: var(--muted);
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}
.skip {
  position: absolute; left: -999px; top: 8px;
  background: var(--accent); color: var(--accent-ink);
  padding: 8px 16px; z-index: 100;
}
.skip:focus { left: 8px; }

.wrap {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}
@media (min-width: 768px) {
  .wrap { padding-left: 64px; padding-right: 64px; }
}

.muted { color: var(--muted); }

/* Sticky context bar */
.context-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(17, 17, 9, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: none;
}
.context-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 24px;
}
@media (min-width: 768px) {
  .context-inner { padding-left: 64px; padding-right: 64px; }
}
.progress {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.progress li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.progress li span {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 11px;
}
.progress li.is-active { color: var(--text); }
.progress li.is-active span {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.progress li.is-done { color: var(--accent); }
.progress li.is-done span {
  border-color: var(--accent);
  color: var(--accent);
}

.context-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.save-status {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  min-width: 72px;
  text-align: right;
}
.save-status.is-saving { color: var(--text); }
.save-status.is-saved { color: var(--accent); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease);
}
.icon-btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
@media (hover: hover) {
  .icon-btn:hover { background: var(--panel); border-color: #4A473A; }
  .icon-btn:active { background: #1F1E18; }
}
.kbd-hint { border: 0; background: transparent; color: var(--muted); padding: 0; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}
.mark {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
}
@media (hover: hover) { .mark:hover { color: var(--accent); } }
.mark:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.top-meta {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero {
  padding: 64px 0 48px;
  display: grid;
  gap: 32px;
}
@media (min-width: 900px) {
  .hero {
    padding: 64px 0;
    grid-template-columns: 1.2fr 0.8fr;
    align-items: end;
    gap: 64px;
  }
}
.eyebrow {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  max-width: 12ch;
}
@media (min-width: 768px) { h1 { font-size: 60px; } }
.lede {
  margin: 24px 0 0;
  font-size: 20px;
  line-height: 1.45;
  color: var(--muted);
  max-width: 36ch;
}
.hero-aside {
  border: 1px solid var(--line);
  background: var(--bg-elev);
  padding: 24px;
  border-radius: var(--radius);
}
.hero-aside p { margin: 0; font-size: 16px; color: var(--muted); }
.hero-aside strong {
  display: block;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}
.hero-mail { margin-top: 16px !important; }
.hero-aside a { color: var(--accent); font-weight: 600; text-decoration: none; }
@media (hover: hover) { .hero-aside a:hover { text-decoration: underline; } }
.hero-aside a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.sticky-tools {
  position: sticky;
  top: 52px;
  z-index: 30;
  background: rgba(17, 17, 9, 0.94);
}
.search-wrap { flex: 1; min-width: 200px; }
.search-wrap input {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
}
.search-wrap input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 12px 20px;
  cursor: pointer;
  transition: background-color 160ms var(--ease), border-color 160ms var(--ease), color 160ms var(--ease);
}
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}
@media (hover: hover) {
  .btn-primary:hover { background: var(--accent-hover); }
  .btn-primary:active { filter: brightness(0.92); }
  .btn-ghost:hover { background: var(--bg-elev); border-color: #4A473A; }
  .btn-ghost:active { background: #1F1E18; }
}
.badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
}

.layout {
  display: grid;
  gap: 32px;
  padding-bottom: 96px;
}
@media (min-width: 1024px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 48px;
    align-items: start;
  }
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0 24px;
}
.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.section-head span {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.grid {
  display: grid;
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0;
}
@media (min-width: 640px) {
  .grid { grid-template-columns: 1fr 1fr; gap: 24px; }
}

.card {
  position: relative;
  display: grid;
  grid-template-rows: 160px auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: inherit;
  opacity: 0;
  transform: translateY(12px);
}
@media (min-width: 1024px) {
  .card { grid-template-rows: 200px auto; }
}
.card.is-in {
  opacity: 1;
  transform: none;
  transition: opacity 320ms var(--ease-out), transform 320ms var(--ease-out), border-color 180ms var(--ease), background-color 180ms var(--ease);
}
.card:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
@media (hover: hover) {
  .card:hover {
    border-color: #4A473A;
    background: #28261F;
  }
}

.card-visual {
  position: relative;
  overflow: hidden;
  background: #0C0C0A;
}
.card-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.72;
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
}
@media (hover: hover) {
  .card:hover .card-visual img {
    opacity: 0.9;
    transform: scale(1.02);
  }
}
.card-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(17, 17, 9, 0.75) 100%);
  pointer-events: none;
}
.card-num {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 1;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: rgba(17, 17, 9, 0.72);
  padding: 4px 8px;
  border-radius: 2px;
}

/* Hover-reveal action bar — always interactive; only fade on fine hover devices */
.card-actions {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  opacity: 1;
  transform: none;
}
@media (hover: hover) and (pointer: fine) {
  .card-actions {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 180ms var(--ease), transform 180ms var(--ease);
  }
  .card:hover .card-actions,
  .card:focus-within .card-actions {
    opacity: 1;
    transform: none;
  }
}
.card-actions .btn {
  padding: 8px 12px;
  font-size: 12px;
  background: rgba(17, 17, 9, 0.88);
  border-color: var(--line);
  color: var(--text);
}
.card-actions .btn-accent {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.card-body { padding: 24px; display: grid; gap: 12px; }
.card-body h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.card-body p {
  margin: 0;
  font-size: 16px;
  color: var(--muted);
  max-width: 36ch;
}
.card-link {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
}
.card-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Skeletons */
.skeleton-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}
@media (min-width: 640px) {
  .skeleton-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
}
.skeleton-card {
  height: 280px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(90deg, var(--panel) 25%, #2A2820 37%, var(--panel) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

[hidden] { display: none !important; }

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: left;
  background: var(--bg-elev);
}
.empty-state h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 20px;
}
.empty-state p { margin: 0 0 24px; color: var(--muted); max-width: 40ch; }
.empty-compact { padding: 24px; margin-top: 8px; }

.load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 32px 0 0;
}
.load-more-wrap[hidden] { display: none; }

.shortlist-panel {
  position: sticky;
  top: 120px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  border-radius: var(--radius);
  padding: 24px;
}
.shortlist-head h2 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.shortlist-head p { margin: 0 0 16px; font-size: 14px; }
.shortlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  min-height: 8px;
}
.shortlist-item {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  gap: 8px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  cursor: grab;
  transition: border-color 160ms var(--ease), transform 160ms var(--ease), box-shadow 160ms var(--ease);
}
.shortlist-item.is-dragging {
  opacity: 0.85;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transform: scale(1.02);
  cursor: grabbing;
}
.shortlist-item.is-drop-target {
  border-color: var(--accent);
}
.drag-handle {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  user-select: none;
}
.shortlist-item input {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  border-bottom: 1px solid transparent;
}
.shortlist-item input:focus-visible {
  outline: none;
  border-bottom-color: var(--accent);
}
.shortlist-item .meta {
  grid-column: 2 / -1;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-display);
}
.shortlist-item .remove {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
  font-size: 16px;
}
@media (hover: hover) {
  .shortlist-item .remove:hover { color: var(--danger); }
}
.shortlist-item .remove:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.shortlist-foot { margin-top: 16px; }
.shortlist-foot .btn { width: 100%; }

footer {
  border-top: 1px solid var(--line);
  padding: 48px 0 64px;
}
footer .row {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  justify-content: space-between;
  align-items: center;
}
footer p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  max-width: 40ch;
}

/* Hover preview */
.preview-portal {
  position: fixed;
  z-index: 50;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
  filter: drop-shadow(0 16px 40px rgba(0, 0, 0, 0.45));
}
.preview-frame-wrap {
  position: relative;
  height: 220px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}
.preview-frame-wrap iframe {
  width: 200%;
  height: 200%;
  border: 0;
  transform: scale(0.5);
  transform-origin: top left;
  opacity: 0;
  transition: opacity 200ms var(--ease);
}
.preview-frame-wrap iframe.is-ready { opacity: 1; }
.preview-skeleton {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--panel) 25%, #2A2820 37%, var(--panel) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}
.preview-skeleton.is-hidden { display: none; }
.preview-caption {
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Overlays */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(8, 8, 5, 0.72);
  display: grid;
  place-items: start center;
  padding: 12vh 16px 16px;
}
.overlay[hidden] { display: none; }
.palette, .sheet {
  width: min(560px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.palette input {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  margin-bottom: 8px;
}
.palette input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
#palette-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow: auto;
}
#palette-list li button {
  width: 100%;
  text-align: left;
  padding: 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 14px;
}
#palette-list li button[aria-selected="true"],
#palette-list li button:hover {
  background: var(--panel);
}
#palette-list .hint { color: var(--muted); font-size: 12px; }
.palette-hint {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--font-display);
}
.sheet h2 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: 24px;
}
.shortcut-list {
  margin: 0 0 24px;
  display: grid;
  gap: 12px;
}
.shortcut-list > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}
.shortcut-list dt { margin: 0; display: flex; gap: 4px; }
.shortcut-list dd { margin: 0; color: var(--muted); font-size: 14px; }

.tooltip {
  position: fixed;
  z-index: 70;
  padding: 6px 10px;
  background: var(--text);
  color: var(--bg);
  font-family: var(--font-display);
  font-size: 12px;
  border-radius: 2px;
  pointer-events: none;
  max-width: 220px;
}

.toast-region {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 32px));
}
.toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  animation: toast-in 200ms var(--ease-out);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.toast button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 600;
  cursor: pointer;
  padding: 4px;
}
.toast button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

@media (max-width: 1023px) {
  .shortlist-panel { position: static; }
  .preview-portal { display: none !important; }
}
