:root {
  /* Primitive Color Tokens */
  --color-white: rgba(255, 255, 255, 1);
  --color-black: rgba(0, 0, 0, 1);
  --color-cream-50: rgba(252, 252, 249, 1);
  --color-cream-100: rgba(255, 255, 253, 1);
  --color-gray-200: rgba(245, 245, 245, 1);
  --color-gray-300: rgba(167, 169, 169, 1);
  --color-gray-400: rgba(119, 124, 124, 1);
  --color-slate-500: rgba(98, 108, 113, 1);
  --color-brown-600: rgba(94, 82, 64, 1);
  --color-charcoal-700: rgba(31, 33, 33, 1);
  --color-charcoal-800: rgba(38, 40, 40, 1);
  --color-slate-900: rgba(19, 52, 59, 1);
  --color-teal-300: rgba(50, 184, 198, 1);
  --color-teal-400: rgba(45, 166, 178, 1);
  --color-teal-500: rgba(33, 128, 141, 1);
  --color-teal-600: rgba(29, 116, 128, 1);
  --color-teal-700: rgba(26, 104, 115, 1);
  --color-teal-800: rgba(41, 150, 161, 1);
  --color-red-400: rgba(255, 84, 89, 1);
  --color-red-500: rgba(192, 21, 47, 1);
  --color-orange-400: rgba(230, 129, 97, 1);
  --color-orange-500: rgba(168, 75, 47, 1);

  /* RGB versions for opacity control */
  --color-brown-600-rgb: 94, 82, 64;
  --color-teal-500-rgb: 33, 128, 141;
  --color-slate-900-rgb: 19, 52, 59;
  --color-slate-500-rgb: 98, 108, 113;
  --color-red-500-rgb: 192, 21, 47;
  --color-red-400-rgb: 255, 84, 89;
  --color-orange-500-rgb: 168, 75, 47;
  --color-orange-400-rgb: 230, 129, 97;

  /* Background color tokens (Light Mode) */
  --color-bg-1: rgba(59, 130, 246, 0.08); /* Light blue */
  --color-bg-2: rgba(245, 158, 11, 0.08); /* Light yellow */
  --color-bg-3: rgba(34, 197, 94, 0.08); /* Light green */
  --color-bg-4: rgba(239, 68, 68, 0.08); /* Light red */
  --color-bg-5: rgba(147, 51, 234, 0.08); /* Light purple */
  --color-bg-6: rgba(249, 115, 22, 0.08); /* Light orange */
  --color-bg-7: rgba(236, 72, 153, 0.08); /* Light pink */
  --color-bg-8: rgba(6, 182, 212, 0.08); /* Light cyan */

  /* Semantic Color Tokens (Light Mode) */
  --color-background: var(--color-cream-50);
  --color-surface: var(--color-cream-100);
  --color-text: var(--color-slate-900);
  --color-text-secondary: var(--color-slate-500);
  --color-primary: var(--color-teal-500);
  --color-primary-hover: var(--color-teal-600);
  --color-primary-active: var(--color-teal-700);
  --color-secondary: rgba(var(--color-brown-600-rgb), 0.12);
  --color-secondary-hover: rgba(var(--color-brown-600-rgb), 0.2);
  --color-secondary-active: rgba(var(--color-brown-600-rgb), 0.25);
  --color-border: rgba(var(--color-brown-600-rgb), 0.2);
  --color-btn-primary-text: var(--color-cream-50);
  --color-card-border: rgba(var(--color-brown-600-rgb), 0.12);
  --color-card-border-inner: rgba(var(--color-brown-600-rgb), 0.12);
  --color-error: var(--color-red-500);
  --color-success: var(--color-teal-500);
  --color-warning: var(--color-orange-500);
  --color-info: var(--color-slate-500);
  --color-focus-ring: rgba(var(--color-teal-500-rgb), 0.4);
  --color-select-caret: rgba(var(--color-slate-900-rgb), 0.8);

  /* Common style patterns */
  --focus-ring: 0 0 0 3px var(--color-focus-ring);
  --focus-outline: 2px solid var(--color-primary);
  --status-bg-opacity: 0.15;
  --status-border-opacity: 0.25;
  --select-caret-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23134252' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  --select-caret-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");

  /* RGB versions for opacity control */
  --color-success-rgb: 33, 128, 141;
  --color-error-rgb: 192, 21, 47;
  --color-warning-rgb: 168, 75, 47;
  --color-info-rgb: 98, 108, 113;

  /* Typography */
  --font-family-base: "FKGroteskNeue", "Geist", "Inter", -apple-system,
    BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-family-mono: "Berkeley Mono", ui-monospace, SFMono-Regular, Menlo,
    Monaco, Consolas, monospace;
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-base: 14px;
  --font-size-md: 14px;
  --font-size-lg: 16px;
  --font-size-xl: 18px;
  --font-size-2xl: 20px;
  --font-size-3xl: 24px;
  --font-size-4xl: 30px;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 550;
  --font-weight-bold: 600;
  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --letter-spacing-tight: -0.01em;

  /* Spacing */
  --space-0: 0;
  --space-1: 1px;
  --space-2: 2px;
  --space-4: 4px;
  --space-6: 6px;
  --space-8: 8px;
  --space-10: 10px;
  --space-12: 12px;
  --space-16: 16px;
  --space-20: 20px;
  --space-24: 24px;
  --space-32: 32px;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-base: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.04),
    0 2px 4px -1px rgba(0, 0, 0, 0.02);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04),
    0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --shadow-inset-sm: inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -1px 0 rgba(0, 0, 0, 0.03);

  /* Animation */
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --ease-standard: cubic-bezier(0.16, 1, 0.3, 1);

  /* Layout */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
}

