/* ═══════════════════════════════════════════════════════════════
   style.css — CalculatorFix.com
   Global Design System + Header Styles
   ═══════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────
   0. CSS CUSTOM PROPERTIES (Design Tokens)
───────────────────────────────────────────── */
:root {
    /* Colors */
    --clr-bg:          #ffffff;
    --clr-bg-soft:     #f9fafb;
    --clr-bg-muted:    #f5f7fa;
    --clr-border:      #e5e9f0;
    --clr-border-soft: #eef1f6;

    --clr-text-primary:   #0f172a;
    --clr-text-secondary: #475569;
    --clr-text-muted:     #94a3b8;

    --clr-accent:        #0ea5e9;   /* sky-500  */
    --clr-accent-dark:   #0284c7;   /* sky-600  */
    --clr-accent-light:  #e0f2fe;   /* sky-100  */
    --clr-teal:          #14b8a6;   /* teal-500 */
    --clr-teal-light:    #ccfbf1;   /* teal-100 */
    --clr-green:         #22c55e;   /* green-500*/
    --clr-green-light:   #dcfce7;   /* green-100*/

    /* Typography */
    --font-head: 'Sora', sans-serif;
    --font-body: 'DM Sans', sans-serif;

    --text-xs:   0.75rem;
    --text-sm:   0.875rem;
    --text-base: 1rem;
    --text-lg:   1.125rem;
    --text-xl:   1.25rem;
    --text-2xl:  1.5rem;
    --text-3xl:  1.875rem;
    --text-4xl:  2.25rem;
    --text-5xl:  3rem;

    --fw-normal:    400;
    --fw-medium:    500;
    --fw-semibold:  600;
    --fw-bold:      700;
    --lh-tight:     1.2;
    --lh-snug:      1.375;
    --lh-normal:    1.6;
    --lh-relaxed:   1.75;

    /* Spacing scale */
    --sp-1:  0.25rem;
    --sp-2:  0.5rem;
    --sp-3:  0.75rem;
    --sp-4:  1rem;
    --sp-5:  1.25rem;
    --sp-6:  1.5rem;
    --sp-8:  2rem;
    --sp-10: 2.5rem;
    --sp-12: 3rem;
    --sp-16: 4rem;
    --sp-20: 5rem;
    --sp-24: 6rem;

    /* Radii */
    --r-sm:   0.375rem;
    --r-md:   0.625rem;
    --r-lg:   0.875rem;
    --r-xl:   1.25rem;
    --r-full: 9999px;

    /* Shadows */
    --shadow-xs: 0 1px 2px 0 rgb(15 23 42 / 0.04);
    --shadow-sm: 0 2px 8px 0 rgb(15 23 42 / 0.06);
    --shadow-md: 0 4px 16px 0 rgb(15 23 42 / 0.08);
    --shadow-lg: 0 8px 32px 0 rgb(15 23 42 / 0.1);
    --shadow-focus: 0 0 0 3px rgb(14 165 233 / 0.25);

    /* Transitions */
    --ease:      cubic-bezier(0.4, 0, 0.2, 1);
    --ease-out:  cubic-bezier(0, 0, 0.2, 1);
    --dur-fast:  150ms;
    --dur-base:  220ms;
    --dur-slow:  350ms;

    /* Layout */
    --container-max: 1240px;
    --header-h:      68px;
    --sidebar-w:     280px;
}


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

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

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    font-weight: var(--fw-normal);
    line-height: var(--lh-normal);
    color: var(--clr-text-primary);
    background-color: var(--clr-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

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

a {
    color: inherit;
    text-decoration: none;
}

ul, ol { list-style: none; }

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

:focus-visible {
    outline: 2px solid var(--clr-accent);
    outline-offset: 3px;
    border-radius: var(--r-sm);
}


/* ─────────────────────────────────────────────
   2. UTILITY CLASSES
───────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--sp-6);
}

@media (max-width: 640px) {
    .container { padding-inline: var(--sp-4); }
}

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

.text-center  { text-align: center; }
.text-accent  { color: var(--clr-accent); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: 0.625rem var(--sp-5);
    border-radius: var(--r-md);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: var(--fw-semibold);
    line-height: 1;
    text-decoration: none;
    transition: background var(--dur-base) var(--ease),
                color var(--dur-base) var(--ease),
                box-shadow var(--dur-base) var(--ease),
                transform var(--dur-fast) var(--ease);
    user-select: none;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--clr-accent);
    color: #fff;
    box-shadow: 0 2px 10px rgb(14 165 233 / 0.3);
}

.btn-primary:hover, .btn-primary:focus-visible {
    background: var(--clr-accent-dark);
    box-shadow: 0 4px 16px rgb(14 165 233 / 0.4);
}

.btn-outline {
    background: transparent;
    color: var(--clr-accent);
    border: 1.5px solid var(--clr-accent);
}

.btn-outline:hover, .btn-outline:focus-visible {
    background: var(--clr-accent-light);
}

.btn-lg {
    padding: 0.875rem var(--sp-8);
    font-size: var(--text-base);
    border-radius: var(--r-lg);
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: var(--sp-1) var(--sp-3);
    border-radius: var(--r-full);
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.badge-accent {
    background: var(--clr-accent-light);
    color: var(--clr-accent-dark);
}

/* Section spacing */
.section { padding-block: var(--sp-20); }
.section-sm { padding-block: var(--sp-12); }

/* Divider */
.divider {
    width: 100%;
    height: 1px;
    background: var(--clr-border);
    border: none;
}


/* ─────────────────────────────────────────────
   3. SITE HEADER
───────────────────────────────────────────── */
.site-header {
    position: sticky;
    top: 0;
    z-index: 900;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--clr-border);
    height: var(--header-h);
    display: flex;
    align-items: center;
    transition: box-shadow var(--dur-base) var(--ease);
}

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

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-8);
    height: 100%;
}

