/* CalculatorHive — shared stylesheet
   Single CSS file for the whole static site. Loaded by every page via a
   path relative to the document (../assets/... etc.). */

:root {
  --c-bg: #f4f6f8;
  --c-surface: #ffffff;
  --c-border: #d8dde2;
  --c-text: #1d2733;
  --c-muted: #5a6775;
  --c-primary: #1f6feb;
  --c-primary-dark: #1858bf;
  --c-accent: #2ea043;
  --c-warn: #d29922;
  --c-danger: #cf222e;
  --c-row-alt: #f7f9fb;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  --maxw: 1180px;
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.55;
}

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ------- Accessibility helpers ------- */
.skip-link {
  position: absolute;
  left: -10000px;
  top: 6px;
  background: var(--c-primary);
  color: white;
  padding: 10px 16px;
  border-radius: var(--radius);
  z-index: 1000;
  font-weight: 500;
  text-decoration: none;
}
.skip-link:focus {
  left: 12px;
  outline: 3px solid #fff;
  outline-offset: 2px;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Strong, visible focus on every interactive element */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--c-primary);
  outline-offset: 2px;
}

/* ------- Layout chrome ------- */
.site-header {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.site-header .wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--c-text);
}
.brand span { color: var(--c-primary); }
.nav-primary {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  flex: 1;
}
.nav-primary a {
  color: var(--c-text);
  font-weight: 500;
  font-size: 0.95rem;
}
.search-mini {
  display: flex;
  gap: 6px;
}
.search-mini input {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 0.9rem;
  min-width: 160px;
}
.search-mini button {
  background: var(--c-primary);
  color: white;
  border: 0;
  border-radius: var(--radius);
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.9rem;
}

