/* =====================================================================
   CalcHub — modern, responsive design system
   ===================================================================== */

:root {
  --bg: #f7faf8;
  --surface: #ffffff;
  --surface-2: #f2f6f4;
  --surface-3: #e9f0ec;
  --ink: #1c1a1d;
  --text: #24312c;
  --muted: #5c6b64;
  --border: #dfe8e3;
  --border-strong: #cdd9d2;
  --brand: #1b5b4a;
  --brand-2: #124e52;
  --brand-dark: #12403a;
  --brand-soft: #e7f1ec;
  --accent: #1b5b4a;
  --danger: #dc2626;
  --radius-lg: 22px;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(2, 13, 10, .05);
  --shadow: 0 1px 2px rgba(2, 13, 10, .04), 0 12px 30px -12px rgba(2, 13, 10, .16);
  --shadow-lg: 0 24px 60px -20px rgba(2, 13, 10, .3);
  --grad: linear-gradient(135deg, #1b5b4a 0%, #124e52 60%, #0f3f42 100%);
  --font-body: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-heading: "ClashGrotesk", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --container: 1240px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; }

a { color: var(--brand); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--brand-2); }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 500;
  color: var(--ink);
  line-height: 1.22;
}

.container { width: min(var(--container), 100% - 2.5rem); margin-inline: auto; }

.full-bleed {
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--brand); color: #fff; padding: .6rem 1rem; border-radius: 0 0 10px 0;
}
.skip-link:focus { left: 0; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.text-center { text-align: center; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* =====================================================================
   Header
   ===================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-main { position: relative; }
.header-inner {
  display: flex; align-items: center; gap: 1.25rem;
  min-height: 70px;
}

.brand { display: inline-flex; align-items: center; gap: .65rem; flex-shrink: 0; }
.brand:hover { text-decoration: none; }
.brand-icon {
  display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 13px;
  background: var(--grad); color: #fff; font-size: 1.3rem;
  box-shadow: 0 8px 20px -8px rgba(79, 70, 229, .8);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 800; font-size: 1.22rem; color: var(--ink); letter-spacing: -.01em; }
.brand-tag { font-size: .68rem; color: var(--muted); font-weight: 500; letter-spacing: .02em; }

/* Primary navigation */
.primary-nav { display: flex; align-items: center; gap: 1rem; margin-left: .5rem; }
.nav-list { display: flex; align-items: center; gap: .15rem; list-style: none; margin: 0; padding: 0; }
.nav-item { position: relative; }
.nav-link {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .55rem .8rem; border-radius: 10px;
  font: inherit; font-weight: 600; font-size: .92rem; color: var(--text);
  background: none; border: 0; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.nav-link:hover { background: var(--surface-2); color: var(--brand); text-decoration: none; }
.nav-item.is-active > .nav-link { color: var(--brand); background: var(--brand-soft); }
.chev { transition: transform .2s ease; }
.mega-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }

/* Mega menu */
.mega {
  position: absolute; top: calc(100% + .6rem); left: 50%; transform: translateX(-50%) translateY(8px);
  width: min(880px, 90vw);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 1.35rem; opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.mega-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }
.mega-col { min-width: 0; }
.mega-head { display: flex; align-items: center; gap: .6rem; padding-bottom: .6rem; margin-bottom: .5rem; border-bottom: 1px solid var(--border); }
.mega-head:hover { text-decoration: none; }
.mega-head strong { display: block; color: var(--ink); font-size: .92rem; }
.mega-head em { display: block; color: var(--muted); font-style: normal; font-size: .74rem; }
.mega-icon { font-size: 1.3rem; }
.mega-list { list-style: none; margin: 0 0 .5rem; padding: 0; }
.mega-list li { margin: .1rem 0; }
.mega-list a { display: block; padding: .3rem .1rem; font-size: .86rem; color: var(--text); }
.mega-list a:hover { color: var(--brand); text-decoration: none; padding-left: .25rem; }
.mega-all { font-size: .8rem; font-weight: 700; color: var(--brand); }

@media (min-width: 1024px) {
  .has-mega:hover .mega,
  .has-mega:focus-within .mega,
  .has-mega.mega-open .mega {
    opacity: 1; visibility: visible; pointer-events: auto;
    transform: translateX(-50%) translateY(0);
  }
}

/* Search */
.header-search {
  display: flex; align-items: center; gap: 0;
  margin-left: auto; flex: 0 1 300px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  padding: .2rem .3rem .2rem .9rem;
}
.header-search input {
  flex: 1; border: 0; background: none; padding: .45rem 0; font-size: .9rem; color: var(--text); width: 100%;
}
.header-search input:focus { outline: none; }
.header-search button {
  display: grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0;
  border: 0; border-radius: 50%; background: var(--grad); color: #fff; cursor: pointer;
}
.nav-search { display: none; }

.menu-toggle {
  display: none; margin-left: auto;
  width: 46px; height: 42px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); cursor: pointer; padding: 0;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.menu-toggle span { display: block; width: 20px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .25s ease, opacity .2s ease; }
.menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =====================================================================
   Layout
   ===================================================================== */
.site-main { padding: 2.25rem 0 4.5rem; }
.page-head { margin-bottom: 1.75rem; }
.page-head h1 { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.6rem); margin: 0 0 .4rem; letter-spacing: -.02em; }
.page-head p { color: var(--muted); margin: 0; max-width: 72ch; font-size: 1.02rem; }
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: 1rem; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); }

