/* ==========================================================================
   AGEIFY - MODERN, ACCESSIBLE, HIGH-PERFORMANCE AGE CALCULATOR
   Pure Vanilla CSS3 - Responsive, SEO & AdSense Ready
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS & CSS VARIABLES
   -------------------------------------------------------------------------- */
:root {
  /* Brand Colors */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-active: #1e40af;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  
  --secondary: #0ea5e9;
  --accent: #f59e0b;
  --success: #10b981;
  --success-light: #ecfdf5;
  --error: #ef4444;
  --error-light: #fef2f2;
  --error-border: #fecaca;
  
  /* Neutrals */
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #e2e8f0;
  
  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  
  --border-light: #e2e8f0;
  --border-subtle: #cbd5e1;
  --border-focus: #3b82f6;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.09), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
  --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.15);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 350ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Max widths */
  --container-max: 1200px;
  --article-max: 820px;
}

/* --------------------------------------------------------------------------
   2. RESET & BASE STYLES
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

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

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

/* Accessibility focus styles */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* --------------------------------------------------------------------------
   3. LAYOUT CONTAINERS
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

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

/* --------------------------------------------------------------------------
   4. HEADER & NAVIGATION
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-light);
  transition: box-shadow var(--transition-base);
}

.site-header.scrolled {
  box-shadow: var(--shadow-sm);
}

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

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
}

.brand-logo svg {
  height: 2.25rem;
  width: auto;
}

.nav-desktop {
  display: none;
}

@media (min-width: 768px) {
  .nav-desktop {
    display: flex;
    align-items: center;
    gap: 1.75rem;
  }
}

.nav-link {
  font-weight: 500;
  color: var(--text-body);
  padding: 0.5rem 0.25rem;
  position: relative;
  transition: color var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: var(--radius-full);
}

/* Header Right Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Language Selector Dropdown */
.lang-dropdown-wrapper {
  position: relative;
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.4375rem 0.75rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.lang-btn:hover {
  background: var(--bg-subtle);
  border-color: var(--border-subtle);
}

.lang-btn svg {
  width: 1rem;
  height: 1rem;
  color: var(--text-muted);
}

.lang-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  width: 14rem;
  max-height: 20rem;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  padding: 0.375rem;
  z-index: 150;
  list-style: none;
}

.lang-dropdown-menu.active {
  display: block;
  animation: dropdownFade 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.lang-dropdown-item a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-body);
}

.lang-dropdown-item a:hover {
  background: var(--bg-subtle);
  color: var(--primary);
}

