:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #64748b;
    --accent: #10b981;
    --background: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #0f172a;
    --text-muted: #475569;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 12px;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

img,
svg {
    max-width: 100%;
    height: auto;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-sans);
    background-color: var(--background);
    color: var(--text-main);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header Styles */
header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    /* Base z-index for header */
    padding: 1rem 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary);
}

.close-menu {
    display: none;
}

/* Hamburger Menu Button - Hidden on Desktop */
.menu-toggle {
    display: none;
    background: rgba(37, 99, 235, 0.08);
    border: 1.5px solid rgba(37, 99, 235, 0.2);
    color: var(--primary);
    cursor: pointer;
    padding: 10px;
    border-radius: 10px;
    transition: all 0.25s ease;
    line-height: 0;
}

.menu-toggle:hover {
    background: rgba(37, 99, 235, 0.15);
    border-color: var(--primary);
}

.menu-toggle:active {
    transform: scale(0.92);
    background: rgba(37, 99, 235, 0.2);
}

.menu-toggle svg {
    width: 22px;
    height: 22px;
}

/* Contact Page Styles */
.contact-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 3rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.contact-card {
    background: #ffffff;
    border: 1px solid var(--border);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.contact-card-icon {
    color: var(--primary);
    margin-bottom: 1.5rem;
}

.contact-card h3 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.contact-card p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.contact-email {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.contact-response-time {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.contact-bug-report {
    margin-top: 4rem;
    padding: 3rem;
    background: #f8fafc;
    border-radius: 12px;
    text-align: center;
    border: 1px solid var(--border);
}

.contact-bug-report h2 {
    margin-top: 0;
    margin-bottom: 1rem;
}

.contact-bug-report p {
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Hero Section */
.hero {
    padding: 6rem 0;
    text-align: center;
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 700px;
    margin: 0 auto 2.5rem;
}

.search-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    box-shadow: var(--shadow-lg);
    border-radius: 50px;
    overflow: hidden;
    border: 2px solid var(--primary);
    transition: all 0.3s;
}

.search-container:focus-within {
    border-color: var(--primary);
}

.search-input {
    width: 100%;
    padding: 1.25rem 1.5rem 1.25rem 3.5rem;
    border: none;
    font-size: 1.1rem;
    outline: none;
    font-family: var(--font-sans);
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.category-group {
    transition: opacity 0.3s;
}

.no-results {
    text-align: center;
    padding: 4rem 2rem;
    display: none;
}

.no-results h4 {
    font-size: 1.5rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.no-results p {
    color: var(--text-muted);
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding: 4rem 0;
}

.tool-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.tool-icon {
    width: 60px;
    height: 60px;
    background: #eff6ff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    color: var(--primary);
    font-size: 2rem;
}

.tool-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.tool-card p {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

.btn-link {
    margin-top: auto;
    color: var(--primary);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Tool Page Specifics */
.tool-container {
    max-width: 800px;
    margin: 3rem auto;
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.tool-input-group {
    margin-bottom: 1.5rem;
}

.tool-input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-muted);
}

.tool-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.tool-input:focus {
    outline: none;
    border-color: var(--primary);
}

.tool-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.tool-btn:hover {
    background: var(--primary-hover);
}

.tool-result {
    margin-top: 2rem;
    padding: 1.5rem;
    background: #f1f5f9;
    border-radius: 8px;
    text-align: center;
}

.result-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
}

/* Article Styling */
.article-section {
    max-width: 900px;
    margin: 4rem auto;
    padding: 0 1.5rem;
}

.article-section h1 {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.article-section h2 {
    font-size: 2rem;
    margin: 3rem 0 1.5rem;
    color: var(--text-main);
    border-left: 4px solid var(--primary);
    padding-left: 1rem;
}

.article-section p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: var(--text-muted);
    line-height: 1.8;
}

.article-section ul,
.article-section ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
    color: var(--text-muted);
}

.article-section li {
    margin-bottom: 0.75rem;
}

.faq-item {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.faq-question {
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

/* Footer */
footer {
    background: #0f172a;
    color: white;
    padding: 4rem 0 2rem;
    margin-top: 5rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-col h4 {
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.footer-col ul {
    list-style: none;
}

.footer-col li {
    margin-bottom: 0.75rem;
}

.footer-col a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-col a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #1e293b;
    color: #4a72ac;
    font-size: 0.9rem;
}

/* ============================================
   RESPONSIVE DESIGN - Full Mobile Optimization
   ============================================ */

/* --- TABLET (1024px and below) --- */
@media (max-width: 1024px) {
    .container {
        padding: 0 1.25rem;
    }

    .hero h1 {
        font-size: 3rem;
    }

    .tools-grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
        gap: 1.5rem;
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }

    .article-section {
        padding: 0 1rem;
    }

    .article-section h1 {
        font-size: 2.5rem;
    }
}

/* --- MOBILE LANDSCAPE & SMALL TABLETS (768px and below) --- */
@media (max-width: 768px) {

    /* Mobile Navigation - Logo Left, Hamburger Right */
    .nav-container {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding: 0 1rem;
        width: 100%;
    }

    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        order: 2;
    }

    .logo {
        order: 1;
        font-size: 1.4rem;
    }

    .logo svg {
        width: 30px;
        height: 30px;
    }

    /* Fixed Header Z-Index for Mobile */
    header {
        z-index: 6000 !important;
        /* Ensure header wins against overlay */
        background: #ffffff !important;
        /* Solid background to prevent 'blur' through it */
        backdrop-filter: none !important;
    }

    .nav-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100% !important;
        background: rgba(0, 0, 0, 0.6) !important;
        z-index: 5000 !important;
        /* Above content, below header */
        display: none !important;
        backdrop-filter: none !important;
        /* Remove blur to prevent mobile lag/glitches */
    }

    .nav-overlay.active {
        display: block !important;
    }

    .nav-links {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100% !important;
        height: 100vh !important;
        background: #ffffff !important;
        flex-direction: column !important;
        padding: 6rem 1.5rem 2rem !important;
        margin: 0 !important;
        z-index: 7000 !important;
        /* Above header background */
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        list-style: none !important;
        display: flex !important;
        overflow-y: auto !important;
        visibility: hidden;
        pointer-events: none;
    }

    .nav-links.active {
        transform: translateX(0) !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    .close-menu {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 8px !important;
        position: absolute !important;
        top: 1.5rem !important;
        right: 1.5rem !important;
        background: #ef4444 !important;
        color: white !important;
        border: none !important;
        padding: 14px 24px !important;
        border-radius: 50px !important;
        font-weight: 800 !important;
        font-size: 1rem !important;
        box-shadow: 0 4px 15px rgba(239, 68, 68, 0.5) !important;
        z-index: 2100 !important;
        cursor: pointer !important;
    }

    .close-menu::after {
        content: "CLOSE" !important;
    }

    .close-menu:active {
        transform: scale(0.9) !important;
    }

    /* Removed redundant active state */

    .nav-links li {
        width: 100%;
        border-bottom: 1px solid var(--border);
    }

    .nav-links li:last-child {
        border-bottom: none;
    }

    .nav-links a {
        display: block;
        padding: 16px 12px;
        border-radius: 0;
        font-size: 1.05rem;
        font-weight: 500;
        color: var(--text-main);
        transition: background 0.2s, color 0.2s;
    }

    .nav-links a:hover {
        background: rgba(37, 99, 235, 0.08);
        color: var(--primary);
    }

    /* Hero Section */
    .hero {
        padding: 3rem 0;
    }

    .hero h1 {
        font-size: 2rem;
        margin-bottom: 1rem;
        padding: 0 0.5rem;
    }

    .hero p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
        padding: 0 0.5rem;
    }

    /* Search */
    .search-container {
        margin: 0 1rem;
        border-radius: 12px;
    }

    .search-input {
        padding: 1rem 1rem 1rem 3rem;
        font-size: 1rem;
    }

    /* Tools Grid */
    .tools-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 2rem 0;
    }

    .tool-card {
        padding: 1.5rem;
    }

    .tool-card h3 {
        font-size: 1.25rem;
    }

    .tool-card p {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    .tool-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 1rem;
    }

    .tool-icon svg {
        width: 20px;
        height: 20px;
    }

    /* Tool Pages */
    .tool-container {
        padding: 1.5rem;
        margin: 1.5rem auto;
        border-radius: 8px;
    }

    .tool-container h2 {
        font-size: 1.3rem !important;
        margin-bottom: 1.5rem !important;
    }

    .tool-input-group {
        margin-bottom: 1rem;
    }

    .tool-input-group label {
        font-size: 0.9rem;
    }

    .tool-input {
        padding: 0.85rem 1rem;
        font-size: 1rem;
    }

    .tool-btn {
        padding: 0.85rem;
        font-size: 1rem;
    }

    .tool-result {
        margin-top: 1.5rem;
        padding: 1.25rem;
    }

    .result-value {
        font-size: 2rem;
    }

    /* Article / Content Pages */
    .article-section {
        margin: 2rem auto;
        padding: 0 0.75rem;
    }

    .article-section h1 {
        font-size: 1.75rem;
        line-height: 1.3;
        margin-bottom: 1rem;
    }

    .article-section h2 {
        font-size: 1.35rem;
        margin: 2rem 0 1rem;
        padding-left: 0.75rem;
    }

    .article-section p {
        font-size: 1rem;
        line-height: 1.7;
        margin-bottom: 1rem;
    }

    .article-section ul,
    .article-section ol {
        padding-left: 1.25rem;
    }

    .article-section li {
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
    }

    /* FAQ Items */
    .faq-item {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .faq-question {
        font-size: 1rem;
    }

    .faq-content {
        font-size: 0.9rem;
    }

    /* Footer */
    footer {
        padding: 2.5rem 0 1.5rem;
        margin-top: 3rem;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .footer-col h4 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }

    .footer-col p {
        font-size: 0.9rem;
    }

    .footer-col li {
        margin-bottom: 0.5rem;
    }

    .footer-col a {
        font-size: 0.9rem;
    }

    .footer-bottom {
        font-size: 0.8rem;
        padding-top: 1.5rem;
    }

    .footer-grid {
        grid-template-columns: 1fr !important;
        text-align: center;
        gap: 2.5rem !important;
    }

    .footer-col {
        width: 100% !important;
    }

    /* Manifest / Technical Data Boxes (inline styles override) */
    [style*="display: grid"] {
        grid-template-columns: 1fr !important;
    }

    /* About page value cards */
    div[style*="grid-template-columns: repeat(auto-fit"] {
        grid-template-columns: 1fr !important;
    }

    /* Contact Page */
    .contact-grid {
        grid-template-columns: 1fr;
    }

    .contact-card {
        padding: 1.5rem;
    }

    .contact-bug-report {
        margin-top: 2rem;
        padding: 1.5rem;
    }

    .contact-subtitle {
        font-size: 1rem;
        margin-bottom: 2rem;
    }
}

/* --- SMALL PHONES (480px and below) --- */
@media (max-width: 480px) {
    .container {
        padding: 0 0.75rem;
    }

    .logo {
        font-size: 1.35rem !important;
    }

    .nav-links a {
        font-size: 1.15rem !important;
        padding: 18px !important;
    }

    /* Hero */
    .hero {
        padding: 2rem 0;
    }

    .hero h1 {
        font-size: 1.6rem;
    }

    .hero p {
        font-size: 0.9rem;
    }

    .search-input {
        padding: 0.85rem 0.75rem 0.85rem 2.5rem;
        font-size: 0.9rem;
    }

    .tools-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }

    .search-icon svg {
        width: 18px;
        height: 18px;
    }

    /* Tool Cards */
    .tool-card {
        padding: 1.25rem;
    }

    .tool-card h3 {
        font-size: 1.1rem;
    }

    /* Tool Pages */
    .tool-container {
        padding: 1rem;
        margin: 1rem auto;
    }

    .tool-container h2 {
        font-size: 1.15rem !important;
    }

    .result-value {
        font-size: 1.75rem;
    }

    /* Article / Content */
    .article-section h1 {
        font-size: 1.4rem;
    }

    .article-section h2 {
        font-size: 1.15rem;
    }

    .article-section p {
        font-size: 0.95rem;
    }

    /* Contact page cards */
    div[style*="grid-template-columns: repeat(auto-fit, minmax(300px"] {
        grid-template-columns: 1fr !important;
    }

    /* Inline padded boxes */
    div[style*="padding: 2.5rem"] {
        padding: 1.25rem !important;
    }

    div[style*="padding: 3rem"] {
        padding: 1.5rem !important;
    }

    div[style*="padding: 2rem"] {
        padding: 1rem !important;
    }
}

/* --- VERY SMALL SCREENS (360px and below) --- */
@media (max-width: 360px) {
    .hero h1 {
        font-size: 1.35rem;
    }

    .hero p {
        font-size: 0.85rem;
    }

    .tool-card h3 {
        font-size: 1.1rem;
    }

    .logo {
        font-size: 1.1rem !important;
    }

    .logo svg {
        width: 24px !important;
        height: 24px !important;
    }

    .article-section h1 {
        font-size: 1.25rem;
    }

    .article-section h2 {
        font-size: 1.05rem;
    }

    .result-value {
        font-size: 1.5rem;
    }

    .footer-col h4 {
        font-size: 1rem;
    }
}

/* --- TOUCH-FRIENDLY ENHANCEMENTS --- */
@media (hover: none) and (pointer: coarse) {
    .tool-card:hover {
        transform: none;
    }

    .tool-btn {
        min-height: 48px;
    }

    .tool-input {
        min-height: 48px;
        font-size: 16px;
        /* Prevents iOS zoom on focus */
    }

    select.tool-input {
        font-size: 16px;
        /* Prevents iOS zoom */
    }

    .nav-links a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .footer-col a {
        padding: 4px 0;
        display: inline-block;
    }
}

/* --- LANDSCAPE PHONE FIX --- */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        padding: 1.5rem 0;
    }

    .hero h1 {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }

    .hero p {
        margin-bottom: 1rem;
    }

    header {
        position: relative;
        /* Don't sticky on landscape phones */
    }
}

/* --- PRINT STYLES --- */
@media print {

    header,
    footer,
    .search-container,
    .tool-btn {
        display: none !important;
    }

    .article-section {
        max-width: 100%;
    }

    body {
        background: white;
        color: black;
    }
}