/* Puzzle Archive showcase — design system */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=Outfit:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #0a0e16;
  --bg-2: #0d1320;
  --panel: rgba(18, 26, 40, 0.72);
  --panel-border: rgba(255, 255, 255, 0.07);
  --card: rgba(22, 31, 48, 0.85);
  --card-border: rgba(255, 255, 255, 0.06);
  --accent: #2fe6c0;
  --accent-2: #7c8cf8;
  --accent-glow: rgba(47, 230, 192, 0.35);
  --text: #e8eef6;
  --text-dim: #8190a6;
  --text-faint: #5d6b82;
  --danger: #f87171;
  --radius: 14px;
  --font-display: 'Sora', sans-serif;
  --font-body: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* per-group accent gradients */
  --g-ui: linear-gradient(135deg, #2fe6c0, #38bdf8);
  --g-marketing: linear-gradient(135deg, #fb923c, #f472b6);
  --g-saas-tools: linear-gradient(135deg, #7c8cf8, #38bdf8);
  --g-fullstack: linear-gradient(135deg, #34d399, #a3e635);
  --g-ai-agents: linear-gradient(135deg, #e879f9, #7c8cf8);
  --g-automation: linear-gradient(135deg, #fbbf24, #fb923c);
  --g-case-studies: linear-gradient(135deg, #94a3b8, #38bdf8);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(47, 230, 192, 0.07), transparent 60%),
    radial-gradient(900px 500px at 85% 110%, rgba(124, 140, 248, 0.06), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ---------------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(10, 14, 22, 0.82);
  border-bottom: 1px solid var(--panel-border);
}
.site-header .wrap { display: flex; align-items: center; gap: 14px; height: 60px; }
.wordmark {
  font-family: var(--font-display); font-weight: 800; font-size: 17px;
  color: var(--text); letter-spacing: -0.02em; display: flex; align-items: center; gap: 9px;
}
.wordmark:hover { text-decoration: none; }
.wordmark .glyph { font-size: 20px; }
.header-count { color: var(--text-faint); font-size: 13px; margin-left: auto; }

/* ------------------------------------------------------------------ hero */
.hero { padding: 72px 0 36px; text-align: center; }
.hero h1 {
  font-family: var(--font-display); font-size: clamp(34px, 6vw, 58px);
  font-weight: 800; letter-spacing: -0.03em; line-height: 1.08;
}
.hero h1 .grad {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.sub {
  color: var(--text-dim); font-size: clamp(15px, 2.2vw, 18px);
  max-width: 640px; margin: 18px auto 0; font-weight: 300;
}
.stats {
  display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 36px;
}
.stat {
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: var(--radius); padding: 16px 26px; min-width: 130px;
}
.stat .num {
  font-family: var(--font-display); font-size: 30px; font-weight: 800;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat .lbl { color: var(--text-dim); font-size: 12.5px; letter-spacing: 0.04em; text-transform: uppercase; }

/* ------------------------------------------------------------- featured */
.featured { margin: 44px auto 8px; }
.featured h2, .section-title {
  font-family: var(--font-display); font-size: 15px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim);
  margin-bottom: 16px;
}
.featured-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.featured-card {
  position: relative; border-radius: var(--radius); padding: 18px 16px 16px;
  border: 1px solid var(--card-border); background: var(--card);
  overflow: hidden; transition: transform 0.18s, border-color 0.18s; display: block;
}
.featured-card:hover { transform: translateY(-3px); border-color: var(--accent-glow); text-decoration: none; }
.featured-card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad, var(--g-ui));
}
.featured-card .fc-num { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); }
.featured-card .fc-title { font-family: var(--font-display); font-weight: 700; font-size: 15px; margin: 4px 0 6px; color: var(--text); }
.featured-card .fc-kind { font-size: 12px; color: var(--text-dim); }

/* -------------------------------------------------------------- filters */
.filters { position: sticky; top: 60px; z-index: 40; padding: 14px 0 12px;
  background: linear-gradient(rgba(10,14,22,0.94), rgba(10,14,22,0.86)); backdrop-filter: blur(10px); }
.filter-rows { display: flex; flex-direction: column; gap: 10px; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pill {
  border: 1px solid var(--panel-border); background: var(--panel); color: var(--text-dim);
  border-radius: 999px; padding: 7px 15px; font-size: 13.5px; font-family: var(--font-body);
  cursor: pointer; transition: all 0.15s; user-select: none;
}
.pill:hover { color: var(--text); border-color: var(--accent-glow); }
.pill.active { color: #06251d; background: var(--accent); border-color: var(--accent); font-weight: 600; }
.pill .cnt { opacity: 0.65; font-size: 12px; margin-left: 4px; }
.pill-row .spacer { flex: 1; }
.search-box { position: relative; }
.search-box input {
  background: var(--panel); border: 1px solid var(--panel-border); color: var(--text);
  border-radius: 999px; padding: 8px 16px 8px 38px; font-size: 14px; width: 240px;
  font-family: var(--font-body); outline: none; transition: border-color 0.15s, width 0.2s;
}
.search-box input:focus { border-color: var(--accent-glow); width: 300px; }
.search-box svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); opacity: 0.5; }
.type-toggle { font-size: 13px; }

/* ------------------------------------------------------------------ grid */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px; padding: 20px 0 60px;
}
.card {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.card:hover {
  transform: translateY(-4px); border-color: var(--accent-glow);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4); text-decoration: none;
}
.card .thumb {
  aspect-ratio: 16 / 10; position: relative; overflow: hidden;
  background: var(--bg-2); display: block;
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.thumb-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--grad, var(--g-ui)); opacity: 0.92;
}
.thumb-fallback span {
  font-family: var(--font-display); font-weight: 800; font-size: 44px;
  color: rgba(6, 12, 20, 0.55); letter-spacing: -0.03em;
}
.card .badge-type {
  position: absolute; top: 10px; right: 10px; font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; letter-spacing: 0.05em;
  background: rgba(6, 12, 20, 0.72); color: var(--text); backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.12);
}
.card .badge-type.live { color: var(--accent); }
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-top { display: flex; align-items: baseline; gap: 8px; }
.card-num { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); }
.card-group { font-size: 11.5px; color: var(--text-dim); margin-left: auto; white-space: nowrap; }
.card h3 { font-family: var(--font-display); font-size: 17px; font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.card p { font-size: 13.5px; color: var(--text-dim); font-weight: 300; flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.chip {
  font-size: 11px; padding: 3px 9px; border-radius: 6px; color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--panel-border);
  font-family: var(--font-mono);
}
.empty-state { text-align: center; color: var(--text-dim); padding: 80px 0; grid-column: 1 / -1; }

/* --------------------------------------------------------------- detail */
.detail-top { padding: 34px 0 6px; }
.back-row { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; font-size: 14px; }
.back-row .nav-links { margin-left: auto; display: flex; gap: 14px; color: var(--text-dim); }
.detail-head h1 {
  font-family: var(--font-display); font-size: clamp(26px, 4.5vw, 40px);
  font-weight: 800; letter-spacing: -0.02em; line-height: 1.15;
}
.detail-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 14px; color: var(--text-dim); font-size: 14px; }
.group-tag {
  font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 999px;
  color: #06251d; background: var(--grad, var(--g-ui));
}
.int-badges { display: flex; gap: 7px; flex-wrap: wrap; margin: 4px 0 10px; }
.int-badge {
  font-size: 12px; font-weight: 500; padding: 4px 11px; border-radius: 999px;
  background: rgba(124, 140, 248, 0.12); color: var(--accent-2);
  border: 1px solid rgba(124, 140, 248, 0.25);
}
.note-callout {
  border: 1px solid rgba(251, 191, 36, 0.3); background: rgba(251, 191, 36, 0.07);
  color: #fcd34d; border-radius: 10px; padding: 10px 16px; font-size: 13.5px; margin: 12px 0;
}
.detail-section { margin: 34px 0; }
.detail-section > h2 {
  font-family: var(--font-display); font-size: 14px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 14px;
  display: flex; align-items: center; gap: 12px;
}
.detail-section > h2 .h-actions { margin-left: auto; display: flex; gap: 10px; font-size: 13px; text-transform: none; letter-spacing: 0; font-weight: 500; font-family: var(--font-body); }

.demo-frame-wrap {
  position: relative; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--panel-border); background: #fff; aspect-ratio: 16 / 10;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}
.demo-frame-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }

