/*
Theme Name: CalcPulse
Theme URI: https://calcpulse.com
Author: CalcPulse
Description: A fast, lightweight theme for free online calculators and converters. Works with the CalcPulse Core plugin.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GPL-2.0-or-later
Text Domain: calcpulse
*/

:root {
  --paper: #f3f5fb; --card: #ffffff; --field: #ffffff; --ink: #10173a; --text: #1b2347; --muted: #566086;
  --line: #dfe4f2; --line-strong: #c3cbe3; --brand: #3b4cf0; --brand-ink: #ffffff; --brand-soft: #e8ebff;
  --panel: #10173a; --panel-text: #e9edff; --panel-muted: #a9b3e6; --lcd: #b8f5d8; --warn: #ffd9a8; --focus: rgba(59, 76, 240, .28);
  --c-finance: #2f6bff; --c-math: #8a4dff; --c-health: #e5484d; --c-converters: #0ea5a0; --c-everyday: #d98a00;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --wrap: 1180px;
}
:root[data-theme="dark"] {
  --paper: #0b0f26; --card: #131a3b; --field: #0f1531; --ink: #e9edff; --text: #dce2ff; --muted: #9aa5d6;
  --line: #242d58; --line-strong: #36407a; --brand: #8c9bff; --brand-ink: #0b0f26; --brand-soft: #1b2455;
  --panel: #070a1c; --panel-text: #e9edff; --focus: rgba(140, 155, 255, .35);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0b0f26; --card: #131a3b; --field: #0f1531; --ink: #e9edff; --text: #dce2ff; --muted: #9aa5d6;
    --line: #242d58; --line-strong: #36407a; --brand: #8c9bff; --brand-ink: #0b0f26; --brand-soft: #1b2455;
    --panel: #070a1c; --panel-text: #e9edff; --focus: rgba(140, 155, 255, .35);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 4.5rem; }
body { margin: 0; background: var(--paper); color: var(--text); font: 400 1.0625rem/1.65 var(--font); font-variant-numeric: tabular-nums; }
img, svg { max-width: 100%; }
a { color: var(--brand); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { color: var(--ink); line-height: 1.15; letter-spacing: -.02em; font-weight: 800; margin: 0 0 .6em; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.85rem); margin-top: 2rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
.wrap { width: min(100% - 2rem, var(--wrap)); margin-inline: auto; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: .5rem; background: var(--brand); color: var(--brand-ink); padding: .6rem 1rem; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: .5rem; }
.ic { flex: none; vertical-align: middle; }

/* header */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.site-header .wrap { display: flex; align-items: center; gap: 1.25rem; min-height: 4rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.3rem; letter-spacing: -.03em; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: #10173a; display: grid; place-items: center; }
.main-nav { margin-left: auto; }
.main-nav ul { list-style: none; display: flex; gap: .15rem; margin: 0; padding: 0; }
.main-nav a { display: block; padding: .5rem .75rem; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 600; font-size: .98rem; }
.main-nav a:hover, .main-nav .current-menu-item > a { background: var(--brand-soft); color: var(--brand); }
.hdr-tools { display: flex; gap: .4rem; align-items: center; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 10px; cursor: pointer; }
.icon-btn:hover { background: var(--brand-soft); }
[data-nav-toggle] { display: none; }
[data-install][hidden] { display: none; }
.theme-sun { display: none; }
:root[data-theme="dark"] .theme-sun { display: inline; } :root[data-theme="dark"] .theme-moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-sun { display: inline; } :root:not([data-theme="light"]) .theme-moon { display: none; } }
@media (max-width: 860px) {
  [data-nav-toggle] { display: inline-grid; }
  .main-nav { position: absolute; left: 0; right: 0; top: 100%; background: var(--card); border-bottom: 1px solid var(--line); display: none; margin: 0; }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; padding: .5rem 1rem 1rem; }
  .hdr-tools { margin-left: auto; }
}

/* hero and search */
.hero { padding: clamp(2rem, 6vw, 4.5rem) 0 clamp(1.5rem, 4vw, 2.5rem); background:
  linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 100% 32px, linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 32px 100%, var(--paper);
  border-bottom: 1px solid var(--line); }
.hero h1 { max-width: 16ch; }
.hero p.lede { max-width: 52ch; font-size: 1.15rem; color: var(--muted); }
.pulse-line { display: block; width: min(320px, 70%); height: 28px; margin: 0 0 1.2rem; color: var(--brand); }
.search { position: relative; max-width: 640px; margin-top: 1.5rem; }
.search-box { display: flex; align-items: center; gap: .75rem; background: var(--panel); border-radius: 14px; padding: 0 1rem; border: 2px solid transparent; }
.search-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px var(--focus); }
.search-box .ic { color: var(--lcd); }
.search input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--lcd); font: 600 1.15rem var(--mono); min-height: 56px; outline: none; }
.search input::placeholder { color: #7f8bc4; font-weight: 400; }
.results { list-style: none; margin: .4rem 0 0; padding: .35rem; background: var(--card); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: 0 14px 40px rgba(16, 23, 58, .18); position: absolute; left: 0; right: 0; z-index: 20; max-height: 22rem; overflow: auto; }
.results[hidden] { display: none; }
.results a { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem .8rem; border-radius: 9px; text-decoration: none; color: var(--text); font-weight: 600; }
.results a small { color: var(--muted); font-weight: 400; }
.results [aria-selected="true"] a, .results a:hover { background: var(--brand-soft); color: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; padding: 0; list-style: none; }
.chips a { display: inline-block; padding: .35rem .8rem; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--card); color: var(--text); text-decoration: none; font-size: .95rem; font-weight: 600; }
.chips a:hover { border-color: var(--brand); color: var(--brand); }

