/* =========================================================
   CALCULATOR_SATHI — PREMIUM DESIGN SYSTEM
   "Digital Display" identity: deep navy instrument casing +
   amber/gold LED-readout accent, tabular numerals for results.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Space+Mono:wght@400;700&display=swap');

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

:root {
    /* Core palette */
    --primary-color: #1B2A4A;      /* deep navy — headings, active states */
    --primary-dark: #101A30;
    --secondary-color: #5B6B8C;    /* slate — secondary icons/text */
    --secondary-dark: #3E4A66;
    --accent-color: #F5A623;       /* amber / LED gold — the signature accent */
    --accent-dark: #D98C0F;
    --accent-soft: #FFF1D6;

    --text-primary: #10182B;
    --text-secondary: #5B6478;
    --text-light: #94A0B8;

    --bg-primary: #FFFFFF;
    --bg-secondary: #F5F7FB;
    --bg-dark: #ECEFF6;
    --border-color: #E3E7F0;

    --shadow-sm: 0 1px 2px 0 rgba(16, 24, 43, 0.05);
    --shadow-md: 0 6px 16px -4px rgba(16, 24, 43, 0.10);
    --shadow-lg: 0 16px 32px -8px rgba(16, 24, 43, 0.16);
    --shadow-xl: 0 24px 48px -12px rgba(16, 24, 43, 0.22);
    --shadow-glow: 0 0 0 1px rgba(245, 166, 35, 0.35), 0 12px 30px -8px rgba(245, 166, 35, 0.35);

    --radius-sm: 0.6rem;
    --radius-md: 1rem;
    --radius-lg: 1.35rem;

    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

.dark-mode {
    --primary-color: #FFC85C;
    --primary-dark: #F5A623;
    --secondary-color: #A9B4C9;
    --secondary-dark: #C8D0E0;
    --accent-color: #5AD1E6;       /* cool cyan counter-accent on dark instrument face */
    --accent-dark: #33B4CC;
    --accent-soft: rgba(90, 209, 230, 0.12);

    --text-primary: #F4F6FB;
    --text-secondary: #B7C0D6;
    --text-light: #8993AC;

    --bg-primary: #0A0E1A;
    --bg-secondary: #101526;
    --bg-dark: #171E33;
    --border-color: #232B45;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 6px 16px -4px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 16px 32px -8px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 24px 48px -12px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 0 1px rgba(255, 200, 92, 0.3), 0 0 32px -4px rgba(255, 200, 92, 0.35);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.35s var(--ease), color 0.35s var(--ease);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: 'Manrope', sans-serif;
    letter-spacing: -0.02em;
}

/* Numerals throughout feel like a calculator readout */
strong, .calc-main-result-value, .calculator-count strong, .stat strong {
    font-variant-numeric: tabular-nums;
}

::selection {
    background: var(--accent-color);
    color: #10182B;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 999px;
    border: 2px solid var(--bg-secondary);
}
::-webkit-scrollbar-thumb:hover { background: var(--accent-color); }

:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
    border-radius: 4px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* =========================================================
   HEADER
   ========================================================= */

.header {
    background-color: color-mix(in srgb, var(--bg-primary) 88%, transparent);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 1px 0 rgba(16, 24, 43, 0.02);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0.85rem 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    cursor: pointer;
}

.logo svg {
    stroke: var(--accent-color);
    filter: drop-shadow(0 0 6px rgba(245, 166, 35, 0.35));
}

.tagline {
    font-size: 0.72rem;
    color: var(--text-light);
    font-weight: 600;
    letter-spacing: 0.02em;
    padding-left: 0.75rem;
    border-left: 1px solid var(--border-color);
}

.nav-menu {
    display: flex;
    gap: 1.75rem;
    flex-wrap: wrap;
}

.nav-item {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.92rem;
    transition: color 0.25s var(--ease);
    padding: 0.5rem 0;
    position: relative;
}

.nav-item:hover {
    color: var(--text-primary);
}

.nav-item.active {
    color: var(--text-primary);
}

.nav-item.active::after,
.nav-item:hover::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-color);
    border-radius: 1px;
    box-shadow: 0 0 8px rgba(245, 166, 35, 0.6);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.icon-button {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.65rem;
    padding: 0.55rem;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s var(--ease);
}

