/* ============================================
   CalcTrades — Global Design System
   Clean, modern, mobile-first trades calculator site
   ============================================ */

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

/* --- CSS Variables --- */
:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: #1c2128;
  --bg-input: #21262d;
  --bg-hover: #292e36;
  --border: #30363d;
  --border-light: #21262d;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #656d76;
  --accent-blue: #58a6ff;
  --accent-green: #3fb950;
  --accent-orange: #d29922;
  --accent-red: #f85149;
  --accent-purple: #bc8cff;
  --accent-cyan: #39d2c0;
  --gradient-blue: linear-gradient(135deg, #1f6feb, #58a6ff);
  --gradient-green: linear-gradient(135deg, #238636, #3fb950);
  --gradient-orange: linear-gradient(135deg, #9e6a03, #d29922);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
  --max-width: 1200px;
  --header-height: 64px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--accent-blue); text-decoration: none; transition: color 0.2s; }
a:hover { color: #79c0ff; }

img, svg { max-width: 100%; height: auto; display: block; }

/* --- Layout --- */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }
.narrow-container { max-width: 860px; margin: 0 auto; padding: 0 20px; }

/* --- Header / Navigation --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,17,23,0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 20px;
  color: var(--text-primary);
}

.logo::before {
  content: "";
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: block;
  background: center / contain no-repeat url('/favicon.svg');
}

.logo svg {
  display: none;
  width: 32px;
  height: 32px;
}

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

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.nav-links a {
  display: block;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* Mobile menu toggle */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 8px;
}

/* --- Breadcrumbs --- */
.breadcrumbs {
  padding: 16px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--accent-blue); }
.breadcrumbs .sep { margin: 0 6px; opacity: 0.5; }

/* --- Calculator Hero --- */
.calc-hero {
  padding: 40px 0 32px;
  border-bottom: 1px solid var(--border);
}

.calc-hero h1 {
  font-size: 36px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.calc-hero .subtitle {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 640px;
  line-height: 1.6;
}

/* --- Risk Notice --- */
/* --- Calculator Card --- */
.calc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin: 32px 0;
  box-shadow: var(--shadow-md);
}

.calc-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.calc-card-header svg {
  width: 28px;
  height: 28px;
  color: var(--accent-blue);
}

.calc-card-header h2 {
  font-size: 20px;
  font-weight: 700;
}

/* Input grid */
.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-group input,
.input-group select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px;
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color 0.2s;
  width: 100%;
}

.input-group input:focus,
.input-group select:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(88,166,255,0.15);
}

.input-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b949e' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Unit toggle */
.unit-toggle {
  display: inline-flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 20px;
}

.unit-toggle button {
  background: none;
  border: none;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}

.unit-toggle button.active {
  background: var(--accent-blue);
  color: #fff;
}

/* Results section */
.results-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-top: 24px;
}

.results-panel.hidden { display: none; }

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.result-row:last-child { border-bottom: none; }

.result-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.result-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-green);
}

.result-value.primary {
  font-size: 28px;
  color: var(--accent-blue);
}

.result-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Visual result card */
.visual-result {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.vr-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.vr-card .vr-num {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent-blue);
  margin-bottom: 4px;
}

.vr-card .vr-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* --- SEO Content Section --- */
.seo-content {
  padding: 48px 0;
}

.seo-content h2 {
  font-size: 28px;
  font-weight: 800;
  margin: 40px 0 16px;
  color: var(--text-primary);
}

.seo-content h2:first-child { margin-top: 0; }

.seo-content h3 {
  font-size: 22px;
  font-weight: 700;
  margin: 32px 0 12px;
  color: var(--text-primary);
}

.seo-content p {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.75;
  max-width: 75ch;
}

.seo-content ul, .seo-content ol {
  margin: 12px 0 20px 24px;
  color: var(--text-secondary);
}

.seo-content li {
  margin-bottom: 8px;
  line-height: 1.65;
}

.seo-content strong { color: var(--text-primary); font-weight: 600; }

