/* ==========================================================================
   AGE CALCULATOR - SAAS-GRADE DESIGN SYSTEM & STYLESHEET
   Pure Vanilla CSS3 with CSS Custom Properties, Dark/Light Themes, 
   Mobile-First Responsive Grid & WCAG 2.1 AA Compliance
   ========================================================================== */

:root {
  /* Color Palette - Light Mode (Slate & Indigo with Emerald Accents) */
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-muted: #f1f5f9;
  --bg-subtle: #e2e8f0;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --primary-border: #c7d2fe;
  
  --accent: #0284c7;
  --accent-light: #f0f9ff;
  --accent-border: #bae6fd;
  
  --success: #059669;
  --success-light: #ecfdf5;
  --success-border: #a7f3d0;
  
  --warning: #d97706;
  --warning-light: #fffbeb;
  --warning-border: #fde68a;
  
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;
  
  --max-width: 1200px;
  --content-width: 860px;
}

[data-theme="dark"] {
  --bg-primary: #0b0f19;
  --bg-surface: #131b2e;
  --bg-surface-elevated: #1a243b;
  --bg-muted: #1e293b;
  --bg-subtle: #293548;
  
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;
  
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --primary-light: rgba(99, 102, 241, 0.15);
  --primary-border: rgba(99, 102, 241, 0.35);
  
  --accent: #38bdf8;
  --accent-light: rgba(56, 189, 248, 0.15);
  --accent-border: rgba(56, 189, 248, 0.35);
  
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.15);
  --success-border: rgba(16, 185, 129, 0.35);
  
  --warning: #f59e0b;
  --warning-light: rgba(245, 158, 11, 0.15);
  --warning-border: rgba(245, 158, 11, 0.35);
  
  --border-subtle: #243048;
  --border-strong: #334155;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */

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

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-normal), color var(--transition-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  width: 100%;
}

/* Accessibility Focus Ring */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Images & Media */
img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Typography Defaults */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 2.1rem;
  margin-bottom: 0.75rem;
}

h2 {
  font-size: 1.65rem;
  margin-top: 2.25rem;
  margin-bottom: 0.85rem;
}

h3 {
  font-size: 1.25rem;
  margin-top: 1.5rem;
  margin-bottom: 0.65rem;
}

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: var(--font-mono);
  background: var(--bg-muted);
  padding: 0.2em 0.4em;
  border-radius: var(--radius-sm);
  font-size: 0.88em;
  color: var(--primary);
}

/* ==========================================================================
   Layout Containers
   ========================================================================== */

.container {
  width: 100%;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 640px) {
  .container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

.content-container {
  width: 100%;
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
}

/* ==========================================================================
   Header & Navigation (Top Right Menu Layout)
   ========================================================================== */

.site-header {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
  width: 100%;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .header-inner {
    height: 4.5rem;
    gap: 1.5rem;
  }
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text-primary);
  text-decoration: none;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .brand-logo {
    gap: 0.75rem;
    font-size: 1.25rem;
  }
}

.brand-logo:hover {
  text-decoration: none;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #ffffff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .logo-icon {
    width: 38px;
    height: 38px;
  }
}

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .header-right {
    gap: 1.25rem;
  }
}

.nav-menu {
  display: none;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
}

@media (min-width: 900px) {
  .nav-menu {
    display: flex;
  }
}

.nav-link {
  font-weight: 500;
  font-size: 0.925rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--primary);
  background-color: var(--bg-muted);
  text-decoration: none;
}

