:root {
  --paper: #fbf6f1;
  --surface: #ffffff;
  --ink: #1a1512;
  --muted: #8a807a;
  --line: rgba(26, 21, 18, 0.1);
  --line-strong: rgba(26, 21, 18, 0.2);
  --pill: #17130f;
  --accent: #ff5f9a;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(80, 40, 30, 0.05), 0 14px 34px rgba(120, 70, 50, 0.08);
  --shadow-hover: 0 4px 10px rgba(80, 40, 30, 0.08), 0 26px 60px rgba(120, 70, 50, 0.16);
  --display: "Inter Tight", -apple-system, BlinkMacSystemFont, sans-serif;
  --body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --cat-live: #16a34a;
  --cat-dev: #e0842b;
  --cat-research: #8b5cf6;
  --ease: cubic-bezier(0.22, 0.9, 0.24, 1);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* warm ambient background (fixed) — glow in the corners, paper in the middle for readability */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(56% 42% at 90% -5%, rgba(255, 140, 90, 0.34), transparent 60%),
    radial-gradient(48% 40% at 10% 2%, rgba(255, 90, 150, 0.2), transparent 62%),
    radial-gradient(68% 52% at 50% 106%, rgba(185, 140, 255, 0.26), transparent 66%);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: 0.2; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 28px; width: 100%; }
main.wrap { flex: 1 0 auto; }
.grad-text { background: linear-gradient(92deg, #ff8a4c, #ff4d8d 46%, #b98cff); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- header hero (warm, organic) ---------- */
.site-header { border-bottom: 1px solid var(--line); padding: 40px 0 30px; }
/* slim variant for pages that only carry a back link (detail, guide) */
.site-header--bar { padding: 14px 0; }
.site-header--bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.site-header--bar .links { margin: 0; padding: 0; flex-wrap: wrap; justify-content: flex-end; }
.site-header h1 { margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(30px, 5vw, 46px); letter-spacing: -0.03em; line-height: 1; }
.tagline { margin: 10px 0 0; color: #55504b; font-size: 16px; }
.back { color: var(--muted); text-decoration: none; font-family: var(--display); font-weight: 600; font-size: 14px; }
.back:hover { color: var(--ink); }

main.wrap { padding-top: 34px; padding-bottom: 40px; }
.status { color: var(--muted); }

/* ---------- hub toolbar (search + filter + sort) ---------- */
.hub-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px 20px; flex-wrap: wrap; margin-bottom: 34px; }
.hub-search-wrap { position: relative; flex: 1 1 260px; min-width: 200px; max-width: 420px; }
.hub-search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 17px; pointer-events: none; }
.hub-search {
  width: 100%; font: inherit; font-size: 15px; color: var(--ink);
  padding: 11px 14px 11px 38px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); box-shadow: var(--shadow);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.hub-search::placeholder { color: var(--muted); }
.hub-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 95, 154, 0.16); }
.hub-search::-webkit-search-cancel-button { cursor: pointer; }
.hub-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hub-filters { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(26, 21, 18, 0.05); border: 1px solid var(--line); }
.hub-chip {
  font-family: var(--display); font-weight: 600; font-size: 13px; color: var(--muted);
  padding: 6px 14px; border-radius: 999px; border: 0; background: transparent; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.hub-chip:hover { color: var(--ink); }
.hub-chip.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(80, 40, 30, 0.12); }
.hub-sort {
  font-family: var(--display); font-weight: 600; font-size: 13px; color: var(--ink); cursor: pointer;
  padding: 8px 34px 8px 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface);
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a807a' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.hub-sort:focus { outline: none; border-color: var(--accent); }
.hub-empty { margin: 40px 0; text-align: center; }
@media (max-width: 560px) { .hub-toolbar { flex-direction: column; align-items: stretch; } .hub-search-wrap { max-width: none; } .hub-controls { justify-content: space-between; } }

/* ---------- sections ---------- */
.group { margin-bottom: 52px; }
.group-title { font-family: var(--display); font-weight: 600; font-size: 14px; letter-spacing: 0.01em; color: var(--muted); margin: 0 0 20px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 26px; }