/* Dark mode colors */
@media (prefers-color-scheme: dark) {
  :root {
    /* RGB versions for opacity control (Dark Mode) */
    --color-gray-400-rgb: 119, 124, 124;
    --color-teal-300-rgb: 50, 184, 198;
    --color-gray-300-rgb: 167, 169, 169;
    --color-gray-200-rgb: 245, 245, 245;

    /* Background color tokens (Dark Mode) */
    --color-bg-1: rgba(29, 78, 216, 0.15); /* Dark blue */
    --color-bg-2: rgba(180, 83, 9, 0.15); /* Dark yellow */
    --color-bg-3: rgba(21, 128, 61, 0.15); /* Dark green */
    --color-bg-4: rgba(185, 28, 28, 0.15); /* Dark red */
    --color-bg-5: rgba(107, 33, 168, 0.15); /* Dark purple */
    --color-bg-6: rgba(194, 65, 12, 0.15); /* Dark orange */
    --color-bg-7: rgba(190, 24, 93, 0.15); /* Dark pink */
    --color-bg-8: rgba(8, 145, 178, 0.15); /* Dark cyan */

    /* Semantic Color Tokens (Dark Mode) */
    --color-background: var(--color-charcoal-700);
    --color-surface: var(--color-charcoal-800);
    --color-text: var(--color-gray-200);
    --color-text-secondary: rgba(var(--color-gray-300-rgb), 0.7);
    --color-primary: var(--color-teal-300);
    --color-primary-hover: var(--color-teal-400);
    --color-primary-active: var(--color-teal-800);
    --color-secondary: rgba(var(--color-gray-400-rgb), 0.15);
    --color-secondary-hover: rgba(var(--color-gray-400-rgb), 0.25);
    --color-secondary-active: rgba(var(--color-gray-400-rgb), 0.3);
    --color-border: rgba(var(--color-gray-400-rgb), 0.3);
    --color-error: var(--color-red-400);
    --color-success: var(--color-teal-300);
    --color-warning: var(--color-orange-400);
    --color-info: var(--color-gray-300);
    --color-focus-ring: rgba(var(--color-teal-300-rgb), 0.4);
    --color-btn-primary-text: var(--color-slate-900);
    --color-card-border: rgba(var(--color-gray-400-rgb), 0.2);
    --color-card-border-inner: rgba(var(--color-gray-400-rgb), 0.15);
    --shadow-inset-sm: inset 0 1px 0 rgba(255, 255, 255, 0.1),
      inset 0 -1px 0 rgba(0, 0, 0, 0.15);
    --button-border-secondary: rgba(var(--color-gray-400-rgb), 0.2);
    --color-border-secondary: rgba(var(--color-gray-400-rgb), 0.2);
    --color-select-caret: rgba(var(--color-gray-200-rgb), 0.8);

    /* Common style patterns - updated for dark mode */
    --focus-ring: 0 0 0 3px var(--color-focus-ring);
    --focus-outline: 2px solid var(--color-primary);
    --status-bg-opacity: 0.15;
    --status-border-opacity: 0.25;
    --select-caret-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23134252' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    --select-caret-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");

    /* RGB versions for dark mode */
    --color-success-rgb: var(--color-teal-300-rgb);
    --color-error-rgb: var(--color-red-400-rgb);
    --color-warning-rgb: var(--color-orange-400-rgb);
    --color-info-rgb: var(--color-gray-300-rgb);
  }
}

/* Data attribute for manual theme switching */
[data-color-scheme="dark"] {
  /* RGB versions for opacity control (dark mode) */
  --color-gray-400-rgb: 119, 124, 124;
  --color-teal-300-rgb: 50, 184, 198;
  --color-gray-300-rgb: 167, 169, 169;
  --color-gray-200-rgb: 245, 245, 245;

  /* Colorful background palette - Dark Mode */
  --color-bg-1: rgba(29, 78, 216, 0.15); /* Dark blue */
  --color-bg-2: rgba(180, 83, 9, 0.15); /* Dark yellow */
  --color-bg-3: rgba(21, 128, 61, 0.15); /* Dark green */
  --color-bg-4: rgba(185, 28, 28, 0.15); /* Dark red */
  --color-bg-5: rgba(107, 33, 168, 0.15); /* Dark purple */
  --color-bg-6: rgba(194, 65, 12, 0.15); /* Dark orange */
  --color-bg-7: rgba(190, 24, 93, 0.15); /* Dark pink */
  --color-bg-8: rgba(8, 145, 178, 0.15); /* Dark cyan */

  /* Semantic Color Tokens (Dark Mode) */
  --color-background: var(--color-charcoal-700);
  --color-surface: var(--color-charcoal-800);
  --color-text: var(--color-gray-200);
  --color-text-secondary: rgba(var(--color-gray-300-rgb), 0.7);
  --color-primary: var(--color-teal-300);
  --color-primary-hover: var(--color-teal-400);
  --color-primary-active: var(--color-teal-800);
  --color-secondary: rgba(var(--color-gray-400-rgb), 0.15);
  --color-secondary-hover: rgba(var(--color-gray-400-rgb), 0.25);
  --color-secondary-active: rgba(var(--color-gray-400-rgb), 0.3);
  --color-border: rgba(var(--color-gray-400-rgb), 0.3);
  --color-error: var(--color-red-400);
  --color-success: var(--color-teal-300);
  --color-warning: var(--color-orange-400);
  --color-info: var(--color-gray-300);
  --color-focus-ring: rgba(var(--color-teal-300-rgb), 0.4);
  --color-btn-primary-text: var(--color-slate-900);
  --color-card-border: rgba(var(--color-gray-400-rgb), 0.15);
  --color-card-border-inner: rgba(var(--color-gray-400-rgb), 0.15);
  --shadow-inset-sm: inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);
  --color-border-secondary: rgba(var(--color-gray-400-rgb), 0.2);
  --color-select-caret: rgba(var(--color-gray-200-rgb), 0.8);

  /* Common style patterns - updated for dark mode */
  --focus-ring: 0 0 0 3px var(--color-focus-ring);
  --focus-outline: 2px solid var(--color-primary);
  --status-bg-opacity: 0.15;
  --status-border-opacity: 0.25;
  --select-caret-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23134252' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  --select-caret-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");

  /* RGB versions for dark mode */
  --color-success-rgb: var(--color-teal-300-rgb);
  --color-error-rgb: var(--color-red-400-rgb);
  --color-warning-rgb: var(--color-orange-400-rgb);
  --color-info-rgb: var(--color-gray-300-rgb);
}

[data-color-scheme="light"] {
  /* RGB versions for opacity control (light mode) */
  --color-brown-600-rgb: 94, 82, 64;
  --color-teal-500-rgb: 33, 128, 141;
  --color-slate-900-rgb: 19, 52, 59;

  /* Semantic Color Tokens (Light Mode) */
  --color-background: var(--color-cream-50);
  --color-surface: var(--color-cream-100);
  --color-text: var(--color-slate-900);
  --color-text-secondary: var(--color-slate-500);
  --color-primary: var(--color-teal-500);
  --color-primary-hover: var(--color-teal-600);
  --color-primary-active: var(--color-teal-700);
  --color-secondary: rgba(var(--color-brown-600-rgb), 0.12);
  --color-secondary-hover: rgba(var(--color-brown-600-rgb), 0.2);
  --color-secondary-active: rgba(var(--color-brown-600-rgb), 0.25);
  --color-border: rgba(var(--color-brown-600-rgb), 0.2);
  --color-btn-primary-text: var(--color-cream-50);
  --color-card-border: rgba(var(--color-brown-600-rgb), 0.12);
  --color-card-border-inner: rgba(var(--color-brown-600-rgb), 0.12);
  --color-error: var(--color-red-500);
  --color-success: var(--color-teal-500);
  --color-warning: var(--color-orange-500);
  --color-info: var(--color-slate-500);
  --color-focus-ring: rgba(var(--color-teal-500-rgb), 0.4);

  /* RGB versions for light mode */
  --color-success-rgb: var(--color-teal-500-rgb);
  --color-error-rgb: var(--color-red-500-rgb);
  --color-warning-rgb: var(--color-orange-500-rgb);
  --color-info-rgb: var(--color-slate-500-rgb);
}