/* Reference tables */
.ref-table-wrap {
  overflow-x: auto;
  margin: 24px 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.ref-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.ref-table thead {
  background: var(--bg-secondary);
}

.ref-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.ref-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

.ref-table tbody tr:hover {
  background: var(--bg-hover);
}

.ref-table tbody tr:last-child td { border-bottom: none; }

/* --- Illustration Blocks (inline SVG) --- */
.illustration-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin: 32px 0;
  text-align: center;
}

.illustration-block svg {
  margin: 0 auto;
}

.illustration-block .caption {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 12px;
}

/* --- FAQ Section --- */
.faq-section {
  margin: 48px 0;
}

.faq-section h2 {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 24px;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  overflow: hidden;
}

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-card);
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  transition: background 0.2s;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.faq-question:hover { background: var(--bg-hover); }

.faq-question .chevron {
  transition: transform 0.3s;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: 12px;
}

.faq-item.open .faq-question .chevron {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.faq-item.open .faq-answer {
  max-height: 500px;
}

.faq-answer-inner {
  padding: 0 20px 16px;
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* --- Related Calculators Grid --- */
.related-calcs {
  margin: 48px 0;
}

.related-calcs h2 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 20px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.related-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.2s;
  text-decoration: none;
  color: var(--text-primary);
}

.related-card:hover {
  border-color: var(--accent-blue);
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.related-card .rc-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--bg-secondary);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.related-card .rc-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.related-card .rc-icon.blue { background: rgba(88,166,255,0.12); color: var(--accent-blue); }
.related-card .rc-icon.green { background: rgba(63,185,80,0.12); color: var(--accent-green); }
.related-card .rc-icon.orange { background: rgba(210,153,34,0.12); color: var(--accent-orange); }
.related-card .rc-icon.purple { background: rgba(188,140,255,0.12); color: var(--accent-purple); }
.related-card .rc-icon.cyan { background: rgba(57,210,192,0.12); color: var(--accent-cyan); }

.related-card .rc-info h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 2px;
}

.related-card .rc-info p {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 48px 0;
  margin-top: 48px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
}

.footer-brand p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 12px;
  line-height: 1.6;
  max-width: 300px;
}

.footer-col h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

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

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

.footer-col a {
  font-size: 14px;
  color: var(--text-muted);
  transition: color 0.2s;
}

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

.footer-bottom {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* --- Homepage Specific --- */
.home-hero {
  padding: 80px 0 60px;
  text-align: center;
}

.home-hero h1 {
  font-size: 48px;
  font-weight: 900;
  line-height: 1.15;
  margin-bottom: 16px;
}

.home-hero h1 .highlight {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.home-hero .tagline {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 32px;
}

/* Search bar on homepage */
.search-box {
  max-width: 500px;
  margin: 0 auto;
  position: relative;
}

.search-box input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 14px 20px 14px 48px;
  font-size: 15px;
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color 0.2s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-blue);
}

