/* site-evolver theme — WordPress-style layout */

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

:root {
  --accent:   #0073aa;
  --accent-h: #005177;
  --text:     #333;
  --muted:    #767676;
  --border:   #e5e5e5;
  --bg:       #f1f1f1;
  --card-bg:  #fff;
  --radius:   4px;
  --max-w:    1100px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}

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

/* ── Header ─────────────────────────────────────────────────────────────── */
#site-header {
  background: var(--accent);
  color: #fff;
  padding: 0 1.5rem;
  position: relative;
}
#site-header.with-banner {
  background-size: cover;
  background-position: center;
  /* Keep accent as fallback color (set by base rule above). When the banner
     image loads, it tints over the accent via multiply blending. */
  background-blend-mode: multiply;
}
#site-header.with-banner::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,.15), rgba(0,0,0,.45));
  pointer-events: none;
}
#site-header .inner { position: relative; z-index: 1; }
#site-header .inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
#site-header .site-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.5px;
}
#site-header .site-title:hover { text-decoration: none; opacity: .85; }
#site-header .tagline {
  font-size: .8rem;
  opacity: .75;
  margin-left: .5rem;
}

nav#main-nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
}
nav#main-nav a {
  color: rgba(255,255,255,.85);
  font-size: .9rem;
  font-weight: 500;
}
nav#main-nav a:hover { color: #fff; text-decoration: none; }

/* Secondary nav strip — for category / topic links */
#subnav {
  background: #f5f7fa;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
#subnav .inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: .5rem 1.5rem;
  display: flex;
  gap: 1rem;
  white-space: nowrap;
  align-items: center;
}
#subnav a {
  color: var(--muted);
  font-weight: 500;
  padding: .15rem 0;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
#subnav a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

/* ── Hero banner (homepage) ─────────────────────────────────────────────── */
.hero {
  position: relative;
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  max-height: 360px;
}
.hero img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
  max-height: 360px;
}
.hero-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  background: linear-gradient(180deg, rgba(0,0,0,.15) 0%, rgba(0,0,0,.55) 100%);
  color: #fff; text-align: center; padding: 1rem 2rem;
}
.hero-title {
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -.5px;
  margin: 0 0 .5rem;
  text-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.hero-tagline {
  font-size: clamp(.95rem, 1.4vw, 1.2rem);
  font-weight: 400;
  max-width: 720px;
  opacity: .95;
  text-shadow: 0 1px 4px rgba(0,0,0,.5);
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
#page {
  max-width: var(--max-w);
  margin: 2rem auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 768px) {
  #page { grid-template-columns: 1fr; }
  #sidebar { display: none; }
}

/* ── Article cards (index page) ─────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: box-shadow .15s;
}
.card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.card h2 { font-size: 1.2rem; margin-bottom: .4rem; }
.card h2 a { color: var(--text); }
.card h2 a:hover { color: var(--accent); text-decoration: none; }
.card .meta { font-size: .82rem; color: var(--muted); margin-bottom: .75rem; }
.card .excerpt { font-size: .95rem; color: #555; }

/* Category badge in article meta */
.cat-badge {
  display: inline-block;
  background: rgba(0, 115, 170, 0.1);
  color: var(--accent);
  padding: .15rem .55rem;
  border-radius: 12px;
  font-size: .78rem;
  font-weight: 600;
  text-decoration: none;
  margin-left: .25rem;
}
.cat-badge:hover { background: var(--accent); color: #fff; text-decoration: none; }

/* Category header */
.cat-header { margin-bottom: 1.5rem; }
.cat-header h1 { margin-bottom: .25rem; }
.cat-count { color: var(--muted); font-size: .9rem; }

/* Category overview grid */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .8rem;
  margin: 1.5rem 0;
}
.cat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  text-decoration: none;
  color: inherit;
  transition: box-shadow .15s, border-color .15s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cat-card:hover {
  text-decoration: none;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.cat-card-name { font-weight: 600; color: var(--accent); }
.cat-card-count {
  background: var(--accent);
  color: #fff;
  border-radius: 12px;
  font-size: .78rem;
  font-weight: 700;
  padding: .15rem .55rem;
}
.cat-back { margin-top: 2rem; font-size: .9rem; }

/* Article image floated right, text wraps around */
.post-image {
  float: right;
  width: 280px;
  max-width: 40%;
  margin: .25rem 0 1rem 1.5rem;
  border-radius: 8px;
  overflow: hidden;
  shape-outside: margin-box;
}
.post-image img {
  width: 100%;
  height: auto;
  display: block;
}
@media (max-width: 600px) {
  .post-image {
    float: none;
    width: 100%;
    max-width: none;
    margin: 0 0 1rem 0;
  }
}

/* ── Single article ─────────────────────────────────────────────────────── */
article.post {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 2.5rem;
}
article.post h1 {
  font-size: 1.9rem;
  line-height: 1.3;
  margin-bottom: .5rem;
}
article.post .post-meta {
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
article.post h2 {
  font-size: 1.3rem;
  margin: 1.75rem 0 .6rem;
  color: #222;
}
article.post h3 { font-size: 1.1rem; margin: 1.25rem 0 .4rem; }
article.post p  { margin-bottom: 1rem; }
article.post ul, article.post ol { margin: .5rem 0 1rem 1.5rem; }
article.post li { margin-bottom: .3rem; }
article.post pre {
  background: #f6f8fa;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  font-size: .88rem;
  margin-bottom: 1rem;
}
article.post code {
  background: #f6f8fa;
  padding: .15em .4em;
  border-radius: 3px;
  font-size: .9em;
}
article.post pre code { background: none; padding: 0; }
article.post blockquote {
  border-left: 4px solid var(--accent);
  padding: .5rem 1rem;
  color: #555;
  margin: 1rem 0;
  font-style: italic;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
#sidebar .widget {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}
#sidebar .widget-title {
  font-size: .95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
#sidebar ul { list-style: none; }
#sidebar ul li { padding: .35rem 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
#sidebar ul li:last-child { border-bottom: none; }

/* ── Search (Pagefind) ───────────────────────────────────────────────────── */
.search-wrap { margin-bottom: 1.5rem; }
.pagefind-ui__search-input {
  width: 100% !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  padding: .6rem 1rem !important;
  font-size: .95rem !important;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
#site-footer {
  border-top: 1px solid var(--border);
  background: var(--card-bg);
  text-align: center;
  padding: 1.5rem;
  font-size: .82rem;
  color: var(--muted);
  margin-top: 3rem;
}
