/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f4f6fb;
  --surface:   rgba(255,255,255,0.75);
  --surface-solid: #ffffff;
  --border:    rgba(255,255,255,0.6);
  --border-hard: #e2e6ef;
  --text:      #111827;
  --muted:     #6b7280;
  --accent:    #6366f1;
  --accent-h:  #4f46e5;
  --radius:    14px;
  --radius-sm: 8px;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
  --max-w:     1100px;
  --prose-w:   680px;
  --transition: 0.18s ease;
  --shadow:    0 4px 24px rgba(99,102,241,0.07), 0 1px 4px rgba(0,0,0,0.06);
  --shadow-hover: 0 12px 40px rgba(99,102,241,0.15), 0 2px 8px rgba(0,0,0,0.08);
  --blur:      blur(16px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0d0d14;
    --surface:   rgba(255,255,255,0.04);
    --surface-solid: #13131f;
    --border:    rgba(255,255,255,0.08);
    --border-hard: rgba(255,255,255,0.10);
    --text:      #f1f1f3;
    --muted:     #8b8fa8;
    --accent:    #818cf8;
    --accent-h:  #a5b4fc;
    --shadow:    0 4px 24px rgba(0,0,0,0.4), 0 1px 4px rgba(0,0,0,0.3);
    --shadow-hover: 0 12px 40px rgba(129,140,248,0.2), 0 2px 8px rgba(0,0,0,0.4);
  }
}

[data-theme="dark"] {
  --bg:        #0d0d14;
  --surface:   rgba(255,255,255,0.04);
  --surface-solid: #13131f;
  --border:    rgba(255,255,255,0.08);
  --border-hard: rgba(255,255,255,0.10);
  --text:      #f1f1f3;
  --muted:     #8b8fa8;
  --accent:    #818cf8;
  --accent-h:  #a5b4fc;
  --shadow:    0 4px 24px rgba(0,0,0,0.4), 0 1px 4px rgba(0,0,0,0.3);
  --shadow-hover: 0 12px 40px rgba(129,140,248,0.2), 0 2px 8px rgba(0,0,0,0.4);
}

[data-theme="light"] {
  --bg:        #f4f6fb;
  --surface:   rgba(255,255,255,0.75);
  --surface-solid: #ffffff;
  --border:    rgba(255,255,255,0.6);
  --border-hard: #e2e6ef;
  --text:      #111827;
  --muted:     #6b7280;
  --accent:    #6366f1;
  --accent-h:  #4f46e5;
  --shadow:    0 4px 24px rgba(99,102,241,0.07), 0 1px 4px rgba(0,0,0,0.06);
  --shadow-hover: 0 12px 40px rgba(99,102,241,0.15), 0 2px 8px rgba(0,0,0,0.08);
}

html { font-size: 17px; scroll-behavior: smooth; scrollbar-gutter: stable; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
  /* mesh gradient background */
  background-image:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(99,102,241,0.12) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(168,85,247,0.09) 0%, transparent 55%);
  background-attachment: fixed;
}

[data-theme="dark"] body,
body:has([data-theme="dark"]) {
  background-image:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(99,102,241,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(168,85,247,0.12) 0%, transparent 55%);
}

/* ── Layout ── */
.site-wrapper {
  max-width: calc(var(--max-w) + 4rem);
  margin: 0 auto;
  padding: 0 2rem;
}

.prose { max-width: var(--prose-w); margin: 0 auto; }

/* ── Header wrap (sticky glass) ── */
.site-header-wrap {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(244,246,251,0.80);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(0,0,0,0.07);
}
[data-theme="dark"] .site-header-wrap {
  background: rgba(13,13,20,0.86);
  border-bottom-color: rgba(255,255,255,0.07);
}

/* ── Header ── */
.site-header {
  padding: 0.8rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

/* Brand */
.site-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.site-logo {
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(99,102,241,0.40));
  transition: filter var(--transition), transform var(--transition);
}
.site-brand:hover .site-logo {
  filter: drop-shadow(0 4px 18px rgba(99,102,241,0.65));
  transform: rotate(-4deg) scale(1.06);
}

.brand-name {
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--text);
  -webkit-text-fill-color: var(--text);
}

/* Nav */
.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.site-nav a {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}
.site-nav a:hover { color: var(--text); background: var(--surface); }
.site-nav a.active { color: var(--accent); }

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-hard);
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.82rem;
  transition: color var(--transition), border-color var(--transition);
  line-height: 1;
  margin-left: 0.5rem;
  flex-shrink: 0;
}
.theme-toggle:hover { color: var(--text); border-color: var(--text); }