.search-box .search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* Category sections */
.category-section {
  margin: 48px 0;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.category-header .cat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.category-header h2 {
  font-size: 24px;
  font-weight: 800;
  margin: 0;
}

.category-header .cat-vol {
  font-size: 13px;
  color: var(--text-muted);
  margin-left: auto;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.calc-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.2s;
  text-decoration: none;
  color: var(--text-primary);
}

.calc-link:hover {
  border-color: var(--accent-blue);
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.calc-link .cl-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 20px;
}

.calc-link .cl-info h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.calc-link .cl-info p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.calc-link .cl-arrow {
  margin-left: auto;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.calc-link:hover .cl-arrow {
  transform: translateX(4px);
  color: var(--accent-blue);
}

/* --- Category Hub Pages --- */
.hub-hero {
  padding: 48px 0 40px;
  border-bottom: 1px solid var(--border);
}

.hub-hero h1 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 12px;
}

.hub-hero .hub-desc {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 640px;
}

/* ============================================
   PREMIUM VISUAL ENHANCEMENTS
   Dark theme polish — premium animations, gradients, glows
   ============================================ */

/* --- 1. Subtle Background Texture & Gradient --- */
body {
  background: radial-gradient(circle at 50% 0%, rgba(31,111,235,0.08) 0%, rgba(13,17,23,0) 50%), var(--bg-primary);
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(circle at 20% 50%, rgba(88,166,255,0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(63,185,80,0.02) 0%, transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* --- 2. Animations & Keyframes --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse-glow {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(88,166,255,0.7);
  }
  50% {
    opacity: 0.9;
    box-shadow: 0 0 0 8px rgba(88,166,255,0);
  }
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

@keyframes float-up {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-4px);
  }
}

@keyframes glow-pulse {
  0%, 100% {
    border-color: var(--border);
    box-shadow: 0 0 0 0 rgba(88,166,255,0);
  }
  50% {
    box-shadow: 0 0 20px 0 rgba(88,166,255,0.15);
  }
}

@keyframes number-count {
  from {
    opacity: 0.5;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes gradient-shift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* --- 3. Calculator Card Enhancements --- */
.calc-card {
  position: relative;
  overflow: hidden;
}

.calc-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(88,166,255,0.3), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.calc-card:focus-within {
  border-color: rgba(88,166,255,0.5);
  box-shadow: var(--shadow-md), 0 0 20px rgba(88,166,255,0.1);
}

.calc-card:focus-within::before {
  opacity: 1;
}

/* --- 4. Input Focus States with Glow Animation --- */
.input-group input:focus,
.input-group select:focus {
  background: var(--bg-input);
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(88,166,255,0.15), inset 0 0 0 1px rgba(88,166,255,0.1);
  animation: glow-pulse 2s ease-in-out infinite;
}

.input-group label {
  transition: color 0.2s ease;
}

.input-group input:focus ~ label,
.input-group input:not(:placeholder-shown) ~ label {
  color: var(--accent-blue);
}

/* Smooth input transitions */
.input-group input {
  transition: all 0.3s ease;
}

/* --- 5. Results Panel Animations --- */
.results-panel {
  animation: fadeInUp 0.5s ease-out;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(22,27,34,0.8), rgba(28,33,40,0.4));
}

.result-row {
  transition: all 0.2s ease;
}

.result-row:hover {
  background: rgba(88,166,255,0.05);
  padding-left: 8px;
}

.result-value {
  animation: number-count 0.6s ease-out;
}

.result-value.primary {
  animation: pulse-glow 3s ease-in-out infinite, number-count 0.6s ease-out;
  position: relative;
}

/* --- 6. Visual Result Cards (VR-Cards) Enhancement --- */
.vr-card {
  background: linear-gradient(135deg, rgba(31,111,235,0.08), rgba(28,33,40,0.6));
  border: 1px solid rgba(88,166,255,0.2);
  position: relative;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  overflow: hidden;
}

.vr-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-blue), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.vr-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(88,166,255,0.1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.vr-card:hover {
  border-color: rgba(88,166,255,0.4);
  box-shadow: 0 0 20px rgba(88,166,255,0.15), var(--shadow-md);
  transform: translateY(-2px);
  background: linear-gradient(135deg, rgba(31,111,235,0.12), rgba(28,33,40,0.8));
}

.vr-card:hover::before {
  opacity: 1;
}

.vr-card:hover::after {
  opacity: 1;
}

.vr-card .vr-num {
  animation: number-count 0.5s ease-out;
}

/* --- 7. Smooth Hover Effects & Transforms --- */
.related-card,
.calc-link {
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.related-card::before,
.calc-link::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(88,166,255,0.1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.related-card:hover,
.calc-link:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: rgba(88,166,255,0.6);
  box-shadow: 0 12px 24px rgba(88,166,255,0.15), var(--shadow-md);
  background: linear-gradient(135deg, var(--bg-hover), rgba(31,111,235,0.05));
}

.related-card:hover::before,
.calc-link:hover::before {
  opacity: 1;
}

.calc-link:hover {
  gap: 18px;
}

.calc-link:hover .cl-arrow {
  transform: translateX(6px) scale(1.2);
  color: var(--accent-blue);
}

/* --- 8. Unit Toggle Smooth Indicator --- */
.unit-toggle {
  background: var(--bg-input);
  border: 1px solid var(--border);
  position: relative;
  padding: 2px;
}

.unit-toggle button {
  position: relative;
  transition: all 0.25s ease;
  z-index: 1;
}

.unit-toggle button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-blue);
  border-radius: var(--radius-sm);
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: -1;
}

.unit-toggle button.active::before {
  opacity: 1;
}

.unit-toggle button.active {
  color: #fff;
}

/* --- 9. Primary Button Style --- */
.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), #1f6feb);
  border: none;
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(88,166,255,0.2);
  position: relative;
  overflow: hidden;
  font-family: inherit;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(88,166,255,0.3);
}

