/* =========================================================
   CalculatorTools.bond — Design System
   Direction: technical drafting / blueprint grid, with
   calculator results rendered as a digital LCD readout —
   the one signature element repeated across every tool.
   ========================================================= */

:root {
  /* Light theme */
  --bg: #f3f5f4;
  --bg-grid: #e7ebe9;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --ink: #16232a;
  --ink-soft: #4b5a62;
  --border: #d7dedb;
  --teal: #14544a;
  --teal-dim: #e6efec;
  --amber: #e8952e;
  --amber-ink: #6b4406;
  --readout-bg: #142019;
  --readout-fg: #f2b23c;
  --readout-fg-dim: #7a5b1f;
  --danger: #b3432b;
  --shadow: 0 1px 2px rgba(20, 35, 30, 0.06), 0 6px 20px rgba(20, 35, 30, 0.06);
  --radius: 10px;
  --mono: "IBM Plex Mono", "Space Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --display: "Space Grotesk", "Archivo", ui-sans-serif, system-ui, sans-serif;
  --body: "IBM Plex Sans", "Inter", ui-sans-serif, system-ui, sans-serif;
}

[data-theme="dark"] {
  --bg: #0e1a17;
  --bg-grid: #122420;
  --surface: #142622;
  --surface-raised: #17302a;
  --ink: #eaf2ef;
  --ink-soft: #a9bdb6;
  --border: #24413a;
  --teal: #3fa593;
  --teal-dim: #16332c;
  --amber: #f2b23c;
  --amber-ink: #2a1c04;
  --readout-bg: #08120e;
  --readout-fg: #ffcf70;
  --readout-fg-dim: #6b5222;
  --danger: #e07354;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    linear-gradient(var(--bg-grid) 1px, transparent 1px) 0 0 / 100% 32px,
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px) 0 0 / 32px 100%,
    var(--bg);
  color: var(--ink);
  font-family: var(--body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

img { max-width: 100%; display: block; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.25rem; }

.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px;
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--amber); color: var(--amber-ink);
  padding: 8px 14px; z-index: 200; border-radius: 0 0 6px 0;
}
.skip-link:focus { left: 0; }

/* ---------- Top bar ---------- */
.topbar {
  background: var(--teal);
  color: #eafaf5;
  font-size: 12.5px;
  padding: 6px 0;
}
.topbar .container { display: flex; justify-content: space-between; align-items: center; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(6px);
}
.nav-wrap {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0;
  gap: 16px;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--display); font-weight: 700; font-size: 1.25rem;
  color: var(--ink);
}
.brand .mark {
  width: 30px; height: 30px; border-radius: 6px;
  background: var(--readout-bg); color: var(--readout-fg);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(242,178,60,.35);
}
.brand small { color: var(--teal); font-family: var(--mono); font-size: .65em; display:block; font-weight: 500;}

.main-nav { display: flex; align-items: center; gap: 4px; }
.main-nav > ul { list-style: none; display: flex; gap: 2px; margin: 0; padding: 0; }
.main-nav > ul > li { position: relative; }
.main-nav a.nav-link {
  display: block; padding: 10px 12px; border-radius: 6px;
  color: var(--ink-soft); font-weight: 500; font-size: 14.5px;
}
.main-nav a.nav-link:hover, .main-nav li:hover > a.nav-link { color: var(--ink); background: var(--teal-dim); text-decoration:none; }

.dropdown { position: absolute; top: 100%; left: 0; min-width: 230px;
  background: var(--surface-raised); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow); padding: 6px; display: none; z-index: 50;
}
.main-nav li:hover .dropdown, .main-nav li:focus-within .dropdown { display: block; }
.dropdown a { display: block; padding: 8px 10px; border-radius: 6px; font-size: 14px; color: var(--ink); }
.dropdown a:hover { background: var(--teal-dim); text-decoration: none; }
.dropdown .cat-label { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-soft); padding: 6px 10px 2px; }

