/* Class-Run — global health calculator platform (new build) */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 1rem;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  color: var(--accent-hover);
}

img {
  max-width: 100%;
  height: auto;
}

/* —— Header —— */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Omni-style: slim main bar + category strip (25 tools grouped) */
.site-header--tiered {
  padding: 0;
}

.site-header--tiered .header-row--main {
  background: var(--surface);
}

.site-header--tiered .header-inner--main {
  padding: 0.5rem 1rem;
  min-height: auto;
}

.site-header--tiered .header-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.site-header--tiered .header-row--categories {
  background: #f8fafc;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.site-header--tiered .header-inner--categories {
  padding: 0.2rem 1rem 0.35rem;
  max-width: 1200px;
  margin: 0 auto;
}

.nav-categories {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.15rem 0.35rem;
}

.nav-cat {
  position: relative;
}

.nav-cat > summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
  border: 1px solid transparent;
}

.nav-cat > summary::-webkit-details-marker {
  display: none;
}

.nav-cat:hover > summary,
.nav-cat[open] > summary {
  color: var(--accent);
  background: rgba(37, 99, 235, 0.08);
  border-color: #e2e8f0;
}

.nav-cat-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  z-index: 250;
  min-width: 220px;
  max-width: min(92vw, 280px);
  max-height: min(70vh, 360px);
  overflow-y: auto;
  padding: 0.45rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.nav-cat-panel a {
  display: block;
  padding: 0.4rem 0.5rem;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text);
  border-radius: 6px;
  text-decoration: none;
}

.nav-cat-panel a:hover {
  background: #f1f5f9;
  color: var(--accent);
  text-decoration: none;
}

.nav-cat-panel.nav-cat-panel--mega {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.35rem;
  min-width: min(94vw, 720px);
  max-width: min(94vw, 900px);
  max-height: min(75vh, 480px);
}

.nav-cat-panel.nav-cat-panel--mega a {
  padding: 0.4rem 0.45rem;
  font-size: 0.8rem;
  border: 1px solid transparent;
}

.nav-cat-panel.nav-cat-panel--mega a:hover {
  border-color: var(--border);
}

@media (max-width: 640px) {
  .nav-cat-panel {
    left: 50%;
    transform: translateX(-50%);
  }
}

/* Header: primary row + mega menu (25 calculators) */
.nav-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  flex: 1;
  min-width: 0;
  justify-content: center;
}

@media (min-width: 1100px) {
  .nav-cluster {
    justify-content: flex-start;
  }
}

.nav-mega {
  position: relative;
}

.nav-mega > summary {
  list-style: none;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.nav-mega > summary::-webkit-details-marker {
  display: none;
}

.nav-mega[open] > summary {
  border-color: var(--accent);
}

.nav-mega-panel {
  position: absolute;
  left: 0;
  right: auto;
  top: calc(100% + 6px);
  z-index: 200;
  min-width: min(100vw - 2rem, 520px);
  max-height: min(70vh, 420px);
  overflow-y: auto;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

@media (max-width: 640px) {
  .nav-mega-panel {
    left: 50%;
    transform: translateX(-50%);
  }
}

.nav-mega-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.4rem;
}

.nav-mega-grid a {
  display: block;
  padding: 0.45rem 0.5rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  border-radius: 6px;
  border: 1px solid transparent;
}

.nav-mega-grid a:hover {
  background: #f1f5f9;
  border-color: var(--border);
  text-decoration: none;
  color: var(--accent);
}

.logo {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--text);
}
.logo:hover {
  text-decoration: none;
  color: var(--accent);
}

.nav-primary {
  display: flex;
  align-items: center;
  gap: 0.5rem 1rem;
  flex-wrap: wrap;
}

.nav-primary a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
}
.nav-primary a:hover {
  color: var(--accent);
}

.lang-select {
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}

/* —— Ad zones (classes match legacy markup) —— */
.top-ad,
.content-ad,
.sidebar-ad {
  text-align: center;
  margin: 1.25rem auto;
}

/* Top leaderboard: empty AdSense slot was reserving 250px → large gray gap.
   Let the slot shrink until an ad renders; keep ins markup unchanged in HTML. */