/* Base styles */
html {
  font-size: var(--font-size-base);
  font-family: var(--font-family-base);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
}

/* top-left corner logo (fixed) */
.top-corner-logo {
  position: fixed;
  top: 8px;
  left: 8px;
  height: 56px;
  width: auto;
  z-index: 9999;
  border-radius: 6px;
  background: rgba(255,255,255,0.7);
  padding: 6px;
  box-shadow: var(--shadow-sm);
}

@media (max-width: 768px) {
  .top-corner-logo {
    height: 44px;
    top: 6px;
    left: 6px;
  }
}

/* placeholders reserving header/corner logo space after removal */
.corner-logo-placeholder {
  position: fixed;
  top: 8px;
  left: 8px;
  height: 56px;
  width: 56px;
  z-index: 9999;
}

.header-logo-placeholder {
  display: inline-block;
  height: 60px;
  width: 240px; /* reserve horizontal space for future logo */
  vertical-align: middle;
}

/* remove these placeholders if logos are intentionally removed */
.corner-logo-placeholder,
.header-logo-placeholder { display: none !important; }

*,
*::before,
*::after {
  box-sizing: inherit;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--color-text);
  letter-spacing: var(--letter-spacing-tight);
}

h1 {
  font-size: var(--font-size-4xl);
}
h2 {
  font-size: var(--font-size-3xl);
}
h3 {
  font-size: var(--font-size-2xl);
}
h4 {
  font-size: var(--font-size-xl);
}
h5 {
  font-size: var(--font-size-lg);
}
h6 {
  font-size: var(--font-size-md);
}

p {
  margin: 0 0 var(--space-16) 0;
}

/* Blog-specific styles (added) */
:root{
  --content-max-width: 880px;
  --article-font-size: 18px;
  --article-line-height: 1.75;
}

.card.article-card{
  margin-bottom: 18px;
  padding: 18px;
  border-radius: var(--radius-base);
  background: var(--color-surface);
  box-shadow: var(--shadow-xs);
}

.article-card .card__header h3{
  margin: 0 0 10px 0;
  font-size: 1.05rem;
}

.article-card .card__body p{
  color: var(--color-text-secondary);
  margin: 0 0 12px 0;
  font-size: 0.98rem;
  line-height: 1.6;
}

.articles-grid .articles-grid-inner{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.article-full{
  max-width: var(--content-max-width);
  margin: 0 auto 48px auto;
  font-size: var(--article-font-size);
  line-height: var(--article-line-height);
  color: var(--color-text);
}
.article-full h1{font-size: 1.9rem; margin-bottom: 8px}
.article-full .meta{color:var(--color-text-secondary); font-size:0.9rem; margin-bottom:18px}
.article-full p{margin-bottom:16px}
.article-full ul{margin-left:18px}

.article-card a{color:var(--color-primary); text-decoration:none}
.article-card a:hover{text-decoration:underline}

.article-featured{width:100%; height:280px; background:#f4f4f6; border-radius:8px; margin-bottom:18px; display:block; object-fit:cover}

/* Blog layout columns and ads */
.content-columns{display:flex; gap:24px; align-items:flex-start}
.content-main{flex:1}
.content-side{width:320px; flex-shrink:0}
.ad-container{background:var(--color-bg-2); border:1px dashed rgba(0,0,0,0.06); padding:12px; border-radius:8px; text-align:center}
.ad-placeholder{color:var(--color-text-secondary); font-size:0.95rem; padding:18px 8px}
.ad-bottom{margin-top:22px}

/* Responsive: stack columns on small screens and hide right ad */
@media (max-width: 900px){
  .content-columns{flex-direction:column}
  .content-side{display:none}
}

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

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

code,
pre {
  font-family: var(--font-family-mono);
  font-size: calc(var(--font-size-base) * 0.95);
  background-color: var(--color-secondary);
  border-radius: var(--radius-sm);
}

code {
  padding: var(--space-1) var(--space-4);
}

pre {
  padding: var(--space-16);
  margin: var(--space-16) 0;
  overflow: auto;
  border: 1px solid var(--color-border);
}

pre code {
  background: none;
  padding: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-16);
  border-radius: var(--radius-base);
  font-size: var(--font-size-base);
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-standard);
  border: none;
  text-decoration: none;
  position: relative;
}

/* Ensure currency symbol uses a font that includes the rupee glyph to avoid mis-rendering
   when custom fonts lack the glyph. Use a safe font stack with Noto Sans / DejaVu Sans
   as fallbacks commonly available on many systems. */