.site-footer {
  margin-top: 60px;
  background: #1d2733;
  color: #c9d4df;
  padding: 36px 20px 28px;
}
.site-footer .wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 30px;
}
.site-footer h4 {
  margin: 0 0 12px;
  color: #ffffff;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 6px; font-size: 0.9rem; }
.site-footer a { color: #c9d4df; }
.site-footer a:hover { color: #ffffff; }
.site-footer .legal {
  max-width: var(--maxw);
  margin: 24px auto 0;
  padding-top: 18px;
  border-top: 1px solid #2a3540;
  font-size: 0.82rem;
  color: #8a99a8;
  text-align: center;
}

/* ------- Page container ------- */
.page {
  max-width: var(--maxw);
  margin: 24px auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
}
.page > main { min-width: 0; }
.page > aside { min-width: 0; }
@media (max-width: 900px) {
  .page { grid-template-columns: 1fr; }
}

.breadcrumb {
  font-size: 0.85rem;
  color: var(--c-muted);
  margin: 0 0 12px;
}
.breadcrumb a { color: var(--c-muted); }
.breadcrumb a:hover { color: var(--c-primary); }

.meta-line {
  font-size: 0.82rem;
  color: var(--c-muted);
  margin: 6px 0 16px;
}

.affiliate-disclosure {
  background: #fff8e6;
  border: 1px solid #f0e0a0;
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 0 0 18px;
  font-size: 0.85rem;
  color: #5a4d10;
}
.affiliate-disclosure strong { color: #8a6d11; }

.related-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 4px 14px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.related-links a { display: block; padding: 4px 0; }

h1 { font-size: 1.7rem; margin: 0 0 8px; }
h2 { font-size: 1.25rem; margin: 28px 0 10px; }
h3 { font-size: 1.05rem; margin: 22px 0 8px; }

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.lead {
  font-size: 1.02rem;
  color: var(--c-muted);
  margin: 0 0 18px;
}

/* ------- Forms ------- */
.calc-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
}
.calc-form .full { grid-column: 1 / -1; }
.calc-form label {
  display: flex;
  flex-direction: column;
  font-size: 0.88rem;
  color: var(--c-muted);
  gap: 4px;
}
.calc-form label .lbl { font-weight: 500; color: var(--c-text); }
.calc-form input[type="number"],
.calc-form input[type="text"],
.calc-form input[type="date"],
.calc-form select,
.calc-form textarea {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 0.95rem;
  background: white;
  color: var(--c-text);
}
.calc-form input:focus,
.calc-form select:focus,
.calc-form textarea:focus {
  outline: 2px solid var(--c-primary);
  outline-offset: 0;
}
.calc-form .input-row {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.calc-form .input-row input { flex: 1; }
.calc-form .input-row select {
  flex: 0 0 auto;
  min-width: 90px;
}
.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  grid-column: 1 / -1;
}
.btn {
  display: inline-block;
  background: var(--c-primary);
  color: white;
  border: 0;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--c-primary-dark); }
.btn.secondary {
  background: #e5eaf0;
  color: var(--c-text);
}
.btn.secondary:hover { background: #d8dee5; }

@media (max-width: 540px) {
  .calc-form { grid-template-columns: 1fr; }
}

/* ------- Result panel ------- */
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.metric {
  background: var(--c-row-alt);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 14px;
}
.metric .label {
  font-size: 0.78rem;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.metric .value {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--c-text);
  margin-top: 4px;
}

/* ------- Chart panel ------- */
.chart-wrap {
  position: relative;
  height: 340px;
  margin-top: 12px;
}
.chart-controls {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--c-muted);
}
.chart-controls button {
  background: #eef2f6;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.82rem;
}
.chart-controls button:hover { background: #e1e8ee; }

/* ------- Table ------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: white;
}
table.amort {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
table.amort th, table.amort td {
  padding: 8px 12px;
  text-align: right;
  border-bottom: 1px solid var(--c-border);
}
table.amort th:first-child, table.amort td:first-child {
  text-align: left;
}
table.amort thead th {
  background: var(--c-row-alt);
  font-weight: 600;
  color: var(--c-text);
}
table.amort tbody tr:nth-child(odd) td { background: var(--c-row-alt); }
table.amort tfoot td {
  background: #eef4ff;
  font-weight: 600;
}

/* ------- Index lists ------- */
.section-block {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.section-block h2 {
  margin: 0 0 12px;
  font-size: 1.15rem;
  color: var(--c-primary);
  border-bottom: 2px solid var(--c-row-alt);
  padding-bottom: 6px;
}
.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px 14px;
  font-size: 0.92rem;
}
.calc-grid a {
  padding: 4px 0;
  display: block;
}

/* ------- Sidebar widgets ------- */
.widget {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.widget h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--c-muted);
}
.widget ul { list-style: none; padding: 0; margin: 0; }
.widget li { margin-bottom: 6px; font-size: 0.92rem; }

.ad-slot {
  background: repeating-linear-gradient(
    45deg,
    #f0f3f6,
    #f0f3f6 10px,
    #e7ecf1 10px,
    #e7ecf1 20px
  );
  border: 1px dashed #b5bec8;
  border-radius: var(--radius);
  color: var(--c-muted);
  text-align: center;
  padding: 36px 12px;
  font-size: 0.82rem;
  margin-bottom: 18px;
}
.affiliate-slot {
  background: #fff8e6;
  border: 1px solid #f0e0a0;
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 18px;
  font-size: 0.9rem;
}
.affiliate-slot strong { color: #8a6d11; }

/* ------- FAQ ------- */
.faq details {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 8px;
}
.faq summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--c-text);
}
.faq details[open] { box-shadow: var(--shadow); }
.faq p { margin: 10px 0 0; color: var(--c-muted); }

/* ------- Cookie banner ------- */
#cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #1d2733;
  color: #f4f6f8;
  padding: 14px 18px;
  display: none;
  z-index: 1000;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.2);
}
#cookie-banner .wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
#cookie-banner p { margin: 0; flex: 1; min-width: 240px; font-size: 0.9rem; }
#cookie-banner a { color: #9bd2ff; }
#cookie-banner .actions { display: flex; gap: 8px; }
#cookie-banner button {
  border: 0;
  border-radius: var(--radius);
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
}
#cookie-banner button.primary { background: var(--c-primary); color: white; }
#cookie-banner button.secondary { background: #4a5560; color: white; }
#cookie-banner button.tertiary { background: transparent; color: #c9d4df; }

/* ------- Search page ------- */
.search-results { margin-top: 16px; }
.search-results .result {
  padding: 10px 0;
  border-bottom: 1px solid var(--c-border);
}
.search-results .result h3 { margin: 0 0 4px; font-size: 1rem; }
.search-results .result p { margin: 0; color: var(--c-muted); font-size: 0.88rem; }

/* ------- Blog ------- */
.blog-post-list .post {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.blog-post-list .post h3 { margin: 0 0 6px; }
.blog-post-list .post .meta {
  font-size: 0.82rem;
  color: var(--c-muted);
  margin-bottom: 8px;
}

.article-body p { margin: 0 0 14px; }
.article-body ul, .article-body ol { margin: 0 0 14px 22px; }