/* category panels and tiles */
.section { padding: clamp(1.75rem, 4vw, 3rem) 0; }
.panels { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.panel { background: var(--card); border: 1px solid var(--line); border-top: 5px solid var(--cat, var(--brand)); border-radius: 6px 6px 18px 6px; padding: 1.1rem 1.25rem 1.25rem; }
.panel-finance { --cat: var(--c-finance); } .panel-math { --cat: var(--c-math); } .panel-health { --cat: var(--c-health); }
.panel-converters { --cat: var(--c-converters); } .panel-everyday { --cat: var(--c-everyday); }
.panel header { display: flex; align-items: center; gap: .65rem; margin-bottom: .6rem; }
.panel header .ic { color: var(--cat, var(--brand)); }
.panel h2 { font-size: 1.25rem; margin: 0; flex: 1; }
.panel h2 a { color: var(--ink); text-decoration: none; }
.panel .count { font-size: .9rem; color: var(--muted); }
.panel ul { list-style: none; margin: 0 0 .8rem; padding: 0; }
.panel li a { display: block; padding: .32rem 0; text-decoration: none; color: var(--text); border-bottom: 1px dashed var(--line); }
.panel li a:hover { color: var(--brand); }
.panel .more { font-weight: 700; text-decoration: none; }
.tile-grid { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }
.tile-grid a { display: grid; gap: .3rem; height: 100%; padding: 1.1rem 1.2rem; background: var(--card); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--text); }
.tile-grid a:hover { border-color: var(--brand); }
.tile-grid strong { color: var(--ink); font-size: 1.1rem; }
.tile-grid span { color: var(--muted); font-size: .95rem; }
.page-head { padding: clamp(1.5rem, 4vw, 2.75rem) 0 0; }
.page-head p { color: var(--muted); max-width: 60ch; font-size: 1.1rem; }
.crumbs { font-size: .92rem; color: var(--muted); margin-bottom: 1rem; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; padding: 0; }
.crumbs li + li::before { content: "/"; margin-right: .4rem; color: var(--line-strong); }
.crumbs a { color: var(--muted); }
.cols { columns: 3 240px; column-gap: 2rem; list-style: none; padding: 0; margin: 0 0 1.5rem; }
.cols li { break-inside: avoid; }
.cols a { display: block; padding: .3rem 0; text-decoration: none; color: var(--text); }
.cols a:hover { color: var(--brand); }

