/* ============================================================
   DM Calc — Modern Design System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ---- Custom Properties ---- */
:root {
  --primary: #1e3a5f;
  --primary-hover: #2d5a8e;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --nav-height: 110px;
}

/* ---- Reset ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

img { max-width: 100%; height: auto; }

/* ---- Utilities ---- */
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -50px;
  left: 0;
  padding: 6px 14px;
  background: var(--primary);
  color: #fff;
  font-size: 0.875rem;
  z-index: 9999;
  border-radius: 0 0 var(--radius) 0;
  transition: top 0.15s;
}
.skip-link:focus { top: 0; }

.group::after { content: ''; display: table; clear: both; }

/* ============================================================
   WRAPPER & LAYOUT
   ============================================================ */
#wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#wrapper-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   HEADER
   ============================================================ */
#header-sticky {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--primary);
  box-shadow: var(--shadow-md);
}

#header {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

#header .pad {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
}

.site-title,
.site-title a {
  font-size: 1.4rem;
  font-weight: 700;
  color: #ffffff !important;
  text-decoration: none !important;
  letter-spacing: -0.025em;
}
h1.site-title a,
p.site-title a { color: #ffffff !important; }

.site-description {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.55);
  font-weight: 400;
  margin: 0 !important;
  padding: 0 !important;
  padding-top: 2px !important;
}

/* ============================================================
   NAVIGATION
   ============================================================ */
#header-bottom {
  background: rgba(0,0,0,0.2);
  border-top: 1px solid rgba(255,255,255,0.08);
}

/* Always hide the empty/broken desktop nav container */
#wrap-nav-header {
  display: none !important;
}

/* Show mobile-nav container on all screen sizes */
#wrap-nav-mobile {
  display: block;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Default (desktop) — hide hamburger, show list horizontally */
#nav-mobile-nav .menu-toggle {
  display: none;
}

#nav-mobile-nav ul.menu,
#nav-mobile-nav ul#nav-mobile {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  gap: 0;
}

#nav-mobile-nav ul li {
  display: block;
}

#nav-mobile-nav ul li .menu-item-wrapper {
  display: block;
}

#nav-mobile-nav ul li a {
  display: block;
  padding: 9px 13px;
  color: rgba(255,255,255,0.75);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
  border-bottom: 2px solid transparent;
}

#nav-mobile-nav ul li a:hover,
#nav-mobile-nav ul li.current-menu-item a,
#nav-mobile-nav ul li.current_page_item a {
  color: #ffffff;
  background: rgba(255,255,255,0.1);
  text-decoration: none;
  border-bottom-color: rgba(255,255,255,0.5);
}

/* Hide search */
.search-trap-focus {
  display: none !important;
}

/* menu-calculators-container — just a wrapper */
.menu-calculators-container {
  display: block;
}

/* ============================================================
   PAGE CONTAINER
   ============================================================ */
#page.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
  width: 100%;
  flex: 1;
}

.container-inner { width: 100%; }

.main { width: 100%; }

.main-inner {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 28px;
  align-items: start;
}

/* ============================================================
   CONTENT / ARTICLE
   ============================================================ */
.content { min-width: 0; }

.post-wrapper {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.entry-header {
  padding: 26px 30px 22px;
  border-bottom: 1px solid var(--border);
}

.entry-title {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.entry-content {
  padding: 26px 30px 30px;
}

.entry-footer {
  padding: 0 30px 16px;
}

/* ---- Entry text ---- */
.entry p,
.entry-content p {
  margin-bottom: 14px;
  font-size: 0.94rem;
  color: var(--text);
}
.entry p:last-child,
.entry-content p:last-child { margin-bottom: 0; }

.entry h2,
.entry h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin: 20px 0 10px;
}
.entry h2:first-child,
.entry h3:first-child { margin-top: 0; }

.entry strong { font-weight: 600; }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* Formula pills */
.entry p strong,
.formula {
  font-weight: 600;
}

/* ============================================================
   CALCULATOR FORMS — shared styles
   ============================================================ */
.calc-form {
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin: 18px 0;
}

.calc-field {
  margin-bottom: 16px;
}

.calc-field:last-child { margin-bottom: 0; }

.calc-field label,
.entry label,
.themeform label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 5px;
  letter-spacing: 0.01em;
}

.calc-field input[type="text"],
.calc-field input[type="number"],
.calc-field select,
.entry input[type="text"],
.entry input[type="number"],
.themeform input[type="text"],
.themeform input[type="number"] {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.94rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  display: block;
}

