/* ==============================================
   WEBFRONT — Global Stylesheet
   
   Table of Contents:
   1. Variables
   2. Reset & Base
   3. Typography
   4. Layout
   5. Buttons & Links
   6. Site Header
   7. Mobile Bottom Nav
   8. Sidebar Menu
   9. Site Footer
   10. Scroll-to-Top
   11. Page Sections
   12. Utilities
   13. Responsive (≤ 768px)
   ============================================== */


/* ==============================================
   1. VARIABLES
   ============================================== */

:root {
    /* Brand */
    --color-primary: #0069c0;
    --color-primary-hover: #005299;
    --color-primary-light: rgba(0, 105, 192, 0.07);
    --color-secondary: #2e7d32;
    --color-secondary-hover: #1b5e20;
    --color-secondary-light: rgba(46, 125, 50, 0.07);

    /* Text */
    --color-text: #212121;
    --color-text-secondary: #555555;
    --color-text-muted: #888888;

    /* Backgrounds */
    --color-bg: #ffffff;
    --color-bg-soft: #fafafa;
    --color-bg-muted: #f2f2f2;
    --color-bg-dark: #1a1a2e;
    --color-white: #ffffff;

    /* Borders */
    --color-border: #e0e0e0;
    --color-border-light: #eeeeee;

    /* Feedback */
    --color-success: #2e7d32;
    --color-error: #d32f2f;
    --color-warning: #f57c00;

    /* Overlay */
    --color-overlay: rgba(0, 0, 0, 0.45);

    /* Typography */
    --font-sans: 'Mulish', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

    --fw-light: 300;
    --fw-regular: 400;
    --fw-medium: 500;
    --fw-semibold: 600;
    --fw-bold: 700;
    --fw-heavy: 800;
    --fw-black: 900;

    --leading-tight: 1.2;
    --leading-normal: 1.5;
    --leading-relaxed: 1.65;

    /* Spacing Scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;
    --space-20: 80px;
    --space-24: 96px;

    /* Layout */
    --container-max: 1100px;
    --container-narrow: 740px;
    --gutter: 24px;
    --header-h: 64px;
    --mobile-nav-h: 60px;
    --sidebar-w: 380px;

    /* Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 20px rgba(0,0,0,0.07), 0 4px 8px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 30px rgba(0,0,0,0.08), 0 8px 12px rgba(0,0,0,0.03);
    --shadow-up: 0 -1px 4px rgba(0,0,0,0.06);
    --shadow-sidebar: -4px 0 24px rgba(0,0,0,0.12);

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
    --dur-fast: 150ms;
    --dur-base: 250ms;
    --dur-slow: 350ms;
}


/* ==============================================
   2. RESET & BASE
   ============================================== */

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: 16px;
    font-weight: var(--fw-regular);
    line-height: var(--leading-normal);
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body.no-scroll {
    overflow: hidden;
}

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

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

button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

ul, ol { list-style: none; }
input, textarea, select { font: inherit; }


/* ==============================================
   3. TYPOGRAPHY
   ============================================== */

h1, h2, h3, h4, h5, h6 {
    line-height: var(--leading-tight);
    font-weight: var(--fw-bold);
    color: var(--color-text);
}

h1 {
    font-size: clamp(2rem, 5vw, 3.25rem);
    font-weight: var(--fw-heavy);
    letter-spacing: -0.02em;
}

h2 {
    font-size: clamp(1.625rem, 3.5vw, 2.5rem);
    font-weight: var(--fw-bold);
    letter-spacing: -0.015em;
}

h3 {
    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    font-weight: var(--fw-bold);
}

h4 {
    font-size: clamp(1.1rem, 2vw, 1.375rem);
    font-weight: var(--fw-semibold);
}

h5 {
    font-size: 1rem;
    font-weight: var(--fw-semibold);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
}

p {
    font-size: 1.0625rem;
    line-height: var(--leading-relaxed);
    color: var(--color-text-secondary);
}

p + p { margin-top: var(--space-4); }

.text-lg {
    font-size: 1.1875rem;
    line-height: var(--leading-relaxed);
}

.text-sm {
    font-size: 0.875rem;
}

strong { font-weight: var(--fw-bold); }


/* ==============================================
   4. LAYOUT
   ============================================== */

.container {
    width: 100%;
    max-width: var(--container-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--gutter);
    padding-right: var(--gutter);
}

.container-narrow {
    max-width: var(--container-narrow);
}

.page-wrap {
    padding-top: var(--header-h);
    min-height: 100vh;
}

/* Simple flex row for multi-column layouts */
.row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--gutter);
}

.col { flex: 1 1 0%; min-width: 0; }
.col-auto { flex: 0 0 auto; }

