/* SiteSafe blog — shared stylesheet (homepage uses inline CSS) */
:root {
  --accent: #00ff00;
  --accent-foreground: #0f172a;
  --bg-dark: #0f172a;
  --bg-darker: #0a1120;
  --bg-card: #1e293b;
  --bg-card-hover: #253349;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: rgba(148, 163, 184, 0.12);
  --border-accent: rgba(0, 255, 0, 0.2);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-weight: 400;
  color: var(--text-primary);
  background: var(--bg-dark);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4 {
  font-family: 'Montserrat', system-ui, sans-serif;
  font-weight: 600;
  line-height: 1.2;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition);
}

img {
  max-width: 100%;
  display: block;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header / nav */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  gap: 16px;
}

.nav-brand img {
  height: 44px;
  width: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
}

.nav-links a {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.nav-links a:hover,
.nav-links a.is-active {
  color: var(--accent);
}

.nav .nav-links a.btn-primary {
  background: var(--accent);
  color: #000;
}

.nav .nav-links a.btn-primary:hover {
  background: #33ff33;
  color: #fff;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.btn {
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  padding: 10px 18px;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-foreground);
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  transition: all var(--transition);
}

/* Main */
.site-main {
  flex: 1;
  padding-top: 96px;
  padding-bottom: 48px;
}

.blog-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 24px;
}

.blog-page--wide {
  max-width: 1100px;
}

.blog-back {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  display: inline-block;
}

.blog-back:hover {
  color: var(--accent);
}

.blog-page h1 {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.blog-lead {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.blog-meta-line {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

/* Post body */
.post-body {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.75;
}

.post-body h2 {
  color: var(--text-primary);
  margin: 2rem 0 0.75rem;
  font-size: 1.35rem;
}

.post-body p {
  margin-bottom: 1.25rem;
}

.post-body ul {
  margin: 0 0 1.25rem 1.5rem;
}

.post-body li {
  margin-bottom: 0.5rem;
}

.post-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-body strong {
  color: var(--text-primary);
}

/* —— Article layout variants (assigned per post slug) —— */

.post-header {
  margin-bottom: 1.5rem;
}

.post-lead {
  margin-top: 1rem;
  font-size: 1.15rem;
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 52ch;
}

/* Float wrap: image right, text wraps on the left */
.layout-wrap-right .post-content--flow {
  overflow: hidden;
}

.layout-wrap-right .post-cover--wrap-right {
  float: right;
  width: min(44%, 400px);
  margin: 0.25rem 0 1.25rem 2rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-accent);
  box-shadow: var(--shadow-lg);
}

.layout-wrap-right .post-cover--wrap-right img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

/* Float wrap: image left */
.layout-wrap-left .post-content--flow {
  overflow: hidden;
}

.layout-wrap-left .post-header {
  max-width: 70%;
}

.layout-wrap-left .post-lead {
  max-width: none;
}

.layout-wrap-left .post-cover--wrap-left {
  float: left;
  width: min(40%, 360px);
  margin: 0.25rem 2rem 1.25rem 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.layout-wrap-left .post-cover--wrap-left img {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

/* Full-width hero, then centered prose */
.layout-hero {
  max-width: 920px;
}

.layout-hero .post-header {
  text-align: center;
  margin-bottom: 2rem;
}

.layout-hero .post-header h1 {
  font-size: 2.35rem;
  max-width: 18ch;
  margin-left: auto;
  margin-right: auto;
}

.layout-hero .blog-meta-line {
  text-align: center;
}

.layout-hero .post-lead {
  margin-left: auto;
  margin-right: auto;
  max-width: 42ch;
}

.layout-hero .post-cover--hero {
  margin: 0 0 2.5rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

.layout-hero .post-cover--hero img {
  width: 100%;
  max-height: 440px;
  object-fit: cover;
}

.layout-hero .post-body--after-hero {
  max-width: 680px;
  margin: 0 auto;
}

/* Sidebar image + main column */
.layout-split .post-content--split {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 2.5rem;
  align-items: start;
}

.layout-split .post-header {
  border-left: 3px solid var(--accent);
  padding-left: 1.25rem;
  margin-bottom: 2rem;
}

.layout-split .post-aside {
  position: sticky;
  top: 96px;
}

.layout-split .post-cover--split {
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-accent);
}

.layout-split .post-cover--split img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
}

.post-cover {
  margin-bottom: 2rem;
  border-radius: var(--radius);
  overflow: hidden;
}

.post-cover img {
  width: 100%;
  height: auto;
}

@media (max-width: 768px) {
  .layout-wrap-right .post-cover--wrap-right,
  .layout-wrap-left .post-cover--wrap-left {
    float: none;
    width: 100%;
    margin: 0 0 1.5rem;
  }

  .layout-wrap-left .post-header {
    max-width: none;
  }

  .layout-split .post-content--split {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .layout-split .post-aside {
    position: static;
  }

  .layout-hero .post-header h1 {
    font-size: 1.75rem;
    max-width: none;
  }
}

/* Blog list cards */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
}

@media (max-width: 960px) {
  .blog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .blog-grid {
    grid-template-columns: 1fr;
  }
}

.blog-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 24px;
  transition: all var(--transition);
}

.blog-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.blog-card .blog-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.blog-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  background: rgba(0, 255, 0, 0.08);
  padding: 3px 10px;
  border-radius: 100px;
}

.blog-date {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.blog-card h2,
.blog-card h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.blog-card h2 a:hover,
.blog-card h3 a:hover {
  color: var(--accent);
}

.blog-card p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.blog-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
}

/* Blog list toolbar */
.blog-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-bottom: 2rem;
  align-items: center;
}