.btn-primary:hover::before {
  opacity: 1;
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(88,166,255,0.2);
}

/* --- 10. FAQ Accordion Polish --- */
.faq-item {
  transition: all 0.2s ease;
}

.faq-item.open {
  background: linear-gradient(135deg, rgba(31,111,235,0.05), rgba(28,33,40,0.6));
  border-color: rgba(88,166,255,0.3);
  box-shadow: 0 4px 12px rgba(88,166,255,0.08);
}

.faq-question {
  transition: all 0.2s ease;
}

.faq-question:hover {
  background: linear-gradient(90deg, rgba(88,166,255,0.05), transparent);
}

.faq-question .chevron {
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  color: var(--accent-blue);
}

.faq-item.open .faq-question .chevron {
  transform: rotate(180deg) scale(1.1);
  color: var(--accent-blue);
}

.faq-answer-inner {
  animation: fadeInUp 0.3s ease-out;
}

.faq-item.open {
  border-left: 3px solid var(--accent-blue);
}

/* --- 11. Table Styling Upgrade --- */
.ref-table tbody tr {
  transition: all 0.2s ease;
  border-bottom: 1px solid var(--border-light);
}

.ref-table tbody tr:nth-child(odd) {
  background: rgba(88,166,255,0.02);
}

.ref-table tbody tr:hover {
  background: linear-gradient(90deg, rgba(88,166,255,0.1), rgba(31,111,235,0.05));
  box-shadow: inset 0 0 0 1px rgba(88,166,255,0.1);
}

.ref-table thead {
  background: linear-gradient(135deg, var(--bg-secondary), rgba(31,111,235,0.1));
  border-bottom: 2px solid rgba(88,166,255,0.2);
}

.ref-table th {
  color: var(--accent-blue);
  font-weight: 700;
  transition: all 0.2s ease;
}

/* --- 12. Hero Section Polish --- */
.home-hero h1 {
  animation: slideIn 0.6s ease-out;
}

.home-hero h1 .highlight {
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan), var(--accent-blue));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-shift 6s ease infinite;
}

.home-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 80% at 50% 0%, rgba(88,166,255,0.05) 0%, transparent 70%);
  pointer-events: none;
  top: -100px;
}

.home-hero {
  position: relative;
  overflow: hidden;
}

.home-hero .tagline {
  animation: fadeInUp 0.6s ease-out 0.1s both;
}

/* --- 13. Footer Upgrade --- */
.site-footer {
  border-top: 1px solid var(--border);
  position: relative;
}

.site-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(88,166,255,0.3), transparent);
}

.footer-col a {
  transition: all 0.3s ease;
  position: relative;
}

.footer-col a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-blue);
  transition: width 0.3s ease;
}

.footer-col a:hover::after {
  width: 100%;
}

.footer-col a:hover {
  color: var(--accent-blue);
  transform: translateX(2px);
}

/* --- 14. Hub Page Styles --- */
.hub-hero {
  position: relative;
  overflow: hidden;
}

.hub-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(31,111,235,0.08) 0%, rgba(63,185,80,0.04) 100%);
  pointer-events: none;
}

.hub-hero h1 {
  animation: slideIn 0.6s ease-out;
  position: relative;
  z-index: 1;
}

.hub-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin: 32px 0;
}

.stat-card {
  background: linear-gradient(135deg, rgba(31,111,235,0.08), rgba(28,33,40,0.6));
  border: 1px solid rgba(88,166,255,0.2);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
}

