/* OpenCalculator — design system v2
   Fresh teal + deep-navy theme. All class names match the HTML. */
:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-soft: #ccfbf1;
  --primary-ghost: #f0fdfa;
  --accent: #f59e0b;
  --navy: #0b1e2d;
  --navy-2: #10293d;
  --bg: #f4f7f9;
  --card: #ffffff;
  --text: #1c2b3a;
  --muted: #5b7186;
  --border: #dfe8ee;
  --radius: 16px;
  --shadow: 0 6px 24px rgba(11, 30, 45, 0.08);
  --shadow-lg: 0 14px 40px rgba(11, 30, 45, 0.14);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
::selection { background: var(--primary-soft); }

/* ---------- Header ---------- */
header.site {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 12px rgba(11, 30, 45, 0.05);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.logo { font-size: 23px; font-weight: 800; letter-spacing: -0.02em; color: var(--navy); display: flex; align-items: center; gap: 9px; }
.logo::before {
  content: "◧"; display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 10px; font-size: 19px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff;
}
.logo span { color: var(--primary); }
.logo:hover { text-decoration: none; }
.nav-links { display: flex; gap: 26px; list-style: none; align-items: center; }
.nav-links a { color: var(--text); font-weight: 600; font-size: 15px; padding: 8px 2px; position: relative; }
.nav-links a::after { content: ""; position: absolute; left: 0; right: 100%; bottom: 2px; height: 2.5px;
  border-radius: 3px; background: var(--primary); transition: right .2s ease; }
.nav-links a:hover { color: var(--primary-dark); text-decoration: none; }
.nav-links a:hover::after { right: 0; }
.menu-btn { display: none; background: none; border: none; font-size: 26px; cursor: pointer; color: var(--text); }

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(700px 320px at 85% -40px, rgba(13, 148, 136, 0.45), transparent 65%),
    radial-gradient(500px 260px at 10% 120%, rgba(245, 158, 11, 0.14), transparent 60%),
    linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 70%, #0a2436 100%);
  color: #fff; padding: 72px 0 64px; text-align: center; position: relative; overflow: hidden;
}
.hero::before { content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(600px 300px at 50% 0%, #000 30%, transparent 75%); }
.hero .wrap { position: relative; }
.hero .badge {
  display: inline-block; font-size: 12.5px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase;
  color: #5eead4; background: rgba(13, 148, 136, 0.16); border: 1px solid rgba(94, 234, 212, 0.35);
  padding: 7px 16px; border-radius: 999px; margin-bottom: 18px;
}
.hero h1 { font-size: clamp(30px, 5.4vw, 48px); margin-bottom: 12px; letter-spacing: -0.025em; line-height: 1.15; }
.hero h1 .hl { background: linear-gradient(90deg, #5eead4, #fbbf24); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: #b8c9d6; font-size: 17.5px; max-width: 660px; margin: 0 auto; }

/* ---------- Tool grid ---------- */
.section-title { font-size: 25px; margin: 38px 0 4px; letter-spacing: -0.02em; color: var(--navy); }
.section-sub { color: var(--muted); margin-bottom: 8px; }
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; padding: 30px 0 10px; }
.tool-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 26px 22px; box-shadow: var(--shadow); display: block; color: var(--text);
  position: relative; overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.tool-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--primary), #5eead4); transform: scaleX(0); transform-origin: left;
  transition: transform .22s ease; }
.tool-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: #bfe9e1; text-decoration: none; }
.tool-card:hover::before { transform: scaleX(1); }
.tool-card .icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 54px; height: 54px; font-size: 27px; margin-bottom: 14px; border-radius: 15px;
  background: linear-gradient(135deg, var(--primary-ghost), var(--primary-soft));
  border: 1px solid #bfe9e1;
}
.tool-card h3 { font-size: 18px; margin-bottom: 6px; letter-spacing: -0.01em; color: var(--navy); }
.tool-card p { font-size: 14px; color: var(--muted); line-height: 1.6; }