.nav-link.active {
  color: var(--primary);
  background-color: var(--primary-light);
  font-weight: 600;
  border: 1px solid var(--primary-border);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.header-cta-btn {
  display: none;
  align-items: center;
  gap: 0.4rem;
  background: var(--primary);
  color: #ffffff;
  padding: 0.5rem 0.9rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.header-cta-btn:hover {
  background: var(--primary-hover);
  color: #ffffff;
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.theme-toggle-btn {
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.theme-toggle-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.mobile-menu-btn {
  display: flex;
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

@media (min-width: 900px) {
  .mobile-menu-btn {
    display: none;
  }
}

.mobile-drawer {
  position: fixed;
  top: 4rem;
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 1.25rem 1rem 1.75rem;
  box-shadow: var(--shadow-xl);
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 99;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: drawerSlideDown 0.2s ease-out;
}

@media (min-width: 768px) {
  .mobile-drawer {
    top: 4.5rem;
    max-height: calc(100vh - 4.5rem);
    padding: 1.5rem;
  }
}

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

.mobile-drawer.open {
  display: flex;
}

.mobile-nav-link {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  transition: background-color var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  touch-action: manipulation;
}

.mobile-nav-link:hover, .mobile-nav-link.active {
  background-color: var(--primary-light);
  color: var(--primary);
  text-decoration: none;
}

/* ==========================================================================
   Hero & Tool Section
   ========================================================================== */

.hero-section {
  padding: 2rem 0 1.25rem;
  text-align: center;
}

@media (min-width: 768px) {
  .hero-section {
    padding: 3rem 0 2rem;
  }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.85rem;
}

.hero-title {
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  line-height: 1.2;
  letter-spacing: -0.025em;
  word-break: break-word;
}

.hero-subtitle {
  font-size: clamp(0.95rem, 2.5vw, 1.15rem);
  color: var(--text-secondary);
  max-width: 680px;
  margin: 0 auto 1.5rem;
  line-height: 1.55;
}

/* ==========================================================================
   Calculator Card & UI Engine
   ========================================================================== */

.calculator-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.25rem;
  margin-bottom: 2.5rem;
  transition: all var(--transition-normal);
  width: 100%;
}

@media (min-width: 640px) {
  .calculator-wrapper {
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    margin-bottom: 3rem;
  }
}

.calculator-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
}

.calculator-inputs {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-align: left;
}

.form-label {
  font-weight: 600;
  font-size: 0.925rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.label-hint {
  font-size: 0.8rem;
  font-weight: normal;
  color: var(--text-muted);
}

.input-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.form-control {
  width: 100%;
  min-height: 48px;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px; /* 16px prevents iOS Safari auto-zoom */
  line-height: 1.4;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}

input[type="date"].form-control,
input[type="time"].form-control {
  min-height: 48px;
  background-position: right 0.75rem center;
  cursor: pointer;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  outline: none;
}

.date-split-inputs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

@media (min-width: 480px) {
  .date-split-inputs {
    grid-template-columns: 2fr 1fr 1.25fr;
  }
}

.time-split-inputs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.quick-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.preset-chip {
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.825rem;
  font-weight: 500;
  cursor: pointer;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.preset-chip:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

@media (min-width: 480px) {
  .form-actions {
    grid-template-columns: 2fr 1fr 1fr;
  }
}

.btn {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  width: 100%;
}

.btn:hover {
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 8px rgba(79, 70, 229, 0.35);
}

.btn-secondary {
  background: var(--bg-muted);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background: var(--bg-muted);
  color: var(--text-primary);
}

.btn-sm {
  min-height: 40px;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  width: auto;
}

/* ==========================================================================
   Results & Display Panels
   ========================================================================== */

.calculator-results {
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: relative;
  width: 100%;
}

@media (min-width: 640px) {
  .calculator-results {
    padding: 1.5rem;
    gap: 1.5rem;
  }
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.results-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.result-primary-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem 0.75rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 640px) {
  .result-primary-card {
    padding: 1.5rem;
  }
}

.result-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.age-highlight-display {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
}

@media (min-width: 480px) {
  .age-highlight-display {
    gap: 0.5rem 1rem;
  }
}

.age-unit-group {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}

.age-big-number {
  font-size: clamp(1.75rem, 5.5vw, 2.5rem);
  font-weight: 800;
  color: var(--primary);
  font-feature-settings: "tnum";
  line-height: 1.1;
}

.age-unit-text {
  font-size: clamp(0.85rem, 2.5vw, 1rem);
  font-weight: 600;
  color: var(--text-secondary);
}

.granular-breakdown-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

@media (min-width: 400px) {
  .granular-breakdown-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .granular-breakdown-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media (min-width: 640px) {
  .metric-card {
    padding: 0.85rem;
  }
}

.metric-card-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.metric-card-value {
  font-size: clamp(1rem, 3vw, 1.25rem);
  font-weight: 700;
  color: var(--text-primary);
  font-feature-settings: "tnum";
  word-break: break-word;
}

.metric-card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Birthday Countdown Banner */
.birthday-countdown-card {
  background: linear-gradient(135deg, var(--primary-light), var(--accent-light));
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-md);
  padding: 1rem 0.75rem;
  text-align: center;
}

@media (min-width: 640px) {
  .birthday-countdown-card {
    padding: 1.25rem;
  }
}

.birthday-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.countdown-digits-wrapper {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 0.4rem;
  margin: 0.75rem 0;
  width: 100%;
}

@media (min-width: 480px) {
  .countdown-digits-wrapper {
    gap: 0.75rem;
  }
}

.countdown-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.35rem;
  flex: 1;
  max-width: 72px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.countdown-num {
  font-size: clamp(1.1rem, 4vw, 1.4rem);
  font-weight: 800;
  color: var(--primary);
  font-feature-settings: "tnum";
  line-height: 1.1;
}

.countdown-lbl {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 0.15rem;
}

.progress-container {
  width: 100%;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-full);
  height: 8px;
  overflow: hidden;
  margin-top: 0.75rem;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: var(--radius-full);
  transition: width 0.5s ease-in-out;
}

/* Fun Metrics Grid */
.fun-metrics-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

@media (min-width: 440px) {
  .fun-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.fun-metric-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.fun-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.fun-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.fun-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fun-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  word-break: break-word;
}

/* User Action Buttons Bar */
.action-buttons-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.5rem;
  width: 100%;
}

.action-buttons-bar .btn {
  flex: 1 1 calc(50% - 0.5rem);
  min-width: 120px;
}

@media (min-width: 640px) {
  .action-buttons-bar .btn {
    flex: 0 0 auto;
    width: auto;
  }
}

/* Toast Notification */
.toast-notification {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--text-inverse);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  font-size: 0.9rem;
  font-weight: 500;
  z-index: 1000;
  display: none;
  align-items: center;
  gap: 0.5rem;
  max-width: 90%;
  width: max-content;
  animation: slideUpMobile 0.3s ease-out;
}

@media (min-width: 640px) {
  .toast-notification {
    left: auto;
    right: 2rem;
    transform: none;
    animation: slideUp 0.3s ease-out;
  }
}

.toast-notification.show {
  display: flex;
}

@keyframes slideUpMobile {
  from {
    transform: translate(-50%, 20px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

.toast-notification.show {
  display: flex;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ==========================================================================
   Article & SEO Rich Content Typography
   ========================================================================== */

.content-section {
  padding: 1.75rem 0;
}

@media (min-width: 768px) {
  .content-section {
    padding: 2.5rem 0;
  }
}

.seo-article {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2.5rem;
  overflow-wrap: break-word;
  word-break: break-word;
}

@media (min-width: 640px) {
  .seo-article {
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    margin-bottom: 3rem;
  }
}

.seo-article h2 {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.5rem;
  font-size: clamp(1.35rem, 4vw, 1.85rem);
}

.seo-article h3 {
  font-size: clamp(1.15rem, 3vw, 1.45rem);
}

.seo-article ul, .seo-article ol {
  margin-left: 1.25rem;
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
}

@media (min-width: 640px) {
  .seo-article ul, .seo-article ol {
    margin-left: 1.75rem;
  }
}

.seo-article li {
  margin-bottom: 0.4rem;
}

.callout-box {
  background: var(--bg-muted);
  border-left: 4px solid var(--primary);
  padding: 1rem 1.15rem;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin: 1.25rem 0;
}

@media (min-width: 640px) {
  .callout-box {
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
  }
}

.callout-box.info {
  border-left-color: var(--accent);
  background: var(--accent-light);
}

.callout-box.warning {
  border-left-color: var(--warning);
  background: var(--warning-light);
}

.callout-title {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Table Styles */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
  min-width: 500px;
}

@media (min-width: 640px) {
  .data-table {
    font-size: 0.925rem;
    min-width: auto;
  }
}

.data-table th {
  background: var(--bg-muted);
  color: var(--text-primary);
  font-weight: 700;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-strong);
}

@media (min-width: 640px) {
  .data-table th {
    padding: 0.85rem 1rem;
  }
}

.data-table td {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

@media (min-width: 640px) {
  .data-table td {
    padding: 0.85rem 1rem;
  }
}

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

.data-table tr:hover td {
  background-color: var(--bg-muted);
}

/* Step-by-step visual cards */
.steps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 1.5rem 0;
}

@media (min-width: 640px) {
  .steps-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }
}

.step-card {
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  gap: 0.85rem;
}

@media (min-width: 640px) {
  .step-card {
    padding: 1.25rem;
    gap: 1rem;
  }
}

.step-number {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: #ffffff;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .step-number {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
}

.step-body h4 {
  margin-top: 0;
  margin-bottom: 0.25rem;
  font-size: 1rem;
}

/* Formula display */
.formula-box {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-primary);
  margin: 1.25rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 640px) {
  .formula-box {
    padding: 1.25rem;
    font-size: 0.95rem;
  }
}

/* FAQ Accordions */
.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.faq-item {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.faq-item.active {
  border-color: var(--primary-border);
}

.faq-trigger {
  width: 100%;
  text-align: left;
  padding: 1rem;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.975rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  gap: 0.75rem;
  min-height: 48px;
  touch-action: manipulation;
}

@media (min-width: 640px) {
  .faq-trigger {
    padding: 1.1rem 1.25rem;
    font-size: 1.05rem;
    gap: 1rem;
  }
}

.faq-icon {
  transition: transform var(--transition-fast);
  color: var(--text-muted);
  flex-shrink: 0;
}

.faq-item.active .faq-icon {
  transform: rotate(180deg);
  color: var(--primary);
}

.faq-content {
  padding: 0 1rem 1rem;
  color: var(--text-secondary);
  display: none;
  font-size: 0.925rem;
  line-height: 1.6;
}

@media (min-width: 640px) {
  .faq-content {
    padding: 0 1.25rem 1.25rem;
    font-size: 0.95rem;
  }
}

.faq-item.active .faq-content {
  display: block;
}

/* Related Tools Directory Grid */
.tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin: 1.5rem 0;
}

@media (min-width: 640px) {
  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .tools-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.tool-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: all var(--transition-fast);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 160px;
}

@media (min-width: 640px) {
  .tool-card {
    padding: 1.5rem;
  }
}

.tool-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.tool-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.tool-card-icon {
  width: 40px;
  height: 40px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.tool-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.tool-card-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.tool-card-badge {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  background: var(--bg-muted);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Author E-E-A-T Box
   ========================================================================== */

.eeat-badge-box {
  background: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}

@media (min-width: 500px) {
  .eeat-badge-box {
    flex-direction: row;
    align-items: center;
    padding: 1.5rem;
    margin-top: 2.5rem;
    gap: 1.25rem;
  }
}

.author-avatar {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  flex-shrink: 0;
}

@media (min-width: 500px) {
  .author-avatar {
    width: 64px;
    height: 64px;
    font-size: 1.35rem;
  }
}

.author-details h4 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
}

.author-details p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Breadcrumb Navigation
   ========================================================================== */

.breadcrumb-nav {
  padding: 0.75rem 0;
}

@media (min-width: 640px) {
  .breadcrumb-nav {
    padding: 1rem 0;
  }
}

.breadcrumb-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  list-style: none;
  font-size: 0.825rem;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
}

.breadcrumb-item a {
  color: var(--text-secondary);
}

.breadcrumb-item a:hover {
  color: var(--primary);
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 2.5rem 0 1.75rem;
  margin-top: auto;
  transition: background-color var(--transition-normal);
}

@media (min-width: 768px) {
  .site-footer {
    padding: 3.5rem 0 2rem;
  }
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

@media (min-width: 640px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2.5rem;
    margin-bottom: 2.5rem;
  }
}

.footer-brand p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  max-width: 320px;
}

.footer-col h4 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  display: inline-block;
  padding: 0.15rem 0;
}

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

.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding-top: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.825rem;
  color: var(--text-muted);
  text-align: center;
}

