/*
========================================================================================
    HKD SERVICES CORP - STYLESHEET
========================================================================================

    File Purpose:   All styling and responsive design rules for the website
    
    Color Scheme:
    - Primary Color (#222a3c):      Dark blue - headers, cards background
    - Secondary Color (#20867b):    Teal - accents, buttons, hover states
    - Background (#fefefe):         Off-white - main background
    - Hover Color (#5AB67D):        Green - button/link hover effects
    
    Responsive Breakpoint:
    - Desktop:      769px and above (full layout with navigation visible)
    - Mobile:       768px and below (hamburger menu, stacked layout)
    
    CSS Organization:
    1. Global Reset & Base Styles
    2. Color Variables (CSS Custom Properties / :root)
    3. Typography (h1-h6, p, links)
    4. Header & Navigation
    5. Hero Section
    6. Container & Layout
    7. Services Section
    8. Articles Section
    9. About Section
    10. Stats Section
    11. Contact Section & Form
    12. Footer
    13. Menu Toggle (Hamburger)
    14. Responsive Media Queries
    15. Utility Classes

================================================================================== */

/* ==================== GLOBAL RESET & BASE STYLES ==================== 
   Removes default browser margins/padding and sets box-sizing to border-box
   for more predictable layout calculations
================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==================== COLOR & DESIGN VARIABLES ====================
   CSS Custom Properties (--variable) for easy theme changes
   Change values here to update colors throughout entire website
================================================================== */
:root {
    --primary-color: #222a3c;       /* Dark blue - main color */
    --secondary-color: #20867b;     /* Teal - accent color */
    --background-color: #fefefe;    /* Off-white - page background */
    --text-color: #fefefe;          /* Light text on dark backgrounds */
    --hover-color: #5AB67D;         /* Green - hover states */
    --light-gray: #222a3c;          /* Alternate section background */
    --border-color: #E1E8ED;        /* Light gray - borders */
    
    /* Shadow effects for depth and elevation */
    --shadow: 0 4px 6px rgba(74, 144, 226, 0.1);
    --shadow-hover: 0 0 10px rgba(32, 134, 123, 0.8),
                    0 0 30px rgba(32, 134, 123, 0.6),
                    0 0 60px rgba(32, 134, 123, 0.4);
}

/* ==================== BODY STYLES ====================
   Sets default font family, line height, and colors for all text
================================================================== */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;                   /* Space between lines for readability */
    color: var(--text-color);
    background-color: var(--background-color);
}

/* ==================== TYPOGRAPHY ==================== 
   Styles for all headings and paragraph text
================================================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;               /* Bold headings for emphasis */
    line-height: 1.3;               /* Slightly tighter line height for headings */
    margin-bottom: 1rem;            /* Space below each heading */
}

/* Page title - largest heading */
h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
}

/* Section heading - secondary size */
h2 {
    font-size: 2rem;
    color: var(--secondary-color);
}

/* Subsection heading */
h3 {
    font-size: 1.5rem;
    color: var(--secondary-color);
}

/* Paragraph and general text */
p {
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

/* ==================== HEADER & NAVIGATION ==================== 
   Sticky header with company logo and navigation menu
   - Desktop: Shows full navigation bar
   - Mobile:  Shows hamburger menu toggle
================================================================== */

/* Sticky header - stays at top when scrolling */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #20867b 100%);
    color: white;
    padding: 1rem 0;
    position: sticky;                /* Stays at top of viewport while scrolling */
    top: 0;
    z-index: 1000;                   /* Appears above other content */
    box-shadow: var(--shadow);       /* Subtle shadow for depth */
}

/* Container for header content - max width and padding */
.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    column-gap: 1rem;               /* Space between left group and right section */
}

/* Left header group: logo and company name close together */
.header-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;                   /* Keep logo and name close */
    min-width: 0;
}

/* Make logo/title block clickable while keeping the same visual style */
.header-home-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

/* Logo section - company icon */
.logo {
    display: flex;
    align-items: center;
    white-space: nowrap;
}