/* ── Logo ── */
.site-logo {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-3);
    flex-shrink: 0;
    text-decoration: none;
    color: var(--clr-text-primary);
    transition: opacity var(--dur-fast) var(--ease);
}

.site-logo:hover { opacity: 0.85; }

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-text {
    font-family: var(--font-head);
    font-size: var(--text-xl);
    font-weight: var(--fw-semibold);
    letter-spacing: -0.02em;
    color: var(--clr-text-primary);
    white-space: nowrap;
}

.logo-text strong {
    font-weight: var(--fw-bold);
    color: var(--clr-accent);
}

/* ── Primary Nav ── */
.primary-nav {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.nav-list {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
    list-style: none;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--r-md);
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    color: var(--clr-text-secondary);
    text-decoration: none;
    transition: color var(--dur-fast) var(--ease),
                background var(--dur-fast) var(--ease);
    white-space: nowrap;
}

.nav-link:hover,
.nav-link[aria-current="page"] {
    color: var(--clr-accent);
    background: var(--clr-accent-light);
}

.nav-link .chevron {
    transition: transform var(--dur-base) var(--ease);
    opacity: 0.6;
    flex-shrink: 0;
}

/* ── Dropdown ── */
.nav-has-dropdown { position: relative; }

.nav-dropdown {
    position: absolute;
    top: calc(100% + var(--sp-2));
    right: 0;
    min-width: 210px;
    background: var(--clr-bg);
    border: 1px solid var(--clr-border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--sp-2);
    list-style: none;
    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity var(--dur-base) var(--ease),
                transform var(--dur-base) var(--ease),
                visibility 0s linear var(--dur-base);
    pointer-events: none;
}

/* Bridge the hover gap so moving mouse into the dropdown doesn't close it */
.nav-dropdown::before {
    content: '';
    position: absolute;
    top: calc(-1 * var(--sp-2));
    left: 0;
    right: 0;
    height: var(--sp-2);
}

.nav-has-dropdown:hover .nav-dropdown,
.nav-has-dropdown:focus-within .nav-dropdown,
.nav-has-dropdown.open .nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity var(--dur-base) var(--ease),
                transform var(--dur-base) var(--ease);
    pointer-events: all;
}

.nav-has-dropdown:hover .nav-link .chevron,
.nav-has-dropdown.open .nav-link .chevron {
    transform: rotate(180deg);
}

.dropdown-link {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    border-radius: var(--r-md);
    font-size: var(--text-sm);
    font-weight: var(--fw-medium);
    color: var(--clr-text-secondary);
    text-decoration: none;
    transition: color var(--dur-fast) var(--ease),
                background var(--dur-fast) var(--ease);
}

.dropdown-link:hover {
    color: var(--clr-accent);
    background: var(--clr-accent-light);
}

.dd-icon {
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}

/* ── Hamburger ── */
.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;                   /* 2px bar + 6px gap × 2 = 14px span; translateY(8px) closes perfectly */
    width: 40px;
    height: 40px;
    border-radius: var(--r-md);
    background: var(--clr-bg-soft);
    border: 1px solid var(--clr-border);
    transition: background var(--dur-fast) var(--ease);
    flex-shrink: 0;
}

.hamburger:hover { background: var(--clr-accent-light); }

.hamburger .bar {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: var(--r-full);
    background: var(--clr-text-secondary);
    transition: transform var(--dur-base) var(--ease),
                opacity  var(--dur-base) var(--ease);
}