.currency-symbol {
  font-family: 'Noto Sans', 'DejaVu Sans', 'Segoe UI Symbol', 'Arial Unicode MS', sans-serif;
  font-weight: 500;
  display: inline-block;
  margin-right: 2px;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn--primary {
  background: var(--color-primary);
  color: var(--color-btn-primary-text);
}

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

.btn--primary:active {
  background: var(--color-primary-active);
}

.btn--secondary {
  background: var(--color-secondary);
  color: var(--color-text);
}

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

.btn--secondary:active {
  background: var(--color-secondary-active);
}

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

.btn--outline:hover {
  background: var(--color-secondary);
}

.btn--sm {
  padding: var(--space-4) var(--space-12);
  font-size: var(--font-size-sm);
  border-radius: var(--radius-sm);
}

.btn--lg {
  padding: var(--space-10) var(--space-20);
  font-size: var(--font-size-lg);
  border-radius: var(--radius-md);
}

.btn--full-width {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Form elements */
.form-control {
  display: block;
  width: 100%;
  padding: var(--space-8) var(--space-12);
  font-size: var(--font-size-md);
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-base);
  transition: border-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

textarea.form-control {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  /* make sure textarea is interactive even if other elements overlap */
  pointer-events: auto;
  z-index: 6;
}

select.form-control {
  padding: var(--space-8) var(--space-12);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: var(--select-caret-light);
  background-repeat: no-repeat;
  background-position: right var(--space-12) center;
  background-size: 16px;
  padding-right: var(--space-32);
}

/* Add a dark mode specific caret */
@media (prefers-color-scheme: dark) {
  select.form-control {
    background-image: var(--select-caret-dark);
  }
}

/* Also handle data-color-scheme */
[data-color-scheme="dark"] select.form-control {
  background-image: var(--select-caret-dark);
}

[data-color-scheme="light"] select.form-control {
  background-image: var(--select-caret-light);
}

.form-control:focus {
  border-color: var(--color-primary);
  outline: var(--focus-outline);
}

.form-label {
  display: block;
  margin-bottom: var(--space-8);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
}

.form-group {
  margin-bottom: var(--space-16);
}

/* Card component */
.card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-card-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--duration-normal) var(--ease-standard);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card__body {
  padding: var(--space-16);
}

.card__header,
.card__footer {
  padding: var(--space-16);
  border-bottom: 1px solid var(--color-card-border-inner);
}

/* Status indicators - simplified with CSS variables */
.status {
  display: inline-flex;
  align-items: center;
  padding: var(--space-6) var(--space-12);
  border-radius: var(--radius-full);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
}

.status--success {
  background-color: rgba(
    var(--color-success-rgb, 33, 128, 141),
    var(--status-bg-opacity)
  );
  color: var(--color-success);
  border: 1px solid
    rgba(var(--color-success-rgb, 33, 128, 141), var(--status-border-opacity));
}

.status--error {
  background-color: rgba(
    var(--color-error-rgb, 192, 21, 47),
    var(--status-bg-opacity)
  );
  color: var(--color-error);
  border: 1px solid
    rgba(var(--color-error-rgb, 192, 21, 47), var(--status-border-opacity));
}

.status--warning {
  background-color: rgba(
    var(--color-warning-rgb, 168, 75, 47),
    var(--status-bg-opacity)
  );
  color: var(--color-warning);
  border: 1px solid
    rgba(var(--color-warning-rgb, 168, 75, 47), var(--status-border-opacity));
}

.status--info {
  background-color: rgba(
    var(--color-info-rgb, 98, 108, 113),
    var(--status-bg-opacity)
  );
  color: var(--color-info);
  border: 1px solid
    rgba(var(--color-info-rgb, 98, 108, 113), var(--status-border-opacity));
}

/* Container layout */
.container {
  width: 100%;
  margin-right: auto;
  margin-left: auto;
  padding-right: var(--space-16);
  padding-left: var(--space-16);
}

/* On the Home page, keep the center content left-aligned within the grid so
   the left sidebar sits flush to the page edge and no large empty gap appears. */
.home-main .container {
  max-width: none;
  margin: 0;
  padding-left: var(--space-16);
  padding-right: var(--space-16);
}

@media (min-width: 640px) {
  .container {
    max-width: var(--container-sm);
  }
}
@media (min-width: 768px) {
  .container {
    max-width: var(--container-md);
  }
}
@media (min-width: 1024px) {
  .container {
    max-width: var(--container-lg);
  }
}
@media (min-width: 1280px) {
  .container {
    max-width: var(--container-xl);
  }
}

/* Utility classes */
.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.items-center {
  align-items: center;
}
.justify-center {
  justify-content: center;
}
.justify-between {
  justify-content: space-between;
}
.gap-4 {
  gap: var(--space-4);
}
.gap-8 {
  gap: var(--space-8);
}
.gap-16 {
  gap: var(--space-16);
}

.m-0 {
  margin: 0;
}
.mt-8 {
  margin-top: var(--space-8);
}
.mb-8 {
  margin-bottom: var(--space-8);
}
.mx-8 {
  margin-left: var(--space-8);
  margin-right: var(--space-8);
}
.my-8 {
  margin-top: var(--space-8);
  margin-bottom: var(--space-8);
}

.p-0 {
  padding: 0;
}
.py-8 {
  padding-top: var(--space-8);
  padding-bottom: var(--space-8);
}
.px-8 {
  padding-left: var(--space-8);
  padding-right: var(--space-8);
}
.py-16 {
  padding-top: var(--space-16);
  padding-bottom: var(--space-16);
}
.px-16 {
  padding-left: var(--space-16);
  padding-right: var(--space-16);
}

.block {
  display: block;
}
.hidden {
  display: none;
}

/* Accessibility */
.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;
}

:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

/* Dark mode specifics */
[data-color-scheme="dark"] .btn--outline {
  border: 1px solid var(--color-border-secondary);
}

@font-face {
  font-family: 'FKGroteskNeue';
  src: url('https://r2cdn.perplexity.ai/fonts/FKGroteskNeue.woff2')
    format('woff2');
}

/* END PERPLEXITY DESIGN SYSTEM */
/* SBI Securities inspired design with sans-serif fonts */

/* Override font family to use sans-serif */
:root {
  --font-family-base: "Arial", "Helvetica", "Segoe UI", sans-serif;
  --font-family-mono: "Consolas", "Monaco", "Courier New", monospace;
  
  /* Enhanced border colors for visibility */
  --color-table-border: #ddd;
  --color-table-border-strong: #bbb;
  --color-container-border: #ccc;
}

html {
  font-family: var(--font-family-base);
}

/* Additional custom styles for the SBI Securities design */

/* Page Navigation System */
.app-container {
    position: relative;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

/* Home Layout - Original design for home page */
.home-layout {
  display: grid;
  /* Left sidebar (All Calculators), main content, right sidebar (ads) */
  grid-template-columns: 320px 1fr 320px;
  gap: var(--space-32);
  /* allow the home grid to expand full-width so the left sidebar sits at the page edge */
  max-width: none;
  margin: 0;
  padding: var(--space-24) var(--space-16);
}

.home-main {
    min-width: 0;
}

.home-sidebar {
    position: sticky;
    top: var(--space-20);
    height: fit-content;
}

/* NEW SBI Securities Calculator Layout */
.calculator-layout {
  display: grid;
  /* Left sidebar, main content, right ad sidebar */
  grid-template-columns: 280px 1fr 320px;
  min-height: calc(100vh - 200px);
  background: var(--color-background);
  gap: var(--space-24);
}

/* Calculator Sidebar */
.calculator-sidebar {
    background: var(--color-surface);
    border-right: 2px solid var(--color-table-border-strong);
    padding: var(--space-24) var(--space-16);
    position: sticky;
    top: 0;
    height: fit-content;
    min-height: 100vh;
}

.sidebar-header {
    margin-bottom: var(--space-24);
    padding-bottom: var(--space-16);
    border-bottom: 2px solid var(--color-primary);
}

.sidebar-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    margin: 0;
    font-family: var(--font-family-base);
}

