/* site.css — shared structural styles for every public site.
   All look-and-feel comes from the CSS variables each theme preset defines:

   --bg --surface --text --muted --accent --accent-contrast --border
   --font-body --font-heading --radius --header-bg --header-text
*/

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.68;
  font-size: 1.05rem;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.05), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 18%);
  opacity: 0.7;
}

h1, h2, h3, h4 { font-family: var(--font-heading); line-height: 1.15; color: var(--text); }
a { color: var(--accent); }
img { max-width: 100%; height: auto; }

/* ── Icons (inline SVG sprite, see partials/icon_sprite.html) ─────────── */
.icon { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.15em; flex-shrink: 0; }

.container { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }

/* ── Header ─────────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}
.header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; padding: 1.05rem 1.25rem; }
.site-brand { text-decoration: none; display: flex; align-items: center; gap: 0.65rem; }
.site-brand-text { display: flex; flex-direction: column; gap: 0.15rem; }
.site-logo { height: 2.1rem; width: auto; border-radius: calc(var(--radius) / 2); }
.site-title { font-family: var(--font-heading); font-size: 1.6rem; font-weight: 700; color: var(--header-text); }
.site-tagline { font-size: 0.8rem; color: var(--muted); }
.site-nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.site-nav a {
  color: var(--header-text);
  text-decoration: none;
  font-size: 0.92rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.site-nav a:hover {
  color: var(--accent-contrast);
  background: var(--accent);
  transform: translateY(-1px);
}
.search-form { display: flex; align-items: center; gap: 0.4rem; }
.search-form .input { padding: 0.4rem 0.75rem; font-size: 0.85rem; width: 11rem; }
.search-form .btn { padding: 0.45rem 0.7rem; }

/* ── Hero ───────────────────────────────────────────────────────────── */
.hero { margin: 2rem 0 2.5rem; }
.hero-link {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 10px);
  text-decoration: none;
  color: inherit;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.hero-link:hover {
  transform: translateY(-3px);
  box-shadow: 0 26px 54px rgba(0, 0, 0, 0.12);
  border-color: var(--accent);
}
.hero-image {
  width: 100%;
  aspect-ratio: 18 / 8;
  object-fit: cover;
  border-radius: calc(var(--radius) + 6px);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.12);
}
.hero-text { padding: 0.15rem 0.3rem 0.3rem; }
.hero-title { font-size: clamp(1.9rem, 4vw, 3rem); margin: 0.65rem 0 0.5rem; letter-spacing: -0.02em; }
.hero-excerpt { color: var(--muted); font-size: 1.08rem; margin: 0; max-width: 68ch; }
.hero-empty {
  text-align: center;
  padding: 3.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 10px);
}

/* ── Cards ──────────────────────────────────────────────────────────── */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.6rem; margin: 2rem 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 8px);
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.12);
  border-color: var(--accent);
}
.card-link { display: flex; flex-direction: column; min-height: 100%; text-decoration: none; color: inherit; }
.card-image { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; filter: saturate(1.03) contrast(1.02); }
.card-image-placeholder { background: linear-gradient(135deg, var(--accent), var(--surface)); aspect-ratio: 16 / 10; display: flex; align-items: center; justify-content: center; }
.card-image-placeholder .icon { width: 2.25rem; height: 2.25rem; color: var(--accent-contrast); opacity: 0.65; }
.card-body { padding: 1rem 1.1rem 1.25rem; display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }
.card-category { display: inline-flex; align-items: center; gap: 0.3rem; width: fit-content; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); text-decoration: none; margin-bottom: 0.15rem; }
.card-title { margin: 0.1rem 0 0.2rem; font-size: 1.14rem; }
.card-excerpt { color: var(--muted); font-size: 0.92rem; margin: 0; }
.card-meta { display: flex; gap: 0.75rem; flex-wrap: wrap; font-size: 0.8rem; color: var(--muted); margin-top: auto; padding-top: 0.25rem; }
.card-meta span, .card-meta time { display: inline-flex; align-items: center; gap: 0.3rem; }