.section-title { display: flex; align-items: baseline; gap: .8rem; margin: 2.75rem 0 1.15rem; flex-wrap: wrap; }
.section-title h2 { margin: 0; font-size: 1.5rem; letter-spacing: -.02em; }
.section-title span { color: var(--muted); font-size: .92rem; }
.section-title a { margin-left: auto; font-weight: 700; font-size: .9rem; }

/* =====================================================================
   Hero
   ===================================================================== */
.hero {
  position: relative; overflow: hidden;
  background: var(--grad); color: #fff;
  padding: 3.5rem 0 3.25rem;
  margin-top: -2.25rem; margin-bottom: 2.5rem;
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(60% 120% at 85% 10%, rgba(255,255,255,.22), transparent 60%),
              radial-gradient(50% 100% at 5% 90%, rgba(0,0,0,.18), transparent 60%);
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; max-width: 780px; }
.hero h1 { color: #fff; margin: 0 0 .7rem; font-size: clamp(2rem, 1.4rem + 3vw, 3.25rem); letter-spacing: -.03em; }
.hero p { margin: 0; font-size: 1.1rem; opacity: .94; max-width: 62ch; }
.hero-stats { display: flex; gap: 2.5rem; margin-top: 1.85rem; flex-wrap: wrap; }
.hero-stats strong { display: block; font-size: 1.9rem; line-height: 1; font-weight: 800; }
.hero-stats span { font-size: .82rem; opacity: .85; }

.hero-search { display: flex; gap: .5rem; margin-top: 1.85rem; max-width: 560px; }
.hero-search input {
  flex: 1; border: 0; border-radius: 999px; padding: .85rem 1.25rem; font-size: 1rem;
  background: rgba(255, 255, 255, .96); color: var(--ink);
}
.hero-search input:focus { outline: 3px solid rgba(255,255,255,.55); }
.hero-search button {
  border: 0; border-radius: 999px; padding: .85rem 1.6rem; font-weight: 700; font-size: 1rem;
  background: #0f172a; color: #fff; cursor: pointer; white-space: nowrap;
}
.hero-search button:hover { background: #1e293b; }

.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px;
  gap: 2.5rem; align-items: center;
}
.hero-inner { max-width: 100%; }
.hero-art { display: grid; place-items: center; justify-self: end; }
.calc-art {
  width: 100%; max-width: 320px; height: auto;
  animation: calcFloat 6s ease-in-out infinite;
}
@keyframes calcFloat {
  0%, 100% { transform: translateY(0) rotate(-2.5deg); }
  50% { transform: translateY(-14px) rotate(-2.5deg); }
}
@media (prefers-reduced-motion: reduce) { .calc-art { animation: none; } }

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; gap: 1.75rem; }
  .hero-art { justify-self: start; }
  .calc-art { max-width: 260px; }
}