.calculator-links {
    display: flex;
    flex-direction: column;
    gap: var(--space-12);
}

.calculator-link {
    display: flex;
    align-items: center;
    padding: var(--space-16);
    background: var(--color-background);
    border: 2px solid var(--color-table-border);
    border-radius: var(--radius-base);
    text-decoration: none;
    color: var(--color-text);
    transition: all var(--duration-fast) var(--ease-standard);
    cursor: pointer;
    font-family: var(--font-family-base);
}

.calculator-link:hover {
    background: var(--color-secondary);
    border-color: var(--color-primary);
    transform: translateX(2px);
}

.calculator-link.active {
    background: var(--color-primary);
    color: var(--color-btn-primary-text);
    border-color: var(--color-primary);
}

.calculator-link-icon {
    font-size: var(--font-size-lg);
    margin-right: var(--space-12);
    min-width: 24px;
}

.calculator-link-text {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-medium);
    font-family: var(--font-family-base);
}

/* Calculator Main Area */
.calculator-main {
    padding: var(--space-32);
    background: var(--color-background);
}

/* Right-side Ad area reserved for AdSense on calculator pages */
.calculator-right-ad {
  position: sticky;
  top: var(--space-20);
  height: fit-content;
  padding: var(--space-24) var(--space-16);
}

.adsense-banner .ad-placeholder {
  width: 100%;
  max-width: 320px;
  height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
  border: 1px dashed var(--color-table-border);
  border-radius: var(--radius-base);
}

.calculator-container {
    max-width: 1200px;
    margin: 0 auto;
    /* Add main container border */
    border: 2px solid var(--color-container-border);
    border-radius: var(--radius-lg);
    padding: var(--space-24);
    background: var(--color-surface);
}

/* Calculator Header */
.calculator-header {
    background: var(--color-surface);
    border: 2px solid var(--color-table-border);
    border-radius: var(--radius-lg);
    padding: var(--space-24);
    margin-bottom: var(--space-32);
    box-shadow: var(--shadow-sm);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    margin-bottom: var(--space-16);
}

.breadcrumb-link {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-family: var(--font-family-base);
}

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

.breadcrumb-separator {
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
}

.breadcrumb-current {
    color: var(--color-text);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    font-family: var(--font-family-base);
}

.calculator-title {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
    margin: 0 0 var(--space-8) 0;
    font-family: var(--font-family-base);
}

.calculator-description {
    font-size: var(--font-size-lg);
    color: var(--color-text-secondary);
    margin: 0;
    font-family: var(--font-family-base);
}

/* Main Calculator Grid - SBI Securities Style */
.calculator-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 2fr; /* 40% - 20% - 40% */
    gap: var(--space-24);
    margin-bottom: var(--space-32);
    /* Add border around entire grid */
    border: 2px solid var(--color-table-border-strong);
    border-radius: var(--radius-lg);
    padding: var(--space-20);
    background: var(--color-background);
}

/* Form Section (Left 40%) */
.calculator-form-section {
    min-width: 0;
}

.form-card {
    background: var(--color-surface);
    border: 2px solid var(--color-table-border);
    border-radius: var(--radius-lg);
    padding: var(--space-24);
    box-shadow: var(--shadow-sm);
    height: fit-content;
  /* Ensure the form card sits above decorative layers so inputs remain interactive */
  position: relative;
  z-index: 5;
}

.form-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    margin: 0 0 var(--space-20) 0;
    text-align: center;
    font-family: var(--font-family-base);
    /* Add border below title */
    padding-bottom: var(--space-12);
    border-bottom: 1px solid var(--color-table-border);
}

.calculator-form {
    display: grid;
    gap: var(--space-20);
    margin-bottom: var(--space-24);
}

/* Enhanced form controls with visible borders */
.form-control {
    border: 2px solid var(--color-table-border) !important;
    transition: border-color var(--duration-fast) var(--ease-standard),
                box-shadow var(--duration-fast) var(--ease-standard);
}

.form-control:focus {
    border-color: var(--color-primary) !important;
    outline: var(--focus-outline);
    box-shadow: 0 0 0 3px rgba(var(--color-teal-500-rgb), 0.1);
}

.form-group {
    border: 1px solid var(--color-table-border);
    border-radius: var(--radius-base);
    padding: var(--space-12);
    background: var(--color-background);
}

/* Results Section (Center 20%) */
.calculator-results-section {
    min-width: 0;
}

.results-card {
    background: var(--color-bg-1);
  /* removed explicit border to restore original look */
  border-radius: var(--radius-lg);
    padding: var(--space-20);
    box-shadow: var(--shadow-sm);
    height: fit-content;
    position: sticky;
    top: var(--space-20);
}

.results-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    margin: 0 0 var(--space-16) 0;
    text-align: center;
    font-family: var(--font-family-base);
  padding-bottom: var(--space-12);
}

.results-content {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    gap: var(--space-12);
}

.results-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    background: var(--color-bg-1);
    border-radius: var(--radius-base);
  /* removed dashed border to match original styling */
}

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

.results-placeholder .placeholder-icon {
    font-size: 2rem;
    margin-bottom: var(--space-8);
    opacity: 0.5;
}

.results-placeholder p {
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    margin: 0;
    font-family: var(--font-family-base);
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-12);
    background: var(--color-surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-table-border);
}

.result-label {
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    font-size: var(--font-size-sm);
    font-family: var(--font-family-base);
}

.result-value {
    font-weight: var(--font-weight-semibold);
    color: var(--color-primary);
    font-size: var(--font-size-md);
    font-family: var(--font-family-base);
}

/* Chart Section (Right 40%) */
.calculator-chart-section {
    min-width: 0;
}

.chart-card {
    background: var(--color-surface);
    border: 2px solid var(--color-table-border);
    border-radius: var(--radius-lg);
    padding: var(--space-24);
    box-shadow: var(--shadow-sm);
    height: fit-content;
    position: sticky;
    top: var(--space-20);
}

.chart-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    margin: 0 0 var(--space-16) 0;
    text-align: center;
    font-family: var(--font-family-base);
    /* Add border below title */
    padding-bottom: var(--space-12);
    border-bottom: 1px solid var(--color-table-border);
}

.chart-container {
  position: relative;
  height: 300px;
    margin-bottom: var(--space-16);
    border: 1px solid var(--color-table-border);
    border-radius: var(--radius-base);
    background: var(--color-background);
}

.chart-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-1);
    border-radius: var(--radius-base);
    border: 2px dashed var(--color-table-border);
}

.chart-placeholder.hidden {
    display: none;
}