.calc-field input:focus,
.calc-field select:focus,
.entry input:focus,
.themeform input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

/* Inline inputs (percentage calculator) */
input.inline {
  display: inline-block !important;
  width: auto !important;
  min-width: 70px;
  padding: 6px 10px !important;
  margin: 0 4px !important;
}

/* Two-column input grid */
.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

/* Result inline display */
.calc-result-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  margin-top: 4px;
  font-size: 0.94rem;
  color: var(--text-muted);
}

.calc-result-row .result-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0 4px;
}

/* Result box for multi-output */
.result-box {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 10px;
}
.result-box .result-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.result-box .result-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
}

/* Inline calc result spans */
#ctrvalue, #convratevalue, #cpavalue, #cpcvalue, #cpmvalue,
#roasvalue, #roasvalue2, #roivalue, #yoyvalue,
#ltvvalue, #clvvalue, #reqclicks, #reqbudget,
#result, #result2 {
  font-weight: 700;
  color: var(--primary);
  font-size: 1.1em;
}

/* Old style result divs used in lead gen */
.entry div[style*="border: 1px solid"] {
  padding: 10px 14px !important;
  border-radius: var(--radius) !important;
  border-color: var(--border) !important;
  background: white;
  font-weight: 600;
  color: var(--primary);
  font-size: 1.1rem;
  min-height: 40px;
}

/* Formula highlight */
.formula-display {
  text-align: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--primary);
  background: rgba(30,58,95,0.06);
  border: 1px solid rgba(30,58,95,0.12);
  padding: 9px 14px;
  border-radius: var(--radius);
  margin: 14px 0;
}

/* Primary button */
button,
.themeform button,
.entry button,
input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  background: var(--accent);
  color: #fff !important;
  border: none;
  border-radius: var(--radius);
  font-size: 0.94rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.08s;
  margin-top: 4px;
  text-decoration: none;
}
button:hover,
.themeform button:hover,
.entry button:hover,
input[type="submit"]:hover {
  background: var(--accent-hover);
}
button:active { transform: scale(0.98); }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar.s1 {
  position: sticky;
  top: calc(var(--nav-height) + 16px);
}

.sidebar-content {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.widget_pages h3.group {
  background: var(--primary);
  padding: 13px 18px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0;
}
.widget_pages h3.group span {
  color: rgba(255,255,255,0.85);
}

.widget_pages ul {
  list-style: none;
  padding: 6px 0;
  margin: 0;
}

.widget_pages ul li a {
  display: block;
  padding: 7px 18px;
  font-size: 0.84rem;
  color: var(--text-muted);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
  line-height: 1.4;
}

.widget_pages ul li a:hover {
  color: var(--accent);
  background: rgba(59,130,246,0.06);
  text-decoration: none;
}

.widget_pages ul li.current_page_item > a {
  color: var(--accent);
  background: rgba(59,130,246,0.08);
  border-left-color: var(--accent);
  font-weight: 600;
}

/* ============================================================
   FOOTER
   ============================================================ */
#footer {
  background: var(--primary);
  margin-top: auto;
}

#footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

#footer-bottom .pad.group {
  display: flex;
  align-items: center;
  flex: 1;
  gap: 0;
}

#footer-bottom .grid.one-full {
  flex: 1;
}

#copyright p,
#credit p {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.5);
  margin: 0;
}

#copyright a,
#credit a {
  color: rgba(255,255,255,0.75);
}
#copyright a:hover,
#credit a:hover {
  color: #fff;
}

#credit { text-align: right; }

#back-to-top {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: rgba(255,255,255,0.12);
  border-radius: 50%;
  color: rgba(255,255,255,0.7) !important;
  font-size: 0.9rem;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
  text-decoration: none !important;
}
#back-to-top:hover {
  background: rgba(255,255,255,0.22);
  color: #fff !important;
}

/* ============================================================
   A/B TESTING CALCULATOR — special styles
   ============================================================ */
.ab-groups {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin: 18px 0;
}

