/* list.css — styles for the posts index page */
:root {
  --bg: #ffffff;
  --ink: #111111;
  --ink-2: #000000;
  --ink-muted: #666666;
  --panel: #fafafa;
  --edge: #eaeaea;
  --shadow-rgb: 0,0,0;

  --shadow-sm: 0 4px 10px rgba(var(--shadow-rgb), 0.05);
  --shadow-md: 0 8px 22px rgba(var(--shadow-rgb), 0.06);
  --shadow-lg: 0 15px 30px -6px rgba(var(--shadow-rgb), 0.10), 0 8px 16px -8px rgba(var(--shadow-rgb), 0.08);

  --radius: 16px;
  --maxw: 1080px;
  --dur: .28s;
  --ease: cubic-bezier(.2,.8,.2,1);

  /* used for active chips */
  --soft: rgba(0,0,0,.04);
}
html[data-theme="dark"] {
  --bg: #0a0a0a;
  --ink: #e7e7e7;
  --ink-2: #ffffff;
  --ink-muted: #9a9a9a;
  --panel: #141414;
  --edge: #262626;

  --shadow-sm: 0 6px 14px rgba(var(--shadow-rgb), 0.25);
  --shadow-md: 0 10px 26px rgba(var(--shadow-rgb), 0.30);
  --shadow-lg: 0 20px 44px rgba(var(--shadow-rgb), 0.45);

  --soft: rgba(255,255,255,.06);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--dur) ease, color var(--dur) ease;
}

/* top progress */
body::before {
  content: "";
  position: fixed; left: 0; top: 0; height: 3px; z-index: 999;
  width: calc(var(--scroll, 0) * 100%);
  background: var(--ink-2);
  transition: background var(--dur) ease;
}

/* subtle ambient */
body::after {
  content: "";
  position: fixed; inset: 0;
  background: radial-gradient(ellipse at top, rgba(120,120,120,.05), transparent 60%);
  pointer-events: none; z-index: 0;
}

.topbar, header, .toolbar, main {
  max-width: var(--maxw);
  margin-left: auto; margin-right: auto;
  padding: 0 24px;
  position: relative; z-index: 2;
}

/* CENTERED LOGO + HEADER */
.topbar {
  padding-top: 40px; padding-bottom: 16px;
  display: grid; place-items: center;
}
.brand { position: relative; display: inline-block; text-decoration: none; }
.brand img {
  width: 64px; height: 64px; border-radius: 18px; display: block;
  border: 1.5px solid var(--edge);
  transition: border-color var(--dur) ease;
  background: var(--bg);
}
.brand::after {
  content: '';
  position: absolute; inset: -8px; border-radius: 24px; z-index: -1;
  animation: pulse 5s ease-in-out infinite;
  opacity: .8; pointer-events: none;
}
html[data-theme="light"] .brand::after {
  background: radial-gradient(circle, rgba(0,0,0,.09) 0%, rgba(0,0,0,0) 70%);
}
html[data-theme="dark"] .brand::after {
  background: radial-gradient(circle, rgba(255,255,255,.10) 0%, rgba(255,255,255,0) 70%);
}

header { padding: 6px 24px 18px; text-align: center; }
header h1 {
  margin: 8px 0 8px;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800; letter-spacing: -0.02em;
  color: var(--ink-2); line-height: 1.08;
}
header .tagline {
  font-size: 1.05rem; font-weight: 700; color: var(--ink-muted);
  max-width: 520px; margin: 0 auto;
}

/* FILTER TOOLBAR */
.toolbar {
  display: flex; align-items: center; justify-content: flex-end;
  padding-bottom: 10px;
}
.filter-btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 12px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--edge);
  font-weight: 800; letter-spacing: .02em;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--dur) var(--ease), background var(--dur) ease, box-shadow var(--dur) ease, border-color var(--dur) ease;
}
.filter-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.filter-count {
  margin-left: 10px; font-size: .82rem; font-weight: 800;
  color: var(--ink-muted);
}