/* Hamburger */
.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid var(--border-hard);
  border-radius: 6px;
  cursor: pointer;
  padding: 0 9px;
  flex-shrink: 0;
  transition: border-color var(--transition);
}
.nav-burger:hover { border-color: var(--text); }
.nav-burger span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.22s ease, opacity 0.22s ease, width 0.22s ease;
  transform-origin: center;
}
.nav-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Main ── */
.site-main { padding: 2.5rem 0; min-height: calc(100vh - 180px); }

/* ── Hero ── */
.hero {
  padding: 1.75rem 0 1.75rem;
  margin-bottom: 2rem;
  position: relative;
}
.hero-eyebrow {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.hero-eyebrow::before {
  content: '';
  display: inline-block;
  width: 20px; height: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.hero-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin-bottom: 0.4rem;
  color: var(--text);
}
.hero-sub { font-size: 0.9rem; color: var(--muted); }

/* ── Filters ── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.25rem;
  align-items: center;
  margin-bottom: 1.75rem;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.filter-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 0.2rem;
}

.filter-btn {
  font-size: 0.78rem;
  font-weight: 500;
  font-family: var(--font-sans);
  padding: 0.32rem 0.85rem;
  border-radius: 100px;
  border: 1px solid var(--border-hard);
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1.4;
}
.filter-btn:hover { color: var(--text); border-color: var(--text); }
.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  -webkit-text-fill-color: #fff;
}

.filter-divider {
  width: 1px;
  height: 18px;
  background: var(--border-hard);
  flex-shrink: 0;
}

.no-results {
  display: none;
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ── Post Card Grid ── */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.post-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(99,102,241,0.25);
}

/* Thumbnail */
.card-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.card-thumb-placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: rgba(255,255,255,0.9);
  position: relative;
  overflow: hidden;
}
.card-thumb-placeholder::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,0.25) 100%);
}

