/* ============================================================
   OmniCalcs — Design System
   Fast, modern, static. Mobile-first.
   ============================================================ */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --accent: #10b981;
  --accent-dark: #059669;
  --accent-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --purple: #8b5cf6;
  --purple-light: #f5f3ff;
  --ink: #0f172a;
  --ink-soft: #334155;
  --ink-muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .12);
  --shadow-lg: 0 12px 32px -12px rgba(15, 23, 42, .18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .5em; }

/* ---------------- Header / Nav ---------------- */

.site-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 24px;
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand img, .brand svg { width: 30px; height: 30px; }
.brand .brand-badge {
  font-size: .6rem;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: .03em;
}

/* Header search */
.search-form { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.search-input { width: 200px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: .9rem; }
.search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.search-btn { background: var(--primary); border: 0; border-radius: 8px; padding: 7px 10px; cursor: pointer; color: #fff; font-size: .95rem; line-height: 1; }
.search-btn:hover { background: var(--primary-dark); }

@media (max-width: 920px) {
  .search-form { order: 3; margin-left: auto; }
  .search-input { width: 150px; }
}

.nav {
  order: 2;
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px;
  border-top: 1px solid var(--line);
  margin-top: 4px;
  padding-top: 6px;
}

.nav-item { position: relative; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border-radius: 9px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: .86rem;
  cursor: pointer;
  border: 0;
  background: none;
  font-family: var(--font);
}
.nav-link:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.nav-link .caret { font-size: .65em; opacity: .7; transition: transform .15s; }
.nav-item.open .nav-link .caret { transform: rotate(180deg); }

.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 260px;
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s, visibility .15s;
  z-index: 200;
}
.nav-item.open .dropdown { opacity: 1; visibility: visible; }

/* Align edge dropdowns to avoid viewport overflow */
.nav-item:first-child .dropdown { left: 0; transform: none; }
.nav-item:last-child .dropdown { left: auto; right: 0; transform: none; }

.dropdown a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: .9rem;
  font-weight: 500;
}
.dropdown a:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.dropdown .dd-all {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--primary);
  font-weight: 700;
}

/* Mobile nav */
.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; cursor: pointer; color: var(--ink); margin-left: auto; }

@media (max-width: 920px) {
  .nav-toggle { display: block; }
  .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px 20px;
    border-bottom: 1px solid var(--line);
    border-top: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    display: none;
  }
  .nav.open { display: flex; }
  .nav-item { width: 100%; }
  .nav-link { justify-content: space-between; width: 100%; }
  .dropdown { position: static; transform: none; box-shadow: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; min-width: 0; padding: 4px 0 8px 8px; max-height: 0; overflow: hidden; padding: 0; }
  .nav-item.open .dropdown { max-height: none; padding: 4px 0 8px 8px; }
  .dropdown a { padding: 7px 10px; }
}

/* ---------------- Layout ---------------- */

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 760px; }

.section { padding: 48px 0; }
.section-tight { padding: 32px 0; }

.page-head { padding: 44px 0 8px; }
.page-head h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); letter-spacing: -.02em; }
.page-head p.lead { font-size: 1.12rem; color: var(--ink-muted); max-width: 640px; }

.breadcrumb { font-size: .82rem; color: var(--ink-muted); margin-bottom: 14px; }
.breadcrumb a { color: var(--ink-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { margin: 0 6px; opacity: .5; }

/* ---------------- Cards / Grid ---------------- */

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) { .grid-4 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 820px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.tool-card { display: block; color: var(--ink); }
.tool-card:hover { text-decoration: none; }
.tool-card .tc-emoji {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  font-size: 1.4rem;
  background: var(--primary-light);
  border-radius: 12px;
  margin-bottom: 12px;
}
.tool-card h3 { font-size: 1.02rem; margin-bottom: 4px; }
.tool-card p { color: var(--ink-muted); font-size: .86rem; margin: 0; }
.tool-card .tc-cat { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); margin-bottom: 10px; }
.tool-card .tc-badge { font-size: .68rem; font-weight: 700; background: var(--accent-light); color: var(--accent-dark); padding: 2px 8px; border-radius: 999px; float: right; }

/* ---------------- Buttons ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 10px;
  border: 0;
  font-family: var(--font);
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .1s;
  background: var(--primary);
  color: #fff;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-outline { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-ghost { background: var(--primary-light); color: var(--primary-dark); }
.btn-ghost:hover { background: #dbeafe; }
.btn-accent { background: var(--accent); }
.btn-accent:hover { background: var(--accent-dark); }
.btn-lg { padding: 14px 30px; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* ---------------- Tool actions (share / report) ---------------- */

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
}
.tool-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: .9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
}
.tool-actions .btn svg { width: 16px; height: 16px; flex: none; }
.oc-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: #0f172a;
  color: #fff;
  padding: 11px 18px;
  border-radius: 10px;
  font-size: .9rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s, transform .2s, visibility .2s;
  z-index: 500;
}
.oc-toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* ---------------- Hero ---------------- */