.icon-button:hover {
    background-color: var(--primary-color);
    color: var(--accent-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.mobile-toggle {
    display: none;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.65rem;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.25s var(--ease);
}

.mobile-toggle:hover {
    background-color: var(--primary-color);
    color: var(--accent-color);
    border-color: var(--primary-color);
}

/* Mobile Navigation */
.mobile-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100vh;
    background-color: var(--bg-primary);
    z-index: 2000;
    transition: right 0.35s var(--ease);
    display: flex;
    flex-direction: column;
    padding: 2rem;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.18);
    visibility: hidden;
    pointer-events: none;
}

.mobile-nav.open {
    right: 0;
    visibility: visible;
    pointer-events: auto;
}

.mobile-close {
    align-self: flex-end;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    padding: 0.6rem;
    border-radius: 0.65rem;
    transition: all 0.25s var(--ease);
}

.mobile-close:hover {
    background-color: var(--primary-color);
    color: var(--accent-color);
}

.mobile-nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 1rem;
}

.mobile-nav-item {
    text-decoration: none;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 700;
    padding: 1rem 1.15rem;
    border-radius: 0.9rem;
    transition: all 0.25s var(--ease);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

.mobile-nav-item:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: var(--accent-color);
    transform: translateX(6px);
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
        gap: 0.75rem;
    }
    .logo-container { flex: 1; min-width: 0; }
    .tagline { display: none; }
    .nav-menu { display: none; }
    .mobile-toggle { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; }
    .header-actions { width: auto; justify-content: flex-end; flex-wrap: nowrap; }
    .icon-button { width: 40px; height: 40px; padding: 0.5rem; }
}

@media (max-width: 480px) {
    .header { padding: 0.6rem 0; }
    .header-content { padding-left: 0.75rem; padding-right: 0.75rem; }
    .icon-button, .mobile-toggle { width: 38px; height: 38px; }
    .mobile-nav { padding: 1.5rem; }
}

/* =========================================================
   HERO
   ========================================================= */

.hero {
    position: relative;
    z-index: 2;
    padding: 6rem 0 2.5rem;
    overflow: visible;
    background: var(--bg-primary);
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(600px circle at 12% 20%, rgba(245, 166, 35, 0.12), transparent 60%),
        radial-gradient(500px circle at 88% 82%, rgba(27, 42, 74, 0.10), transparent 60%);
    animation: heroDrift 16s ease-in-out infinite alternate;
    z-index: 0;
}

.dark-mode .hero::before {
    background:
        radial-gradient(600px circle at 12% 20%, rgba(255, 200, 92, 0.10), transparent 60%),
        radial-gradient(500px circle at 88% 82%, rgba(90, 209, 230, 0.10), transparent 60%);
}

@keyframes heroDrift {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(-2%, 2%) scale(1.05); }
}

.hero-content {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 3.5rem;
    align-items: center;
    width: min(100%, 1360px);
    margin-inline: auto;
    padding-inline: clamp(1rem, 4vw, 3.5rem);
    box-sizing: border-box;
}

.hero-text { text-align: left; }

.hero-trust-note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    margin: -1rem 0 1.25rem;
    color: var(--text-secondary);
    font-size: .82rem;
    font-weight: 650;
}
.hero-trust-note span:first-child { color: #16835d; font-weight: 900; }
.hero-trust-note span[aria-hidden="true"]:not(:first-child) { color: var(--text-light); }

.hero h1 {
    font-size: clamp(2.1rem, 4.2vw, 3.4rem);
    font-weight: 800;
    margin-bottom: 1.1rem;
    line-height: 1.12;
    color: var(--text-primary);
    opacity: 0;
    animation: heroRise 0.7s var(--ease) 0.05s forwards;
}

.highlight {
    background: linear-gradient(100deg, var(--text-primary) 45%, var(--accent-color) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block;
}

.dark-mode .highlight {
    background: linear-gradient(100deg, #FFFFFF 40%, var(--accent-color) 100%);
    -webkit-background-clip: text;
    background-clip: text;
}

.hero > p,
.hero-text > p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.7;
    max-width: 520px;
    opacity: 0;
    animation: heroRise 0.7s var(--ease) 0.16s forwards;
}

.search-container {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    max-width: 520px;
    position: relative;
    z-index: 3;
    opacity: 0;
    animation: heroRise 0.7s var(--ease) 0.26s forwards;
}

.search-input {
    flex: 1;
    padding: 1rem 1.25rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.25s var(--ease);
    box-shadow: var(--shadow-sm);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(245, 166, 35, 0.15), var(--shadow-md);
    transform: translateY(-1px);
}

.search-btn {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 700;
    border-radius: var(--radius-md);
    background: linear-gradient(120deg, var(--primary-color), var(--primary-dark));
    border: 1px solid var(--primary-dark);
    color: #fff;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
    box-shadow: var(--shadow-md);
}

.search-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(245, 166, 35, 0.55) 50%, transparent 70%);
    transform: translateX(-120%);
    transition: transform 0.6s var(--ease);
}

