/* Skip link — visible on focus for keyboard users */
.skip-to-main {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
  padding: 12px 18px;
  background: #1e3a5f;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 8px 0;
}
.skip-to-main:focus {
  left: 0;
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

/* ========================================
   EntireCalc — Premium Shared Styles
   ======================================== */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --accent: #0ea5e9;
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.1);
  --radius: 16px;
  --header-h: 72px;
}

html.dark, body.dark, .dark {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #1e3a5f;
  --bg-body: #0b1120;
  --bg-card: #111827;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --border: #1e293b;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.25s, color 0.25s;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Contextual links inside content sections */
.info-section p a,
.info-section li a,
.info-section td a,
.info-section .faq-answer a,
.info-section .reviewer-note a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s, text-decoration 0.15s;
}
.info-section p a:hover,
.info-section li a:hover,
.info-section td a:hover,
.info-section .faq-answer a:hover,
.info-section .reviewer-note a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ========== HEADER ========== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  height: var(--header-h);
  display: flex;
  align-items: center;
  transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
}

html.dark .header,
body.dark .header {
  background: rgba(11, 17, 32, 0.9);
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
}

/* Logo */
.logo {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  white-space: nowrap;
  transition: opacity 0.2s;
}

.logo:hover {
  opacity: 0.9;
}

.logo span {
  color: var(--primary);
}

/* Nav */
.nav {
  display: flex;
  align-items: center;
  gap: 1px;
  flex-wrap: nowrap;
}

.nav-link,
.dropbtn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
  text-decoration: none;
}

a.dropbtn-link {
  text-decoration: none;
}

.nav-link:hover,
.dropbtn:hover,
.dropdown:hover .dropbtn {
  color: var(--primary);
  background: var(--primary-light);
}

.chevron {
  transition: transform 0.2s;
  opacity: 0.7;
}

.dropdown:hover .chevron {
  transform: rotate(180deg);
}

.dropdown {
  position: relative;
}

.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 230px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 8px;
  z-index: 50;
}

/* Invisible bridge so mouse can move from button to menu without losing hover */
.dropdown-content::before {
  content: '';
  position: absolute;
  top: -14px;
  left: 0;
  right: 0;
  height: 14px;
}

.dropdown:hover .dropdown-content {
  display: block;
  animation: dropdownIn 0.15s ease;
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown-content a {
  display: block;
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: background 0.15s, color 0.15s;
}

.dropdown-content a:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* Header right controls */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle {
  position: relative;
  background: none;
  border: 1px solid var(--border);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
  color: var(--text-primary);
}

.theme-toggle:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.theme-icon-light { display: none; }
.theme-icon-dark  { display: inline; }

html.dark .theme-icon-light,
body.dark .theme-icon-light { display: inline; }

html.dark .theme-icon-dark,
body.dark .theme-icon-dark { display: none; }

/* Hamburger */
.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  width: 40px;
  height: 40px;
  border-radius: 10px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s;
  padding: 0;
}

.menu-toggle:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

.hamburger {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  position: relative;
  transition: background 0.2s;
}

.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform 0.2s, top 0.2s;
}

.hamburger::before { top: -6px; }
.hamburger::after  { top: 6px; }

.menu-toggle[aria-expanded="true"] .hamburger {
  background: transparent;
}

.menu-toggle[aria-expanded="true"] .hamburger::before {
  top: 0;
  transform: rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .hamburger::after {
  top: 0;
  transform: rotate(-45deg);
}

/* Mobile nav */
@media (max-width: 900px) {
  .nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 12px 16px 16px;
    gap: 2px;
    box-shadow: var(--shadow-lg);
  }

  .nav.open {
    display: flex;
  }

  .nav-link,
  .dropbtn {
    width: 100%;
    text-align: left;
    padding: 12px 14px;
  }

  .dropdown-content {
    position: static;
    box-shadow: none;
    border: none;
    display: none;
    padding: 0 0 4px 12px;
    min-width: 0;
    animation: none;
  }

  .dropdown-content::before {
    display: none;
  }

  .dropdown.open .dropdown-content {
    display: block;
  }

  .dropdown.open .chevron {
    transform: rotate(180deg);
  }

  .menu-toggle {
    display: flex;
  }
}

/* ========== FOOTER ========== */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 56px 0 0;
  margin-top: 48px;
}

.footer .container {
  width: 100%;
}

.footer-grid {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
  align-items: flex-start;
  gap: 40px;
  padding-bottom: 40px;
  width: 100%;
}

.footer-brand {
  flex: 1 1 240px;
  max-width: 300px;
  min-width: 200px;
}

.footer-col {
  flex: 1 1 180px;
  min-width: 160px;
}

.footer-logo {
  display: inline-block;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.footer-logo span {
  color: var(--primary);
}

.footer-brand p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.65;
}

.footer-col h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.footer-col ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer-col ul li {
  margin-bottom: 8px;
}

.footer-col ul a {
  color: var(--text-secondary);
  font-size: 0.92rem;
  transition: color 0.15s;
}

.footer-col ul a:hover {
  color: var(--primary);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 18px 0;
  text-align: center;
}

.footer-bottom p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Footer responsive — only stack on small screens */
@media (max-width: 700px) {
  .footer-grid {
    flex-direction: column;
    gap: 28px;
  }

  .footer-brand,
  .footer-col {
    flex: 1 1 100%;
    max-width: 100%;
    min-width: 0;
  }
}

/* ===== RELATED TOOLS ===== */
.related-tools {
  margin: 48px 0 24px;
  padding-top: 8px;
}

.related-tools h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 18px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

@media (max-width: 800px) {
  .related-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .related-grid {
    grid-template-columns: 1fr;
  }
}

.related-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  box-shadow: var(--shadow);
}

.related-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}

.related-card strong {
  display: block;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.related-card span {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}