.lang-dropdown-item.active a {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.lang-tag {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

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

.mobile-menu-btn svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Mobile Drawer Nav */
.mobile-nav-drawer {
  display: none;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  padding: 1rem 1.25rem 1.5rem;
  box-shadow: var(--shadow-lg);
}

.mobile-nav-drawer.open {
  display: block;
}

.mobile-nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mobile-nav-links a {
  display: block;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-main);
  border-radius: var(--radius-md);
  transition: background var(--transition-fast);
}

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

/* --------------------------------------------------------------------------
   5. ADSENSE-READY SLOTS
   -------------------------------------------------------------------------- */
.ad-slot {
  margin: 1.75rem auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: var(--container-max);
  position: relative;
}

.ad-slot-box {
  width: 100%;
  min-height: 90px;
  background: #f8fafc;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
}

.ad-slot-leaderboard {
  max-width: 728px;
  min-height: 90px;
}

.ad-slot-content {
  max-width: 728px;
  min-height: 100px;
}

.ad-slot-prefooter {
  max-width: 970px;
  min-height: 90px;
}

.ad-label {
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.ad-notice {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

/* --------------------------------------------------------------------------
   6. HERO SECTION
   -------------------------------------------------------------------------- */
.hero-section {
  padding-top: 2rem;
  padding-bottom: 1.5rem;
  text-align: center;
}

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

.hero-tagline-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.375rem 0.875rem;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.hero-tagline-badge svg {
  width: 1rem;
  height: 1rem;
  color: var(--primary);
}

.hero-title {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 1rem;
}

@media (min-width: 768px) {
  .hero-title {
    font-size: 3.25rem;
  }
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 42rem;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

@media (min-width: 768px) {
  .hero-subtitle {
    font-size: 1.25rem;
  }
}

/* --------------------------------------------------------------------------
   7. AGE CALCULATOR SECTION
   -------------------------------------------------------------------------- */
.calculator-section {
  padding-bottom: 2.5rem;
}

.calc-wrapper-card {
  max-width: 680px;
  margin: 0 auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 1.75rem 1.25rem;
  position: relative;
  overflow: hidden;
}

@media (min-width: 640px) {
  .calc-wrapper-card {
    padding: 2.25rem 2rem;
  }
}

.calc-wrapper-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.calc-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

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

.input-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.input-label span.req {
  color: var(--primary);
}

.input-helper {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 400;
}

.date-input-control {
  width: 100%;
  padding: 0.875rem 1.125rem;
  font-size: 1.0625rem;
  color: var(--text-main);
  background: var(--bg-page);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  outline: none;
  font-family: inherit;
}

.date-input-control:hover {
  border-color: var(--border-subtle);
}

.date-input-control:focus {
  border-color: var(--primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.date-input-control.has-error {
  border-color: var(--error);
  background: var(--error-light);
}

/* Quick helpers / Time picker toggle */
.calc-options-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-top: 0.25rem;
}

.time-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.time-toggle-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
  cursor: pointer;
}

.time-input-container {
  display: none;
  width: 100%;
  animation: fadeIn 0.2s ease-in-out;
}

.time-input-container.visible {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Error Banner */
.calc-error-banner {
  display: none;
  padding: 0.875rem 1rem;
  background: var(--error-light);
  border: 1px solid var(--error-border);
  border-radius: var(--radius-md);
  color: var(--error);
  font-size: 0.875rem;
  font-weight: 500;
  align-items: center;
  gap: 0.625rem;
  animation: shake 0.3s ease-in-out;
}

.calc-error-banner.active {
  display: flex;
}

.calc-error-banner svg {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

/* Action Buttons */
.calc-buttons-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

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

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--primary);
  color: #ffffff;
  font-size: 1.0625rem;
  font-weight: 600;
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.btn-primary:active {
  background: var(--primary-active);
  transform: translateY(0);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 500;
  padding: 0.875rem 1.25rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

/* --------------------------------------------------------------------------
   8. RESULT CARD
   -------------------------------------------------------------------------- */
.calc-result-box {
  display: none;
  margin-top: 2rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border-light);
}

.calc-result-box.active {
  display: block;
  animation: resultSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.result-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.result-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.5rem;
}

.result-main-statement {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
}

@media (min-width: 640px) {
  .result-main-statement {
    font-size: 1.5rem;
  }
}

.result-main-statement .highlight-num {
  color: var(--primary);
}

/* Primary Metric Grid: Years, Months, Weeks, Days */
.result-grid-primary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 520px) {
  .result-grid-primary {
    grid-template-columns: repeat(4, 1fr);
  }
}

.metric-card {
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1rem 0.75rem;
  text-align: center;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary-border);
}

.metric-card.hero-metric {
  background: linear-gradient(180deg, var(--primary-light) 0%, var(--bg-page) 100%);
  border-color: var(--primary-border);
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.1;
  font-family: var(--font-sans);
}

.metric-card.hero-metric .metric-value {
  color: var(--primary);
}

.metric-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.375rem;
}

/* Live Time Section: Approximately X Hours, X Minutes, X Seconds */
.approx-time-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.125rem 1.25rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

.approx-title {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.approx-title svg {
  width: 1rem;
  height: 1rem;
  color: var(--primary);
}

.approx-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.625rem;
}

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

.approx-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  text-align: center;
}

.approx-item-val {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-mono);
}

.approx-item-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