@media (min-width: 768px) {
  .footer-bottom {
    flex-direction: row;
    text-align: left;
    padding-top: 1.5rem;
    gap: 1rem;
    font-size: 0.85rem;
  }
}

/* ==========================================================================
   Homepage Specific Components
   ========================================================================== */

.hero-homepage {
  padding: 2.5rem 0 2rem;
  text-align: center;
  position: relative;
}

@media (min-width: 768px) {
  .hero-homepage {
    padding: 4rem 0 3rem;
  }
}

.hero-stats-banner {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 2rem;
  padding: 1.25rem 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

@media (min-width: 640px) {
  .hero-stats-banner {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    padding: 1.5rem;
    margin-top: 2.5rem;
  }
}

.hero-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.hero-stat-value {
  font-size: clamp(1.25rem, 4vw, 1.5rem);
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.hero-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
}

.homepage-cta-group {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  width: 100%;
}

.homepage-cta-group .btn {
  width: 100%;
}

@media (min-width: 480px) {
  .homepage-cta-group .btn {
    width: auto;
  }
}

.quick-calc-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-lg);
  margin: 2rem auto 0;
  max-width: 780px;
  text-align: left;
  width: 100%;
}

@media (min-width: 640px) {
  .quick-calc-card {
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin: 2.5rem auto 0;
  }
}