.search-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.search-btn:hover::after {
    transform: translateX(120%);
}

.popular-searches {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    opacity: 0;
    animation: heroRise 0.7s var(--ease) 0.36s forwards;
}

.popular-searches .tag {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1.15rem;
    border-radius: 2rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.25s var(--ease);
    font-weight: 600;
}

.popular-searches .tag:hover {
    background: var(--primary-color);
    color: var(--accent-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

/* ---- Hero visual: animated "digital display" device ---- */

.hero-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.75rem;
    opacity: 0;
    animation: heroRise 0.8s var(--ease) 0.2s forwards;
}

.device-display {
    width: 100%;
    max-width: 360px;
    background: linear-gradient(165deg, var(--primary-color), var(--primary-dark));
    border-radius: 1.5rem;
    padding: 1.1rem;
    box-shadow: var(--shadow-xl);
    position: relative;
}

.device-display::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 1.5rem;
    padding: 1px;
    background: linear-gradient(165deg, rgba(245, 166, 35, 0.55), transparent 40%);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.device-display-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.15rem 0.3rem 0.9rem;
}

.device-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
}

.device-display-label {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.45);
}

.device-screen {
    background: #0A0E1A;
    border-radius: 1rem;
    padding: 2rem 1.5rem;
    position: relative;
    height: 128px;
    overflow: hidden;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.ticker {
    position: relative;
    width: 100%;
    height: 100%;
}

.ticker-item {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    opacity: 0;
    transform: translateY(10px);
    animation: tickerCycle 12s infinite;
}

.ticker-item:nth-child(1) { animation-delay: 0s; }
.ticker-item:nth-child(2) { animation-delay: 3s; }
.ticker-item:nth-child(3) { animation-delay: 6s; }
.ticker-item:nth-child(4) { animation-delay: 9s; }

.ticker-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: rgba(245, 166, 35, 0.75);
    margin-bottom: 0.35rem;
}

.ticker-value {
    font-family: 'Space Mono', monospace;
    font-size: 2rem;
    font-weight: 700;
    color: #FFC85C;
    text-shadow: 0 0 18px rgba(255, 200, 92, 0.45);
}

.ticker-unit {
    font-size: 1rem;
    color: rgba(255, 200, 92, 0.6);
    margin-left: 0.25rem;
}

@keyframes tickerCycle {
    0%, 3% { opacity: 0; transform: translateY(10px); }
    8%, 20% { opacity: 1; transform: translateY(0); }
    25%, 100% { opacity: 0; transform: translateY(-10px); }
}

@media (prefers-reduced-motion: reduce) {
    .ticker-item { animation: none; opacity: 0; }
    .ticker-item:nth-child(1) { opacity: 1; transform: none; }
    .hero::before { animation: none; }
}

.feature-points {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem;
    width: 100%;
    max-width: 360px;
}

.feature-point {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.95rem 1rem;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    transition: all 0.25s var(--ease);
    box-shadow: var(--shadow-sm);
}

.feature-point:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-color);
}

.feature-icon {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.6rem;
    background: var(--accent-soft);
    color: var(--accent-dark);
}

.dark-mode .feature-icon { color: var(--accent-color); }

