/* ============================================================
   TraderH4 Calculators — base stylesheet (vanilla, mobile-first)
   ============================================================ */
:root {
  --teal: #0f766e;
  --teal-dark: #115e59;
  --teal-light: #ccfbf1;
  --ink: #1f2933;
  --ink-soft: #52606d;
  --line: #e4e7eb;
  --bg: #ffffff;
  --bg-soft: #f5f7fa;
  --bg-card: #ffffff;
  --warn-bg: #fff7ed;
  --warn-border: #fdba74;
  --good: #047857;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 16px rgba(16,24,40,.06);
  --maxw: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
}
h1, h2, h3, h4 { line-height: 1.25; color: var(--ink); font-weight: 700; }
h1 { font-size: clamp(1.6rem, 1.1rem + 2.4vw, 2.4rem); margin: 0 0 .5rem; }
h2 { font-size: clamp(1.3rem, 1rem + 1.4vw, 1.6rem); margin: 2rem 0 .75rem; }
h3 { font-size: 1.12rem; margin: 1.25rem 0 .5rem; }
p { margin: 0 0 1rem; }
a { color: var(--teal); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--teal-dark); }
img { max-width: 100%; height: auto; }
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }
.visually-hidden, .skip-link:not(:focus) {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 1rem; top: .5rem; background: var(--teal); color: #fff; padding: .5rem .9rem; border-radius: var(--radius-sm); z-index: 100; }

/* ---------- Header ---------- */
.site-header { border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800; text-decoration: none; color: var(--ink); font-size: 1.15rem; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; background: var(--teal); color: #fff; border-radius: 8px; font-size: 1.1rem; }
.primary-nav { margin-left: auto; display: flex; align-items: center; gap: 1.25rem; }
.primary-nav a { color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: .98rem; }
.primary-nav a:hover { color: var(--teal); }
.lang-switch select { font: inherit; font-size: .9rem; padding: .35rem 1.6rem .35rem .55rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-soft); }
.nav-toggle { display: none; flex-direction: column; gap: 4px; background: none; border: 0; cursor: pointer; padding: .5rem; margin-left: auto; }
.nav-toggle span { width: 22px; height: 2px; background: var(--ink); border-radius: 2px; transition: .2s; }

@media (max-width: 760px) {
  .nav-toggle { display: flex; }
  .primary-nav { position: absolute; top: 60px; left: 0; right: 0; background: #fff; flex-direction: column; align-items: stretch; gap: 0; border-bottom: 1px solid var(--line); margin: 0; max-height: 0; overflow: hidden; transition: max-height .25s ease; }
  .primary-nav.open { max-height: 460px; }
  .primary-nav a { padding: .9rem clamp(1rem,4vw,2rem); border-top: 1px solid var(--line); }
  .lang-switch { padding: .8rem clamp(1rem,4vw,2rem); }
  .lang-switch select { width: 100%; }
}

/* ---------- Breadcrumb ---------- */
.breadcrumb { background: var(--bg-soft); border-bottom: 1px solid var(--line); font-size: .85rem; }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; padding: .6rem clamp(1rem,4vw,2rem); max-width: var(--maxw); margin-inline: auto; }
.breadcrumb li + li::before { content: "›"; color: var(--ink-soft); margin-right: .35rem; }
.breadcrumb a { color: var(--ink-soft); text-decoration: none; }
.breadcrumb a:hover { color: var(--teal); text-decoration: underline; }
.breadcrumb [aria-current] { color: var(--ink); font-weight: 600; }

/* ---------- Tool / page hero ---------- */
.tool-page, .content-page { padding-block: 1.5rem 3rem; }
.tool-hero, .page-hero { margin-bottom: 1.5rem; }
.tool-intro { font-size: 1.1rem; color: var(--ink-soft); max-width: 65ch; }
.tool-updated { font-size: .85rem; color: var(--ink-soft); margin: 0; }
.badge-sensitive { display: inline-block; background: var(--warn-bg); border: 1px solid var(--warn-border); color: #9a3412; padding: .4rem .7rem; border-radius: var(--radius-sm); font-size: .9rem; }

/* ---------- Calculator ---------- */
.calc { display: grid; gap: 1.5rem; align-items: start; margin: 1.5rem 0 2rem; }
@media (min-width: 880px) { .calc { grid-template-columns: 1fr 1fr; } }
.calc-card { background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(1.1rem, 3vw, 1.6rem); }
.calc-card h2 { margin-top: 0; }
.field { margin-bottom: 1rem; }
.field > label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .95rem; }
.field .hint { font-weight: 400; color: var(--ink-soft); font-size: .82rem; display: block; margin-top: .15rem; }
.input, select.input, .calc input[type="number"], .calc input[type="text"], .calc input[type="date"], .calc select {
  width: 100%; font: inherit; font-size: 1rem; padding: .7rem .8rem; border: 1px solid #cbd2d9;
  border-radius: var(--radius-sm); background: #fff; min-height: 46px; color: var(--ink);
}
.calc input:focus, .calc select:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal); }
.input-group { display: flex; gap: .5rem; }
.input-group .input { flex: 1; }
.input-group select { flex: 0 0 auto; width: auto; min-width: 84px; }
.unit-toggle { display: inline-flex; border: 1px solid #cbd2d9; border-radius: var(--radius-sm); overflow: hidden; }
.unit-toggle button { font: inherit; font-size: .9rem; padding: .5rem .9rem; background: #fff; border: 0; cursor: pointer; color: var(--ink-soft); }
.unit-toggle button[aria-pressed="true"] { background: var(--teal); color: #fff; font-weight: 600; }
label.checkbox { display: flex; align-items: flex-start; gap: .55rem; font-weight: 600; font-size: .95rem; cursor: pointer; line-height: 1.4; }
label.checkbox input[type="checkbox"] { width: 20px; height: 20px; min-height: 0; margin-top: .1rem; flex: 0 0 auto; accent-color: var(--teal); }
.field-row { display: grid; gap: 1rem; }
@media (min-width: 520px) { .field-row.two { grid-template-columns: 1fr 1fr; } }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .5rem; }
.btn { font: inherit; font-weight: 600; font-size: 1rem; padding: .75rem 1.3rem; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; min-height: 46px; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-secondary { background: #fff; color: var(--ink); border-color: #cbd2d9; }
.btn-secondary:hover { border-color: var(--teal); color: var(--teal); }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: transparent; text-decoration: underline; padding-inline: .4rem; }
.field-error { color: #b91c1c; font-size: .85rem; margin-top: .3rem; display: none; }
.field.has-error .input, .field.has-error select { border-color: #dc2626; }
.field.has-error .field-error { display: block; }
.form-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; padding: .7rem .9rem; border-radius: var(--radius-sm); margin-bottom: 1rem; display: none; }
.form-error.show { display: block; }

/* ---------- Result ---------- */
.result { background: linear-gradient(180deg, var(--teal-light), #f0fdfa); border: 1px solid #99f6e4; border-radius: var(--radius); padding: clamp(1.1rem, 3vw, 1.6rem); }
.result h2 { margin-top: 0; }
.result.empty { background: var(--bg-soft); border: 1px dashed var(--line); color: var(--ink-soft); }
.result-headline { font-size: clamp(1.5rem, 1rem + 3vw, 2.1rem); font-weight: 800; color: var(--teal-dark); margin: .25rem 0; }
.result-sub { color: var(--ink-soft); margin-bottom: 1rem; }
.breakdown { width: 100%; border-collapse: collapse; margin: .75rem 0; font-size: .95rem; }
.breakdown th, .breakdown td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid #b6e6df; }
.breakdown td:last-child, .breakdown th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.breakdown tr.total td { font-weight: 700; border-top: 2px solid var(--teal); border-bottom: 0; }
.result-note { font-size: .88rem; color: var(--ink-soft); }
.result-warn { background: var(--warn-bg); border: 1px solid var(--warn-border); color: #9a3412; padding: .6rem .8rem; border-radius: var(--radius-sm); font-size: .9rem; margin-top: .75rem; }

/* ---------- Generic content sections ---------- */
.tool-section { margin: 2rem 0; }
.prose, .tool-page section { max-width: 72ch; }
.prose ul, .tool-page section ul, .prose ol, .tool-page section ol { padding-left: 1.3rem; }
.prose li, .tool-page li { margin-bottom: .4rem; }
.formula-box { background: var(--bg-soft); border-left: 4px solid var(--teal); padding: 1rem 1.2rem; border-radius: var(--radius-sm); font-size: .98rem; overflow-x: auto; }
.formula-box code, code { background: #eef2f5; padding: .12em .4em; border-radius: 4px; font-size: .92em; }
.formula-box pre { margin: 0; white-space: pre-wrap; }
.note-box { background: #eff6ff; border: 1px solid #bfdbfe; padding: 1rem 1.2rem; border-radius: var(--radius-sm); }

/* tables */
.data-table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .92rem; }
.data-table th, .data-table td { border: 1px solid var(--line); padding: .55rem .7rem; text-align: left; }
.data-table th { background: var(--bg-soft); }
.table-scroll { overflow-x: auto; }

/* ---------- FAQ ---------- */
.faq-list { display: grid; gap: .6rem; max-width: 72ch; }
.faq-item { border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.faq-item summary { list-style: none; cursor: pointer; padding: .9rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary h3 { margin: 0; font-size: 1.02rem; }
.faq-item summary::after { content: "+"; font-size: 1.3rem; color: var(--teal); }
.faq-item[open] summary::after { content: "–"; }
.faq-a { padding: 0 1rem 1rem; color: var(--ink-soft); }
.faq-a p:last-child { margin-bottom: 0; }

/* ---------- Related cards ---------- */
.card-grid { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; transition: box-shadow .2s, transform .2s; }
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card a { display: block; padding: 1rem 1.1rem; text-decoration: none; color: var(--ink); }
.card-title { display: block; font-weight: 700; color: var(--teal-dark); margin-bottom: .25rem; }
.card-desc { display: block; font-size: .88rem; color: var(--ink-soft); }
.link-list { padding-left: 1.2rem; }

/* ---------- Disclaimer ---------- */
.disclaimer { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.3rem; margin-top: 2.5rem; font-size: .92rem; color: var(--ink-soft); max-width: none; }
.disclaimer h2 { margin-top: 0; font-size: 1.1rem; }
.sources a { word-break: break-word; }

/* ---------- Home ---------- */
.hero-home { background: linear-gradient(180deg, #ecfeff, #fff); border-bottom: 1px solid var(--line); padding-block: clamp(2rem, 6vw, 3.5rem); }
.hero-home p { font-size: 1.15rem; color: var(--ink-soft); max-width: 60ch; }
.section-title { margin-top: 2.5rem; }
.cat-block { margin-bottom: 1rem; }
.ad-slot { margin: 2rem auto; max-width: var(--maxw); text-align: center; min-height: 90px; color: #9aa5b1; font-size: .8rem; display: grid; place-items: center; border: 1px dashed var(--line); border-radius: var(--radius-sm); }

/* ---------- Footer ---------- */
.site-footer { background: #0b1f1d; color: #cbd5d1; margin-top: 3rem; padding-block: 2.5rem 1.5rem; font-size: .92rem; }
.footer-grid { display: grid; gap: 1.5rem 2rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.site-footer h2 { color: #fff; font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; margin: 0 0 .6rem; }
.site-footer .brand, .site-footer .brand-text { color: #fff; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; }
.site-footer a { color: #9fb3ad; text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-tagline { color: #9fb3ad; }
.footer-note { color: #7f938d; font-size: .82rem; }
.footer-bottom { border-top: 1px solid #1c302d; margin-top: 1.5rem; padding-top: 1rem; color: #7f938d; font-size: .85rem; }

/* ---------- Cookie consent ---------- */
.cookie-consent {
  position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 200;
  max-width: 880px; margin-inline: auto;
  background: #0b1f1d; color: #e6efed; border: 1px solid #1c302d;
  border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0,0,0,.25);
  padding: 1rem 1.1rem; display: flex; flex-wrap: wrap; align-items: center; gap: .8rem 1rem;
}
.cookie-consent[hidden] { display: none; }
.cookie-consent .cc-text { margin: 0; flex: 1 1 320px; font-size: .9rem; line-height: 1.5; }
.cookie-consent .cc-text a { color: #7fe3d4; }
.cookie-consent .cc-actions { display: flex; gap: .6rem; flex: 0 0 auto; margin-left: auto; }
.cookie-consent .btn { min-height: 40px; padding: .55rem 1rem; font-size: .92rem; }
.cookie-consent .btn-secondary { background: transparent; color: #cbd5d1; border-color: #3a5450; }
.cookie-consent .btn-secondary:hover { color: #fff; border-color: #7fe3d4; }
@media (max-width: 560px) { .cookie-consent .cc-actions { width: 100%; } .cookie-consent .btn { flex: 1; } }

@media print {
  .site-header, .site-footer, .breadcrumb, .nav-toggle, .btn-row, .ad-slot { display: none !important; }
}