.nav-actions { display: flex; align-items: center; gap: 8px; }
.theme-toggle {
  width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { background: var(--teal-dim); }
.theme-toggle svg { width: 18px; height: 18px; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
.icon-sun { display: none; }
.icon-moon { display: block; }

.menu-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: 8px; padding: 8px; cursor: pointer; }
.menu-toggle svg { width: 20px; height: 20px; color: var(--ink); }

@media (max-width: 900px) {
  .main-nav { position: fixed; inset: 0 0 0 auto; width: min(320px, 85vw); height: 100vh;
    background: var(--surface); border-left: 1px solid var(--border);
    transform: translateX(100%); transition: transform .25s ease; overflow-y: auto; padding: 70px 16px 16px;
  }
  .main-nav.open { transform: translateX(0); }
  .main-nav > ul { flex-direction: column; }
  .dropdown { position: static; box-shadow: none; border: none; display: block; padding-left: 10px; }
  .menu-toggle { display: flex; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 8px; font-weight: 600; font-size: 14.5px;
  border: 1px solid transparent; cursor: pointer; font-family: var(--body);
}
.btn-primary { background: var(--amber); color: var(--amber-ink); }
.btn-primary:hover { filter: brightness(1.06); text-decoration: none; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--ink); }
.btn-outline:hover { background: var(--teal-dim); text-decoration: none; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Hero ---------- */
.hero {
  padding: 64px 0 48px;
  position: relative;
}
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }
.eyebrow {
  font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--teal); display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px;
}
.eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--teal); display: inline-block; }
.hero p.lead { font-size: 1.1rem; color: var(--ink-soft); max-width: 46ch; margin: 14px 0 26px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* Signature: digital LCD readout, used in hero preview + every calculator result */
.readout {
  background: var(--readout-bg);
  border-radius: 12px;
  padding: 22px 22px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04), var(--shadow);
  font-family: var(--mono);
  color: var(--readout-fg-dim);
  position: relative;
  overflow: hidden;
}
.readout::before {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(180deg, rgba(255,255,255,.025) 0 1px, transparent 1px 3px);
  pointer-events: none;
}
.readout .ro-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .7; margin-bottom: 6px; }
.readout .ro-value { font-size: 2.1rem; font-weight: 700; color: var(--readout-fg); letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.readout .ro-value.small { font-size: 1.3rem; }
.readout .ro-sub { font-size: 12.5px; color: var(--readout-fg-dim); margin-top: 4px; }
.readout .ro-row { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0; border-top: 1px dashed rgba(255,255,255,.08); }
.readout .ro-row:first-child { border-top: none; }

/* ---------- Category cards ---------- */
.section { padding: 56px 0; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.section-head p { color: var(--ink-soft); margin: 6px 0 0; max-width: 60ch; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }

.tool-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; position: relative; transition: border-color .2s ease, transform .2s ease;
}
.tool-card:hover { border-color: var(--teal); transform: translateY(-2px); }
.tool-card .tc-icon {
  width: 42px; height: 42px; border-radius: 8px; background: var(--teal-dim); color: var(--teal);
  display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
}
.tool-card .tc-icon svg { width: 22px; height: 22px; }
.tool-card h3 { font-size: 1rem; margin: 0 0 6px; }
.tool-card p { font-size: 13.5px; color: var(--ink-soft); margin: 0 0 12px; }
.tool-card .tc-link { font-family: var(--mono); font-size: 12.5px; color: var(--amber-ink); background: var(--amber); padding: 4px 9px; border-radius: 5px; }
[data-theme="dark"] .tool-card .tc-link { color: #241703; }
.tool-card a.tc-cover { position: absolute; inset: 0; border-radius: inherit; }

.category-block { margin-bottom: 44px; }
.category-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.category-head .ci { width: 34px; height: 34px; border-radius: 7px; background: var(--teal); color: #fff; display:flex; align-items:center; justify-content:center; }
.category-head .ci svg { width: 18px; height: 18px; }
.category-head h2 { margin: 0; font-size: 1.3rem; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { font-size: 13px; color: var(--ink-soft); padding: 16px 0 0; font-family: var(--mono); }
.breadcrumbs a { color: var(--ink-soft); }
.breadcrumbs .sep { margin: 0 6px; opacity: .5; }
.breadcrumbs .current { color: var(--ink); }

/* ---------- Tool page layout ---------- */
.tool-page { padding: 28px 0 60px; }
.tool-header { margin-bottom: 26px; }
.tool-header .badge {
  display: inline-block; font-family: var(--mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--teal); background: var(--teal-dim); padding: 4px 10px; border-radius: 20px; margin-bottom: 10px;
}
.tool-layout { display: grid; grid-template-columns: 1.3fr .9fr; gap: 28px; align-items: start; }
@media (max-width: 900px) { .tool-layout { grid-template-columns: 1fr; } }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 18px; }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.field input[type="text"], .field input[type="number"], .field select, .field textarea, .field input[type="file"] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface); color: var(--ink); font-family: var(--body); font-size: 14.5px;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--teal); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }
.radio-group { display: flex; gap: 14px; flex-wrap: wrap; }
.radio-group label { font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 6px; }