/* Header title text */
.header-title {
    display: flex;
    align-items: center;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: white;
    white-space: nowrap;
}

.brand-highlight {
    color: var(--secondary-color);
    margin-right: 0.4rem;
}

/* Right side of header: nav + mobile toggle */
.header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
}

/* Logo image - adjusts size responsively */
.logo img {
    height: 50px;
    width: auto;
    display: block;
}

/* Logo company name highlight - different color */
.logo span {
    color: var(--secondary-color);
}

/* Navigation menu - horizontal list of links */
nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}

/* Navigation links - styling and hover effects */
nav a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;      /* Smooth color change on hover */
    padding: 0.5rem 1rem;
    border-radius: 5px;
}

/* Navigation link hover - highlight on mouse over */
nav a:hover {
    color: var(--hover-color);
    background-color: rgba(255, 255, 255, 0.1);
}

/* ==================== MENU TOGGLE (Hamburger Icon) ==================== */
/* Hamburger menu button - only visible on mobile */
.menu-toggle {
    margin-left: auto;           /* Push it to the right side */
    display: none;               /* Hidden by default (shown on mobile) */
    font-size: 28px;
    color: white;
    cursor: pointer;
    transition: color 0.3s ease;
    padding: 0.5rem;             /* Add padding around the button */
    margin-right: 0.5rem;        /* Space from right edge */
}

.menu-toggle:hover {
    color: var(--hover-color);
}

/* ==================== HERO SECTION ==================== */
.hero {
    background: var(--primary-color);
    background-size: cover;
    background-position: center;
    color: white;
    padding: 5rem 2rem;
    text-align: center;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero h1 {
    color: white;
    font-size: 3rem;
    margin-bottom: 1.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.hero p {
    font-size: 1.3rem;
    margin-bottom: 2rem;
    opacity: 0.95;
}

.cta-button {
    display: inline-block;
    background-color: var(--secondary-color);
    color: white;
    padding: 1rem 2.5rem;
    text-decoration: none;
    border-radius: 50px;
    font-weight: bold;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(111, 207, 151, 0.3);
}

.cta-button:hover {
    background-color: var(--hover-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(111, 207, 151, 0.4);
}

/* ==================== CONTAINER & LAYOUT ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

.section {
    margin-bottom: 4rem;
}

.section-title {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
    padding-bottom: 1rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

/* ==================== SERVICES GRID ==================== */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.service-card {
    background: var(--primary-color);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--secondary-color);
}

.service-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.service-card h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* ==================== ARTICLES SECTION ==================== */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2.5rem;
    margin-top: 2rem;
}

.article-card {
    background: var(--primary-color);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--secondary-color);
}

.article-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    background-color: var(--light-gray);
}

.article-content {
    padding: 2rem;
}

.article-meta {
    color: var(--background-color);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.article-card h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.article-card p {
    color: var(--background-color);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.read-more {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    transition: color 0.3s ease;
}

.read-more:hover {
    color: var(--hover-color);
}

.read-more::after {
    content: ' →';
    margin-left: 0.5rem;
}

/* ==================== ABOUT SECTION ==================== */
.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    background: var(--light-gray);
    padding: 3rem;
    border-radius: 12px;
}

.about-text h2 {
    margin-bottom: 1.5rem;
}

.about-text ul {
    list-style: none;
    margin: 1.5rem 0;
}

.about-text li {
    padding: 0.7rem 0;
    padding-left: 2rem;
    position: relative;
}

.about-text li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--secondary-color);
    font-weight: bold;
    font-size: 1.2rem;
}