/* calculator page layout */
.layout { display: grid; gap: 2rem; padding-bottom: 3rem; grid-template-columns: minmax(0, 1fr); }
.calc-page, .side { min-width: 0; }
@media (min-width: 1040px) { .layout { grid-template-columns: minmax(0, 1fr) 300px; } .side { position: sticky; top: 5rem; align-self: start; } }
.calc-head { padding: clamp(1.25rem, 3vw, 2.25rem) 0 .25rem; }
.calc-head h1 { margin-bottom: .35em; }
.calc-head .lede { color: var(--muted); font-size: 1.12rem; max-width: 62ch; margin: 0; }
.side .box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.1rem; margin-bottom: 1rem; }
.side h2 { font-size: 1.05rem; margin: 0 0 .5rem; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side li a { display: block; padding: .3rem 0; text-decoration: none; color: var(--text); }
.side li a:hover { color: var(--brand); }
.updated { color: var(--muted); font-size: .92rem; }

/* calculator widget (rendered by the CalcPulse engine) */
.cp-calc { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: clamp(1rem, 3vw, 1.6rem); margin: 1.25rem 0; }
.cp-calc:not(.cp-ready) { min-height: 360px; }
.cp-bar { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: space-between; align-items: center; margin-bottom: 1.1rem; }
.cp-tabs { display: flex; gap: .2rem; padding: .25rem; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; max-width: 100%; }
.cp-tab { border: 0; background: transparent; color: var(--muted); font: 700 .95rem var(--font); padding: .5rem .9rem; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.cp-tab[aria-selected="true"] { background: var(--card); color: var(--brand); box-shadow: 0 1px 4px rgba(16, 23, 58, .18); }
.cp-curwrap { display: inline-flex; align-items: center; gap: .5rem; font-size: .92rem; color: var(--muted); }
.cp-cur { min-height: 38px; border: 1.5px solid var(--line-strong); background: var(--field); color: var(--text); border-radius: 9px; font: inherit; padding: 0 .5rem; }
.cp-body { display: grid; gap: 1.25rem; }
@media (min-width: 780px) { .cp-body { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); align-items: start; } }
.cp-form { display: grid; gap: .95rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.cp-field.cp-wide { grid-column: 1 / -1; }
.cp-field label { display: block; font-weight: 700; font-size: .95rem; color: var(--ink); margin-bottom: .3rem; }
.cp-input { display: flex; align-items: stretch; border: 1.5px solid var(--line-strong); border-radius: 10px; background: var(--field); overflow: hidden; }
.cp-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus); }
.cp-input input, .cp-input select, .cp-input textarea { flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; color: var(--text); font: 600 1.05rem var(--font); min-height: 46px; padding: 0 .8rem; outline: none; }
.cp-input textarea { padding: .65rem .8rem; min-height: 110px; font-family: var(--mono); font-size: 1rem; resize: vertical; }
.cp-adorn { display: flex; align-items: center; padding: 0 .7rem; background: var(--paper); color: var(--muted); font-size: .92rem; white-space: nowrap; }
.cp-help { margin: .3rem 0 0; font-size: .85rem; color: var(--muted); line-height: 1.4; }
.cp-readout { background: var(--panel); color: var(--panel-text); border-radius: 16px; padding: 1.15rem 1.25rem; }
.cp-lcd-label { display: block; font-size: .9rem; color: var(--panel-muted); margin-bottom: .2rem; }
.cp-lcd-value { display: block; font: 700 clamp(1.6rem, 4.6vw, 2.35rem)/1.2 var(--mono); color: var(--lcd); letter-spacing: -.01em; overflow-wrap: anywhere; }
.cp-rows { margin: .9rem 0 0; }
.cp-rows > div { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-top: 1px solid rgba(255, 255, 255, .12); }
.cp-rows dt { color: var(--panel-muted); font-size: .95rem; min-width: 0; }
.cp-rows dd { margin: 0; font-weight: 700; text-align: right; flex: none; max-width: 62%; overflow-wrap: break-word; }
.cp-msg { margin: 0; color: var(--warn); }
.cp-extra { margin-top: 1rem; }
.cp-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: 1.1rem; }
.cp-btn { border: 1.5px solid var(--brand); background: var(--brand); color: var(--brand-ink); font: 700 .95rem var(--font); padding: .55rem 1rem; border-radius: 10px; cursor: pointer; }
.cp-btn:hover { filter: brightness(1.08); }
.cp-ghost { background: transparent; color: var(--brand); }
.cp-ghost:hover { background: var(--brand-soft); filter: none; }
.cp-status { color: var(--muted); font-size: .92rem; }
.cp-tablewrap { overflow: auto; max-height: 26rem; border: 1px solid var(--line); border-radius: 12px; margin: .75rem 0; }
.cp-table { border-collapse: collapse; width: 100%; font-size: .95rem; }
.cp-table caption { text-align: left; font-weight: 800; color: var(--ink); padding: .7rem .9rem; }
.cp-table th, .cp-table td { padding: .5rem .9rem; text-align: right; border-top: 1px solid var(--line); white-space: nowrap; }
.cp-table th:first-child, .cp-table td:first-child { text-align: left; }
.cp-table thead th { position: sticky; top: 0; background: var(--paper); color: var(--ink); }
.cp-steps { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: .7rem 1rem; margin-top: .75rem; }
.cp-steps summary { cursor: pointer; font-weight: 700; color: var(--ink); }
.cp-steps ol { margin: .6rem 0 .2rem; padding-left: 1.25rem; }
.cp-ad { min-height: 280px; margin: 1rem 0; text-align: center; overflow: hidden; }