.feature-point span {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

@media (max-width: 900px) {
    .hero-content { grid-template-columns: 1fr; }
    .hero-visual { order: -1; }
}

@media (max-width: 768px) {
    .hero { padding: 3rem 0 2.5rem; }
    .hero h1 { font-size: 2rem; }
    .hero > p, .hero-text > p { font-size: 1rem; }
    .search-container { flex-direction: column; }
}

/* =========================================================
   FOOTER
   ========================================================= */

.footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 3.5rem 0 1.5rem;
    margin-top: 4rem;
    position: relative;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.footer-section p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.footer-section a {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 0.6rem;
    transition: color 0.2s var(--ease);
    width: fit-content;
}

.footer-section a:hover {
    color: var(--accent-dark);
}

.dark-mode .footer-section a:hover { color: var(--accent-color); }

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-light);
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .footer-content { grid-template-columns: 1fr; text-align: center; }
    .footer-section a { margin-left: auto; margin-right: auto; }
}

/* =========================================================
   SEARCH RESULTS DROPDOWN
   ========================================================= */

.search-container { position: relative; }

.search-results {
    position: absolute;
    top: calc(100% + 0.6rem);
    left: 0;
    right: 0;
    z-index: 1500;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: searchDrop 0.22s var(--ease);
}

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

.search-result {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: background-color 0.2s var(--ease);
}

.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--bg-secondary); }
.search-result:focus {
    outline: none;
    background: var(--bg-secondary);
    box-shadow: inset 3px 0 0 var(--accent-color);
}

.search-result-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    color: var(--accent-color);
    border-radius: 0.7rem;
    font-size: 1.05rem;
}

.search-result-content { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.search-result-content strong {
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-result-content small { margin-top: 2px; color: var(--text-secondary); font-size: 0.75rem; }
.search-result-arrow { font-size: 1.2rem; color: var(--accent-dark); transition: transform 0.2s var(--ease); }
.search-result:hover .search-result-arrow { transform: translateX(4px); }

@media (max-width: 768px) {
    .search-results { max-height: 60vh; overflow-y: auto; }
}

/* =========================================================
   NOTIFICATIONS / TOAST
   ========================================================= */

.calchub-notification {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 9999;
    max-width: min(420px, calc(100vw - 2rem));
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--accent-color);
    border-radius: 0.9rem;
    box-shadow: var(--shadow-xl);
    animation: notificationIn 0.3s var(--ease);
}

.calchub-notification.warning { border-left-color: #EF4444; }
.calchub-notification.calculator { border-left-color: var(--primary-color); }

.calchub-notification.hide {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

.calchub-notification span { flex: 1; font-size: 0.9rem; line-height: 1.45; }

.calchub-notification button {
    width: 28px; height: 28px; flex: 0 0 28px;
    border: none; border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer; font-size: 1.2rem; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s var(--ease);
}

.calchub-notification button:hover { background: var(--primary-color); color: var(--accent-color); }

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

@media (max-width: 768px) {
    .calchub-notification { left: 1rem; right: 1rem; bottom: 1rem; max-width: none; }
}

/* =========================================================
   CALCULATOR DIRECTORY SECTION
   ========================================================= */

.calculator-directory-section {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 2.5rem clamp(1rem, 4vw, 3.5rem) 6rem;
    box-sizing: border-box;
    position: relative;
    display: block;
}

.calculator-directory-section .section-header,
.calculator-directory-section .calculator-categories,
.calculator-directory-section > #calculator-directory {
    width: 100%;
    max-width: 1360px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.calculator-directory-section .section-header {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2.25rem;
}

.section-label {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--accent-dark);
    background: var(--accent-soft);
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    margin-bottom: 0.75rem;
}

.dark-mode .section-label { color: var(--accent-color); }

.calculator-directory-section .section-header h2 {
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    color: var(--text-primary);
    font-weight: 800;
}

.calculator-directory-section .section-header p {
    color: var(--text-secondary);
    max-width: 480px;
    margin-top: 0.4rem;
}

/* The homepage markup nests an empty legacy grid inside the header;
   script.js hides it, so it never affects layout. */
#calculatorGrid { display: none !important; }

.calculator-count {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.15rem;
}

.calculator-count strong {
    font-family: 'Space Mono', monospace;
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(120deg, var(--primary-color), var(--accent-dark));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.dark-mode .calculator-count strong {
    background: linear-gradient(120deg, #FFFFFF, var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
}

.calculator-count span {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-light);
    text-transform: uppercase;
}

/* ---- Category filter chips ---- */

.calculator-categories {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-bottom: 2.5rem;
    padding-bottom: 0.25rem;
}

.category-card {
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: 999px;
    padding: 0.65rem 1.1rem;
    cursor: pointer;
    transition: all 0.25s var(--ease);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.category-card strong {
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 700;
}

.category-card span {
    color: var(--text-light);
    font-size: 0.76rem;
    background: var(--bg-secondary);
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
}

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

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

.category-card.active strong { color: #fff; }
.category-card.active span { background: rgba(255, 255, 255, 0.15); color: var(--accent-color); }

@media (max-width: 600px) {
    .calculator-categories {
        overflow-x: auto;
        flex-wrap: nowrap;
        scrollbar-width: thin;
    }
    .category-card { flex: 0 0 auto; }
}

/* ---- Calculator grid & cards ----
   Single, clean, gap-filling responsive grid — replaces every
   earlier fixed-column / !important override. */

.calculator-grid,
#calculator-directory {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    align-items: stretch;
}

.calculator-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    gap: 1.1rem;
    min-height: 180px;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), border-color 0.3s var(--ease);
    opacity: 0;
    animation: cardIn 0.5s var(--ease) forwards;
}

.calculator-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(245, 166, 35, 0.06), transparent 55%);
    opacity: 0;
    transition: opacity 0.3s var(--ease);
    pointer-events: none;
}