/* Panel + Backdrop */
.filter-backdrop {
  position: fixed; inset: 0; z-index: 80; display: none;
  background: rgba(0,0,0,.25); backdrop-filter: blur(2px);
}
.filter-backdrop.show { display: block; }

.filter-panel {
  position: fixed;
  right: 16px; left: 16px; top: 72px; bottom: 16px; /* Added bottom to constrain height */
  z-index: 90;
  max-width: 720px;
  margin: 0 auto;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border: 1px solid var(--edge);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
   /* Make it a flex container to manage scrolling and sticky footer */
  display: flex;
  flex-direction: column;
  
  transform: translateY(-8px); opacity: 0; pointer-events: none;
  transition: transform var(--dur) var(--ease), opacity var(--dur) ease;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.filter-panel.show { transform: translateY(0); opacity: 1; pointer-events: auto; }

.filter-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  overflow-y: auto; /* Allow this part to scroll */
  padding: 16px; /* Moved padding here */
}

@media (min-width: 720px) {
  .filter-grid { grid-template-columns: 1fr 1fr; }
}
.filter-group { border: 1px solid var(--edge); border-radius: 12px; padding: 12px; background: var(--panel); }
.filter-group h3 { margin: 0 0 8px; font-size: .9rem; color: var(--ink-2); letter-spacing: .02em; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.chip, .seg button {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--edge); background: var(--bg); color: var(--ink);
  font-weight: 800; font-size: .9rem; cursor: pointer;
  transition: transform var(--dur) var(--ease), background var(--dur), border-color var(--dur);
}
.chip[aria-pressed="true"], .seg button[aria-pressed="true"] { background: var(--soft); border-color: var(--ink-muted); }
.select, .input { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--edge); background: var(--bg); color: var(--ink); font-weight: 700; }


.filter-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  /* Removed margin-top, flexbox handles spacing */
  padding: 12px 16px 16px; /* Added padding */
  border-top: 1px solid var(--edge); /* Visual separation */
}

.btn {
  padding: 10px 14px; border-radius: 12px; border: 1px solid var(--edge);
  background: var(--bg); color: var(--ink); font-weight: 800; cursor: pointer;
  transition: transform var(--dur) var(--ease), background var(--dur), box-shadow var(--dur);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn.primary { background: var(--ink-2); color: var(--bg); border-color: var(--ink-2); }
.btn.primary:hover { box-shadow: var(--shadow-md); }

/* LIST + CARDS */
main { padding-bottom: 80px; }
.post-list { display: grid; grid-template-columns: 1fr; gap: 32px; }
@media (min-width: 768px) { .post-list { grid-template-columns: 1fr 1fr; } }

article {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 28px;
  display: flex; flex-direction: column; gap: 16px;
  min-height: 190px;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
article:hover { transform: translateY(-8px); box-shadow: var(--shadow-lg); background: var(--bg); border-color: var(--ink-muted); }

article h2 { font-size: clamp(1.25rem, 2.5vw, 1.5rem); margin: 0; }
article p { margin: 0; color: var(--ink-muted); font-weight: 600; line-height: 1.6; flex-grow: 1; }

.meta {
  display: flex; flex-wrap: wrap; gap: 16px;
  font-size: .8rem; font-weight: 800; color: var(--ink-muted);
  text-transform: uppercase; letter-spacing: .05em; margin: 0;
}

/* tags hidden in cards (for filters) */
article .tag-list { display: none !important; }

/* stretched link */
article > a[href^="/posts/"],
article > a[href^="/blogs/"] {
  position: absolute; inset: 0; z-index: 3; color: transparent; outline-offset: 4px;
}

/* A11y focus */
:focus-visible { outline: 2px solid var(--ink-2); outline-offset: 2px; border-radius: 8px; }
article:has(> a[href^="/posts/"]:focus-visible),
article:has(> a[href^="/blogs/"]:focus-visible) {
  transform: translateY(-8px); box-shadow: var(--shadow-lg); border-color: var(--ink-2); background: var(--bg);
}

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.12)} }
@keyframes revealCard { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