.post-card:nth-child(6n+1) .card-thumb-placeholder { background: linear-gradient(135deg, #667eea, #764ba2); }
.post-card:nth-child(6n+2) .card-thumb-placeholder { background: linear-gradient(135deg, #f7971e, #ffd200); }
.post-card:nth-child(6n+3) .card-thumb-placeholder { background: linear-gradient(135deg, #11998e, #38ef7d); }
.post-card:nth-child(6n+4) .card-thumb-placeholder { background: linear-gradient(135deg, #ee0979, #ff6a00); }
.post-card:nth-child(6n+5) .card-thumb-placeholder { background: linear-gradient(135deg, #2980b9, #6dd5fa); }
.post-card:nth-child(6n+0) .card-thumb-placeholder { background: linear-gradient(135deg, #834d9b, #d04ed6); }

/* Card body */
.card-body {
  padding: 1.1rem 1.3rem 1.4rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.5rem;
}

.card-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.card-date {
  font-size: 0.72rem;
  color: var(--muted);
  margin-right: auto;
}

/* Category chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  border: 1px solid transparent;
  line-height: 1.4;
  white-space: nowrap;
}

.chip { background: rgba(99,102,241,0.10); color: #6366f1; border-color: rgba(99,102,241,0.25); }
[data-theme="dark"] .chip { color: #a5b4fc; background: rgba(99,102,241,0.14); border-color: rgba(99,102,241,0.30); }

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--text);
  margin-top: 0.1rem;
}

.card-summary {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.card-read-more {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: gap var(--transition), color var(--transition);
}
.post-card:hover .card-read-more { gap: 0.55rem; }

/* ── Status badge ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem 0.2rem 0.45rem;
  border-radius: 100px;
  border: 1px solid;
  white-space: nowrap;
  line-height: 1.4;
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
  display: block;
}

.status-zrealizowany    { background: rgba(16,185,129,0.12); color: #059669; border-color: rgba(16,185,129,0.30); }
.status-zrealizowany    .status-dot { background: #10b981; }
.status-wstrzymany      { background: rgba(245,158,11,0.12); color: #d97706; border-color: rgba(245,158,11,0.30); }
.status-wstrzymany      .status-dot { background: #f59e0b; }
.status-w-toku          { background: rgba(100,116,139,0.10); color: #475569; border-color: rgba(100,116,139,0.25); }
.status-w-toku          .status-dot { background: #64748b; animation: dot-pulse 2s ease-in-out infinite; }
.status-niezrealizowany { background: rgba(107,114,128,0.10); color: #6b7280; border-color: rgba(107,114,128,0.25); }
.status-niezrealizowany .status-dot { background: #9ca3af; }
.status-odrzucony       { background: rgba(239,68,68,0.12); color: #dc2626; border-color: rgba(239,68,68,0.30); }
.status-odrzucony       .status-dot { background: #ef4444; }

@keyframes dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(100,116,139,0.5); }
  50%       { box-shadow: 0 0 0 4px rgba(100,116,139,0); }
}

[data-theme="dark"] .status-w-toku          { color: #94a3b8; }
[data-theme="dark"] .status-zrealizowany    { color: #34d399; }
[data-theme="dark"] .status-wstrzymany      { color: #fbbf24; }
[data-theme="dark"] .status-niezrealizowany { color: #9ca3af; }
[data-theme="dark"] .status-odrzucony       { color: #f87171; }

/* ── Tags (single post) ── */
.tag-list { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  background: rgba(99,102,241,0.1);
  border: 1px solid rgba(99,102,241,0.22);
  color: var(--accent);
  text-decoration: none;
  transition: background var(--transition), box-shadow var(--transition);
}
.tag:hover {
  background: rgba(99,102,241,0.18);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}

/* ── Single Post ── */
.post-header { padding: 2.5rem 0 2rem; }
.post-header::after {
  content: '';
  display: block;
  margin-top: 2rem;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent 60%);
  opacity: 0.4;
}

.post-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.post-title {
  font-size: 2.8rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 1rem;
}

/* ── Post hero (cover above title, full wrapper width) ── */
.post-hero {
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}
.post-hero img {
  width: 100%;
  aspect-ratio: 21 / 9;
  object-fit: cover;
  display: block;
}

.post-content { padding: 2rem 0; }

.post-content h1 { font-size: 2rem; }
.post-content h2 { font-size: 1.5rem; }
.post-content h3 { font-size: 1.2rem; }
.post-content h4 { font-size: 1rem; }

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 2rem 0 0.75rem;
  line-height: 1.3;
}

.post-content p { margin-bottom: 1.25rem; }

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.post-content a:hover { color: var(--accent-h); }

.post-content ul, .post-content ol { margin: 0 0 1.25rem 1.5rem; }
.post-content li { margin-bottom: 0.25rem; }

.post-content blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.5rem 0;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--muted);
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--surface);
  border: 1px solid var(--border-hard);
  border-radius: 4px;
  padding: 0.15em 0.4em;
}

.post-content pre {
  background: var(--surface-solid);
  border: 1px solid var(--border-hard);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.post-content pre code {
  background: none; border: none; padding: 0;
  font-size: 0.85rem; line-height: 1.6;
}

.post-content img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  display: block;
  margin: 1.5rem auto;
}

.post-content hr {
  border: none;
  border-top: 1px solid var(--border-hard);
  margin: 2rem 0;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}
.post-content th, .post-content td {
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border-hard);
  text-align: left;
}
.post-content th { background: var(--surface); font-weight: 600; }

/* ── Post Footer ── */
.post-footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border-hard);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}
.post-footer a {
  font-size: 0.875rem;
  color: var(--muted);
  text-decoration: none;
  transition: color var(--transition);
}
.post-footer a:hover { color: var(--text); }

/* ── Page (about etc.) ── */
.page-content { padding: 2.5rem 0; }
.page-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem 0;
}
.pagination a, .pagination span {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--border-hard);
  border-radius: 100px;
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--muted);
  transition: all var(--transition);
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .current { border-color: var(--accent); color: var(--accent); }

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border-hard);
  padding: 1.5rem 0;
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }

/* ── Responsive ── */
@media (max-width: 700px) {
  html { font-size: 16px; }
  .site-wrapper { padding: 0 1.25rem; }
  .post-title { font-size: 2rem; }
  .post-grid { grid-template-columns: 1fr; }

  .nav-burger { display: flex; }

  .site-nav {
    display: none;
    position: fixed;
    top: 57px;
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem 1.25rem 0.75rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border-hard);
    box-shadow: 0 8px 32px rgba(0,0,0,0.10);
    z-index: 200;
  }
  .site-nav.is-open { display: flex; }

  .site-nav a {
    padding: 0.75rem 0.75rem;
    border-radius: 8px;
    font-size: 0.95rem;
  }

  .theme-toggle {
    margin: 0.25rem 0 0;
    width: 100%;
    text-align: center;
    padding: 0.65rem;
    border-radius: 8px;
  }
}