.calculator-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color);
    box-shadow: var(--shadow-lg);
}

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

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

.calculator-card:nth-child(1)  { animation-delay: 0.02s; }
.calculator-card:nth-child(2)  { animation-delay: 0.05s; }
.calculator-card:nth-child(3)  { animation-delay: 0.08s; }
.calculator-card:nth-child(4)  { animation-delay: 0.11s; }
.calculator-card:nth-child(5)  { animation-delay: 0.14s; }
.calculator-card:nth-child(6)  { animation-delay: 0.17s; }
.calculator-card:nth-child(7)  { animation-delay: 0.20s; }
.calculator-card:nth-child(8)  { animation-delay: 0.23s; }
.calculator-card:nth-child(9)  { animation-delay: 0.26s; }
.calculator-card:nth-child(10) { animation-delay: 0.29s; }
.calculator-card:nth-child(11) { animation-delay: 0.32s; }
.calculator-card:nth-child(12) { animation-delay: 0.35s; }
.calculator-card:nth-child(n+13) { animation-delay: 0.38s; }

.calculator-card-icon {
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    border-radius: 0.9rem;
    font-size: 1.5rem;
    position: relative;
    z-index: 1;
    transition: transform 0.3s var(--ease);
}

.calculator-card:hover .calculator-card-icon {
    transform: scale(1.08) rotate(-4deg);
}

.calculator-card-content { min-width: 0; flex: 1; position: relative; z-index: 1; }

.calculator-card h3 {
    margin: 0 0 0.4rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.calculator-card p {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin: 0 0 .65rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.45;
}

.calculator-card-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--accent-dark);
    font-weight: 800;
    font-size: 0.84rem;
    text-decoration: none;
    transition: gap 0.2s var(--ease);
}

.dark-mode .calculator-card-link { color: var(--accent-color); }

.calculator-card-link:hover { gap: 0.6rem; }

.calculator-card-link span { transition: transform 0.2s var(--ease); }
.calculator-card-link:hover span { transform: translateX(2px); }

/* ---- Empty state ---- */

.directory-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-lg);
}

.directory-empty h3 { margin: 0 0 0.5rem; color: var(--text-primary); }
.directory-empty p { margin: 0; color: var(--text-secondary); }

/* ---- Responsive grid steps ---- */

@media (max-width: 900px) {
    .calculator-directory-section { padding: 2.75rem 1.5rem 5rem; }
    .calculator-grid, #calculator-directory {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: .9rem;
    }
}

@media (max-width: 700px) {
    .hero-content { grid-template-columns: minmax(0, 1fr); }
    .hero-visual { grid-column: 1; grid-row: auto; order: -1; align-items: center; }
    .hero-text { grid-column: 1; grid-row: auto; }
}

