/* 
 * KS Tax & Accounting - Corporate Design System 
 * Theme: "Big 4" Professional (White, Navy, Serif)
 */

:root {
    /* Colors */
    --bg-body: #FFFFFF;
    --bg-light: #F8F9FA;
    /* Off-white for sections */
    --bg-accent: #E9ECEF;
    /* Subtle borders/backgrounds */

    --text-main: #212529;
    /* Almost Black */
    --text-muted: #6C757D;
    --text-on-dark: #FFFFFF;

    --primary: #002060;
    /* Deep Corporate Navy */
    --primary-light: #003399;
    --accent: #C5A059;
    /* Muted Gold/Beige for elegance */

    /* Typography */
    --font-heading: 'Times New Roman', Times, serif;
    /* Classic Authority */
    /* We will load Google Fonts later, falling back to system serif for now to ensure speed */
    --font-body: 'Arial', sans-serif;
    /* Clean tech/modern */

    /* Spacing */
    --container-width: 1280px;
    --header-height: 140px;
    --section-spacing: 120px;

    /* Shadows */
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 10px 40px rgba(0, 32, 96, 0.1);

    --transition: all 0.3s ease;
}

/* Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'Open Sans', 'Helvetica Neue', sans-serif;
    /* Placeholder till fonts load */
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
h5 {
    font-family: 'Playfair Display', serif;
    color: var(--primary);
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

h1 {
    font-size: 3.5rem;
    font-weight: 700;
}

h2 {
    font-size: 2.5rem;
}

h3 {
    font-size: 1.75rem;
}

p {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Utilities */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 40px;
}

.text-gold {
    color: var(--accent);
}

.text-white {
    color: var(--text-on-dark);
}

.text-center {
    text-align: center;
}

.bg-light {
    background-color: var(--bg-light);
}

.bg-navy {
    background-color: var(--primary);
    color: var(--text-on-dark);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 16px 36px;
    font-family: 'Open Sans', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--text-on-dark);
}

.btn-primary:hover {
    background-color: var(--primary-light);
    transform: translateY(-2px);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background-color: var(--primary);
    color: var(--text-on-dark);
}

.btn-white {
    background-color: white;
    color: var(--primary);
}

.btn-white:hover {
    background-color: var(--accent);
    color: white;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.98);
    height: var(--header-height);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.header.scrolled {
    height: 125px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.logo {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    gap: 40px;
}

.nav-link {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    padding-bottom: 5px;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent);
    transition: var(--transition);
}

.nav-link:hover::after {
    width: 100%;
}

/* Dropdown Menu */
.dropdown-parent {
    position: relative;
    padding-bottom: 20px;
    /* Bridge the gap */
    margin-bottom: -20px;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 280px;
    background: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    padding: 10px 0;
    border-radius: 4px;
    border-top: 3px solid var(--accent);
}

.dropdown-parent:hover .dropdown-menu {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.dropdown-menu li {
    list-style: none;
}

.dropdown-menu a {
    display: block;
    padding: 10px 20px;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 500;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s;
}

.dropdown-menu a:hover {
    background-color: var(--bg-light);
    color: var(--primary);
    padding-left: 25px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-toggle {
    display: none;
    cursor: pointer;
    color: var(--primary);
    font-size: 1.5rem;
}

/* Hero */
.hero {
    height: 90vh;
    padding-top: var(--header-height);
    display: flex;
    align-items: center;
    background-color: var(--bg-light);
    position: relative;
    overflow: hidden;
}

/* Knowledge/Book Motif Background */
.hero-bg {
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    background-image: url('https://images.unsplash.com/photo-1454165804606-c3d57bc86b40?ixlib=rb-1.2.1&auto=format&fit=crop&w=1950&q=80');
    /* Professional desk/consulting */
    background-size: cover;
    background-position: center;
    z-index: 0;
    opacity: 0.9;
    clip-path: polygon(20% 0, 100% 0, 100% 100%, 0% 100%);
}

.hero-overlay {
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    background: rgba(0, 32, 96, 0.2);
    /* Navy Tint */
    clip-path: polygon(20% 0, 100% 0, 100% 100%, 0% 100%);
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 600px;
}

.hero-label {
    display: block;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent);
    margin-bottom: 20px;
    font-weight: 700;
}

/* Sections */
.section {
    padding: var(--section-spacing) 0;
}

.section-head {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 80px;
}

.section-head h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background-color: var(--accent);
    margin: 20px auto 0;
}