.chart-placeholder .placeholder-icon {
    font-size: 3rem;
    margin-bottom: var(--space-12);
    opacity: 0.5;
}

.chart-placeholder p {
    color: var(--color-text-secondary);
    font-size: var(--font-size-md);
    margin: 0;
    font-family: var(--font-family-base);
}

/* Download Section */
.download-section {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-32);
    border: 1px solid var(--color-table-border);
    border-radius: var(--radius-base);
    padding: var(--space-16);
    background: var(--color-surface);
}

/* Calculate Button with Star Animation */
.calculate-btn {
    position: relative;
    overflow: hidden;
    width: 100%;
    padding: var(--space-16) var(--space-24);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    font-family: var(--font-family-base);
    border: 2px solid var(--color-primary);
}

.btn-text {
    position: relative;
    z-index: 2;
}

.stars-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

.star {
    position: absolute;
    color: #ffd700;
    font-size: 20px;
    animation: sparkle 1s ease-out forwards;
    pointer-events: none;
}

@keyframes sparkle {
    0% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1) rotate(180deg);
    }
    100% {
        opacity: 0;
        transform: scale(0.5) rotate(360deg) translateY(-50px);
    }
}

/* Educational Content Section */
.educational-section {
    background: var(--color-surface);
    border: 2px solid var(--color-table-border);
    border-radius: var(--radius-lg);
    padding: var(--space-24);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-32);
}

.educational-title {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    margin: 0 0 var(--space-16) 0;
    font-family: var(--font-family-base);
    padding-bottom: var(--space-12);
    border-bottom: 1px solid var(--color-table-border);
}

.educational-subsection {
    margin-bottom: var(--space-24);
    border: 1px solid var(--color-table-border);
    border-radius: var(--radius-base);
    padding: var(--space-16);
    background: var(--color-background);
}

.educational-subsection:last-child {
    margin-bottom: 0;
}

.educational-subtitle {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    margin: 0 0 var(--space-12) 0;
    font-family: var(--font-family-base);
}

.educational-content {
    color: var(--color-text-secondary);
    line-height: var(--line-height-normal);
    margin: 0 0 var(--space-12) 0;
    font-family: var(--font-family-base);
}

.educational-list {
    list-style: none;
    padding: 0;
    margin: var(--space-12) 0;
}

.educational-list li {
    position: relative;
    padding-left: var(--space-20);
    margin-bottom: var(--space-8);
    color: var(--color-text-secondary);
    font-family: var(--font-family-base);
    padding: var(--space-8);
    border-left: 3px solid var(--color-primary);
    background: var(--color-bg-1);
    border-radius: var(--radius-sm);
}

.educational-list li:before {
  /* Removed checkmark icon to avoid overlap with text. */
  content: none;
}

/* Enhanced FAQ Section */
.faq-section {
    background: var(--color-surface);
    border: 2px solid var(--color-table-border);
    border-radius: var(--radius-lg);
    padding: var(--space-24);
    box-shadow: var(--shadow-sm);
}

.faq-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    margin: 0 0 var(--space-20) 0;
    text-align: center;
    font-family: var(--font-family-base);
    padding-bottom: var(--space-12);
    border-bottom: 1px solid var(--color-table-border);
}

.faq-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-16);
}

.faq-item {
    border: 2px solid var(--color-table-border);
    border-radius: var(--radius-base);
    overflow: hidden;
    transition: all var(--duration-normal) var(--ease-standard);
}

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

.faq-question-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-16);
    background: var(--color-background);
    cursor: pointer;
    transition: background-color var(--duration-fast) var(--ease-standard);
    border-bottom: 1px solid var(--color-table-border);
}

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

.faq-question-wrapper.active {
    background: var(--color-bg-1);
}

.faq-question {
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    margin: 0;
    flex: 1;
    font-family: var(--font-family-base);
}

.faq-arrow {
    font-size: var(--font-size-lg);
    color: var(--color-text-secondary);
    transition: transform var(--duration-normal) var(--ease-standard);
    margin-left: var(--space-12);
}

.faq-question-wrapper.active .faq-arrow {
    transform: rotate(180deg);
}

.faq-answer-wrapper {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--duration-normal) var(--ease-standard);
}

.faq-answer-wrapper.active {
    max-height: 200px;
}

.faq-answer {
    padding: var(--space-16);
    padding-top: 0;
    color: var(--color-text-secondary);
    line-height: var(--line-height-normal);
    margin: 0;
    font-family: var(--font-family-base);
}

/* Ad Styling */
.sidebar-ad-container,
.footer-ad-container {
    background: var(--color-surface);
    border: 2px solid var(--color-table-border);
    border-radius: var(--radius-lg);
    padding: var(--space-16);
    box-shadow: var(--shadow-sm);
}

.ad-label {
    display: block;
    text-align: center;
    font-size: var(--font-size-xs);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-8);
    font-weight: var(--font-weight-medium);
    font-family: var(--font-family-base);
}

.adsense-banner {
    display: flex;
    justify-content: center;
}

/* Make sidebar ad sticky within the sidebar flow. It will use the --header-offset CSS variable set by JS. */
.sidebar-ad-container {
  position: relative; /* container remains in flow */
}
.sidebar-ad-container .adsense-banner {
  position: sticky;
  top: var(--header-offset, 12px);
  align-self: start;
  z-index: 5;
}

.sidebar-banner {
    margin: 0;
}

.footer-banner {
    margin: 0;
}

.ad-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-2);
    border: 2px dashed var(--color-table-border);
    border-radius: var(--radius-base);
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
    text-align: center;
    padding: var(--space-16);
    transition: all var(--duration-fast) var(--ease-standard);
    font-family: var(--font-family-base);
}

.ad-placeholder:hover {
    background: var(--color-bg-3);
    border-color: var(--color-primary);
}

.sidebar-banner .ad-placeholder {
    width: 300px;
    height: 200px;
    min-height: 200px;
}

.footer-banner .ad-placeholder {
  width: 300px;
  height: 200px;
  min-height: 200px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-16);
}

/* Header navigation placed between brand and search */
.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  margin-left: var(--space-8);
}

.header-link {
  color: var(--color-text);
  text-decoration: none;
  font-weight: var(--font-weight-medium);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--duration-fast) var(--ease-standard), color var(--duration-fast) var(--ease-standard);
  white-space: nowrap;
}

.header-link:hover {
  background: var(--color-secondary-hover);
  color: var(--color-text);
}

/* Page content utility used by simple static pages */
.page-content {
  padding: 24px;
}

.section-block {
  margin-top: 24px;
}

.article-card {
  margin-bottom: 16px;
}