/* Total Stats Summary Accordion/Grid */
.total-stats-section {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  background: var(--bg-surface);
}

.total-stats-header {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.total-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.625rem;
}

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

.total-stat-item {
  font-size: 0.8125rem;
  padding: 0.5rem;
  background: var(--bg-page);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
}

.total-stat-num {
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.9375rem;
}

.total-stat-lbl {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Next Birthday Callout */
.birthday-callout {
  margin-top: 1.25rem;
  padding: 0.875rem 1rem;
  background: linear-gradient(135deg, #fef3c7 0%, #fef9c3 100%);
  border: 1px solid #fde047;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: #854d0e;
}

.birthday-callout svg {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  color: #ca8a04;
}

/* --------------------------------------------------------------------------
   9. HOW IT WORKS SECTION
   -------------------------------------------------------------------------- */
.how-it-works-section {
  padding: 3rem 0;
  text-align: center;
}

.section-header {
  margin-bottom: 2.25rem;
}

.section-title {
  font-size: 1.875rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
  .section-title {
    font-size: 2.25rem;
  }
}

.section-desc {
  font-size: 1.0625rem;
  color: var(--text-muted);
  max-width: 38rem;
  margin: 0 auto;
}

.steps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  text-align: left;
}

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

.step-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 2rem 1.5rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

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

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background: var(--primary);
  color: #ffffff;
  border-radius: var(--radius-md);
  font-weight: 800;
  font-size: 1.125rem;
  margin-bottom: 1.25rem;
}

.step-card:nth-child(2) .step-badge {
  background: #0284c7;
}

.step-card:nth-child(3) .step-badge {
  background: #059669;
}

.step-card h3 {
  font-size: 1.1875rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.625rem;
}

.step-card p {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   10. MAIN ARTICLE SECTION
   -------------------------------------------------------------------------- */
.article-section {
  padding: 3.5rem 0 2rem;
}

.article-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  padding: 2.25rem 1.5rem;
}

@media (min-width: 768px) {
  .article-content {
    padding: 3.5rem 3rem;
  }
}

.article-header {
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 1.75rem;
  margin-bottom: 2rem;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.article-h1-display {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.025em;
  line-height: 1.2;
}

@media (min-width: 768px) {
  .article-h1-display {
    font-size: 2.5rem;
  }
}

.article-body {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: #334155;
}

.article-body p {
  margin-bottom: 1.5rem;
}

.article-body h2 {
  font-size: 1.625rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--bg-subtle);
}

.article-body h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
}

.article-body ul,
.article-body ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
}

.article-body li {
  margin-bottom: 0.5rem;
}

.article-callout {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  color: var(--text-main);
}

.article-callout strong {
  color: var(--primary);
}

.article-table-wrapper {
  overflow-x: auto;
  margin: 2rem 0;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.article-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  text-align: left;
}

.article-table th {
  background: var(--bg-subtle);
  padding: 0.875rem 1rem;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-light);
}

.article-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-body);
}

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

/* --------------------------------------------------------------------------
   11. FAQ ACCORDION SECTION
   -------------------------------------------------------------------------- */
.faq-section {
  padding: 3rem 0;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: var(--article-max);
  margin: 0 auto;
}

.faq-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.faq-item:hover {
  border-color: var(--border-subtle);
}

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

.faq-question-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  background: none;
  border: none;
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.faq-question-btn:hover {
  color: var(--primary);
}

.faq-icon-chevron {
  width: 1.25rem;
  height: 1.25rem;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform var(--transition-base);
}

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

.faq-answer-panel {
  display: none;
  padding: 0 1.5rem 1.5rem 1.5rem;
  color: var(--text-body);
  font-size: 0.9375rem;
  line-height: 1.7;
}

.faq-item.active .faq-answer-panel {
  display: block;
  animation: panelSlide 0.25s ease-in-out;
}

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

/* --------------------------------------------------------------------------
   12. COMMENTS SECTION
   -------------------------------------------------------------------------- */