/* Section spacing */
.section {
    padding-top: var(--space-20);
    padding-bottom: var(--space-20);
}

.section-sm {
    padding-top: var(--space-12);
    padding-bottom: var(--space-12);
}

.section-lg {
    padding-top: var(--space-24);
    padding-bottom: var(--space-24);
}


/* ==============================================
   5. BUTTONS & LINKS
   ============================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 12px 24px;
    font-size: 0.9375rem;
    font-weight: var(--fw-semibold);
    line-height: 1;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--dur-fast) ease;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.97);
}

/* Primary — filled */
.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-white);
}
.btn-primary:hover {
    background-color: var(--color-primary-hover);
}

/* Secondary — filled */
.btn-secondary {
    background-color: var(--color-text);
    color: var(--color-white);
}
.btn-secondary:hover {
    background-color: #333333;
}

/* Outline */
.btn-outline {
    background-color: transparent;
    border-color: var(--color-border);
    color: var(--color-text);
}
.btn-outline:hover {
    border-color: var(--color-text);
    background-color: var(--color-bg-soft);
}

/* Ghost — text-only with hover bg */
.btn-ghost {
    background-color: transparent;
    color: var(--color-text);
    padding: 10px 16px;
}
.btn-ghost:hover {
    background-color: var(--color-bg-muted);
}

/* Sizes */
.btn-lg {
    padding: 16px 32px;
    font-size: 1.0625rem;
    border-radius: var(--radius-md);
}
.btn-sm {
    padding: 8px 16px;
    font-size: 0.8125rem;
}

/* Full width */
.btn-full { width: 100%; }

/* Pill */
.btn-pill { border-radius: var(--radius-full); }

/* Inline text link with underline */
.link {
    color: var(--color-primary);
    font-weight: var(--fw-medium);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.link:hover {
    color: var(--color-primary-hover);
}


/* ==============================================
   6. SITE HEADER
   ============================================== */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--header-h);
    background-color: var(--color-bg);
    border-bottom: 1px solid transparent;
    transition:
        transform var(--dur-base) var(--ease-out),
        border-color var(--dur-base) ease,
        box-shadow var(--dur-base) ease;
}

.site-header.is-scrolled {
    border-bottom-color: var(--color-border);
    box-shadow: var(--shadow-sm);
}

.site-header.is-hidden {
    transform: translateY(-100%);
}

.header-inner {
    display: flex;
    align-items: center;
    height: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--gutter);
    gap: var(--space-2);
}

/* Logo */
.header-logo {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-right: auto;
}
.header-logo img {
    height: 32px;
    width: auto;
}

/* Desktop nav links */
.header-nav {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.header-nav-link {
    position: relative;
    padding: 8px 14px;
    font-size: 0.9375rem;
    font-weight: var(--fw-medium);
    color: var(--color-text-secondary);
    border-radius: var(--radius-md);
    transition: color var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.header-nav-link:hover {
    color: var(--color-text);
    background-color: var(--color-bg-muted);
}
.header-nav-link.is-active {
    color: var(--color-primary);
    font-weight: var(--fw-semibold);
}

/* Admin links — visible when logged in as admin/manager */
.header-nav-sep {
    width: 1px;
    height: 16px;
    background: var(--color-border);
    margin: 0 var(--space-1);
    flex-shrink: 0;
}
.header-nav-link.header-nav-admin {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}
.header-nav-link.header-nav-admin:hover {
    color: var(--color-text);
}

/* Header actions (CTA + hamburger) */
.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-left: var(--space-4);
}

/* Header CTA button */
.header-cta {
    display: inline-flex;
    align-items: center;
    padding: 9px 20px;
    font-size: 0.875rem;
    font-weight: var(--fw-bold);
    color: var(--color-white);
    background-color: var(--color-primary);
    border-radius: var(--radius-full);
    transition: background-color var(--dur-fast) ease, transform var(--dur-fast) ease;
}
.header-cta:hover {
    background-color: var(--color-primary-hover);
}
.header-cta:active {
    transform: scale(0.96);
}

/* Hamburger button */
.header-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    transition: background-color var(--dur-fast) ease;
    -webkit-tap-highlight-color: transparent;
}
.header-menu-btn:hover {
    background-color: var(--color-bg-muted);
}

/* CSS hamburger icon */
.menu-icon {
    display: block;
    position: relative;
    width: 20px;
    height: 2px;
    background-color: var(--color-text);
    border-radius: 1px;
}
.menu-icon::before,
.menu-icon::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--color-text);
    border-radius: 1px;
}
.menu-icon::before { top: -7px; }
.menu-icon::after  { top: 7px; }


/* ==============================================
   7. MOBILE BOTTOM NAV
   ============================================== */