.hero {
  background: linear-gradient(135deg, var(--primary-light) 0%, #ffffff 55%, var(--accent-light) 100%);
  border-bottom: 1px solid var(--line);
  padding: 64px 0 56px;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.1rem); letter-spacing: -.03em; max-width: 720px; }
.hero .lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 560px; }
.hero .hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.hero-stats { display: flex; gap: 36px; flex-wrap: wrap; margin-top: 40px; }
.hero-stat b { display: block; font-size: 1.9rem; color: var(--primary); letter-spacing: -.02em; }
.hero-stat span { color: var(--ink-muted); font-size: .9rem; }

.hero-demo {
  margin-top: 40px;
  max-width: 560px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 24px;
}
.hero-demo .hd-title { font-weight: 800; margin-bottom: 16px; }
.demo-result {
  background: var(--accent-light);
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  padding: 16px;
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.demo-result b { font-size: 1.3rem; color: var(--accent-dark); }

/* Hero two-column layout: fills the empty right side with demo + ad. */
.hero-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 40px;
  align-items: start;
}
.hero-main .hero-demo { margin-top: 34px; max-width: 560px; }
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-side { display: none; }
  .hero-main .hero-demo { max-width: 560px; }
}

/* ---------------- Forms / Calculator UI ---------------- */

.calc-shell {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
}
.calc-shell h2 { font-size: 1.25rem; }
.calc-shell h3 { font-size: 1.05rem; }

.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 6px; color: var(--ink-soft); }
.field label .unit { font-weight: 400; color: var(--ink-muted); }

.input, select.input, textarea.input {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 1rem;
  color: var(--ink);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
textarea.input { resize: vertical; min-height: 100px; font-family: var(--mono); font-size: .9rem; line-height: 1.5; }

.input-group { display: flex; }
.input-group .input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .input-suffix {
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 11px 13px;
  font-size: .9rem;
  color: var(--ink-muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
}

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

.result-box {
  background: var(--primary-light);
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 18px;
}
.result-box .result-label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); margin-bottom: 4px; }
.result-box .result-value { font-size: 1.7rem; font-weight: 800; color: var(--primary-dark); }
.result-box .result-note { font-size: .86rem; color: var(--ink-muted); margin-top: 6px; }

.result-list { margin-top: 18px; }
.result-row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px dashed var(--line); font-size: .94rem; }
.result-row:last-child { border-bottom: 0; }
.result-row .k { color: var(--ink-muted); }
.result-row .v { font-weight: 700; text-align: right; }
.mono { font-family: var(--mono); word-break: break-all; }

.bar-wrap { background: var(--line); border-radius: 999px; height: 12px; overflow: hidden; margin-top: 6px; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--primary); transition: width .3s; }