.stat-card:hover {
  border-color: rgba(88,166,255,0.4);
  box-shadow: 0 8px 16px rgba(88,166,255,0.12);
  transform: translateY(-2px);
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent-blue);
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.hub-calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin: 32px 0;
}

.hub-calc-card {
  background: linear-gradient(135deg, var(--bg-card), rgba(31,111,235,0.08));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.hub-calc-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top center, rgba(88,166,255,0.1) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.hub-calc-card:hover {
  transform: translateY(-6px);
  border-color: rgba(88,166,255,0.5);
  box-shadow: 0 16px 32px rgba(88,166,255,0.15);
  background: linear-gradient(135deg, var(--bg-hover), rgba(31,111,235,0.12));
}

.hub-calc-card:hover::before {
  opacity: 1;
}

.hub-calc-card .hcc-icon {
  font-size: 32px;
}

.hub-calc-card .hcc-title {
  font-size: 16px;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.hub-calc-card .hcc-desc {
  font-size: 14px;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}

/* --- 15. Skeleton / Loading States --- */
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-card) 0%,
    var(--bg-hover) 50%,
    var(--bg-card) 100%);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 16px;
  margin-bottom: 8px;
}

.skeleton-title {
  height: 24px;
  margin-bottom: 12px;
  width: 60%;
}

.skeleton-card {
  height: 120px;
  border-radius: var(--radius-md);
}

/* --- 16. Category Section Dividers --- */
.category-section {
  position: relative;
  padding: 48px 0;
}

.category-section::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(88,166,255,0.2), transparent);
}

.category-header .cat-icon {
  transition: all 0.3s ease;
}

.category-header:hover .cat-icon {
  transform: scale(1.05) rotate(5deg);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* --- 17. Animate-In Class (Intersection Observer) --- */
.animate-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.animate-in.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* --- 18. Smooth Link Transitions --- */
a {
  position: relative;
}

a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-blue);
  transition: width 0.3s ease;
}

a:hover::after {
  width: 100%;
}

/* --- 19. Card Base Enhancements --- */
.calc-card,
.illustration-block,
.ref-table-wrap {
  transition: all 0.3s ease;
}

.calc-card:hover,
.illustration-block:hover {
  box-shadow: 0 8px 24px rgba(88,166,255,0.12);
}

/* --- 20. Smooth Transitions for Interactive Elements --- */
button,
input,
select,
textarea {
  transition: all 0.25s ease;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* --- Print Styles --- */
@media print {
  .site-header, .site-footer, .related-calcs, .mobile-toggle { display: none; }
  body { background: #fff; color: #000; }
  .calc-card { border: 2px solid #000; }
  .results-panel { background: #f5f5f5; }
}

/* --- Responsive --- */

/* Tablet */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .related-grid { grid-template-columns: repeat(2, 1fr); }
  .seo-content p { max-width: 100%; }
}

/* Mobile landscape / small tablet */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-toggle { display: block; }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 12px;
    z-index: 99;
  }

  /* Hero sections */
  .home-hero { padding: 48px 0 40px; }
  .home-hero h1 { font-size: 32px; }
  .calc-hero { padding: 28px 0 24px; }
  .calc-hero h1 { font-size: 26px; }
  .calc-hero .subtitle { font-size: 15px; }
  /* Calculator cards */
  .calc-card { padding: 20px; margin: 20px 0; }
  .calc-card-header h2 { font-size: 18px; }
  .input-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Ensure inputs are touch-friendly (min 44px tap target) */
  .input-group input,
  .input-group select {
    padding: 14px;
    font-size: 16px; /* Prevents iOS zoom on focus */
    min-height: 48px;
  }

  .unit-toggle button { padding: 10px 16px; min-height: 44px; }

  /* Results */
  .results-panel { padding: 16px; }
  .result-row { flex-direction: column; align-items: flex-start; gap: 4px; }
  .result-value { font-size: 16px; }
  .result-value.primary { font-size: 24px; }
  .visual-result { grid-template-columns: 1fr 1fr; gap: 8px; }
  .vr-card { padding: 12px; }
  .vr-card .vr-num { font-size: 20px; }

  /* Reference tables — scrollable with hint */
  .ref-table-wrap {
    margin: 16px -20px;
    border-radius: 0;
    border-left: none;
    border-right: none;
    position: relative;
  }
  .ref-table { font-size: 13px; }
  .ref-table th, .ref-table td { padding: 8px 12px; white-space: nowrap; }

  /* FAQ — larger touch targets */
  .faq-question { padding: 16px; min-height: 48px; font-size: 14px; }

  /* Grids stack */
  .calc-grid { grid-template-columns: 1fr; }
  .related-grid { grid-template-columns: 1fr; }
  .related-card { padding: 14px; }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }

  /* SEO content */
  .seo-content { padding: 32px 0; }
  .seo-content h2 { font-size: 24px; margin: 28px 0 12px; }
  .seo-content h3 { font-size: 19px; margin: 24px 0 10px; }
  .seo-content p { font-size: 15px; }

  /* Illustration blocks */
  .illustration-block { padding: 20px 12px; margin: 20px 0; }
  .illustration-block svg { max-height: 200px; }

  /* Breadcrumbs */
  .breadcrumbs { font-size: 12px; padding: 12px 0 0; }

  /* Category sections */
  .category-header { flex-wrap: wrap; }
  .category-header .cat-vol { margin-left: 0; width: 100%; margin-top: 4px; }
}