/* article text */
.cp-article, .entry { max-width: 72ch; }
.cp-article h2, .entry h2 { margin-top: 1.9rem; }
.cp-article ul, .cp-article ol, .entry ul, .entry ol { padding-left: 1.3rem; }
.cp-article li, .entry li { margin-bottom: .4rem; }
.cp-faq { max-width: 72ch; }
.cp-faq details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; margin-bottom: .6rem; }
.cp-faq summary { cursor: pointer; font-weight: 700; color: var(--ink); }
.cp-faq p { margin: .6rem 0 0; }
.cp-related ul { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; }
.cp-related a { display: inline-block; padding: .4rem .9rem; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--card); text-decoration: none; font-weight: 600; }

/* footer */
.site-footer { background: var(--panel); color: var(--panel-text); margin-top: 2rem; padding: 2.5rem 0 1.5rem; }
.site-footer a { color: #cfd6ff; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.foot-grid { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.site-footer h2 { color: #fff; font-size: 1.05rem; margin: 0 0 .6rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { padding: .2rem 0; }
.foot-note { border-top: 1px solid rgba(255, 255, 255, .14); margin-top: 2rem; padding-top: 1rem; font-size: .9rem; color: var(--panel-muted); }
.pager { display: flex; gap: 1rem; justify-content: space-between; margin: 2rem 0; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media print {
  .site-header, .site-footer, .side, .cp-ad, .cp-actions, .cp-tabs, .cp-bar, .cp-faq, .cp-related, .crumbs { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .cp-calc, .cp-readout { border: 1px solid #999; background: #fff; color: #000; }
  .cp-lcd-value, .cp-lcd-label, .cp-rows dt, .cp-rows dd { color: #000; }
  .layout { display: block; }
}