.about-image {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

/* ==================== STATS SECTION ==================== */
.stats {
    background: linear-gradient(135deg, #0b1d2a 0%, var(--primary-color) 100%);
    color: white;
    padding: 4rem 2rem;
    margin: 4rem 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
}

.stat-item {
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
}

.stat-item.visible {
    animation: statFadeIn 0.8s ease forwards;
}

.stat-item.visible:nth-child(1) {
    animation-delay: 0.1s;
}

.stat-item.visible:nth-child(2) {
    animation-delay: 0.2s;
}

.stat-item.visible:nth-child(3) {
    animation-delay: 0.3s;
}

.stat-item.visible:nth-child(4) {
    animation-delay: 0.4s;
}

.stat-number {
    font-size: 3rem;
    font-weight: bold;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1.1rem;
    opacity: 0.9;
}

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

/* ==================== CONTACT SECTION ==================== */
.contact-section {
    background: var(--light-gray);
    padding: 4rem 3rem;                /* More frame space on left/right */
    border-radius: 12px;
}

.contact-grid {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(360px, 1fr);
    gap: 2.5rem;                       /* More distance between contact block and form */
    max-width: 980px;                  /* Narrower inner width for a more centered layout */
    margin: 0 auto;
    align-items: start;                /* Keep both columns aligned at the top */
}

.contact-info {
    display: grid;
    gap: 1rem;
    text-align: left;                  /* Keep contact details left-aligned */
}

.contact-info h3 {
    color: var(--text-color);
    margin-bottom: 1rem;
}

.contact-item {
    display: grid;
    grid-template-columns: auto 1fr;   /* Icon and content columns */
    gap: 0.75rem;
    align-items: start;                /* Align content at the top */
    margin-bottom: 1.5rem;
}

.contact-item > div {
    text-align: left;                  /* Force contact text to stay left-aligned */
}

.contact-item strong {
    display: block;
    color: white;
    font-size: 1rem;
    margin: 0;                         /* Remove all margins */
    line-height: 1;
}

.contact-item p {
    margin: 0.3rem 0 0 0;              /* Tight spacing above paragraph */
    font-size: 1rem;
    line-height: 1.4;
}

.contact-icon {
    font-size: 1.6rem;
    color: var(--primary-color);
    min-width: 34px;
    line-height: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}
.contact-logo {
    margin-top: 0.5rem;
    display: flex;
    justify-content: center;          /* Center the logo horizontally */
    align-items: center;
    min-height: 120px;
}

.contact-logo img {
    height: 180px;
    width: auto;
    display: block;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .contact-logo {
        min-height: 80px;
        margin-top: 1.5rem;
    }
    
    .contact-logo img {
        height: 100px;
    }
}

.contact-form {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--primary-color);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

/* Keep placeholder text size controlled and consistent */
.form-group input::placeholder,
.form-group textarea::placeholder {
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    .contact-form {
        padding: 1.5rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 0.7rem;
        font-size: 16px;
    }

    .form-group input::placeholder,
    .form-group textarea::placeholder {
        font-size: 0.9rem;
    }
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.submit-button {
    background-color: var(--secondary-color);
    color: white;
    padding: 1rem 2.5rem;
    border: none;
    border-radius: 50px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.submit-button:hover {
    background-color: var(--hover-color);
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .submit-button {
        padding: 0.9rem 2rem;
        font-size: 0.95rem;
    }
}

/* ==================== FOOTER ==================== */
@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr; /* stack columns */
        justify-items: stretch;      /* keep content full width on mobile */
        gap: 1.5rem;                 /* tighter vertical spacing */
    }
}
footer {
    background-color: var(--primary-color);
    color: white;
    padding: 3rem 2rem 1.5rem;
    margin-top: 4rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
    justify-items: center;   /* horizontally center each column’s content */
}

.footer-section h4 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: var(--background-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

.footer-section p {
    color: var(--background-color);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #555;
    color: #999;
}

@media (max-width: 768px) {
    .footer-section h4 {
        font-size: 1rem;
        margin-bottom: 0.8rem;
        text-align: left;
    }
    
    .footer-section p,
    .footer-section ul,
    .footer-section ul li {
        text-align: left;
    }
    
    .footer-section p {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
    
    .footer-section ul li {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
    }
    
    .footer-bottom {
        font-size: 0.8rem;
        padding-top: 1.5rem;
    }

    .footer-content {
        justify-items: stretch;    /* force mobile footer columns to fill width */
    }
}

/* ==================== RESPONSIVE DESIGN ==================== */
/* ==================== DESKTOP VIEW (769px and up) ==================== */
/* On desktop screens, show the full navigation bar and hide the hamburger menu */
@media (min-width: 769px) {
    /* Show navigation links in a horizontal row */
    nav ul {
        display: flex !important;              /* Display as flexbox */
        flex-direction: row !important;        /* Arrange items horizontally */
        gap: 2rem;                             /* Space between menu items */
        background: none !important;           /* No background needed for desktop */
        padding: 0 !important;                 /* No padding needed for desktop */
        position: static !important;           /* Normal positioning (not absolute) */
    }

    /* Larger company title on desktop */
    .header-title {
        font-size: 2rem;
    }
    
    /* Hide the hamburger menu on desktop - not needed */
    .menu-toggle {
        display: none !important;
    }
}

/* ==================== MOBILE VIEW (768px and below) ==================== */
/* On mobile screens, show hamburger menu and hide navigation until toggled */
@media (max-width: 768px) {
    /* Adjust header container for mobile */
    .header-container {
        position: relative;                    /* Use relative positioning for the expanded menu */
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 0;
        justify-content: space-between;
        padding: 0 1rem;
    }

    .header-title {
        justify-content: center;
    }

    .header-right {
        justify-content: flex-end;
    }

    /* Navigation menu - hidden by default on mobile, shown when active */
    nav ul {
        display: flex;                         /* Always flex for transition */
        flex-direction: column;                /* Stack items vertically */
        gap: 0;
        text-align: left;                      /* Align text to left */
        position: absolute;                    /* Position relative to header container */
        top: calc(100% + 15px);                 /* Start at the bottom white divider line */
        left: 0;                               /* Stretch from left edge */
        right: 0;                              /* Stretch to right edge */
        width: 100%;                           /* Full width of header container */
        background: linear-gradient(180deg, rgba(32, 134, 123, 0.95), rgba(34, 42, 60, 0.95));
        padding: 0 0.75rem 0;
        z-index: 999;                          /* Appear above page content */
        box-shadow: 0 10px 30px rgba(0,0,0,0.25);
        overflow: hidden;
        max-height: 0;
        opacity: 0;
        visibility: hidden;
        transition: max-height 0.35s ease, opacity 0.25s ease, visibility 0.25s ease;
    }
    
    /* When menu has 'active' class, show it (toggled by JavaScript) */
    nav ul.active {
        max-height: 420px;                    /* Enough to show all mobile links */
        opacity: 1;
        visibility: visible;
        padding: 1rem 0.75rem 1.25rem;
    }
    
    /* Style menu items on mobile */
    nav ul li {
        padding: 0.75rem 0;
    }
    
    /* Style menu links on mobile */
    nav ul li a {
        display: block;                        /* Make link block element */
        padding: 0.8rem 1rem;                  /* Add padding for touch targets */
    }
    
    /* Show hamburger menu toggle button on mobile */
    .menu-toggle {
        display: block;                        /* Visible on mobile */
        transition: transform 0.3s ease;
    }

    .menu-toggle.open {
        transform: rotate(90deg);
    }

    .hero h1 {
        font-size: 1.5rem;
    }

    .hero p {
        font-size: 0.95rem;
    }
    
    .hero {
        padding: 3rem 1rem;
    }
    
    .cta-button {
        padding: 0.8rem 2rem;
        font-size: 0.95rem;
    }

    .about-content {
        grid-template-columns: 1fr;
        padding: 1.5rem;
    }

    .contact-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .services-grid,
    .articles-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .container {
        padding: 2rem 1rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.3rem;
    }
    
    h3 {
        font-size: 1.1rem;
    }
    
    p {
        font-size: 0.95rem;
    }
    
    .section-title {
        margin-bottom: 2rem;
    }
    
    .contact-info {
        text-align: center;
    }
    
    .contact-item {
        justify-content: center;
        text-align: center;
    }
}

/* ==================== UTILITY CLASSES ==================== */
.text-center {
    text-align: center;
}

.mb-2 {
    margin-bottom: 2rem;
}

.highlight {
    color: var(--secondary-color);
    font-weight: bold;
}