.article-readmore {
  margin-top: 12px;
}

/* Header size adjustments to fit larger attached logo */
.header {
  padding: var(--space-16) 0;
  min-height: 110px;
  /* Make header sticky so it remains visible while scrolling */
  position: sticky;
  top: 0;
  z-index: 1100;
  /* ensure header has a solid background to cover page content when sticky */
  background: var(--color-surface);
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.header-brand {
  /* Keep the brand content left-aligned and avoid it stretching the whole header */
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-standard);
}

/* Ensure the search area is pushed to the far right */
.search-container {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-logo {
  /* slightly larger logo for desktop */
  height: 128px;
  width: auto;
  display: inline-block;
  vertical-align: middle;
}

/* Ensure the picture wrapper doesn't affect layout and its img scales responsively */
.site-logo-picture {
  display: inline-block;
  vertical-align: middle;
  line-height: 0; /* remove descender gaps for images */
}
.site-logo-picture img,
.site-logo-picture svg {
  height: 128px;
  width: auto;
  display: block;
}

/* Make header container flush to the left so the logo sits at the left-most edge
   of the page while preserving horizontal padding for other pages */
.header > .container {
  padding-left: 0;
  /* keep small right padding so search doesn't touch the edge */
  padding-right: var(--space-16);
}

/* Small spacing between brand and nav, and ensure nav sits before search */
.header-brand {
  margin-right: var(--space-12);
}

.header-nav {
  margin-left: 0;
}

@media (max-width: 600px) {
  .site-logo,
  .site-logo-picture img,
  .site-logo-picture svg {
    height: 72px;
  }
  .header {
    min-height: 80px;
  }
}

/* Mobile/tablet stacking: stack brand, nav, search vertically and center nav */
@media (max-width: 768px) {
  .header > .container {
    padding-left: var(--space-16); /* restore small left padding on small screens */
    padding-right: var(--space-16);
  }

  .header-content {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-8);
  }

  .header-brand {
    margin: 0 auto;
    display: flex;
    justify-content: center;
  }

  .header-nav {
    order: 2;
    justify-content: center;
    flex-wrap: wrap;
    gap: var(--space-8);
  }

  .header-link {
    padding: 6px 10px;
  }

  .search-container {
    order: 3;
    width: 100%;
    display: flex;
    gap: var(--space-8);
  }

  .search-input {
    flex: 1 1 auto;
    min-width: 0;
  }
}

.header-brand .tagline {
  margin-left: 12px;
  display: inline-block;
  vertical-align: middle;
}

.header-brand:hover {
    transform: translateY(-1px);
}

.site-title {
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-primary);
    margin: 0;
    letter-spacing: var(--letter-spacing-tight);
    font-family: var(--font-family-base);
}

.tagline {
    font-size: var(--font-size-md);
    color: var(--color-text-secondary);
    margin: var(--space-4) 0 0 0;
    font-family: var(--font-family-base);
}

.search-container {
    display: flex;
    align-items: center;
    position: relative;
    min-width: 300px;
}

.search-input {
    flex: 1;
    padding: var(--space-10) var(--space-12);
    padding-right: var(--space-32);
    border: 2px solid var(--color-table-border);
    border-radius: var(--radius-full);
    font-size: var(--font-size-md);
    background: var(--color-background);
    color: var(--color-text);
    transition: border-color var(--duration-fast) var(--ease-standard);
    font-family: var(--font-family-base);
}

.search-input:focus {
    border-color: var(--color-primary);
    outline: none;
    box-shadow: var(--focus-ring);
}

.search-btn {
    position: absolute;
    right: var(--space-8);
    background: none;
    border: none;
    font-size: var(--font-size-lg);
    cursor: pointer;
    padding: var(--space-4);
    border-radius: var(--radius-sm);
    transition: background-color var(--duration-fast) var(--ease-standard);
}

.search-btn:hover {
    background: var(--color-secondary);
}

/* Section Styles */
.section-title {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    margin: 0 0 var(--space-24) 0;
    text-align: center;
    font-family: var(--font-family-base);
}

/* Quick Access Section */
.quick-access-section {
    margin-bottom: var(--space-32);
}

.quick-access-grid {
  display: grid;
  /* auto-fit cards; allow slightly smaller cards on narrow screens */
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-20);
    margin-top: var(--space-24);
}

.quick-card {
    background: var(--color-surface);
    border: 2px solid var(--color-table-border);
    border-radius: var(--radius-lg);
  padding: var(--space-20);
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-standard);
  box-shadow: var(--shadow-sm);
  /* keep card content vertically aligned so buttons sit at the bottom */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 320px;
}

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

.quick-card-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-12);
    display: block;
}

.quick-card-title {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    margin: 0 0 var(--space-8) 0;
    font-family: var(--font-family-base);
}

.quick-card-description {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin: 0 0 var(--space-16) 0;
    line-height: var(--line-height-normal);
    font-family: var(--font-family-base);
}

.quick-card-button {
    background: var(--color-primary);
    color: var(--color-btn-primary-text);
    border: 2px solid var(--color-primary);
    padding: var(--space-8) var(--space-16);
    border-radius: var(--radius-base);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: background-color var(--duration-fast) var(--ease-standard);
    font-family: var(--font-family-base);
  /* ensure button sits at the bottom of flex column */
  margin-top: auto;
  align-self: center;
}

.quick-card-button:hover {
    background: var(--color-primary-hover);
}

/* Net Worth Section */
.net-worth-section {
    margin-top: var(--space-32);
    padding: var(--space-32) 0;
}

.net-worth-card {
    background: var(--color-bg-5);
    border: 2px solid var(--color-table-border);
    border-radius: var(--radius-lg);
    padding: var(--space-32);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-md);
    transition: transform var(--duration-normal) var(--ease-standard);
}

.net-worth-card:hover {
    transform: translateY(-2px);
}

.net-worth-content {
    flex: 1;
}

.net-worth-title {
    font-size: var(--font-size-2xl);
    font-weight: var(--font-weight-bold);
    color: var(--color-text);
    margin: 0 0 var(--space-12) 0;
    font-family: var(--font-family-base);
}

.net-worth-description {
    font-size: var(--font-size-md);
    color: var(--color-text-secondary);
    margin: 0 0 var(--space-20) 0;
    line-height: var(--line-height-normal);
    font-family: var(--font-family-base);
}

.net-worth-btn {
    padding: var(--space-12) var(--space-24);
    font-size: var(--font-size-lg);
    font-family: var(--font-family-base);
    border: 2px solid var(--color-primary);
}

.net-worth-icon {
    font-size: 4rem;
    margin-left: var(--space-24);
}