.ab-group {
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.ab-group-variant {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.ab-group h2 {
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  margin-bottom: 14px !important;
  margin-top: 0 !important;
  color: var(--text) !important;
}
.ab-group-variant h2 { color: #1d4ed8 !important; }

.ab-field {
  margin-bottom: 12px;
}
.ab-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.ab-field input[type="number"] {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.93rem;
  font-family: inherit;
  background: white;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ab-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.ab-live-rate {
  margin-top: 12px;
  padding: 10px 14px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.ab-live-rate .rate-number {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
}
.ab-group-variant .ab-live-rate .rate-number {
  color: #1d4ed8;
}
.ab-live-rate .rate-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.ab-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

.ab-option-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.ab-option-field select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.93rem;
  font-family: inherit;
  background: white;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
}
.ab-option-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.btn-calculate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 28px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.94rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 22px;
}
.btn-calculate:hover { background: var(--accent-hover); }

.ab-results {
  background: #f8fafc;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}

.ab-verdict {
  font-size: 1rem;
  font-weight: 600;
  padding: 13px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  text-align: center;
  line-height: 1.4;
}
.ab-verdict.significant {
  background: #d1fae5;
  color: #065f46;
  border: 1.5px solid #6ee7b7;
}
.ab-verdict.not-significant {
  background: #fef3c7;
  color: #92400e;
  border: 1.5px solid #fcd34d;
}
.ab-verdict.negative {
  background: #fee2e2;
  color: #991b1b;
  border: 1.5px solid #fca5a5;
}

.ab-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.ab-metric {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px;
  text-align: center;
}
.ab-metric-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
}
.ab-metric-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ab-confidence-wrap {
  margin-bottom: 18px;
}
.ab-confidence-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.ab-confidence-bar-track {
  position: relative;
  height: 8px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
}
.ab-confidence-bar-fill {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  border-radius: 99px;
  transition: width 0.4s ease;
  background: linear-gradient(to right, #ef4444, #f59e0b 70%, #10b981 90%);
}
.ab-confidence-ticks {
  display: flex;
  justify-content: space-between;
  padding: 0 0;
  margin-top: 4px;
}
.ab-confidence-ticks span {
  font-size: 0.68rem;
  color: #94a3b8;
}

.ab-interpretation {
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.65;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
  .main-inner {
    grid-template-columns: 1fr 230px;
    gap: 20px;
  }
}

@media (max-width: 720px) {
  /* Switch to mobile hamburger nav */
  #nav-mobile-nav .menu-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: 1.5px solid rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.85);
    padding: 7px 13px;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: inherit;
    margin: 8px 0;
  }

  .menu-toggle-icon {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 16px;
  }
  .menu-toggle-icon span {
    display: block;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
  }

  #nav-mobile-nav ul.menu,
  #nav-mobile-nav ul#nav-mobile {
    display: none;
    flex-direction: column;
    padding: 4px 0 8px;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 0;
  }
  #nav-mobile-nav.toggled ul.menu,
  #nav-mobile-nav.toggled ul#nav-mobile {
    display: flex !important;
  }
  #nav-mobile-nav ul li a {
    padding: 9px 16px;
    font-size: 0.88rem;
    white-space: normal;
  }

  /* Stack layout */
  .main-inner {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .sidebar.s1 {
    position: static;
  }

  #page.container {
    padding: 16px 16px;
  }

  .entry-header {
    padding: 20px 18px 16px;
  }
  .entry-content {
    padding: 18px 18px 22px;
  }
  .entry-title {
    font-size: 1.35rem;
  }

  /* Footer */
  #footer-bottom {
    flex-direction: column;
    gap: 10px;
    padding: 16px;
    text-align: center;
  }
  #footer-bottom .pad.group {
    flex-direction: column;
    gap: 4px;
    width: 100%;
  }
  #credit { text-align: center; }

  /* A/B calculator */
  .ab-groups,
  .ab-options,
  .ab-metrics {
    grid-template-columns: 1fr;
  }

  /* Input grid */
  .input-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .entry-header { padding: 16px 14px 12px; }
  .entry-content { padding: 14px 14px 18px; }
  .calc-form { padding: 16px; }
}

/* ============================================================
   WORDPRESS ARTIFACT SUPPRESSION
   Suppress old WP-generated inline styles that may bleed through
   ============================================================ */

/* Block any global div style overrides from old calc pages */
.entry > div,
.entry .calc-wrapper {
  background: transparent;
  padding: 0;
}

/* Suppress emoji styles leaking */
img.wp-smiley, img.emoji {
  display: inline !important;
  height: 1em !important;
  width: 1em !important;
  border: none !important;
  box-shadow: none !important;
  background: none !important;
  padding: 0 !important;
}