/* ---------- cards (image top, text below) ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease);
}
.card:hover, .card:focus-visible { transform: translateY(-5px); box-shadow: var(--shadow-hover); outline: none; }
.card:focus-visible { border-color: var(--accent); }
.card-hero { position: relative; aspect-ratio: 16 / 10; background-size: cover; background-position: top center; background-color: #efe7df; }
.card-hero.no-image { background: linear-gradient(135deg, #ff8a4c, #ff4d8d 55%, #b98cff); }

.badge {
  position: absolute; top: 12px; left: 12px;
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--display); font-weight: 600; font-size: 12px; letter-spacing: 0.01em;
  color: var(--ink); background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(6px);
  padding: 5px 11px 5px 9px; border-radius: 999px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.badge.live::before { background: var(--cat-live); }
.badge.dev::before { background: var(--cat-dev); }
.badge.research::before { background: var(--cat-research); }

.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font-family: var(--display); font-weight: 600; font-size: 19px; letter-spacing: -0.01em; margin: 0; }
.card-body .tagline { margin: 0; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- buttons (ACA pills) ---------- */
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 6px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-family: var(--display); font-weight: 600; font-size: 13px; text-decoration: none;
  padding: 9px 15px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink); background: transparent;
}
.btn.primary { background: var(--pill); color: #fff; border-color: transparent; }
.btn.amplitude { border-color: var(--accent); color: #d63b7b; }
.btn:hover { filter: brightness(0.97); }
.more-toggle { border-style: dashed; color: var(--muted); }
.more-links { display: none; flex-wrap: wrap; gap: 8px; width: 100%; }
.more-links.open { display: flex; }

/* ---------- detail page ---------- */
.detail { max-width: 1080px; }
.detail-title { font-family: var(--display); font-weight: 700; font-size: clamp(28px, 4vw, 40px); letter-spacing: -0.025em; margin: 10px 0 12px; line-height: 1.02; }
.detail-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.detail-meta .badge { position: static; }
.detail-group { color: var(--muted); font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: 0.02em; }
.detail-tagline { font-size: 18px; color: var(--muted); margin: 0 0 22px; }

/* white cards on the warm background */
.detail-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; }
.detail-head { position: relative; display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; margin-bottom: 24px; }
/* per-project actions (copy link + edit in Linear), bottom-right corner of the header card */
.detail-actions { position: absolute; right: 16px; bottom: 14px; display: flex; gap: 8px; }
.detail-action {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 999px; padding: 0; cursor: pointer;
  color: var(--muted); background: var(--surface); border: 1px solid var(--line);
  transition: color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.detail-action:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.detail-action svg { display: block; }
.detail-copy.copied { color: var(--cat-live); border-color: var(--cat-live); }
.detail-copy.copied:hover { color: var(--cat-live); border-color: var(--cat-live); }
.detail-head-main { min-width: 0; }
.detail-head .detail-title { margin: 0 0 10px; font-size: clamp(24px, 3vw, 34px); }
.detail-head .detail-meta { margin-bottom: 10px; }
.detail-head .detail-tagline { margin: 0; max-width: 68ch; font-size: 16px; }
.detail-head .links { margin: 0; flex: none; justify-content: flex-end; }
@media (max-width: 760px) { .detail-head { flex-direction: column; gap: 16px; } .detail-head .links { justify-content: flex-start; } }
/* gallery + description as equal-height cards; stack when narrow */
.detail-cards { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.85fr); gap: 24px; align-items: stretch; }
.detail-gallery-card, .detail-brief-card { display: flex; flex-direction: column; }
.detail-gallery-card .gallery { margin: 0; }
.detail-card-title { font-family: var(--display); font-weight: 600; font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px; }
.detail-brief-card .detail-body { margin: 0; flex: 1; min-height: 0; overflow-y: auto; }
.detail-empty { color: var(--muted); font-style: italic; margin: 0; }
@media (max-width: 880px) { .detail-cards { grid-template-columns: 1fr; } }
.gallery { margin: 0; }

/* Lightroom-style project strip on the detail page */
/* full-width "liquid glass" filmstrip pinned to the bottom — the page shows through, blurred */
.detail-films {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; align-items: center; gap: 22px;
  padding: 12px 24px;
  background: rgba(251, 246, 241, 0.55);
  backdrop-filter: blur(22px) saturate(1.4);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  border-top: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.05), 0 -16px 44px rgba(120, 70, 50, 0.1);
}
.detail-films-label { flex: none; margin: 0; font-family: var(--display); font-weight: 600; font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.detail-strip { flex: 1; display: flex; gap: 14px; overflow-x: auto; padding: 3px 2px 5px; }
.detail-strip::-webkit-scrollbar { height: 6px; }
.detail-strip::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.film { position: relative; flex: none; width: 116px; aspect-ratio: 16 / 10; margin: 2px 0; border-radius: 8px; overflow: hidden; border: 2px solid rgba(255, 255, 255, 0.7); background: #efe7df; box-shadow: 0 4px 12px rgba(80, 40, 30, 0.14); text-decoration: none; }
.film img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0.94; transition: opacity 0.2s; }
.film:hover img { opacity: 1; }
.film-name { position: absolute; left: 0; right: 0; bottom: 0; font-family: var(--display); font-weight: 600; font-size: 10.5px; color: #fff; padding: 12px 7px 5px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.8)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.film.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 6px 16px rgba(255, 95, 154, 0.3); }
.film.active img { opacity: 1; }

/* leave room so the fixed strip never covers content */
body.has-filmstrip main.wrap { padding-bottom: 130px; }
.gallery-frame { position: relative; }
.gallery-stage { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; aspect-ratio: 16 / 10; }
.stage-media { max-width: 100%; max-height: 100%; display: block; }
img.stage-media, video.stage-media { object-fit: contain; }
video.stage-media { background: #000; }
iframe.stage-embed { width: 100%; height: 100%; border: 0; }
.stage-fallback { display: grid; place-items: center; width: 100%; height: 100%; }

/* asset switch animation: directional slide + fade */
.stage-item { position: absolute; inset: 0; margin: auto; transition: transform 0.45s var(--ease), opacity 0.35s ease; will-change: transform, opacity; }
.stage-item.is-active { opacity: 1; transform: translateX(0) scale(1); }
.stage-item.from-right, .stage-item.to-right { opacity: 0; transform: translateX(42px) scale(0.985); }
.stage-item.from-left, .stage-item.to-left { opacity: 0; transform: translateX(-42px) scale(0.985); }
@media (prefers-reduced-motion: reduce) { .stage-item { transition: none; } }

.nav { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border-radius: 999px; border: 0; cursor: pointer; background: rgba(255,255,255,0.85); backdrop-filter: blur(6px); color: var(--ink); font-size: 22px; display: grid; place-items: center; opacity: 0.9; box-shadow: var(--shadow); transition: background 0.15s ease; }
.gallery-frame:hover .nav { opacity: 1; }
.nav:hover { background: #fff; }
.nav.prev { left: 12px; }
.nav.next { right: 12px; }

.thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.thumb { width: 96px; height: 62px; padding: 0; border-radius: 8px; overflow: hidden; border: 2px solid transparent; background: #efe7df; cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.active { border-color: var(--accent); }
.thumb-video { display: grid; place-items: center; background: #17130f; color: #fff; }
.thumb-video .play { font-size: 16px; }

.detail-body { font-size: 16px; }
.detail-body p { margin: 0 0 14px; }
.detail-body ul { margin: 0 0 14px; padding-left: 20px; }
.detail-body li { margin: 4px 0; }
.detail-body a { color: #d63b7b; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 1000; background: rgba(20, 12, 10, 0.94); display: none; align-items: center; justify-content: center; }
.lightbox.open { display: flex; }
.lb-content { width: 94vw; height: 90vh; display: flex; align-items: center; justify-content: center; }
.lb-media { width: 100%; height: 100%; object-fit: contain; display: block; }
iframe.lb-media { width: 100%; height: 100%; border: 0; }
.lb-close { position: absolute; top: 14px; right: 22px; background: none; border: 0; color: #fff; font-size: 40px; line-height: 1; cursor: pointer; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: none; border: 0; color: #fff; font-size: 52px; line-height: 1; cursor: pointer; padding: 8px 18px; opacity: 0.85; }
.lb-nav:hover { opacity: 1; }
.lb-prev { left: 8px; }
.lb-next { right: 8px; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 18px; padding-bottom: 18px; color: var(--muted); font-size: 13px; }
.sync-btn { font: inherit; font-family: var(--display); font-weight: 600; font-size: 13px; color: var(--ink); cursor: pointer; background: transparent; border: 1px solid var(--line-strong); border-radius: 999px; padding: 7px 15px; }
.sync-btn:hover:not(:disabled) { background: var(--surface); border-color: var(--ink); }
.sync-btn:disabled { opacity: 0.7; cursor: default; }
.footer-nav { display: flex; align-items: center; gap: 16px; }
.footer-nav a { color: var(--muted); text-decoration: none; font-family: var(--display); font-weight: 600; }
.footer-nav a:hover { color: var(--ink); }

/* ---------- guide page ---------- */
.guide { max-width: 1000px; }
.guide h1 { font-family: var(--display); font-weight: 700; font-size: 32px; letter-spacing: -0.025em; margin: 8px 0 12px; }
.guide-intro { font-size: 17px; color: var(--muted); margin: 0 0 36px; max-width: 720px; }
.step { margin: 0 0 40px; }
.step h2 { font-family: var(--display); font-size: 19px; margin: 0 0 10px; display: flex; align-items: center; gap: 10px; }
.step-num { display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: 999px; background: linear-gradient(135deg, #ff8a4c, #ff4d8d); color: #fff; font-size: 14px; font-weight: 700; }
.step p { margin: 0 0 14px; }
.guide code { background: rgba(0,0,0,0.05); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; font-size: 0.9em; }
.step.has-shot { display: grid; grid-template-columns: 1fr minmax(0, 440px); gap: 32px; align-items: center; }
.step.has-shot .step-text p { margin-bottom: 0; }
.guide-shot { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); background: var(--surface); }
.guide-shot img { width: 100%; display: block; }
.guide-fields { margin: 0 0 14px; padding-left: 20px; }
.guide-fields li { margin: 6px 0; }
.guide-optional { color: var(--muted); font-size: 14px; }
.guide-done { margin-top: 28px; padding: 14px 18px; border-radius: 12px; background: rgba(255, 95, 154, 0.08); border: 1px solid rgba(255, 95, 154, 0.28); font-family: var(--display); font-weight: 600; }
@media (max-width: 820px) { .step.has-shot { grid-template-columns: 1fr; gap: 16px; } }