.mobile-nav {
    display: none;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    padding: 6px 0 8px;
    font-size: 11px;
    font-weight: var(--fw-semibold);
    letter-spacing: 0.02em;
    color: var(--color-text-muted);
    -webkit-tap-highlight-color: transparent;
    transition: color var(--dur-fast) ease;
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
}

.mobile-nav-item:active {
    color: var(--color-primary);
    transform: scale(0.92);
    transition: transform 0.08s ease;
}

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

.mobile-nav-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* Icon inherits currentColor for stroke */
.mobile-nav-icon svg,
.mobile-nav-icon img {
    width: 100%;
    height: 100%;
}


/* ==============================================
   8. SIDEBAR MENU
   ============================================== */

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background-color: rgba(0, 0, 0, 0);
    visibility: hidden;
    transition:
        background-color var(--dur-slow) ease,
        visibility 0s linear var(--dur-slow);
}

.sidebar-overlay.is-open {
    background-color: var(--color-overlay);
    visibility: visible;
    transition:
        background-color var(--dur-slow) ease,
        visibility 0s linear 0s;
}

.sidebar {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--sidebar-w);
    max-width: 88%;
    background-color: var(--color-primary);
    color: var(--color-white);
    box-shadow: var(--shadow-sidebar);
    transform: translateX(100%);
    transition: transform var(--dur-slow) var(--ease-out);
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.sidebar-overlay.is-open .sidebar {
    transform: translateX(0);
}

/* Hide scrollbar in sidebar */
.sidebar::-webkit-scrollbar { display: none; }
.sidebar { -ms-overflow-style: none; scrollbar-width: none; }

.sidebar-inner {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: var(--space-8) var(--space-6);
}

/* Close button */
.sidebar-close {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    height: 48px;
    padding: 0;
    margin-bottom: var(--space-10);
    color: rgba(255, 255, 255, 0.7);
    transition: color var(--dur-fast) ease;
}
.sidebar-close:hover {
    color: var(--color-white);
}
.sidebar-close svg {
    width: 28px;
    height: 28px;
}

/* Sidebar navigation */
.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.sidebar-link {
    display: block;
    padding: 12px 0;
    font-size: 1.375rem;
    font-weight: var(--fw-medium);
    color: rgba(255, 255, 255, 0.85);
    text-align: right;
    text-decoration: none;
    transition: color var(--dur-fast) ease, padding-right var(--dur-fast) ease;
}
.sidebar-link:hover {
    color: var(--color-white);
    padding-right: var(--space-2);
}
.sidebar-link:active {
    color: rgba(255, 255, 255, 0.5);
}

.sidebar-group-label {
    padding: var(--space-4) 0 var(--space-2);
    font-size: 0.75rem;
    font-weight: var(--fw-bold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.4);
    text-align: right;
}
.sidebar-group-label:first-child {
    padding-top: 0;
}

.sidebar-divider {
    height: 1px;
    margin: var(--space-4) 0;
    background-color: rgba(255, 255, 255, 0.15);
}

/* Sidebar CTA */
.sidebar-cta {
    margin-top: auto;
    padding-top: var(--space-10);
}
.sidebar-cta .btn {
    background-color: var(--color-white);
    color: var(--color-primary);
    font-weight: var(--fw-bold);
}
.sidebar-cta .btn:hover {
    background-color: rgba(255, 255, 255, 0.9);
}


/* ==============================================
   9. SITE FOOTER
   ============================================== */

.site-footer {
    background-color: var(--color-bg-soft);
    border-top: 1px solid var(--color-border-light);
    padding: var(--space-10) 0;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.footer-logo img {
    height: 24px;
    width: auto;
    opacity: 0.6;
    transition: opacity var(--dur-fast) ease;
}
.footer-logo:hover img {
    opacity: 1;
}

.footer-links {
    display: flex;
    gap: var(--space-6);
}

.footer-links a {
    font-size: 0.875rem;
    font-weight: var(--fw-medium);
    color: var(--color-text-muted);
    transition: color var(--dur-fast) ease;
}
.footer-links a:hover {
    color: var(--color-text);
}

.footer-copy {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}


/* ==============================================
   10. SCROLL-TO-TOP
   ============================================== */

.scroll-top-btn {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    z-index: 90;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-md);
    color: var(--color-text-secondary);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition:
        opacity var(--dur-base) ease,
        visibility 0s linear var(--dur-base),
        transform var(--dur-base) var(--ease-out),
        background-color var(--dur-fast) ease;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.scroll-top-btn.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition:
        opacity var(--dur-base) ease,
        visibility 0s linear 0s,
        transform var(--dur-base) var(--ease-out),
        background-color var(--dur-fast) ease;
}

.scroll-top-btn:hover {
    background-color: var(--color-bg-muted);
    color: var(--color-text);
}

