/* Corpus Index — reusable stylesheet for directory index pages */

:root {
  --primary: #1E293B;
  --accent: #6366F1;
  --bg: #F8FAFC;
  --card-bg: #FFFFFF;
  --border: #E2E8F0;
  --text: #1E293B;
  --muted: #64748B;
  --shadow: 0 4px 24px rgba(0,0,0,0.09);
  --tag-bg: #F1F5F9;
  --th-bg: #F1F5F9;
  --th-hover: #E2E8F0;
  --tr-hover: #F8FAFC;
  --input-bg: #FFFFFF;
  --dot-border: #FFFFFF;
}

html[data-fui-theme="dark"], [data-fui-theme="dark"] {
  --primary: #A5B4FC;
  --accent: #818CF8;
  --bg: #0F172A;
  --card-bg: #1E293B;
  --border: #334155;
  --text: #E2E8F0;
  --muted: #94A3B8;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --tag-bg: #1E293B;
  --th-bg: #1E293B;
  --th-hover: #334155;
  --tr-hover: #1A2332;
  --input-bg: #1E293B;
  --dot-border: #1E293B;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-fui-theme]) {
    --primary: #A5B4FC;
    --accent: #818CF8;
    --bg: #0F172A;
    --card-bg: #1E293B;
    --border: #334155;
    --text: #E2E8F0;
    --muted: #94A3B8;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --tag-bg: #1E293B;
    --th-bg: #1E293B;
    --th-hover: #334155;
    --tr-hover: #1A2332;
    --input-bg: #1E293B;
    --dot-border: #1E293B;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }

/* ── Hero ────────────────────────────────────────────────────────── */
.hero {
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 40%, #1E3A8A 100%);
  color: white; padding: 44px 28px 36px; text-align: center; position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; top: -40%; left: -20%; width: 140%; height: 200%;
  background: radial-gradient(ellipse at 60% 50%, rgba(99,102,241,0.25) 0%, transparent 65%);
  animation: glow 5s ease-in-out infinite;
}
@keyframes glow { 0%,100% { opacity: .5; transform: scale(1) } 50% { opacity: 1; transform: scale(1.08) } }
.hero-inner { position: relative; z-index: 1; max-width: 780px; margin: 0 auto; }
.eyebrow { font-size: .72rem; letter-spacing: 2.5px; text-transform: uppercase; opacity: .55; margin-bottom: 14px; }
.hero h1 { font-size: 2.1rem; font-weight: 800; letter-spacing: -.5px; margin-bottom: 10px; }
.hero p { font-size: 1rem; opacity: .8; margin-bottom: 30px; max-width: 560px; margin-left: auto; margin-right: auto; }
.stats { display: flex; justify-content: center; gap: 36px; flex-wrap: wrap; }
.stat-num { font-size: 1.9rem; font-weight: 800; color: #A5B4FC; line-height: 1; }
.stat-lbl { font-size: .7rem; opacity: .6; text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }

/* ── Controls ────────────────────────────────────────────────────── */
.controls {
  background: var(--card-bg); border-bottom: 1px solid var(--border); padding: 12px 20px;
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  position: sticky; top: 0; z-index: 200; box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.search { flex: 1; min-width: 180px; padding: 7px 13px; border: 1.5px solid var(--border); border-radius: 8px; font-size: .87rem; outline: none; transition: border-color .2s; }
.search:focus { border-color: var(--accent); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  padding: 5px 13px; border-radius: 999px; font-size: .75rem; font-weight: 600;
  cursor: pointer; border: 2px solid transparent; transition: all .18s;
  background: var(--bg); color: var(--muted);
}
.pill:hover { opacity: .85; }
.pill.on { color: white; }
.pill[data-t="all"].on { background: #1E293B; }
.view-btns { display: flex; gap: 4px; margin-left: auto; }
.vbtn { padding: 5px 11px; border-radius: 6px; border: 1.5px solid var(--border); background: var(--card-bg); cursor: pointer; font-size: .82rem; transition: all .18s; }
.vbtn.on { background: var(--accent); color: white; border-color: var(--accent); }

/* ── Content area ────────────────────────────────────────────────── */
.main { padding: 24px 20px; max-width: 1200px; margin: 0 auto; }

/* Grid view */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.card {
  background: var(--card-bg); border-radius: 12px; border: 1.5px solid var(--border);
  padding: 18px; display: flex; flex-direction: column; gap: 11px;
  color: inherit; text-decoration: none; transition: all .22s; animation: fadeUp .4s ease both;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px) } to { opacity: 1; transform: translateY(0) } }
.card-top { display: flex; gap: 9px; align-items: flex-start; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.ctitle { font-size: .92rem; font-weight: 700; line-height: 1.4; }
.ctitle a { color: inherit; text-decoration: none; }
.ctitle a:hover { text-decoration: underline; }
.cmeta { display: flex; gap: 7px; align-items: center; font-size: .76rem; color: var(--muted); flex-wrap: wrap; }
.cdesc { font-size: .83rem; color: var(--muted); line-height: 1.55; flex: 1; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { padding: 3px 8px; border-radius: 4px; font-size: .7rem; background: var(--tag-bg); color: var(--muted); border: 1px solid var(--border); }
.cfoot { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--border); font-size: .76rem; color: var(--muted); gap: 8px; }
.cfoot-links { display: flex; gap: 8px; align-items: center; }
.src { font-size: .72rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.src:hover { text-decoration: underline; }

/* Timeline view */
.timeline { display: none; position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px; background: linear-gradient(to bottom, var(--accent), var(--border)); }
.ti { position: relative; margin-bottom: 18px; animation: fadeUp .4s ease both; }
.tdot { position: absolute; left: -24px; top: 13px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--dot-border); }
.tcard { background: var(--card-bg); border: 1.5px solid var(--border); border-radius: 10px; padding: 14px 16px; display: flex; gap: 14px; transition: all .2s; }
.tcard:hover { box-shadow: var(--shadow); transform: translateX(3px); }
.tdate { min-width: 52px; text-align: right; }
.tmo { font-size: .72rem; font-weight: 800; color: var(--accent); }
.tyr { font-size: .68rem; color: var(--muted); }
.tdiv { width: 1px; background: var(--border); flex-shrink: 0; }
.tcnt { flex: 1; }
.ttitle { font-size: .88rem; font-weight: 700; margin-bottom: 3px; }
.ttitle a { color: inherit; text-decoration: none; }
.ttitle a:hover { text-decoration: underline; }
.tmeta { font-size: .76rem; margin-bottom: 5px; }
.tbadge { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: .68rem; font-weight: 600; color: white; margin-right: 5px; }
.tdesc { font-size: .8rem; color: var(--muted); line-height: 1.5; }
.tlink { text-decoration: none; font-size: 1.1rem; align-self: center; opacity: .6; }
.tlink:hover { opacity: 1; }

/* Table view */
.tview { display: none; overflow-x: auto; }
.dtable { width: 100%; border-collapse: collapse; font-size: .83rem; }
.dtable th { background: var(--th-bg); padding: 9px 13px; text-align: left; font-weight: 700; font-size: .74rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); border-bottom: 2px solid var(--border); cursor: pointer; white-space: nowrap; }
.dtable th:hover { background: var(--th-hover); }
.dtable td { padding: 10px 13px; border-bottom: 1px solid var(--border); vertical-align: top; }
.dtable tr:hover td { background: var(--tr-hover); }
.tbadge2 { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: .7rem; font-weight: 600; color: white; }

/* Empty state */
.nores { text-align: center; padding: 56px 20px; color: var(--muted); display: none; }
.nores-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: .35; }

/* Footer */
.footer { text-align: center; padding: 28px 20px; color: var(--muted); font-size: .75rem; border-top: 1px solid var(--border); margin-top: 40px; }

/* Card stagger */
.card:nth-child(1) { animation-delay: .04s } .card:nth-child(2) { animation-delay: .08s }
.card:nth-child(3) { animation-delay: .12s } .card:nth-child(4) { animation-delay: .16s }
.card:nth-child(5) { animation-delay: .20s } .card:nth-child(6) { animation-delay: .24s }
.card:nth-child(7) { animation-delay: .28s } .card:nth-child(8) { animation-delay: .32s }
.card:nth-child(9) { animation-delay: .36s } .card:nth-child(10) { animation-delay: .40s }
.card:nth-child(11) { animation-delay: .44s } .card:nth-child(12) { animation-delay: .48s }

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .hero h1 { font-size: 1.5rem } .stats { gap: 20px } .grid { grid-template-columns: 1fr }
  .controls { gap: 8px } .view-btns { margin-left: 0; width: 100% }
}
