/*
Theme Name: SIP Calculator Theme
Theme URI: https://shareincentiveplancalculator.net/
Author: Share Incentive Plan Calculator
Author URI: https://shareincentiveplancalculator.net/
Description: A fast, single-page fintech theme for the Share Incentive Plan (SIP) Calculator. Vanilla JS, no frameworks, light and dark mode, AdSense-safe layout and a built-in editorial guide.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: sip-calculator
Tags: one-column, custom-menu, accessibility-ready, translation-ready, blog
*/

/* ==========================================================================
   Design tokens
   ========================================================================== */
:root {
  --slate-900: #0F172A;
  --emerald: #10B981;
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --surface-2: #F1F5F9;
  --text: #0F172A;
  --muted: #475569;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --link: #047857;
  --accent: #10B981;
  --accent-ink: #0F172A;
  --accent-soft: #D1FAE5;
  --danger: #B91C1C;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --result-bg: #0F172A;
  --result-text: #E2E8F0;
  --result-muted: #94A3B8;
  --result-line: #1E293B;
  --radius: 12px;
  --radius-sm: 8px;
  --font-head: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-ui: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0B1120;
  --surface: #0F172A;
  --surface-2: #162033;
  --text: #E2E8F0;
  --muted: #94A3B8;
  --border: #1E293B;
  --border-strong: #334155;
  --link: #34D399;
  --accent-soft: rgba(16, 185, 129, .16);
  --danger: #F87171;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
  --result-bg: #111B30;
  --result-line: #22304A;
  color-scheme: dark;
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.65;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-wrap: break-word;
}
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; letter-spacing: -.02em; margin: 0 0 .6em; color: var(--text); }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1em; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
img, svg { max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.screen-reader-text, .skip-link:not(:focus) {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link:focus {
  position: fixed; top: 8px; left: 8px; z-index: 1000; padding: 10px 16px;
  background: var(--accent); color: var(--accent-ink); border-radius: var(--radius-sm); font-weight: 600;
}
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.container--narrow { max-width: 760px; }
.num { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 800; font-size: 1.05rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--slate-900); color: var(--emerald); display: grid; place-items: center; border: 1px solid var(--border-strong); }
.site-nav { flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; justify-content: flex-end; }
.site-nav a { display: block; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--muted); font-size: .9rem; font-weight: 500; text-decoration: none; white-space: nowrap; }
.site-nav a:hover { background: var(--surface-2); color: var(--text); }
.theme-toggle {
  flex: none; width: 44px; height: 44px; touch-action: manipulation; display: grid; place-items: center; cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.theme-toggle:hover { background: var(--surface-2); }
.menu-toggle {
  display: none; flex: none; width: 44px; height: 44px; place-items: center; cursor: pointer;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.menu-toggle:hover { background: var(--surface-2); }
.menu-toggle .icon-close { display: none; }
.site-header.menu-open .menu-toggle .icon-open { display: none; }
.site-header.menu-open .menu-toggle .icon-close { display: block; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero { padding: 56px 0 28px; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 640px; }
.trust-badge {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 8px;
  padding: 8px 14px; border-radius: 999px; font-size: .875rem; font-weight: 600;
  background: var(--accent-soft); color: var(--link); border: 1px solid var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}

/* ==========================================================================
   Calculator
   ========================================================================== */
.calc-section { padding: 16px 0 40px; }
.calc-grid { display: grid; gap: 20px; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 900px) { .calc-grid { grid-template-columns: 1.1fr .9fr; } .results-card { position: sticky; top: 84px; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.card h2 { font-size: 1.25rem; margin-bottom: 4px; }
.card .sub { color: var(--muted); font-size: .92rem; margin-bottom: 20px; }
.field-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .field-grid { grid-template-columns: 1fr 1fr; } }
.field label { display: block; font-size: .875rem; font-weight: 600; margin-bottom: 6px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .affix { position: absolute; left: 12px; color: var(--muted); pointer-events: none; font-weight: 500; }
.input-wrap .affix--end { left: auto; right: 12px; }
.field--full { grid-column: 1 / -1; }
.field input, .field select {
  width: 100%; height: 44px; padding: 0 12px; font: inherit; font-variant-numeric: tabular-nums;
  background: var(--bg); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.field .has-prefix { padding-left: var(--prefix-pad, 28px); }
.field .has-suffix { padding-right: 30px; }
.field input:hover, .field select:hover { border-color: var(--muted); }
.field input:focus-visible, .field select:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 0; border-color: var(--accent); }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.hint { display: block; margin-top: 5px; font-size: .8rem; color: var(--muted); }
.error { display: block; margin-top: 5px; min-height: 0; font-size: .8rem; color: var(--danger); font-weight: 600; }
.error:empty { display: none; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.btn {
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px;
  font: inherit; font-weight: 600; cursor: pointer; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
}
.btn:hover { background: var(--surface-2); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: #34D399; border-color: #34D399; }

.results-card { background: var(--result-bg); color: var(--result-text); border: 1px solid var(--result-line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.results-card h2 { color: #fff; font-size: 1.05rem; margin-bottom: 14px; }
.headline-figure { font-family: var(--font-head); font-weight: 800; font-size: clamp(2.2rem, 6vw, 3rem); color: var(--emerald); line-height: 1.1; letter-spacing: -.03em; }
.headline-label { color: var(--result-muted); font-size: .9rem; margin: 4px 0 18px; }
.result-list { margin: 0; padding: 0; }
.result-row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--result-line); font-size: .93rem; }
.result-row dt { color: var(--result-muted); }
.result-row dd { margin: 0; font-weight: 600; text-align: right; color: #fff; }
.result-row--positive dd { color: var(--emerald); }
.result-note { margin: 14px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(16, 185, 129, .1); color: var(--result-text); font-size: .83rem; line-height: 1.5; }
.result-note:empty { display: none; }

/* ==========================================================================
   Ad slots (layout reserved to keep CLS at zero)
   ========================================================================== */
.ad-slot { margin: 8px auto 40px; max-width: 1120px; padding: 0 20px; }
.ad-slot__box {
  position: relative; min-height: 280px; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius); overflow: hidden; contain: layout paint;
}
.ad-slot__label { position: absolute; top: 6px; left: 12px; font-size: .7rem; color: var(--muted); }
.ad-slot--tall .ad-slot__box { min-height: 320px; }
.ad-slot__box--live { display: block; padding: 22px 0 0; text-align: center; background: transparent; border-style: solid; border-color: var(--border); }
.ad-slot__box--live ins.adsbygoogle { display: block; width: 100%; }
.ad-slot__box--live:has(ins[data-ad-status="unfilled"]) { display: none; }
.ad-slot__box--empty { flex-direction: column; gap: 6px; text-align: center; padding: 28px 16px 16px; }
.ad-slot__help { font-size: .85rem; color: var(--muted); max-width: 34em; }
@media (max-width: 600px) { .ad-slot__box { min-height: 300px; } }

/* ==========================================================================
   Editorial guide
   ========================================================================== */
.guide { padding: 24px 0 24px; }
.guide section { margin-bottom: 56px; }
.guide .prose p, .guide .prose li { color: var(--muted); font-size: 1.02rem; }
.guide .prose strong { color: var(--text); }
.guide ul, .guide ol { padding-left: 1.3em; margin: 0 0 1em; }
.guide li { margin-bottom: .5em; }
.steps { list-style: none; padding: 0 !important; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 0 0 0 52px; margin-bottom: 20px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0; width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 50%; background: var(--slate-900); color: var(--emerald); font-weight: 700; font-family: var(--font-head);
  border: 1px solid var(--border-strong);
}
.steps li strong { display: block; color: var(--text); }
.table-scroll { overflow-x: auto; margin: 0 0 1.2em; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .93rem; min-width: 560px; background: var(--surface); }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
th { background: var(--surface-2); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
.callout { border-left: 4px solid var(--accent); background: var(--accent-soft); padding: 14px 18px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 0 0 1.2em; color: var(--text); }

/* FAQ accordion (native <details>: works without JavaScript) */
.faq { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.faq-item + .faq-item { border-top: 1px solid var(--border); }
.faq-q {
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; text-align: left;
  min-height: 56px; padding: 16px 20px; cursor: pointer; font-weight: 600; color: var(--text);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
.faq-q::-webkit-details-marker { display: none; }
.faq-q::marker { content: ''; }
.faq-q-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.faq-q:hover { background: var(--surface-2); }
.faq-q .chev { flex: none; transition: transform .2s ease; color: var(--muted); }
.faq-item[open] > .faq-q .chev { transform: rotate(180deg); color: var(--emerald); }
.faq-a { padding: 0 20px 18px; color: var(--muted); }
.faq-a p { margin: 0; }

/* ==========================================================================
   Pages & fallback templates
   ========================================================================== */

/* Pages: lead text, small print, contact form, notices */
.entry-content .lead { font-size: 1.15rem; color: var(--text); }
.entry-content .small { font-size: .85rem; color: var(--muted); }
.entry-content ul { padding-left: 1.3em; }
.entry-content li + li { margin-top: .45em; }
.sip-form { margin: 0; }
.sip-form .field { margin-bottom: 16px; }
.sip-form textarea {
  display: block; width: 100%; min-height: 160px; padding: 12px; font: inherit; resize: vertical;
  background: var(--bg); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.sip-form textarea:hover { border-color: var(--muted); }
.sip-form textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.sip-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.notice { padding: 14px 16px; margin: 0 0 20px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); }
.notice--ok { border-color: var(--emerald); }
.notice--err { border-color: #dc2626; }
.page-wrap { padding: 56px 0 72px; }
.entry-title { margin-bottom: .4em; }
.entry-content { font-size: 1.05rem; }
.entry-content > * + * { margin-top: 1em; }
.entry-content h2 { margin-top: 1.8em; }
.entry-content h3 { margin-top: 1.4em; }
.entry-content ul, .entry-content ol { padding-left: 1.4em; }
.entry-content img { height: auto; border-radius: var(--radius-sm); }
.entry-content input, .entry-content textarea { max-width: 100%; font: inherit; padding: 10px 12px; background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.entry-content input[type="submit"], .entry-content button { background: var(--accent); color: var(--accent-ink); font-weight: 600; cursor: pointer; border-color: var(--accent); }
.post-list article { padding: 20px 0; border-bottom: 1px solid var(--border); }

/* ==========================================================================
   Footer & toast
   ========================================================================== */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 40px 0 48px; margin-top: 24px; }
.footer-menu { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 0; margin: 0 0 20px; }
.footer-menu a { color: var(--text); font-weight: 500; text-decoration: none; }
.footer-menu a:hover { text-decoration: underline; }
.disclaimer { font-size: .85rem; color: var(--muted); max-width: 820px; }
.copyright { font-size: .85rem; color: var(--muted); margin: 0; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 200;
  background: var(--slate-900); color: #fff; border: 1px solid var(--emerald); padding: 12px 18px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .92rem; transition: opacity .2s ease, transform .2s ease; width: max-content; max-width: calc(100% - 32px); text-align: center;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* Tablet / phone navigation: links collapse into a dropdown menu */
@media (max-width: 860px) {
  .header-inner { position: relative; }
  .brand { margin-right: auto; min-width: 0; }
  .brand span:last-child { overflow: hidden; text-overflow: ellipsis; }
  .menu-toggle { display: grid; }
  .site-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0; flex: none; overflow: visible;
    background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); padding: 8px 12px 12px;
  }
  .site-header.menu-open .site-nav { display: block; }
  .site-nav ul { flex-direction: column; gap: 2px; justify-content: flex-start; }
  .site-nav a { padding: 14px 12px; font-size: 1rem; }
}

@media (max-width: 640px) {
  .hero { padding-top: 36px; }
  .card, .results-card { padding: 18px; }
  .header-inner { gap: 8px; }
  .container { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .ad-slot { padding: 0 16px; }
  .trust-badge { border-radius: var(--radius); align-items: flex-start; line-height: 1.4; }
  .trust-badge svg { flex: none; margin-top: 2px; }
  .actions .btn { flex: 1 1 0; white-space: nowrap; padding: 0 12px; }
  .result-row { font-size: .9rem; gap: 12px; }
  .faq-q { padding: 14px 16px; }
  .faq-a { padding: 0 16px 16px; }
  .steps li { padding-left: 46px; }
  .toast { bottom: calc(16px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print { .site-header, .ad-slot, .actions, .toast, .site-footer .footer-menu { display: none !important; } }