.diff-out { border: 1px solid var(--line); border-radius: var(--radius-sm); max-height: 320px; overflow-y: auto; font-family: var(--mono); font-size: .82rem; margin-top: 12px; }
.dl { display: flex; gap: 8px; padding: 4px 10px; white-space: pre-wrap; word-break: break-word; }
.dl .dmark { display: inline-block; width: 14px; color: var(--ink-muted); flex-shrink: 0; }
.dl.add { background: var(--accent-light); color: #065f46; }
.dl.add .dmark { color: #059669; }
.dl.rem { background: var(--danger-light); color: #7f1d1d; }
.dl.rem .dmark { color: #dc2626; }
.dl.same { color: var(--ink-soft); }

.frow { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.fchar { width: 22px; text-align: center; font-family: var(--mono); font-weight: 700; }
.fbar-wrap { flex: 1; background: var(--line); border-radius: 999px; height: 14px; overflow: hidden; }
.fbar { height: 100%; background: var(--primary); border-radius: 999px; min-width: 2px; }
.fcount { width: 34px; text-align: right; font-family: var(--mono); font-size: .8rem; color: var(--ink-muted); }

/* ---------------- Tables ---------------- */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; margin-top: 14px; }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
table.data th { background: var(--bg); font-weight: 700; color: var(--ink-soft); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
table.data tr:hover td { background: var(--primary-light); }

/* ---------------- Misc ---------------- */

.alert { padding: 14px 16px; border-radius: var(--radius-sm); font-size: .9rem; margin-top: 14px; border: 1px solid; }
.alert-error { background: var(--danger-light); color: #b91c1c; border-color: #fecaca; }
.alert-info { background: var(--primary-light); color: var(--primary-dark); border-color: #bfdbfe; }
.alert-success { background: var(--accent-light); color: var(--accent-dark); border-color: #a7f3d0; }
.alert-danger { background: var(--danger-light); color: #b91c1c; border-color: #fecaca; }

.formula-box {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: .88rem;
  color: var(--ink-soft);
  overflow-x: auto;
  margin: 10px 0;
}

.quote-box { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; font-size: 1rem; line-height: 1.6; color: var(--ink); }
.color-swatch { border: 1px solid var(--line); }
.sw { border-radius: var(--radius-sm); padding: 14px 16px; font-family: var(--mono); font-weight: 700; margin-bottom: 8px; font-size: .9rem; }

.tag { display: inline-block; background: var(--primary-light); color: var(--primary-dark); font-size: .74rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; margin: 0 4px 4px 0; }

.faq details { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 18px; margin-bottom: 10px; }
.faq summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.faq details[open] summary { margin-bottom: 8px; }
.faq p { color: var(--ink-soft); font-size: .93rem; margin: 0; }

.prose { color: var(--ink-soft); }
.prose h2 { color: var(--ink); margin-top: 1.6em; }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose li { margin-bottom: 6px; }

/* ---------------- Blog ---------------- */

.blog-card { display: block; color: var(--ink); }
.blog-card:hover { text-decoration: none; }
.blog-card .bc-img { height: 150px; border-radius: var(--radius-sm); margin-bottom: 14px; background: var(--primary-light); display: grid; place-items: center; font-size: 1.5rem; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--primary); overflow: hidden; }
.blog-card .bc-meta { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-muted); margin-bottom: 8px; }
.blog-card h3 { font-size: 1.05rem; }
.blog-card p { color: var(--ink-muted); font-size: .88rem; margin: 0; }

/* ---------------- Footer ---------------- */

.site-footer { background: #0f172a; color: #cbd5e1; margin-top: 56px; }
.footer-top { padding: 48px 0 28px; display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 28px; }
@media (max-width: 820px) { .footer-top { grid-template-columns: 1fr 1fr; } }
@media (max-width: 540px) { .footer-top { grid-template-columns: 1fr; } }
.site-footer h4 { color: #fff; font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 14px; }
.site-footer a { color: #cbd5e1; display: block; padding: 4px 0; font-size: .9rem; }
.site-footer a:hover { color: #fff; }
.footer-brand { color: #fff; font-size: 1.2rem; font-weight: 800; display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.footer-brand:hover { text-decoration: none; }
.footer-bottom { border-top: 1px solid #1e293b; padding: 18px 0; font-size: .84rem; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer-bottom a { display: inline; padding: 0; font-size: inherit; color: #fff; }
.footer-bottom a:hover { text-decoration: underline; }

/* ---------------- Cookie banner ---------------- */

.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 24px rgba(15, 23, 42, .1);
  padding: 16px 20px;
  z-index: 500;
  display: none;
}
.cookie-banner.show { display: block; }
.cookie-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; font-size: .9rem; color: var(--ink-soft); }
.cookie-inner .btn { flex-shrink: 0; }

/* ---------------- Ad placeholder ---------------- */

.ad-slot {
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-muted);
  font-size: .8rem;
  text-align: center;
  padding: 18px;
  margin: 24px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  overflow: hidden;
}
.ad-slot-top { margin-top: 0; }
.ad-slot-bottom { margin-bottom: 0; }
.ad-slot-sidebar { margin-top: 18px; min-height: 250px; }

/* With an active AdSense client the placeholder border disappears. */
.ad-slot .adsbygoogle { margin: 0 auto; }

@media (min-width: 768px) {
  .ad-slot-sidebar { position: sticky; top: 88px; }
}

/* Mobile: make in-page slots tighter so layout stays clean. */
@media (max-width: 767px) {
  .ad-slot { min-height: 100px; padding: 12px; }
  .ad-slot-sidebar { display: none; }
}

/* ---------------- Small helpers ---------------- */

.center { text-align: center; }
.muted { color: var(--ink-muted); }
.small { font-size: .85rem; }
.flex { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { height: 24px; }
.nowrap { white-space: nowrap; }
kbd { background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 2px 7px; font-family: var(--mono); font-size: .82rem; }

/* Print */
@media print {
  .site-header, .site-footer, .cookie-banner, .ad-slot, .no-print { display: none !important; }
  body { background: #fff; }
  .calc-shell, .card { box-shadow: none; }
}

/* Honeypot anti-spam field (hidden from humans, visible to bots) */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