/* Hamburger → X animation  (bar spacing = 6px gap + 2px bar = 8px) */
.hamburger[aria-expanded="true"] .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.hamburger[aria-expanded="true"] .bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.hamburger[aria-expanded="true"] .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* ── Mobile nav overlay ── */
.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgb(15 23 42 / 0.4);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 840; /* below nav (850) but above page content */
    /* hidden by default via pointer-events + opacity; no display:none so transition works */
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur-slow) var(--ease);
}

.nav-overlay.active {
    opacity: 1;
    pointer-events: all;
}


/* ─────────────────────────────────────────────
   4. RESPONSIVE — HEADER (FIXED)
───────────────────────────────────────────── */

/* Tablet: tighten nav spacing */
@media (max-width: 1024px) {
    .nav-link {
        padding: var(--sp-2) var(--sp-2);
        font-size: var(--text-sm);
    }
}

/* Mobile: top-down dropdown (≤ 768px) */
@media (max-width: 768px) {
    .primary-nav {
        position: fixed;
        top: var(--header-h);
        left: 0;
        right: 0;
        width: 100%;
        background: var(--clr-bg);
        z-index: 850; /* slides out from under the header (z-index: 900) */
        display: flex;
        flex-direction: column;
        padding: 1rem 1.5rem 1.5rem;
        border-top: 1px solid var(--clr-border);
        box-shadow: var(--shadow-lg);
        max-height: calc(100vh - var(--header-h));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transform: translateY(-110%);
        visibility: hidden;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                    visibility 0s linear 0.3s;
    }

    .primary-nav.open {
        transform: translateY(0);
        visibility: visible;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                    visibility 0s linear 0s;
    }

    .hamburger {
        display: flex;
        position: relative;
        z-index: 910;
    }

    .nav-list {
        flex-direction: column;
        align-items: stretch;
        gap: var(--sp-2);
        width: 100%;
    }

    .nav-link {
        padding: var(--sp-3) var(--sp-4);
        font-size: var(--text-base);
        border-radius: var(--r-md);
        justify-content: space-between;
    }

    /* Dropdown becomes inline accordion on mobile */
    .nav-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        border-left: 2px solid var(--clr-accent-light);
        border-radius: 0;
        margin-left: var(--sp-4);
        margin-top: var(--sp-1);
        padding: var(--sp-1) 0;
        background: transparent;
        pointer-events: auto;
        display: none;
        transition: none;
    }

    /* Disable the desktop bridge pseudo-element on mobile */
    .nav-dropdown::before {
        display: none;
    }

    .nav-has-dropdown.open .nav-dropdown {
        display: block;
    }

    .nav-has-dropdown.open > .nav-link .chevron {
        transform: rotate(180deg);
    }

    .dropdown-link {
        padding: var(--sp-2) var(--sp-3);
        font-size: var(--text-sm);
        pointer-events: auto;
    }

    .primary-nav a,
    .primary-nav button {
        pointer-events: auto;
    }
}

/* Small phones */
@media (max-width: 480px) {
    :root {
        --header-h: 60px;
    }

    .logo-text {
        font-size: var(--text-lg);
    }

    .primary-nav {
        padding: 0.875rem 1.25rem 1.5rem;
    }
}

/* Prevent body scroll when nav is open — overflow:hidden only to avoid scroll-position jump */
body.nav-open {
    overflow: hidden;
}

/* ─────────────────────────────────────────────
   5. SKIP-LINK (accessibility)
───────────────────────────────────────────── */
.skip-link {
    position: absolute;
    top: -100%;
    left: var(--sp-4);
    background: var(--clr-accent);
    color: #fff;
    padding: var(--sp-2) var(--sp-5);
    border-radius: 0 0 var(--r-md) var(--r-md);
    font-weight: var(--fw-semibold);
    font-size: var(--text-sm);
    z-index: 9999;
    transition: top var(--dur-base) var(--ease);
}

.skip-link:focus { top: 0; }


/* ─────────────────────────────────────────────
   6. BREADCRUMBS
───────────────────────────────────────────── */
.breadcrumbs {
    padding-block: var(--sp-4);
    background: var(--clr-bg-soft);
    border-bottom: 1px solid var(--clr-border-soft);
}

.breadcrumbs ol {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-2);
    list-style: none;
    font-size: var(--text-sm);
    color: var(--clr-text-muted);
}

.breadcrumbs li {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.breadcrumbs li:not(:last-child)::after {
    content: "/";
    color: var(--clr-border);
    font-size: 0.8em;
}

.breadcrumbs a {
    color: var(--clr-text-secondary);
    text-decoration: none;
    transition: color var(--dur-fast) var(--ease);
}

.breadcrumbs a:hover { color: var(--clr-accent); }

.breadcrumbs [aria-current="page"] {
    color: var(--clr-text-primary);
    font-weight: var(--fw-medium);
}