.comments-section {
  padding: 3rem 0;
}

.comments-wrapper {
  max-width: var(--article-max);
  margin: 0 auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 2.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

@media (min-width: 768px) {
  .comments-wrapper {
    padding: 2.75rem 2.5rem;
  }
}

.comments-header {
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 1.25rem;
}

.comments-title {
  font-size: 1.625rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.375rem;
}

.moderation-notice-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.625rem 0.875rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.moderation-notice-box svg {
  width: 1rem;
  height: 1rem;
  color: var(--primary);
  flex-shrink: 0;
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}

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

@media (min-width: 640px) {
  .form-row {
    grid-template-columns: 1fr 1fr;
  }
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-main);
  transition: all var(--transition-fast);
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

textarea.form-control {
  min-height: 110px;
  resize: vertical;
}

.comment-feedback {
  display: none;
  padding: 0.875rem 1rem;
  background: var(--success-light);
  border: 1px solid #a7f3d0;
  color: #065f46;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 1rem;
}

.comment-feedback.active {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Sample Discussion List */
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  border-top: 1px solid var(--border-light);
  padding-top: 1.75rem;
}

.comment-card {
  display: flex;
  gap: 1rem;
}

.comment-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-full);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.9375rem;
}

.comment-body {
  flex-grow: 1;
}

.comment-author-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.comment-author-name {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--text-main);
}

.comment-date {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.comment-text {
  font-size: 0.9375rem;
  color: var(--text-body);
  line-height: 1.5;
}

/* --------------------------------------------------------------------------
   13. 17-LANGUAGE SECTION
   -------------------------------------------------------------------------- */
.languages-section {
  padding: 3.5rem 0 2rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.languages-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  max-width: 980px;
  margin: 0 auto;
}

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

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

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

.lang-card {
  display: flex;
  flex-direction: column;
  padding: 0.875rem 1rem;
  background: var(--bg-page);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all var(--transition-fast);
  position: relative;
}

.lang-card:hover {
  background: var(--bg-subtle);
  border-color: var(--primary-border);
  transform: translateY(-2px);
}

.lang-card.active {
  background: var(--primary-light);
  border-color: var(--primary);
}

.lang-native {
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--text-main);
}

.lang-card.active .lang-native {
  color: var(--primary);
}

.lang-en-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.lang-active-pill {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 0.625rem;
  font-weight: 800;
  background: var(--primary);
  color: #ffffff;
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --------------------------------------------------------------------------
   14. FOOTER
   -------------------------------------------------------------------------- */
.site-footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 3.5rem 0 2rem;
  margin-top: auto;
}

.footer-top-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid #1e293b;
}

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

.footer-brand {
  max-width: 24rem;
}

.footer-logo-link {
  display: inline-block;
  margin-bottom: 1rem;
}

.footer-brand-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.footer-brand-title span {
  color: #38bdf8;
}

.footer-desc {
  font-size: 0.9375rem;
  line-height: 1.6;
  color: #94a3b8;
}

.footer-col-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

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

.footer-nav-list a {
  color: #94a3b8;
  font-size: 0.875rem;
  transition: color var(--transition-fast);
}

.footer-nav-list a:hover {
  color: #ffffff;
}

.footer-bottom-row {
  padding-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  text-align: center;
  font-size: 0.8125rem;
}

@media (min-width: 640px) {
  .footer-bottom-row {
    flex-direction: row;
    text-align: left;
  }
}

.footer-bottom-row p {
  color: #64748b;
}

/* --------------------------------------------------------------------------
   15. ACCESSIBILITY & PRINT
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .site-header,
  .ad-slot,
  .calc-buttons-row,
  .how-it-works-section,
  .faq-section,
  .comments-section,
  .languages-section,
  .site-footer {
    display: none !important;
  }
  
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .calc-wrapper-card,
  .article-content {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
  }
}

/* --------------------------------------------------------------------------
   16. RTL (RIGHT-TO-LEFT) SUPPORT FOR ARABIC
   -------------------------------------------------------------------------- */