.scroll-top-btn:active {
    transform: scale(0.92);
}

.scroll-top-btn svg {
    width: 20px;
    height: 20px;
}


/* ==============================================
   11. PAGE SECTIONS (reusable)
   ============================================== */

.section-alt {
    background-color: var(--color-bg-soft);
}

.section-dark {
    background-color: var(--color-bg-dark);
    color: var(--color-white);
}
.section-dark h1,
.section-dark h2,
.section-dark h3,
.section-dark h4 {
    color: var(--color-white);
}
.section-dark p {
    color: rgba(255, 255, 255, 0.75);
}

.section-primary {
    background-color: var(--color-primary);
    color: var(--color-white);
}
.section-primary h1,
.section-primary h2,
.section-primary h3,
.section-primary h4 {
    color: var(--color-white);
}
.section-primary p {
    color: rgba(255, 255, 255, 0.85);
}

/* CTA block — reusable across pages */
.cta-block {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--space-12) var(--space-10);
    background-color: var(--color-primary);
    color: var(--color-white);
    border-radius: var(--radius-lg);
    text-align: center;
}
.cta-block h2 {
    color: var(--color-white);
    margin-bottom: var(--space-4);
}
.cta-block p {
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: var(--space-6);
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}
.cta-block .btn {
    background-color: var(--color-white);
    color: var(--color-primary);
    font-weight: var(--fw-bold);
}
.cta-block .btn:hover {
    background-color: rgba(255, 255, 255, 0.9);
}


/* ==============================================
   12. UTILITIES
   ============================================== */

.text-center { text-align: center; }
.text-left   { text-align: left; }
.text-right  { text-align: right; }

.text-primary { color: var(--color-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-muted { color: var(--color-text-muted); }
.text-white { color: var(--color-white); }

.fw-light    { font-weight: var(--fw-light); }
.fw-regular  { font-weight: var(--fw-regular); }
.fw-medium   { font-weight: var(--fw-medium); }
.fw-semibold { font-weight: var(--fw-semibold); }
.fw-bold     { font-weight: var(--fw-bold); }
.fw-heavy    { font-weight: var(--fw-heavy); }

.mt-0  { margin-top: 0; }
.mt-4  { margin-top: var(--space-4); }
.mt-6  { margin-top: var(--space-6); }
.mt-8  { margin-top: var(--space-8); }
.mt-10 { margin-top: var(--space-10); }
.mt-12 { margin-top: var(--space-12); }

.mb-0  { margin-bottom: 0; }
.mb-2  { margin-bottom: var(--space-2); }
.mb-4  { margin-bottom: var(--space-4); }
.mb-6  { margin-bottom: var(--space-6); }
.mb-8  { margin-bottom: var(--space-8); }
.mb-10 { margin-bottom: var(--space-10); }

.mx-auto { margin-left: auto; margin-right: auto; }

.hidden    { display: none !important; }
.sr-only   { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.desktop-only { display: flex; }
.mobile-only  { display: none; }


/* ==============================================
   13. RESPONSIVE (≤ 768px)
   ============================================== */

@media (max-width: 768px) {

    :root {
        --gutter: 20px;
        --header-h: 56px;
    }

    /* Show/hide responsive elements */
    .desktop-only { display: none !important; }
    .mobile-only  { display: flex !important; }

    /* Page wrap needs bottom padding for mobile nav */
    .page-wrap {
        padding-top: var(--header-h);
        padding-bottom: var(--mobile-nav-h);
    }

    /* Section spacing tightens */
    .section {
        padding-top: var(--space-12);
        padding-bottom: var(--space-12);
    }
    .section-lg {
        padding-top: var(--space-16);
        padding-bottom: var(--space-16);
    }

    /* Columns stack */
    .row {
        flex-direction: column;
    }

    /* Header — simplified */
    .header-nav {
        display: none;
    }

    .header-cta {
        display: none;
    }

    .header-actions {
        margin-left: auto;
    }

    /* Mobile bottom nav — visible */
    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 100;
        height: var(--mobile-nav-h);
        background-color: var(--color-bg);
        border-top: 1px solid var(--color-border);
        box-shadow: var(--shadow-up);
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    /* Footer clears bottom nav */
    .site-footer {
        margin-bottom: var(--mobile-nav-h);
    }

    /* Footer layout stacks */
    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-5);
    }

    /* Scroll-to-top repositions above mobile nav */
    .scroll-top-btn {
        bottom: calc(var(--mobile-nav-h) + var(--space-4));
    }

    /* CTA block */
    .cta-block {
        padding: var(--space-8) var(--space-6);
        border-radius: var(--radius-md);
    }
}

/* Small phones */
@media (max-width: 400px) {
    :root {
        --gutter: 16px;
    }
}