.blog-search {
  flex: 0 0 auto;
  width: min(100%, 240px);
  max-width: 240px;
}

.blog-search #search,
.blog-search .pagefind-ui,
.blog-search .pagefind-ui__form {
  width: 100%;
  max-width: 240px;
}

.blog-search .pagefind-ui {
  --pagefind-ui-scale: 0.85;
  --pagefind-ui-primary: var(--accent);
  --pagefind-ui-text: var(--text-primary);
  --pagefind-ui-background: var(--bg-card);
  --pagefind-ui-border: var(--border-color);
  --pagefind-ui-tag: var(--text-secondary);
}

.blog-search .pagefind-ui__search-input {
  width: 100% !important;
  max-width: 240px;
  padding: 0.55rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.9rem;
}

.subject-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.subject-filters-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.subject-chip {
  padding: 0.35rem 0.85rem;
  border-radius: 100px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.82rem;
  font-family: inherit;
  transition: all var(--transition);
}

.subject-chip.active,
.subject-chip:hover {
  border-color: var(--border-accent);
  background: rgba(0, 255, 0, 0.08);
  color: var(--accent);
}

.pagefind-ui mark {
  background: rgba(0, 255, 0, 0.15);
  color: var(--accent);
}

.blog-card.is-hidden {
  display: none !important;
}

.blog-pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2.5rem;
}

.blog-page-btn {
  min-width: 2.25rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  transition: all var(--transition);
}

.blog-page-btn--nav {
  min-width: auto;
  padding-inline: 1rem;
}

.blog-page-btn:hover:not(:disabled),
.blog-page-btn.is-active {
  border-color: var(--border-accent);
  background: rgba(0, 255, 0, 0.08);
  color: var(--accent);
}

.blog-page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-color);
  background: var(--bg-darker);
  padding: 32px 0;
  margin-top: auto;
}

.site-footer p {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.site-footer a {
  color: var(--text-secondary);
}

.site-footer a:hover {
  color: var(--accent);
}

@media (max-width: 900px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-darker);
    padding: 24px;
    gap: 16px;
    border-bottom: 1px solid var(--border-color);
  }

  .nav-links.active {
    display: flex;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-inner {
    position: relative;
    flex-wrap: wrap;
  }
}
