/* ==========================================================================
   BarkCalc — main stylesheet
   One file, no framework, system fonts (zero font downloads = fast).
   Colours are defined once below; change them here to re-brand the site.
   ========================================================================== */

:root {
  --brand: #0e7a6d;        /* teal: buttons, links, logo */
  --brand-dark: #0a5d53;   /* hover / pressed */
  --brand-soft: #e3f4f1;   /* soft teal backgrounds */
  --accent: #f6b73c;       /* warm yellow highlight (use with dark text) */
  --accent-soft: #fff4dc;
  --bg: #fffdf8;           /* page background (warm white) */
  --surface: #ffffff;
  --text: #1d2733;
  --muted: #55606e;        /* 6.3:1 on white */
  --border: #e7e1d4;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --warn-soft: #fffaeb;
  --warn-border: #f0a43a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 39, 51, .06), 0 6px 20px rgba(29, 39, 51, .06);
  --wrap: 1120px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body {
  margin: 0; font-family: var(--font); font-size: 1.0625rem; line-height: 1.65;
  color: var(--text); background: var(--bg);
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-dark); }
h1, h2, h3 { line-height: 1.25; margin: 1.6em 0 .5em; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); margin-top: .2em; letter-spacing: -.01em; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.7rem); }
h3 { font-size: 1.15rem; }
p, ul, ol { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 780px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--text); color: #fff; padding: 10px 16px; z-index: 100; }
.skip:focus { left: 10px; top: 10px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 16px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 800; font-size: 1.3rem; letter-spacing: -.02em; }
.logo svg { width: 36px; height: 36px; flex: none; }
.logo span b { color: var(--brand); }
.nav-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font: inherit; font-size: .95rem; color: var(--text); cursor: pointer; }
.site-nav ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.site-nav a { display: block; padding: 8px 12px; border-radius: 10px; text-decoration: none; color: var(--text); font-weight: 600; font-size: .98rem; }
.site-nav a:hover, .site-nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-dark); }
@media (max-width: 760px) {
  .nav-toggle { display: inline-block; }
  .site-nav { display: none; position: absolute; left: 0; right: 0; top: 64px; background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; padding: 8px 12px 14px; }
}

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { font-size: .9rem; color: var(--muted); margin: 18px 0 6px; }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumbs li + li::before { content: "›"; margin-right: 6px; color: var(--muted); }
.breadcrumbs a { color: var(--muted); }

/* ---------- Hero (home) ---------- */
.hero { background: linear-gradient(180deg, var(--brand-soft), var(--bg)); padding: 48px 0 30px; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: .3em; }
.hero p.lead { font-size: 1.2rem; color: var(--muted); max-width: 680px; }
.hero .badges { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 18px 0 0; }
.hero .badges li { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 5px 14px; font-size: .92rem; font-weight: 600; }

/* ---------- Cards / grid ---------- */
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); margin: 20px 0 10px; padding: 0; list-style: none; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.tool-card { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--text); height: 100%; transition: transform .15s, border-color .15s; }
.tool-card:hover { transform: translateY(-2px); border-color: var(--brand); color: var(--text); }
.tool-card .icon { font-size: 1.8rem; line-height: 1; }
.tool-card h3 { margin: 6px 0 0; font-size: 1.1rem; color: var(--brand-dark); }
.tool-card p { margin: 0; color: var(--muted); font-size: .97rem; }
.post-list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.post-list a { display: block; height: 100%; text-decoration: none; color: var(--text); }
.post-list a:hover { border-color: var(--brand); }
.post-list h3 { margin: 0 0 6px; font-size: 1.08rem; color: var(--brand-dark); }
.post-list p { margin: 0; color: var(--muted); font-size: .95rem; }