.comparison-table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.75rem 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
  width: 100%;
}

.comparison-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  background: var(--bg-surface);
  text-align: left;
}

.comparison-table th {
  background: var(--bg-muted);
  padding: 0.85rem 1rem;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 0.9rem;
  border-bottom: 2px solid var(--border-subtle);
}

@media (min-width: 640px) {
  .comparison-table th {
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
  }
}

.comparison-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

@media (min-width: 640px) {
  .comparison-table td {
    padding: 1rem 1.25rem;
    font-size: 0.925rem;
  }
}

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

.feature-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.775rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.feature-pill-success {
  background: var(--success-light);
  color: var(--success);
}

.feature-pill-danger {
  background: #fee2e2;
  color: #dc2626;
}

.trust-badges-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 2rem 0;
}

@media (min-width: 540px) {
  .trust-badges-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .trust-badges-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    margin: 2.5rem 0;
  }
}

.trust-badge-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

@media (min-width: 640px) {
  .trust-badge-card {
    padding: 1.5rem;
    gap: 0.75rem;
  }
}

.trust-badge-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .trust-badge-icon {
    width: 44px;
    height: 44px;
  }
}

.trust-badge-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.trust-badge-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0;
}

@media (min-width: 1024px) {
  .calculator-grid {
    grid-template-columns: 1.15fr 1.35fr;
    align-items: start;
  }
}

/* ==========================================================================
   Print Stylesheet
   ========================================================================== */

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 12pt;
  }
  
  .site-header, .site-footer, .theme-toggle-btn, .mobile-menu-btn,
  .form-actions, .quick-presets, .action-buttons-bar, .breadcrumb-nav {
    display: none !important;
  }
  
  .calculator-wrapper {
    box-shadow: none !important;
    border: 1px solid #cccccc !important;
    padding: 1cm !important;
    margin: 0 !important;
  }
  
  .calculator-results {
    background: #ffffff !important;
    border: 1px solid #999999 !important;
  }
  
  .age-big-number {
    color: #000000 !important;
  }
  
  .data-table th, .data-table td {
    border-color: #000000 !important;
  }
}