@media (max-width: 600px) {
    .calculator-directory-section { padding: 1.75rem 1rem 4rem; }
    .section-header { flex-direction: column; align-items: flex-start; }
    .calculator-count { align-items: flex-start; }
    .calculator-grid, #calculator-directory {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }
    .calculator-card { min-height: auto; padding: 1.1rem; flex-direction: column; }
    .calculator-card-icon { width: 42px; height: 42px; flex-basis: 42px; font-size: 1.25rem; }
}

/* Six-column directory on desktop, with card content stacked to keep
   calculator titles readable in the narrower columns. */
@media (min-width: 1200px) {
    .calculator-grid,
    #calculator-directory {
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: .75rem;
    }
    .calculator-card {
        min-height: 220px;
        padding: 1.15rem;
        flex-direction: column;
        gap: .75rem;
    }
    .calculator-card-icon { width: 44px; height: 44px; flex-basis: 44px; font-size: 1.3rem; }
    .calculator-card p { margin-bottom: .7rem; font-size: .82rem; }
}

@media (min-width: 901px) and (max-width: 1199px) {
    .calculator-grid,
    #calculator-directory { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Prevent accidental horizontal overflow */
html, body { width: 100%; max-width: 100%; overflow-x: hidden; }

/* Calculator Sathi finishing and accessibility */
.calculator-favorite {
    position: absolute;
    z-index: 2;
    top: .8rem;
    right: .8rem;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    background: var(--bg-primary);
    color: var(--accent-dark);
    font-size: 1.2rem;
    cursor: pointer;
}
.calculator-favorite[aria-pressed="true"] { color: #b45309; background: var(--accent-soft); }
.logo { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
    outline: 3px solid var(--accent-color);
    outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* Shared educational guide used by calculator pages. */
.calculator-guide {
    margin: 1.5rem auto 2rem;
    max-width: 1100px;
    padding: clamp(1.25rem, 3vw, 2rem);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 1.25rem;
    background: var(--bg-primary, #fff);
    box-shadow: 0 10px 28px rgba(15, 23, 42, .05);
}
.calculator-guide h2,
.calculator-guide h3 { color: var(--text-primary, #172033); line-height: 1.35; }
.calculator-guide h2 { margin: 0 0 .8rem; font-size: clamp(1.25rem, 2.5vw, 1.6rem); }
.calculator-guide h3 { margin: 1.25rem 0 .35rem; font-size: 1rem; }
.calculator-guide p { max-width: 78ch; margin: 0; color: var(--text-secondary, #526078); line-height: 1.75; }
.calculator-guide p + h3 { margin-top: 1.2rem; }

/* Tighter shared spacing for calculator pages without shrinking touch targets. */
.calc-page .calc-grid { gap: clamp(.75rem, 1.5vw, 1.25rem); }
.calc-page .calc-card { padding: clamp(1rem, 2vw, 1.5rem); }

@media (max-width: 800px) {
    .calc-page .calc-grid,
    .loan-page .loan-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 700px) {
    .hero { padding: .8rem 0 .5rem; }
    .hero-content { gap: 0; }
    .hero-visual { display: none; }
    .hero-text { order: 0; }
    .hero h1 { margin: 0 0 .45rem; font-size: clamp(1.55rem, 7vw, 2rem); line-height: 1.08; }
    .hero > p, .hero-text > p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin: 0 0 .65rem; font-size: .9rem; line-height: 1.4; }
    .hero-trust-note { margin: 0 0 .55rem; font-size: .7rem; }
    .search-container { flex-direction: row; gap: .5rem; margin: 0 0 .5rem; }
    .search-input { min-width: 0; min-height: 46px; padding: .65rem .8rem; font-size: .9rem; }
    .search-btn { flex: 0 0 auto; padding: .65rem .9rem; font-size: .9rem; }
    .popular-searches { flex-wrap: nowrap; overflow-x: auto; margin-top: .4rem; padding: 0 0 .2rem; gap: .4rem; scrollbar-width: none; }
    .popular-searches::-webkit-scrollbar { display: none; }
    .popular-searches .tag { flex: 0 0 auto; padding: .35rem .65rem; font-size: .72rem; }
    .calculator-directory-section { padding: .85rem .85rem 3rem; }
    .calculator-directory-section .section-header { flex-direction: row; align-items: center; gap: .5rem; margin-bottom: .7rem; }
    .calculator-directory-section .section-header p { display: none; }
    .calculator-directory-section .section-header h2 { margin: .3rem 0 0; font-size: 1.35rem; }
    .calculator-count strong { font-size: 1.5rem; }
    .calculator-grid, #calculator-directory { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
    .calculator-card { min-height: 88px; padding: .72rem; flex-direction: row; align-items: flex-start; gap: .55rem; border-radius: .85rem; }
    .calculator-card-icon { width: 34px; height: 34px; flex-basis: 34px; border-radius: .65rem; font-size: 1.05rem; }
    .calculator-card h3 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin: 0 0 .2rem; font-size: .82rem; line-height: 1.25; }
    .calculator-card p { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden; margin: 0 0 .25rem; font-size: .68rem; line-height: 1.25; }
    .calculator-card-link { gap: .2rem; font-size: .68rem; }
    .calculator-favorite { top: .4rem; right: .4rem; width: 1.8rem; height: 1.8rem; font-size: 1rem; }
    .quick-page { padding: .75rem .75rem 3rem !important; }
    .quick-heading { margin-bottom: .75rem !important; }
    .quick-heading h1 { margin: .25rem 0; font-size: 1.65rem !important; }
    .quick-heading p { font-size: .85rem; line-height: 1.35; }
    .quick-grid { grid-template-columns: minmax(0, 1fr) !important; gap: .6rem !important; }
    .quick-panel { padding: .85rem !important; }
    #quick-form { gap: .55rem !important; }
    #quick-form label { gap: .25rem !important; font-size: .9rem; }
    #quick-form input { padding: .65rem .75rem !important; }
    .quick-results { gap: .45rem !important; }
    .quick-result { padding: .65rem .75rem !important; }
    .calc-page .calc-header { margin-bottom: .7rem; }
    .calc-page .calc-header h1 { margin-bottom: .3rem; font-size: clamp(1.6rem, 7vw, 2rem); }
    .calc-page .calc-header p { font-size: .86rem; line-height: 1.4; }
    .calc-page .calc-grid { gap: .6rem; }
    .calc-page .calc-card { padding: .8rem; }
    .calc-page .calc-card h2 { margin-bottom: .65rem; font-size: 1.05rem; }
    .calc-page .calc-card .calc-field { margin-bottom: .65rem; }
    .calc-page .calc-input,
    .calc-page .calc-select { min-height: 42px; padding: .6rem .7rem; font-size: 16px; }
    .calc-page .calc-actions { gap: .5rem; margin-top: .65rem; }
    .calc-page .calc-btn { min-height: 42px; padding: .6rem .7rem; font-size: .88rem; }
    .mobile-result-inline { margin: .65rem 0 0 !important; padding: .8rem !important; border-radius: .8rem !important; }
    .mobile-result-inline .calc-main-result-value,
    .mobile-result-inline .main-result-value,
    .mobile-result-inline > strong { font-size: clamp(1.35rem, 6vw, 1.8rem) !important; word-break: break-word; }
    .loan-page .loan-header { margin-bottom: .7rem; }
    .loan-page .loan-header h1 { margin-bottom: .3rem; font-size: 1.7rem; }
    .loan-page .loan-header p { font-size: .85rem; line-height: 1.4; }
    .loan-page .loan-grid { gap: .6rem; }
    .loan-page .loan-card { padding: .8rem; }
    .loan-page .loan-card h2 { margin-bottom: .65rem; font-size: 1.05rem; }
    .loan-page .loan-field { margin-bottom: .65rem; }
    .loan-page .loan-result-main { margin-top: .65rem; padding: .8rem; }
    .calculator-page .calculator-header { padding-top: .75rem; }
    .calculator-page .calculator-header h1 { font-size: 1.7rem; }
    .calculator-page .input-panel,
    .calculator-page .result-panel { padding: .8rem; }
    .calculator-page .panel-description { margin-bottom: .6rem; font-size: .82rem; }
    .calculator-page .input-group { margin-bottom: .65rem; }
}

@media (max-width: 380px) {
    .hero-trust-note { display: none; }
    .age-fields { grid-template-columns: 1fr; }
    .calculator-card { min-height: 82px; padding: .62rem; gap: .45rem; }
    .calculator-card h3 { font-size: .76rem; }
    .calculator-card p { display: none; }
}