.top-ad {
  max-width: 1200px;
  padding: 0 1rem;
  overflow-x: auto;
  margin: 0.35rem auto 0.5rem;
  line-height: 0;
}

.top-ad ins.adsbygoogle {
  display: inline-block !important;
  max-width: min(970px, 100%) !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  vertical-align: top;
}

.content-ad {
  max-width: 100%;
}

/* In-article MPU: avoid a fixed 280px-tall empty box when no fill (same idea as .top-ad). */
.content-ad ins.adsbygoogle {
  display: inline-block !important;
  max-width: min(336px, 100%) !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  vertical-align: top;
}

.sidebar-ad {
  margin-top: 1.5rem;
}

/* —— Layout —— */
.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.layout-split {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 2rem;
  align-items: start;
}

@media (max-width: 960px) {
  .layout-split {
    grid-template-columns: 1fr;
  }
  .calc-column {
    order: -1;
  }
}

/* —— Article / SEO —— */
.article {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.article h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin: 0 0 0.75rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.lead {
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0 0 1.25rem;
}

.seo-block h2 {
  font-size: 1.2rem;
  margin: 2rem 0 0.75rem;
  color: var(--text);
}

.seo-block h3 {
  font-size: 1.05rem;
  margin: 1.25rem 0 0.5rem;
}

.seo-block p {
  margin: 0.65rem 0;
  color: #334155;
}

.seo-block ul {
  margin: 0.5rem 0 1rem;
  padding-left: 1.25rem;
  color: #334155;
}

.faq-block {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.faq-block h2 {
  margin-top: 0;
}

/* —— Calculator card —— */
.calc-column {
  position: sticky;
  top: 6.75rem;
}

.calc-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.calc-card h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.field input,
.field select {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbfc;
}

.field-row {
  display: flex;
  gap: 0.75rem;
}

.field-row .field {
  flex: 1;
}

.result-panel {
  margin-top: 1.25rem;
  padding: 1rem;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-radius: 10px;
  border: 1px solid #bae6fd;
}

.result-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.status-message {
  margin-top: 0.65rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}

.status-message.info {
  background: #eff6ff;
  color: #1e40af;
}
.status-message.ok {
  background: #ecfdf5;
  color: #047857;
}
.status-message.warn {
  background: #fffbeb;
  color: #b45309;
}
.status-message.risk {
  background: #fef2f2;
  color: #b91c1c;
}

.action-suggestion {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 0.92rem;
  border-left: 4px solid var(--accent);
}

.action-suggestion strong {
  display: block;
  margin-bottom: 0.25rem;
}

/* —— Related links —— */
.related.related--top {
  margin: 0.75rem 0 0.5rem;
}

.related.related--top h2 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.65rem;
  margin-top: 0.65rem;
  margin-bottom: 0.25rem;
}

.related-grid a {
  display: block;
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
}
.related-grid a:hover {
  border-color: var(--accent);
  text-decoration: none;
  color: var(--accent);
}

.chain-nav {
  margin: 1rem 0 1.5rem;
  padding: 0.85rem 1rem;
  background: #eef2ff;
  border-radius: 10px;
  font-size: 0.88rem;
}
.chain-nav strong {
  color: #3730a3;
}

/* —— Footer —— */
.site-footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
  font-size: 0.82rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.disclaimer {
  margin-top: 1.5rem;
  padding: 1rem;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.calc-primary {
  margin: 1.25rem 0 1.5rem;
}

.calc-card--primary {
  max-width: 640px;
}

.section-heading {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  color: var(--text);
}

.calc-actions {
  margin: 0.75rem 0 0.5rem;
}

.btn-calculate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn-calculate:hover {
  background: var(--accent-hover);
}

.next-calculators {
  margin: 1.5rem 0 1.25rem;
}

.next-calc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.6rem;
}

.next-calc-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.next-calc-card:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.next-calc-card__go {
  color: var(--muted);
  font-weight: 700;
}

.related--bottom {
  margin-top: 1.5rem;
}

.calc-column--rail {
  align-self: flex-start;
}

/* —— Utilities —— */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