/* Categories Section */
.categories-section {
    margin-top: var(--space-32);
}

.categories-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-16);
}

.category-section {
    background: var(--color-surface);
    border: 2px solid var(--color-table-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.category-header {
    display: flex;
    align-items: center;
    padding: var(--space-16) var(--space-20);
    cursor: pointer;
    background: var(--color-background);
    border-bottom: 1px solid var(--color-table-border);
    transition: background-color var(--duration-fast) var(--ease-standard);
}

.category-header:hover {
    background: var(--color-secondary);
}

.category-header.active {
    background: var(--color-secondary);
}

.category-icon {
    font-size: 1.5rem;
    margin-right: var(--space-12);
}

.category-title {
    flex: 1;
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    margin: 0;
    font-family: var(--font-family-base);
}

.category-chevron {
    font-size: var(--font-size-lg);
    color: var(--color-text-secondary);
    transition: transform var(--duration-normal) var(--ease-standard);
}

.category-header.active .category-chevron {
    transform: rotate(180deg);
}

.category-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--duration-normal) var(--ease-standard);
    background: var(--color-surface);
}

.category-content.active {
    max-height: 1000px;
}

.category-calculators {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-16);
    padding: var(--space-20);
}

.calculator-card {
    background: var(--color-background);
    border: 2px solid var(--color-table-border);
    border-radius: var(--radius-base);
    padding: var(--space-16);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-standard);
}

.calculator-card-top {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  margin-bottom: var(--space-8);
}

.calculator-card-icon {
  font-size: 1.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-table-border);
}

.calculator-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary);
}

.calculator-card-title {
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-medium);
    color: var(--color-text);
    margin: 0 0 var(--space-6) 0;
    font-family: var(--font-family-base);
}

.calculator-card-description {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin: 0 0 var(--space-12) 0;
    line-height: var(--line-height-normal);
    font-family: var(--font-family-base);
}

.calculator-card-button {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
    padding: var(--space-6) var(--space-12);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-standard);
    font-family: var(--font-family-base);
}

.calculator-card-button:hover {
    background: var(--color-primary);
    color: var(--color-btn-primary-text);
}

/* Footer */
.footer {
    background: var(--color-surface);
    border-top: 2px solid var(--color-table-border-strong);
    padding: var(--space-24) 0;
    margin-top: var(--space-32);
}

.footer-ad-container {
    margin-bottom: var(--space-24);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.footer-content {
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-24);
    margin-bottom: var(--space-16);
}

.footer-link {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: var(--font-size-sm);
    transition: color var(--duration-fast) var(--ease-standard);
    font-family: var(--font-family-base);
}

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

.footer-text {
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin: 0;
    font-family: var(--font-family-base);
}

/* Responsive Design */
@media (max-width: 768px) {
    .calculator-layout {
        grid-template-columns: 1fr;
    }
    
  .calculator-sidebar {
    position: static;
    /* Avoid using `min-height: auto` — use 0 for broad browser support */
    min-height: 0;
    order: 2;
    padding: var(--space-16);
  }
    
    .calculator-main {
        order: 1;
        padding: var(--space-16);
    }
    
    .calculator-grid {
        grid-template-columns: 1fr;
        gap: var(--space-16);
    }
    
    .calculator-results-section {
        order: 2;
    }
    
    .calculator-chart-section {
        order: 3;
    }
    
    .calculator-form-section {
        order: 1;
    }
    
    .results-card,
    .chart-card {
        position: static;
    }
    
    .home-layout {
        grid-template-columns: 1fr;
        padding: var(--space-16);
        gap: var(--space-24);
    }
    
    .home-sidebar {
        order: 1;
        position: static;
    }
    
    .home-main {
        order: 0;
    }
    
    .header-content {
        flex-direction: column;
        text-align: center;
    }
  .site-logo {
    height: 44px;
  }

    /* Fixed global right ad (appears below header, on right side of viewport) */
    /* Global fixed right ad removed; sidebar ad containers will be sized to fit available space */

    /* Ensure sidebar ad banners and placeholders fill the container area */
    .sidebar-ad-container,
    .adsense-banner {
      width: 100%;
    }
    .sidebar-ad-container .ad-placeholder,
    .adsense-banner .ad-placeholder {
      width: 100%;
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
    }
    
    .search-container {
        min-width: 100%;
        max-width: 400px;
    }
    
    .quick-access-grid {
        grid-template-columns: 1fr;
    }
    
    .category-calculators {
        grid-template-columns: 1fr;
    }
    
    .footer-links {
        flex-direction: column;
        gap: var(--space-12);
    }
    
    .section-title {
        font-size: var(--font-size-xl);
    }
    
    .site-title {
        font-size: var(--font-size-2xl);
    }
    
    .net-worth-card {
        flex-direction: column;
        text-align: center;
    }
    
    .net-worth-icon {
        margin-left: 0;
        margin-top: var(--space-16);
    }
    
    .sidebar-banner .ad-placeholder {
        width: 100%;
        max-width: 300px;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .calculator-layout {
    /* On medium screens, hide right ad and keep left sidebar + main */
    grid-template-columns: 250px 1fr;
  }
    
    .calculator-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-16);
    }
    
    .calculator-results-section {
        grid-column: 1 / 3;
        order: 3;
    }
    
    .calculator-form-section {
        order: 1;
    }
    
    .calculator-chart-section {
        order: 2;
    }
    
  .home-layout {
    /* Left sidebar + main for medium screens */
    grid-template-columns: 300px 1fr;
    gap: var(--space-24);
  }
    
    .quick-access-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .category-calculators {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

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

/* Search highlighting */
.calculator-card.hidden,
.quick-card.hidden {
    display: none;
}

.calculator-card.highlight,
.quick-card.highlight {
    border-color: var(--color-primary);
    background: var(--color-bg-1);
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.loading .calculate-btn {
    cursor: not-allowed;
}

.loading .calculate-btn:after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Print Styles for PDF */
@media print {
    .calculator-sidebar,
    .home-sidebar,
    .sidebar-ad-container,
    .footer-ad-container,
    .adsense-banner,
    .back-btn,
    .download-btn {
        display: none !important;
    }
    
    .calculator-layout {
        grid-template-columns: 1fr;
    }
    
    .calculator-grid {
        grid-template-columns: 1fr;
    }
}

/* Override all elements to use sans-serif fonts */
* {
    font-family: var(--font-family-base) !important;
}

/* Specific elements that need sans-serif enforcement */
h1, h2, h3, h4, h5, h6,
p, span, div, label, input, select, textarea, button,
.form-control, .btn, .card {
    font-family: var(--font-family-base) !important;
}