[dir="rtl"] {
  direction: rtl;
  text-align: right;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Tahoma", "Arial", sans-serif;
}

[dir="rtl"] .header-inner {
  flex-direction: row;
}

[dir="rtl"] .nav-desktop {
  margin-right: 2rem;
  margin-left: 0;
}

[dir="rtl"] .lang-dropdown-menu {
  right: auto;
  left: 0;
}

[dir="rtl"] .lang-tag {
  margin-left: 0;
  margin-right: auto;
}

[dir="rtl"] .input-group {
  text-align: right;
}

[dir="rtl"] .calc-error-banner {
  flex-direction: row;
}

[dir="rtl"] .approx-title {
  justify-content: flex-start;
}

[dir="rtl"] .steps-grid {
  text-align: right;
}

[dir="rtl"] .article-callout {
  border-left: none;
  border-right: 4px solid var(--primary);
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

[dir="rtl"] .article-table th,
[dir="rtl"] .article-table td {
  text-align: right;
}

[dir="rtl"] .article-body ul,
[dir="rtl"] .article-body ol {
  padding-left: 0;
  padding-right: 1.5rem;
}

[dir="rtl"] .faq-question-btn {
  text-align: right;
}

[dir="rtl"] .faq-icon-chevron {
  transform: rotate(0deg);
}

[dir="rtl"] .faq-item.active .faq-icon-chevron {
  transform: rotate(180deg);
}

[dir="rtl"] .comment-card {
  flex-direction: row;
}

[dir="rtl"] .lang-active-pill {
  right: auto;
  left: 0.5rem;
}

[dir="rtl"] .footer-top-grid {
  text-align: right;
}

[dir="rtl"] .footer-bottom-row {
  flex-direction: row-reverse;
}

/* --------------------------------------------------------------------------
   17. DEMO ADVERTISEMENTS & SPONSORED CARDS
   -------------------------------------------------------------------------- */
.demo-ad-card {
  width: 100%;
  max-width: 970px;
  margin: 1.5rem auto;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  text-align: left;
}

.demo-ad-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.demo-ad-badge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.demo-ad-pill {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: #eff6ff;
  color: var(--primary);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

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

.demo-ad-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.demo-ad-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.demo-ad-info {
  flex: 1;
  min-width: 220px;
}

.demo-ad-info h4 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.demo-ad-info p {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin: 0;
}

.demo-ad-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #ffffff !important;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.demo-ad-btn:hover {
  opacity: 0.9;
}

/* --------------------------------------------------------------------------
   18. COMPREHENSIVE MOBILE RESPONSIVENESS OVERRIDES
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  .hero-tagline-badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
    text-align: center;
  }

  .hero-title {
    font-size: 2rem;
    line-height: 1.2;
  }

  .hero-subtitle {
    font-size: 0.9375rem;
    line-height: 1.5;
  }

  .calc-wrapper-card {
    padding: 1.25rem 1rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
  }

  .date-input-control {
    font-size: 16px; /* Prevents unwanted iOS Safari zooming */
    padding: 0.75rem 0.875rem;
  }

  .calc-buttons-row {
    grid-template-columns: 1fr;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    padding: 0.875rem 1rem;
  }

  .result-main-statement {
    font-size: 1.15rem;
  }

  .result-grid-primary {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .metric-card {
    padding: 0.75rem 0.5rem;
  }

  .metric-value {
    font-size: 1.5rem;
  }

  .approx-list {
    grid-template-columns: 1fr;
  }

  .languages-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.5rem;
  }

  .demo-ad-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .demo-ad-btn {
    width: 100%;
    margin-top: 0.5rem;
  }

  .article-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
}

@media (max-width: 380px) {
  .header-inner {
    height: 3.75rem;
  }

  .brand-text {
    font-size: 1.25rem;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .result-grid-primary {
    grid-template-columns: 1fr;
  }
}