/* ---------- Calculator ---------- */
.page-head { margin-bottom: 18px; }
.page-head .lead { font-size: 1.15rem; color: var(--muted); max-width: 760px; }
.calc { margin: 10px 0 26px; border-top: 5px solid var(--brand); }
.calc form { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: start; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label, .field legend { font-weight: 700; font-size: .97rem; }
.field .hint { font-size: .86rem; color: var(--muted); margin: 0; }
.input-unit { display: flex; }
.input-unit input { border-top-right-radius: 0; border-bottom-right-radius: 0; flex: 1; min-width: 0; }
.input-unit select { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 0; width: auto; flex: none; background-color: var(--brand-soft); font-weight: 700; }
input[type="number"], input[type="date"], input[type="email"], input[type="text"], select {
  width: 100%; font: inherit; font-size: 1rem; padding: 11px 12px; border: 1.5px solid #c9c2b3; border-radius: 10px;
  background: #fff; color: var(--text); min-height: 48px;
}
input:focus, select:focus { border-color: var(--brand); }
.calc .actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; font-size: 1rem; padding: 12px 22px; border-radius: 10px; border: 2px solid var(--brand); background: var(--brand); color: #fff; cursor: pointer; text-decoration: none; min-height: 48px; }
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn.ghost { background: transparent; color: var(--brand-dark); }
.btn.ghost:hover { background: var(--brand-soft); color: var(--brand-dark); }
.btn.small { padding: 8px 14px; font-size: .92rem; min-height: 40px; }

.result { margin-top: 22px; padding: 20px; border-radius: 12px; background: var(--brand-soft); border: 1px solid #bfe3dc; }
.result[hidden] { display: none; }
.result .big { font-size: clamp(1.8rem, 5vw, 2.6rem); font-weight: 800; color: var(--brand-dark); line-height: 1.15; margin: 0 0 6px; }
.result .sub { color: var(--text); margin: 0 0 12px; }
.result table { width: 100%; border-collapse: collapse; margin: 10px 0; background: #fff; border-radius: 8px; overflow: hidden; font-size: .97rem; }
.result th, .result td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.result th { background: #f6fbfa; font-weight: 700; }
.share-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.toast { font-size: .9rem; color: var(--brand-dark); font-weight: 700; align-self: center; }
.level { display: inline-block; padding: 3px 12px; border-radius: 999px; font-weight: 800; font-size: .95rem; }
.level.ok { background: #dcfae6; color: #085d3a; }
.level.mild { background: #fef0c7; color: #7a2e0e; }
.level.moderate { background: #fdddc8; color: #7e2410; }
.level.severe { background: #fee4e2; color: #912018; }

.alert { border-radius: 12px; padding: 16px 18px; margin: 16px 0; border: 1.5px solid; }
.alert.danger { background: var(--danger-soft); border-color: #f4a19a; color: #55160c; }
.alert.danger strong:first-child { color: var(--danger); }
.alert.warn { background: var(--warn-soft); border-color: var(--warn-border); }
.alert.info { background: var(--brand-soft); border-color: #bfe3dc; }
.alert p:last-child, .alert ul:last-child { margin-bottom: 0; }

/* ---------- Content ---------- */
.layout { display: grid; gap: 40px; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
@media (max-width: 960px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.prose { max-width: 760px; }
.prose h2 { border-top: 1px solid var(--border); padding-top: 1.1em; }
.prose table { border-collapse: collapse; width: 100%; margin: 0 0 1.2em; font-size: .97rem; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.prose th { background: var(--brand-soft); }
.prose blockquote { margin: 1em 0; padding: 10px 18px; border-left: 4px solid var(--accent); background: var(--accent-soft); border-radius: 0 10px 10px 0; }
.formula { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; background: #f4f1ea; padding: 12px 14px; border-radius: 10px; display: block; overflow-x: auto; font-size: .95rem; margin: 0 0 1em; }
.sources { font-size: .93rem; color: var(--muted); }
.meta { color: var(--muted); font-size: .92rem; margin-bottom: 1em; }
.cta-box { background: var(--accent-soft); border: 1.5px solid var(--accent); border-radius: var(--radius); padding: 18px 20px; margin: 1.5em 0; }
.cta-box p { margin: 0 0 10px; font-weight: 600; }

aside.sidebar { position: sticky; top: 84px; display: grid; gap: 18px; }
aside.sidebar h2 { font-size: 1.05rem; margin: 0 0 10px; border: 0; padding: 0; }
aside.sidebar ul { list-style: none; padding: 0; margin: 0; }
aside.sidebar li { margin: 0 0 6px; }
@media (max-width: 960px) { aside.sidebar { position: static; } }

/* FAQ */
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin: 0 0 10px; }
.faq summary { cursor: pointer; padding: 14px 18px; font-weight: 700; list-style: none; position: relative; padding-right: 44px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 18px; top: 10px; font-size: 1.4rem; color: var(--brand); }
.faq details[open] summary::after { content: "–"; }
.faq details > div { padding: 0 18px 14px; }

/* Related */
.related ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.related a { display: block; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); text-decoration: none; font-weight: 600; }
.related a:hover { border-color: var(--brand); }

/* ---------- Affiliate block (filled from /js/config.js) ---------- */
.aff[hidden] { display: none; }
.aff { margin: 26px 0; }
.aff h2 { margin-top: 0; font-size: 1.15rem; border: 0; padding: 0; }
.aff ul { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 10px; }
.aff li { display: flex; justify-content: space-between; gap: 12px; align-items: center; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; background: #fff; flex-wrap: wrap; }
.aff li span { font-weight: 600; }
.aff .note { font-size: .85rem; color: var(--muted); margin: 0; }

/* ---------- Ad slots (empty until an ad network is configured) ---------- */
.ad-slot { display: none; }
.ads-on .ad-slot { display: block; margin: 24px auto; min-height: 280px; text-align: center; }
.ads-preview .ad-slot { display: flex; align-items: center; justify-content: center; margin: 24px auto; min-height: 120px; border: 2px dashed #c9c2b3; border-radius: 12px; color: var(--muted); font-size: .9rem; background: repeating-linear-gradient(45deg, #fff, #fff 10px, #faf7f0 10px, #faf7f0 20px); }
.ads-preview .ad-slot::before { content: "Ad slot: " attr(data-ad-slot); }

/* ---------- Newsletter ---------- */
.newsletter { background: var(--brand); color: #fff; padding: 36px 0; margin-top: 50px; }
.newsletter h2 { margin: 0 0 6px; color: #fff; }
.newsletter p { margin: 0 0 14px; color: #e6f5f2; }
.newsletter form { display: flex; gap: 10px; flex-wrap: wrap; max-width: 560px; }
.newsletter input[type="email"] { flex: 1 1 240px; border-color: transparent; }
.newsletter .btn { background: var(--accent); border-color: var(--accent); color: #1d2733; }
.newsletter .btn:hover { background: #ffd27a; border-color: #ffd27a; color: #1d2733; }
.newsletter .msg { margin-top: 10px; font-weight: 700; min-height: 1.4em; }
.newsletter .fine { font-size: .85rem; color: #d3eee9; margin-top: 8px; }
.newsletter .fine a { color: #fff; }

/* ---------- Footer ---------- */
.site-footer { background: #17222d; color: #cdd5de; padding: 40px 0 26px; font-size: .95rem; }
.site-footer a { color: #e8edf2; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; color: #fff; }
.footer-cols { display: grid; gap: 26px; grid-template-columns: 1.4fr repeat(3, 1fr); }
@media (max-width: 760px) { .footer-cols { grid-template-columns: 1fr 1fr; } }
.site-footer h2 { font-size: .95rem; color: #fff; margin: 0 0 10px; text-transform: uppercase; letter-spacing: .05em; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 6px; }
.site-footer .logo { color: #fff; }
.site-footer .logo span b { color: #7fd6c9; }
.footer-bottom { border-top: 1px solid #2c3a48; margin-top: 26px; padding-top: 18px; font-size: .86rem; color: #a9b4c0; }

.section { padding: 34px 0 8px; }
.section > .wrap > h2:first-child { margin-top: 0; }
.center { text-align: center; }
.mt0 { margin-top: 0; }
.pad-xl { padding-top: 60px; padding-bottom: 40px; }
.emoji-xl { font-size: 4rem; margin: 0; }

@media print {
  .site-header, .site-footer, .newsletter, .ad-slot, .aff, .share-row, .nav-toggle { display: none !important; }
  body { background: #fff; }
}