/* =====================================================================
   Cards / grids
   ===================================================================== */
.grid { display: grid; gap: 1.1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid--cats { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.card {
  position: relative; display: block; color: inherit;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem 1.3rem; box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--border-strong); text-decoration: none; color: inherit; }
.card h3 { margin: 0 0 .4rem; font-size: 1.08rem; }
.card p { margin: 0; color: var(--muted); font-size: .9rem; }
.card .tags { margin-top: .7rem; display: flex; flex-wrap: wrap; gap: .35rem; }
.tag { font-size: .72rem; background: var(--brand-soft); color: var(--brand-dark); padding: .2rem .6rem; border-radius: 999px; font-weight: 600; }
.card-cat { font-size: 1.9rem; margin-bottom: .5rem; }
.card-arrow { margin-top: .9rem; display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; font-size: .85rem; color: var(--brand); }

.card--cat { background: linear-gradient(180deg, #fff, var(--surface-2)); }

.card--post .post-meta { display: flex; gap: .6rem; align-items: center; margin-bottom: .6rem; font-size: .76rem; color: var(--muted); }
.card--post h3 { font-size: 1.12rem; line-height: 1.35; }
.post-thumb {
  aspect-ratio: 16 / 9; border-radius: var(--radius-sm); margin-bottom: .9rem;
  background: var(--grad); display: grid; place-items: center; color: #fff; font-size: 2rem;
  overflow: hidden;
}
.post-thumb img { width: 100%; height: 100%; object-fit: cover; }

.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: .2rem .6rem; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); }
.badge--accent { background: #dcfce7; color: #15803d; }

/* =====================================================================
   Calculator page
   ===================================================================== */
.calc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.75rem; align-items: start; }
.calc-col { min-width: 0; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.panel + .panel { margin-top: 1.4rem; }
.panel-head {
  padding: 1.05rem 1.3rem; border-bottom: 1px solid var(--border);
  font-weight: 700; color: var(--ink);
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  background: linear-gradient(180deg, #fff, var(--surface-2));
}
.panel-body { padding: 1.4rem; }

.calc-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) { .calc-grid { grid-template-columns: 1fr 1fr; } .calc-grid .field--full { grid-column: 1 / -1; } }

.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.field label { font-size: .85rem; font-weight: 600; color: var(--ink); }
.field .hint { font-size: .78rem; color: var(--muted); }
.input-wrap { display: flex; align-items: stretch; }
.input-wrap .affix {
  display: flex; align-items: center; padding: 0 .7rem;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-size: .9rem;
}
.input-wrap .affix--pre { border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-wrap .affix--post { border-left: 0; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-wrap input, .input-wrap select { flex: 1; min-width: 0; }
.input-wrap:has(.affix--pre) input, .input-wrap:has(.affix--pre) select { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.input-wrap:has(.affix--post) input, .input-wrap:has(.affix--post) select { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }

input, select, textarea {
  width: 100%; padding: .62rem .75rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: .95rem; font-family: inherit; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }

.radio-group { display: flex; flex-wrap: wrap; gap: .5rem; }
.radio-group label {
  display: inline-flex; align-items: center; gap: .4rem; font-weight: 500; font-size: .9rem;
  border: 1px solid var(--border-strong); padding: .5rem .8rem; border-radius: 999px; cursor: pointer;
  transition: all .15s ease;
}
.radio-group label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.radio-group input { width: auto; }

.btn-row { display: flex; gap: .65rem; flex-wrap: wrap; margin-top: .5rem; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .72rem 1.5rem; border: 0; border-radius: var(--radius-sm);
  font-weight: 700; font-size: .95rem; cursor: pointer; font-family: inherit;
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 24px -12px rgba(79,70,229,.9); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 16px 30px -14px rgba(79,70,229,.9); color: #fff; }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); }
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn.small { padding: .5rem 1rem; font-size: .85rem; }

/* Results */
.results { margin-top: 1.4rem; }
.result-hidden { display: none; }
.result-highlight {
  background: linear-gradient(135deg, var(--brand-soft), #f5f3ff);
  border: 1px solid #c7d2fe; border-radius: var(--radius); padding: 1.2rem; margin-bottom: 1.1rem; text-align: center;
}
.result-highlight .label { font-size: .8rem; color: var(--brand-dark); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.result-highlight .value { font-size: clamp(1.8rem, 1.2rem + 2vw, 2.4rem); font-weight: 800; color: var(--brand-dark); line-height: 1.2; }
.result-highlight .hint { font-size: .82rem; color: var(--muted); }
.result-rows { display: grid; }
.result-row { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-bottom: 1px dashed var(--border); }
.result-row:last-child { border-bottom: 0; }
.result-row .k { color: var(--muted); font-size: .9rem; }
.result-row .v { font-weight: 700; text-align: right; }
.result-row .hint { display: block; font-weight: 400; font-size: .75rem; color: var(--muted); }
.result-error { background: #fef2f2; border: 1px solid #fecaca; color: var(--danger); padding: .8rem 1rem; border-radius: var(--radius-sm); font-size: .9rem; }

table.data { width: 100%; border-collapse: collapse; font-size: .85rem; margin-top: .5rem; }
table.data th, table.data td { padding: .5rem .65rem; border-bottom: 1px solid var(--border); text-align: right; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th { background: var(--surface-2); position: sticky; top: 0; color: var(--ink); }
.table-scroll { max-height: 380px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: .8rem; }

/* =====================================================================
   Prose / content
   ===================================================================== */
.prose h2 { font-size: 1.3rem; margin: 1.6rem 0 .55rem; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 1.08rem; margin: 1.15rem 0 .45rem; }
.prose p { margin: .6rem 0; color: #334155; }
.prose ul, .prose ol { margin: .6rem 0; padding-left: 1.35rem; color: #334155; }
.prose li { margin: .3rem 0; }
.prose img { border-radius: var(--radius-sm); margin: .75rem 0; }
.prose blockquote { margin: 1rem 0; padding: .5rem 1.1rem; border-left: 4px solid var(--brand); background: var(--surface-2); color: #334155; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.prose a { font-weight: 600; }
.prose .formula {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .7rem .9rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88rem; overflow-x: auto;
}

.callout {
  border-left: 4px solid var(--brand); background: var(--brand-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: .8rem 1.1rem; font-size: .9rem; color: #312e81;
}

/* FAQ */
.faq details { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .15rem 1rem; margin-bottom: .6rem; background: var(--surface); }
.faq details[open] { background: var(--surface-2); }
.faq summary { cursor: pointer; font-weight: 600; padding: .8rem 0; list-style: none; display: flex; justify-content: space-between; gap: 1rem; color: var(--ink); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-weight: 700; color: var(--brand); font-size: 1.2rem; line-height: 1; }
.faq details[open] summary::after { content: '−'; }
.faq .answer { padding: 0 0 .85rem; color: #334155; }

/* Embed box */
.embed-box textarea { font-family: ui-monospace, Menlo, monospace; font-size: .8rem; height: 86px; resize: vertical; }
.copy-row { display: flex; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }

/* Sidebar */
.sidebar .panel-body { padding: 1.1rem; }
.related-list { list-style: none; margin: 0; padding: 0; }
.related-list li { border-bottom: 1px solid var(--border); }
.related-list li:last-child { border-bottom: 0; }
.related-list a { display: block; padding: .5rem 0; font-size: .9rem; color: var(--text); }
.related-list a:hover { color: var(--brand); }

/* =====================================================================
   Blog
   ===================================================================== */
.blog-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 2rem; align-items: start; }
.blog-cats { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }
.chip {
  display: inline-block; padding: .45rem .95rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border-strong);
  font-size: .85rem; font-weight: 600; color: var(--text);
}
.chip:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }
.chip.is-active { background: var(--grad); color: #fff; border-color: transparent; }

.pagination { display: flex; gap: .4rem; justify-content: center; margin-top: 2.25rem; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 42px; height: 42px; padding: 0 .7rem; display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); font-weight: 600; font-size: .9rem; color: var(--text); background: var(--surface);
}
.pagination .is-current { background: var(--grad); color: #fff; border-color: transparent; }
.pagination a:hover { border-color: var(--brand); color: var(--brand); text-decoration: none; }

.article-head { margin-bottom: 1.5rem; }
.article-head h1 { font-size: clamp(1.8rem, 1.3rem + 2.4vw, 2.8rem); margin: .5rem 0 .6rem; letter-spacing: -.02em; }
.article-meta { display: flex; flex-wrap: wrap; gap: .9rem; align-items: center; color: var(--muted); font-size: .88rem; }
.article-cover { border-radius: var(--radius); overflow: hidden; margin-bottom: 1.5rem; box-shadow: var(--shadow); }
.article-body { font-size: 1.06rem; }
.article-body p { margin: 1rem 0; }
.article-body h2 { margin-top: 2rem; }
.article-body h3 { margin-top: 1.5rem; }
.article-tags { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 2rem; }
.share-row { display: flex; gap: .5rem; align-items: center; margin-top: 1.5rem; flex-wrap: wrap; }

/* Byline */
.byline { display: flex; align-items: center; gap: .6rem; margin-top: 1rem; color: var(--muted); font-size: .92rem; }
.byline strong { color: var(--ink); font-weight: 600; }

/* Author card / avatar */
.author-card { display: flex; gap: .85rem; align-items: flex-start; }
.author-card p, .author-bio { margin: .35rem 0 0; font-size: .88rem; color: var(--muted); }
.author-bio p { margin: .35rem 0 0; }
.author-bio p:first-child { margin-top: 0; }
.author-bio ul, .author-bio ol { margin: .35rem 0 0; padding-left: 1.1rem; }
.author-label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.author-avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.byline .author-avatar { width: 40px; height: 40px; }
.author-avatar--initial {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--grad); color: #fff; font-family: var(--font-heading); font-weight: 600; font-size: 1.3rem;
}

/* From-the-blog strip on non-blog pages */
.blog-strip { margin: 2.5rem 0 1rem; }
.blog-side { position: sticky; top: 90px; }

.sidebar-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow-sm); }
.sidebar-card + .sidebar-card { margin-top: 1.25rem; }
.sidebar-card h3 { margin: 0 0 .9rem; font-size: 1.02rem; }
.mini-post { display: flex; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.mini-post:last-child { border-bottom: 0; }
.mini-post .mini-thumb { width: 54px; height: 54px; flex-shrink: 0; border-radius: 10px; background: var(--grad); display: grid; place-items: center; color: #fff; font-size: 1.2rem; }
.mini-post a { font-weight: 600; font-size: .9rem; color: var(--ink); line-height: 1.35; }
.mini-post .mini-date { font-size: .74rem; color: var(--muted); }

/* =====================================================================
   Contact
   ===================================================================== */
.contact-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 2rem; align-items: start; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field-block { margin-bottom: 1rem; }
.field-block label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: .35rem; }
.alert { padding: .85rem 1.1rem; border-radius: var(--radius-sm); margin-bottom: 1.25rem; font-size: .92rem; }
.alert-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #047857; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: var(--danger); }
.contact-info-item { display: flex; gap: .75rem; margin-bottom: 1rem; }
.contact-info-item .ci-icon { font-size: 1.3rem; }

/* =====================================================================
   Footer
   ===================================================================== */
.site-footer { background: #0b1020; color: #94a3b8; margin-top: 1rem; }
.footer-grid {
  display: grid; grid-template-columns: 1.7fr 1fr 1fr 1fr; gap: 2rem;
  padding: 3rem 0 2rem;
}
.footer-brand .brand { margin-bottom: 1rem; }
.brand--footer .brand-name { color: #fff; }
.footer-brand p { font-size: .9rem; line-height: 1.7; max-width: 42ch; }
.footer-social { display: flex; gap: .6rem; margin-top: 1.1rem; flex-wrap: wrap; }
.footer-social a {
  font-size: .8rem; font-weight: 600; color: #cbd5e1;
  border: 1px solid #1e293b; padding: .35rem .8rem; border-radius: 999px;
}
.footer-social a:hover { border-color: var(--brand); color: #fff; text-decoration: none; }
.site-footer h4 { color: #fff; font-size: .95rem; margin: 0 0 .9rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin: .45rem 0; }
.site-footer a { color: #94a3b8; font-size: .9rem; }
.site-footer a:hover { color: #fff; text-decoration: none; }
.footer-bottom {
  border-top: 1px solid #1e293b; padding: 1.35rem 0; display: flex; align-items: center;
  justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: .82rem;
}
.footer-bottom p { margin: 0; }
.footer-legal { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.footer-legal a { color: #94a3b8; }

.empty-state { text-align: center; padding: 4rem 1rem; color: var(--muted); }
.empty-state h1 { margin-top: 0; }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 1023px) {
  .menu-toggle { display: flex; }
  .header-search { display: none; }

  .primary-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg); padding: .5rem 1.25rem 1.25rem;
    display: none; max-height: calc(100vh - 70px); overflow-y: auto;
  }
  .site-header.nav-open .primary-nav { display: flex; }
  .nav-list { flex-direction: column; align-items: stretch; gap: 0; width: 100%; }
  .nav-item { width: 100%; }
  .nav-link { width: 100%; justify-content: space-between; padding: .85rem .5rem; border-bottom: 1px solid var(--border); border-radius: 0; font-size: 1rem; }
  .nav-item.is-active > .nav-link { background: none; }
  .mega {
    position: static; transform: none; width: 100%; opacity: 1; visibility: visible; pointer-events: auto;
    display: none; border: 0; box-shadow: none; padding: 0 0 1rem .5rem;
  }
  .has-mega.mega-open .mega { display: block; }
  .mega-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
  .mega-grid { grid-template-columns: 1fr 1fr; gap: 1rem; }
  .nav-search { display: flex; gap: 0; margin-top: 1rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: .2rem .3rem .2rem .9rem; }
  .nav-search input { flex: 1; border: 0; background: none; padding: .5rem 0; font-size: .95rem; }
  .nav-search input:focus { outline: none; }
  .nav-search button { border: 0; border-radius: 999px; background: var(--grad); color: #fff; padding: 0 1.1rem; font-weight: 700; cursor: pointer; }

  .calc-layout, .blog-layout, .contact-layout { grid-template-columns: 1fr; }
  .sidebar { order: 2; }
}

@media (max-width: 700px) {
  .container { width: min(var(--container), 100% - 1.5rem); }
  .brand-tag { display: none; }
  .hero { padding: 2.5rem 0 2.25rem; }
  .hero-stats { gap: 1.75rem; }
  .hero-search { flex-direction: column; }
  .hero-search button { width: 100%; }
  .mega-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 1.75rem; padding: 2.25rem 0 1.5rem; }
  .footer-brand { grid-column: 1 / -1; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 460px) {
  .footer-grid { grid-template-columns: 1fr; }
  .grid--cats { grid-template-columns: 1fr; }
}