/* Services Grid (Clean White Cards) */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 40px;
}

.service-card {
    background: white;
    padding: 50px 40px;
    border: 1px solid var(--bg-accent);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 0;
    background-color: var(--primary);
    transition: var(--transition);
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-hover);
}

.service-card:hover::before {
    height: 100%;
}

.service-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 30px;
}

.service-link {
    margin-top: 20px;
    display: inline-block;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.service-link i {
    transition: transform 0.3s;
}

.service-card:hover .service-link i {
    transform: translateX(5px);
}

/* Knowledge / Why Us */
.split-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: center;
}

.image-block {
    position: relative;
}

.image-block img {
    box-shadow: -20px 20px 0 var(--bg-accent);
}

/* Testimonials (Clean) */
.testimonial-card {
    text-align: center;
    padding: 60px;
    background: white;
    border: 1px solid var(--bg-accent);
}

.quote-icon {
    font-size: 2rem;
    color: var(--accent);
    margin-bottom: 30px;
    opacity: 0.5;
}

.client-name {
    font-weight: 700;
    color: var(--primary);
    margin-top: 20px;
}

/* Footer */
.footer {
    background-color: #0f172a;
    /* Very dark navy/slate */
    color: #94a3b8;
    padding: 100px 0 30px;
    font-size: 0.9rem;
}

.footer h4 {
    color: white;
    font-family: 'Open Sans', sans-serif;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 30px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 60px;
    margin-bottom: 80px;
}

.footer-links li {
    margin-bottom: 15px;
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 30px;
    display: flex;
    justify-content: space-between;
}

/* Responsive */
@media (max-width: 1024px) {

    .hero-bg,
    .hero-overlay {
        width: 100%;
        height: 50%;
        bottom: 0;
        top: auto;
        clip-path: none;
    }

    .hero {
        flex-direction: column;
        justify-content: center;
        height: auto;
        padding-bottom: 400px;
        text-align: center;
    }

    .hero-content {
        margin: 60px auto;
    }

    .split-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }
    
    .container {
        padding: 0 20px;
    }
    
    .btn:not(.header .btn) {
        width: 100%;
        display: block;
        text-align: center;
        margin-bottom: 12px;
    }

    .nav-links {
        display: none;
        /* Hide for now, needs JS toggle */
    }

    .mobile-toggle {
        display: block;
    }

    h1 {
        font-size: 2.5rem;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .services-grid {
        grid-template-columns: 1fr;
    }

    /* Mobile Menu Active State */
    .nav.active .nav-links {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: var(--header-height);
        left: 0;
        width: 100%;
        background: white;
        padding: 20px;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        align-items: flex-start !important;
        /* Override inline style */
        gap: 20px;
        height: auto;
        max-height: 80vh;
        overflow-y: auto;
    }

    .nav-links li {
        width: 100%;
    }

    .dropdown-menu {
        position: static;
        width: 100%;
        box-shadow: none;
        border-top: none;
        padding-left: 20px;
        display: none;
        /* Controlled by JS or hover */
        border-left: 2px solid var(--accent);
    }

    .dropdown-parent:hover .dropdown-menu {
        display: flex;
        /* Show on hover for desktop, need JS for click on mobile */
    }

    /* For mobile click interaction, we'll need a class 'show-dropdown' */
    .dropdown-parent.show-dropdown .dropdown-menu {
        display: flex;
    }
}

/* Chatbot Widget */
.chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
}

.chat-button {
    width: 60px;
    height: 60px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-hover);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
}

.chat-button:hover {
    background-color: var(--accent);
    transform: scale(1.1);
}

.chat-tooltip {
    position: absolute;
    right: 70px;
    background-color: white;
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: var(--shadow-card);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    white-space: nowrap;
}

.chat-button:hover .chat-tooltip {
    opacity: 1;
    visibility: visible;
    right: 75px;
}