/* Mobile portrait */
@media (max-width: 480px) {
  .container, .narrow-container { padding: 0 16px; }

  .home-hero { padding: 36px 0 28px; }
  .home-hero h1 { font-size: 24px; }
  .home-hero .tagline { font-size: 15px; }

  .calc-card { padding: 16px; border-radius: var(--radius-md); }
  .calc-card-header { gap: 8px; margin-bottom: 16px; padding-bottom: 12px; }
  .calc-card-header h2 { font-size: 16px; }

  .visual-result { grid-template-columns: 1fr; }
  .vr-card .vr-num { font-size: 22px; }
  /* Full-width buttons on small screens */
  .unit-toggle { width: 100%; display: flex; }
  .unit-toggle button { flex: 1; text-align: center; }

  /* Stack result rows tighter */
  .result-row { padding: 10px 0; }

  /* Compact related cards */
  .related-card .rc-info h3 { font-size: 13px; }
  .related-card .rc-info p { font-size: 11px; }

  .faq-section h2 { font-size: 22px; }
  .faq-question { font-size: 13px; padding: 14px; }
  .faq-answer-inner { font-size: 14px; padding: 0 14px 14px; }

  .seo-content h2 { font-size: 22px; }
  .seo-content h3 { font-size: 17px; }

  .site-footer { padding: 32px 0; margin-top: 32px; }
  .footer-col h4 { margin-bottom: 10px; }
}

/* Fix for iOS Safari input zoom — must be 16px+ */
@media screen and (max-width: 768px) {
  input, select, textarea { font-size: 16px !important; }
}

/* Ensure SVGs never overflow on mobile */
svg { max-width: 100%; height: auto; }

/* Touch-friendly spacing for all interactive elements */
@media (pointer: coarse) {
  .calc-link { min-height: 56px; }
  .related-card { min-height: 56px; }
  .faq-question { min-height: 52px; }
  .nav-links a { min-height: 44px; display: flex; align-items: center; }
}


    /* Hero Image Styles */
    .hero-image-wrap {
      width: 100%;
      max-height: 320px;
      overflow: hidden;
      border-radius: var(--radius-lg);
      margin-top: 32px;
      position: relative;
    }
    .hero-image-wrap::after {
      content: '';
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      height: 80px;
      background: linear-gradient(to top, var(--bg-primary), transparent);
      pointer-events: none;
    }
    .hero-image {
      width: 100%;
      height: 320px;
      object-fit: cover;
      display: block;
      border-radius: var(--radius-lg);
    }
    @media (max-width: 768px) {
      .hero-image-wrap { max-height: 200px; margin-top: 24px; }
      .hero-image { height: 200px; }
    }