.result-box { margin-top: 18px; }
.result-empty { color: var(--ink-soft); font-size: 13.5px; font-style: italic; }

/* Ad slots */
.ad-slot {
  border: 1px dashed var(--border); border-radius: 8px; background: var(--teal-dim);
  color: var(--ink-soft); font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 14px;
}
.ad-slot.header { min-height: 90px; margin: 14px 0; }
.ad-slot.incontent { min-height: 100px; margin: 26px 0; }
.ad-slot.sidebar { min-height: 250px; }
.ad-slot.footer { min-height: 90px; margin: 20px 0; }

/* ---------- Article / blog ---------- */
.post-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.post-card .pc-cover { height: 150px; background: linear-gradient(135deg, var(--teal), var(--readout-bg)); display:flex; align-items:center; justify-content:center; }
.post-card .pc-cover span { font-family: var(--mono); color: var(--readout-fg); font-size: 12px; letter-spacing:.08em; text-transform: uppercase;}
.post-card .pc-body { padding: 16px; }
.post-card .pc-meta { font-family: var(--mono); font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.post-card h3 { font-size: 1.05rem; margin: 0 0 8px; }
.post-card p { font-size: 13.5px; color: var(--ink-soft); margin: 0; }
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }

.article-body { font-size: 1.02rem; }
.article-body h2 { margin-top: 34px; }
.article-body h3 { margin-top: 24px; }
.article-body p { margin: 14px 0; color: var(--ink); }
.toc { background: var(--teal-dim); border-radius: var(--radius); padding: 16px 18px; margin: 24px 0; }
.toc .toc-label { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--teal); margin-bottom: 8px; }
.toc ol { margin: 0; padding-left: 18px; font-size: 14px; }
.faq-item { border-bottom: 1px solid var(--border); padding: 14px 0; }
.faq-item summary { cursor: pointer; font-weight: 600; }
.share-row { display: flex; gap: 8px; margin: 20px 0; flex-wrap: wrap; }
.share-row a { border: 1px solid var(--border); border-radius: 20px; padding: 6px 14px; font-size: 13px; color: var(--ink); }
.share-row a:hover { background: var(--teal-dim); text-decoration: none; }
.author-box { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 24px 0; }
.author-box .av { width: 44px; height: 44px; border-radius: 50%; background: var(--teal); color: #fff; display:flex; align-items:center; justify-content:center; font-family: var(--mono); font-weight:700; }

.sidebar-widget { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.sidebar-widget h4 { margin: 0 0 12px; font-size: .95rem; }
.sidebar-widget ul { list-style: none; margin: 0; padding: 0; }
.sidebar-widget li { padding: 8px 0; border-top: 1px solid var(--border); font-size: 13.5px; }
.sidebar-widget li:first-child { border-top: none; }

.search-box { display: flex; gap: 8px; margin-bottom: 24px; }
.search-box input { flex: 1; padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14.5px; }

.tag-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.tag-row a { font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; padding: 5px 10px; border-radius: 20px; background: var(--teal-dim); color: var(--teal); }
.tag-row a:hover { text-decoration: none; background: var(--teal); color: #fff; }

.comment-form textarea { min-height: 100px; resize: vertical; }

/* ---------- Legal pages ---------- */
.legal-body h2 { margin-top: 30px; }
.legal-body p, .legal-body li { color: var(--ink-soft); }
.legal-body ul { padding-left: 20px; }
.updated-badge { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); }

/* ---------- Footer ---------- */
.site-footer { background: var(--readout-bg); color: #cfe0d8; margin-top: 60px; padding: 50px 0 24px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 28px; }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.site-footer h4 { color: #fff; font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; font-family: var(--mono); margin: 0 0 14px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 8px; font-size: 13.5px; }
.site-footer a { color: #cfe0d8; }
.site-footer a:hover { color: var(--amber); }
.site-footer .brand { color: #fff; }
.site-footer .brand .mark { background: rgba(255,255,255,.08); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); margin-top: 34px; padding-top: 18px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; font-size: 12.5px; color: #91a89e; }

/* ---------- Misc ---------- */
.status-msg { padding: 10px 14px; border-radius: 8px; font-size: 13.5px; margin-top: 10px; }
.status-msg.ok { background: var(--teal-dim); color: var(--teal); }
.status-msg.err { background: rgba(179,67,43,.1); color: var(--danger); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