.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 320px;
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow-hover);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 400px;
}

.chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.chat-header {
    background-color: var(--primary);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 1rem;
    color: white;
}

.close-chat {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1rem;
}

.chat-body {
    flex: 1;
    padding: 20px;
    background-color: var(--bg-light);
    overflow-y: auto;
}

.chat-message {
    background: white;
    padding: 10px 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    font-size: 0.9rem;
    line-height: 1.4;
}

.chat-message.bot {
    border-left: 3px solid var(--accent);
    margin-right: 20px;
}

.chat-message.user {
    background-color: var(--primary);
    color: white;
    margin-left: 20px;
    text-align: right;
    border-right: 3px solid var(--accent);
}

.chat-input-area {
    padding: 15px;
    border-top: 1px solid var(--bg-accent);
    display: flex;
    gap: 10px;
    background: white;
}

.chat-input-area input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
}

.chat-input-area button {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 1.2rem;
}

/* Accessibility Widget */
.accessibility-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 2000;
}

.acc-button {
    width: 60px;
    height: 60px;
    background-color: #0044cc;
    /* Distinct Blue */
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s;
}

.acc-button:hover {
    transform: scale(1.1);
}

.acc-menu {
    position: absolute;
    bottom: 80px;
    left: 0;
    width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 20px;
    display: none;
    /* Hidden by default */
    flex-direction: column;
    animation: fadeIn 0.3s ease;
    border: 1px solid #eee;
}

.acc-menu.active {
    display: flex;
}

.acc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.acc-header h3 {
    font-size: 1.1rem;
    margin: 0;
    color: #333;
    font-family: var(--font-body);
}

.acc-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #666;
}

.acc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.acc-option {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}

.acc-option:hover,
.acc-option.active {
    background: #e9ecef;
    border-color: #0044cc;
    color: #0044cc;
}

.acc-option i {
    font-size: 1.5rem;
    color: #555;
    margin-bottom: 5px;
}

.acc-option.active i {
    color: #0044cc;
}

.acc-option span {
    font-size: 0.85rem;
    font-weight: 600;
}

/* Accessibility Modes */

/* High Contrast */
body.acc-contrast {
    background-color: #000 !important;
    color: #fff !important;
}

body.acc-contrast header,
body.acc-contrast .footer,
body.acc-contrast .service-card,
body.acc-contrast .acc-menu,
body.acc-contrast .chat-window,
body.acc-contrast .chat-message {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
}

body.acc-contrast .acc-option {
    background-color: #222;
    border-color: #fff;
    color: #fff;
}

body.acc-contrast a,
body.acc-contrast h1,
body.acc-contrast h2,
body.acc-contrast h3,
body.acc-contrast i {
    color: #ffff00 !important;
    /* Yellow for high visibility */
}

/* Large Text */
body.acc-text-lg {
    font-size: 120% !important;
}

body.acc-text-lg h1 {
    font-size: 4rem !important;
}

body.acc-text-lg h2 {
    font-size: 3rem !important;
}

/* Spacing */
body.acc-spacing {
    letter-spacing: 2px !important;
    word-spacing: 5px !important;
    line-height: 2 !important;
}

/* Large Cursor */
body.acc-cursor * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><path fill="black" stroke="white" stroke-width="2" d="M0,0 L0,32 L8,24 L16,32 L20,32 L12,20 L24,20 z"/></svg>'), auto !important;
}

/* Reading Guide */
.reading-guide {
    position: fixed;
    top: 50%;
    left: 0;
    width: 100%;
    height: 20px;
    background: rgba(255, 255, 0, 0.3);
    border-top: 2px solid yellow;
    border-bottom: 2px solid yellow;
    pointer-events: none;
    z-index: 9999;
    display: none;
    transform: translateY(-50%);
}

body.acc-guide .reading-guide {
    display: block;
}

/* Mobile Fixes - Strict Rule */
@media (max-width: 768px) {
    img {
        max-width: 100%;
        height: auto;
    }
    .split-section {
        gap: 30px !important;
        padding-top: 20px;
    }
    .text-block {
        margin-top: 15px;
    }
    section.section {
        padding: 60px 0;
    }
}