.graph-shell {
  border: 1px solid var(--panel-border); border-radius: var(--radius);
  background: var(--bg-2); overflow: hidden; position: relative; height: 460px;
}
.graph-shell svg { display: block; width: 100%; height: 100%; cursor: grab; }
.graph-shell svg:active { cursor: grabbing; }
.graph-toolbar {
  position: absolute; bottom: 12px; right: 12px; display: flex; gap: 6px; z-index: 7;
}
.graph-toolbar button {
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--panel-border);
  background: var(--panel); color: var(--text); font-size: 16px; cursor: pointer;
  font-family: var(--font-body);
}
.graph-toolbar button:hover { border-color: var(--accent-glow); }
.wf-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.node-inspector {
  position: absolute; top: 12px; right: 12px; width: min(380px, calc(100% - 24px));
  max-height: calc(100% - 70px); overflow: auto; z-index: 6;
  background: rgba(13, 19, 32, 0.96); border: 1px solid var(--panel-border);
  border-radius: 12px; padding: 14px 16px; display: none;
}
.node-inspector.open { display: block; }
.node-inspector h4 { font-family: var(--font-display); font-size: 14px; margin-bottom: 2px; }
.node-inspector .ni-type { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); margin-bottom: 10px; }
.node-inspector pre {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--text-dim);
  white-space: pre-wrap; word-break: break-word;
}
.node-inspector .ni-close { position: absolute; top: 8px; right: 12px; cursor: pointer; color: var(--text-dim); background: none; border: none; font-size: 16px; }