/* ── Article ────────────────────────────────────────────────────────── */
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2rem; margin: 2rem 0; align-items: start; }
@media (max-width: 900px) { .article-layout { grid-template-columns: 1fr; } }
.article-narrow { max-width: 760px; margin: 2rem auto; }
.article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 10px);
  padding: clamp(1.1rem, 2vw, 1.75rem);
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.08);
}
.sidebar { display: grid; gap: 1rem; align-content: start; }
.article-header { margin-bottom: 1.4rem; }
.article-title { font-size: clamp(1.8rem, 3.6vw, 2.6rem); margin: 0.35rem 0 0.85rem; letter-spacing: -0.02em; }
.article-hero { margin: 0 0 1.5rem; }
.article-hero img {
  width: 100%;
  border-radius: calc(var(--radius) + 6px);
  aspect-ratio: 16 / 9;
  object-fit: cover;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
}
.article-hero figcaption { font-size: 0.78rem; color: var(--muted); margin-top: 0.4rem; }
.article-hero figcaption a { color: var(--muted); }
.article-body { max-width: 70ch; }
.article-body h2 { margin-top: 2.2rem; }
.article-body h3 { margin-top: 1.6rem; }
.article-body p, .article-body li { font-size: 1.03rem; line-height: 1.74; }
.article-body pre { background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); padding: 1rem; overflow-x: auto; font-size: 0.9rem; }
.article-body code { background: var(--surface); padding: 0.1em 0.35em; border-radius: 4px; font-size: 0.92em; }
.article-body pre code { background: none; padding: 0; }
.article-body blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.5rem 0;
  padding: 1rem 1.2rem;
  color: var(--muted);
  background: rgba(127, 127, 127, 0.06);
  border-radius: 0 calc(var(--radius) + 2px) calc(var(--radius) + 2px) 0;
}
.article-tags { margin: 1.5rem 0 0.5rem; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tag {
  background: rgba(127, 127, 127, 0.08);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.22rem 0.8rem;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Byline / author ────────────────────────────────────────────────── */
.avatar-fallback { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); color: var(--muted); }
.avatar-fallback .icon { width: 50%; height: 50%; }
.byline { display: flex; align-items: center; gap: 0.75rem; padding: 0.85rem 0; }
.byline-avatar { border-radius: 50%; }
.byline-text { display: flex; flex-direction: column; font-size: 0.88rem; }
.byline-name { font-weight: 600; text-decoration: none; }
.byline-quals, .byline-date { color: var(--muted); font-size: 0.8rem; }
.author-box { background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) + 8px); padding: 1.25rem; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.08); }
.author-box img { border-radius: 50%; }
.author-box h3 { margin: 0.5rem 0 0.2rem; }
.author-box h3 a { text-decoration: none; color: var(--text); }
.author-quals { color: var(--accent); font-size: 0.85rem; margin: 0 0 0.5rem; }
.author-header { display: flex; gap: 1.5rem; align-items: center; }
.author-avatar { border-radius: 50%; }

/* ── Listings / misc ────────────────────────────────────────────────── */
.listing-header { margin: 2.5rem 0 0.5rem; }
.listing-header p { color: var(--muted); }
.related h2 { margin-top: 3rem; }
.empty-note { color: var(--muted); }

/* ── Forms & buttons (search, newsletter, contact) ─────────────────── */
.form { display: grid; gap: 0.9rem; max-width: 480px; margin: 1.5rem 0; }
.field { display: grid; gap: 0.3rem; }
.field label { font-size: 0.85rem; color: var(--muted); }
.input, .textarea {
  font: inherit; padding: 0.6rem 0.85rem; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--bg); color: var(--text);
}
.textarea { resize: vertical; min-height: 6rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem; justify-content: center;
  background: var(--accent); color: var(--accent-contrast); border: none;
  border-radius: 999px; padding: 0.55rem 1.15rem; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }
.form-banner { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1rem; margin: 1rem 0; color: var(--text); }
.newsletter-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.newsletter-form .input { min-width: 14rem; }
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ── Ads: reserve space so units don't shift the layout (CLS) ───────── */
.ad-slot { min-height: 100px; margin: 1.5rem auto; text-align: center; }
.ad-slot-header, .ad-slot-footer { max-width: 1100px; }
.ad-slot-sidebar { min-height: 250px; }

/* ── Footer ─────────────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--border); margin-top: 3rem; background: var(--header-bg); backdrop-filter: blur(14px); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; padding: 1.5rem 1.25rem; font-size: 0.85rem; color: var(--muted); }
.footer-inner a { color: var(--muted); margin-right: 1rem; }