/* ---------- Tool page ---------- */
.crumb { font-size: 14px; color: var(--muted); padding: 20px 0 0; }
.crumb a { color: var(--muted); }
.tool-layout { display: grid; grid-template-columns: 1fr; gap: 26px; padding: 26px 0 10px; }
.tool-box {
  background: var(--card); border: 1px solid var(--border); border-radius: 20px;
  box-shadow: var(--shadow); padding: 32px; position: relative; overflow: hidden;
}
.tool-box::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px;
  background: linear-gradient(90deg, var(--primary), #5eead4, var(--accent)); }
.tool-box h1 { font-size: clamp(24px, 4vw, 32px); margin-bottom: 6px; letter-spacing: -0.02em; color: var(--navy); }
.tool-box .lede { color: var(--muted); margin-bottom: 24px; font-size: 16px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 650; margin-bottom: 7px; font-size: 14.5px; color: var(--navy); }
.field input[type="number"], .field input[type="text"], .field input[type="date"],
.field select, .field textarea {
  width: 100%; padding: 13px 15px; border: 1.5px solid var(--border); border-radius: 12px;
  font-size: 16px; font-family: inherit; background: #fbfdfd; color: var(--text);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.14); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.btn {
  display: inline-block; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border: none; border-radius: 999px; padding: 14px 38px;
  font-size: 16px; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(13, 148, 136, 0.42); filter: brightness(1.05); }
.btn:active { transform: translateY(0); }
.btn-secondary { background: #e6eef3; color: var(--text); box-shadow: none; }
.btn-secondary:hover { background: #d7e3ea; box-shadow: none; filter: none; }
.result {
  margin-top: 24px; background: linear-gradient(180deg, var(--primary-ghost), #fff);
  border: 1.5px solid #99e6d8; border-radius: 14px; padding: 22px; display: none;
}
.result.show { display: block; animation: pop .28s ease; }
@keyframes pop { from { transform: scale(.97) translateY(4px); opacity: 0; } to { transform: none; opacity: 1; } }
.result .big { font-size: 34px; font-weight: 800; color: var(--primary-dark); letter-spacing: -0.02em; }
.result table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.result td { padding: 9px 4px; border-bottom: 1px solid #d3ece7; font-size: 15px; }
.result td:last-child { text-align: right; font-weight: 700; color: var(--navy); }
.checks { display: flex; flex-wrap: wrap; gap: 12px 22px; margin: 4px 0 16px; }
.checks label { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
input[type="range"] { width: 100%; accent-color: var(--primary); }

/* ---------- Article content ---------- */
.article {
  background: var(--card); border: 1px solid var(--border); border-radius: 20px;
  padding: 32px; box-shadow: var(--shadow); font-size: 16px;
}
.article h2 { font-size: 22px; margin: 28px 0 10px; letter-spacing: -0.015em; color: var(--navy); }
.article h2:first-child { margin-top: 0; }
.article h3 { font-size: 18px; margin: 22px 0 8px; color: var(--navy); }
.article p, .article li { color: #33475c; margin-bottom: 12px; }
.article ul, .article ol { padding-left: 24px; }
.article table.data { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 15px; }
.article table.data th, .article table.data td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; }
.article table.data th { background: var(--primary-ghost); color: var(--primary-dark); }
.faq { margin-top: 8px; }
.faq details { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; background: #fff; transition: border-color .15s, box-shadow .15s; }
.faq details[open] { border-color: #99e6d8; box-shadow: 0 4px 14px rgba(13,148,136,.1); }
.faq summary { padding: 15px 18px; font-weight: 700; cursor: pointer; list-style: none; color: var(--navy);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-ghost); color: var(--primary-dark); font-size: 18px; font-weight: 700; }
.faq details[open] summary::after { content: '–'; background: var(--primary); color: #fff; }
.faq details p { padding: 0 18px 16px; margin: 0; animation: fadeSlide .2s ease; }
@keyframes fadeSlide { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Ad slots (driven by assets/ads.js) ---------- */
.ad-slot { margin: 30px auto; max-width: 760px; text-align: center; }
.ad-slot .ad-label { display: block; font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  color: #8aa0b4; margin-bottom: 8px; }
.ad-slot.ad-empty { background: #fff; border: 2px dashed #c3d5df; border-radius: var(--radius); padding: 30px 16px; }
.ad-slot.ad-empty .ad-label { margin-bottom: 0; font-size: 11px; }

/* ---------- Footer ---------- */
footer.site { background: linear-gradient(180deg, var(--navy-2), var(--navy)); color: #a9bccd; margin-top: 56px; padding: 46px 0 26px; }
.foot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 28px; margin-bottom: 28px; }
.foot-grid h4 { color: #fff; margin-bottom: 13px; font-size: 15.5px; letter-spacing: 0.01em;
  padding-bottom: 8px; border-bottom: 2px solid rgba(13,148,136,.5); display: inline-block; }
.foot-grid ul { list-style: none; }
.foot-grid li { margin-bottom: 9px; }
.foot-grid a { color: #8fa6b8; font-size: 14px; transition: color .15s, padding-left .15s; }
.foot-grid a:hover { color: #5eead4; text-decoration: none; padding-left: 4px; }
.copy { border-top: 1px solid rgba(255,255,255,.09); padding-top: 20px; font-size: 13px; color: #6b8499; text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .nav-links { display: none; position: absolute; top: 68px; left: 0; right: 0; background: #fff;
    flex-direction: column; padding: 12px 20px 20px; border-bottom: 1px solid var(--border);
    gap: 6px; box-shadow: 0 14px 30px rgba(11,30,45,.1); }
  .nav-links.open { display: flex; }
  .nav-links a::after { display: none; }
  .menu-btn { display: block; }
  .field-row { grid-template-columns: 1fr; }
  .tool-box, .article { padding: 22px; }
  .hero { padding: 56px 0 48px; }
}