.doc-panel {
  border: 1px solid var(--panel-border); border-radius: var(--radius);
  background: var(--panel); padding: 26px 30px; overflow-x: auto;
}
.doc-panel.markdown h1, .doc-panel.markdown h2, .doc-panel.markdown h3 {
  font-family: var(--font-display); letter-spacing: -0.01em; margin: 22px 0 10px; line-height: 1.25;
}
.doc-panel.markdown h1 { font-size: 24px; } .doc-panel.markdown h2 { font-size: 19px; } .doc-panel.markdown h3 { font-size: 16px; }
.doc-panel.markdown p, .doc-panel.markdown li { color: var(--text-dim); font-size: 14.5px; }
.doc-panel.markdown ul, .doc-panel.markdown ol { padding-left: 22px; margin: 10px 0; }
.doc-panel.markdown code { font-family: var(--font-mono); font-size: 12.5px; background: rgba(255,255,255,0.06); padding: 1px 6px; border-radius: 5px; }
.doc-panel.markdown pre { background: var(--bg-2); border: 1px solid var(--panel-border); border-radius: 10px; padding: 14px 16px; overflow-x: auto; margin: 12px 0; }
.doc-panel.markdown pre code { background: none; padding: 0; font-size: 12px; color: #b8c5d9; }
.doc-panel.markdown table { border-collapse: collapse; margin: 14px 0; width: 100%; }
.doc-panel.markdown th, .doc-panel.markdown td { border: 1px solid var(--panel-border); padding: 7px 12px; font-size: 13px; text-align: left; }
.doc-panel.markdown th { color: var(--text); background: rgba(255,255,255,0.04); }
.doc-panel.markdown td { color: var(--text-dim); }
.doc-panel.markdown blockquote { border-left: 3px solid var(--accent); padding-left: 14px; color: var(--text-dim); margin: 12px 0; }
.doc-panel pre.code-view { font-family: var(--font-mono); font-size: 12px; color: #b8c5d9; line-height: 1.6; }
.doc-panel table.csv { border-collapse: collapse; width: 100%; }
.doc-panel table.csv th, .doc-panel table.csv td { border: 1px solid var(--panel-border); padding: 6px 10px; font-size: 12.5px; text-align: left; }
.doc-panel table.csv th { background: rgba(255,255,255,0.04); }
.doc-panel table.csv td { color: var(--text-dim); }

.about-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 26px; }
.about-grid .desc { color: var(--text-dim); font-size: 15.5px; font-weight: 300; }
.hl-list { display: flex; flex-direction: column; gap: 10px; }
.hl-item {
  display: flex; gap: 10px; font-size: 13.5px; color: var(--text-dim);
  background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: 10px; padding: 10px 14px;
}
.hl-item::before { content: '◆'; color: var(--accent); font-size: 10px; margin-top: 4px; }

.prevnext { display: flex; gap: 14px; margin: 50px 0 70px; }
.pn-link {
  flex: 1; background: var(--panel); border: 1px solid var(--panel-border);
  border-radius: var(--radius); padding: 16px 20px; transition: border-color 0.15s;
}
.pn-link:hover { border-color: var(--accent-glow); text-decoration: none; }
.pn-link .pn-dir { font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); }
.pn-link .pn-title { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--text); margin-top: 3px; }
.pn-link.next { text-align: right; }

/* ---------------------------------------------------------------- footer */
.site-footer {
  border-top: 1px solid var(--panel-border); padding: 30px 0 44px;
  color: var(--text-faint); font-size: 13px; text-align: center;
}

/* --------------------------------------------------------------- states */
.loading { text-align: center; color: var(--text-dim); padding: 100px 0; }
.notfound { text-align: center; padding: 110px 0; }
.notfound h1 { font-family: var(--font-display); font-size: 40px; }
.notfound p { color: var(--text-dim); margin: 10px 0 22px; }
.btn {
  display: inline-block; background: var(--accent); color: #06251d; font-weight: 600;
  border-radius: 999px; padding: 10px 24px; font-size: 14px;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }

/* thumbnail-capture mode: hide all chrome, show only the graph */
body.thumb-mode .site-header, body.thumb-mode .detail-top, body.thumb-mode .prevnext,
body.thumb-mode .site-footer, body.thumb-mode .detail-section:not(.wf-section),
body.thumb-mode .graph-toolbar, body.thumb-mode .wf-tabs, body.thumb-mode .wf-section > h2 { display: none !important; }
body.thumb-mode .wrap { max-width: none; padding: 0; }
body.thumb-mode .detail-section.wf-section { margin: 0; }
body.thumb-mode .graph-shell { border: none; border-radius: 0; height: 100vh; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
  .search-box input, .search-box input:focus { width: 100%; }
  .pill-row .search-box { width: 100%; }
}
@media (max-width: 560px) {
  .hero { padding: 48px 0 24px; }
  .stats { gap: 8px; }
  .stat { padding: 12px 16px; min-width: 100px; }
  .stat .num { font-size: 24px; }
  .grid { grid-template-columns: 1fr; }
  .graph-shell { height: 340px; }
  .prevnext { flex-direction: column; }
}
