/* ==========================================================================
   H&H Chemical - Homepage + Chat Widget (matches screenshot look)
   ========================================================================== */

:root {
    --accent: #54B435;
    /* sampled from your screenshot */
    --accent-2: #7BE255;
    --accent-dark: #3B8F25;

    --bg0: #050705;
    --bg1: #0b0f0a;
    --ink: #eaf2e8;
    --muted: rgba(234, 242, 232, .78);

    --card: rgba(10, 14, 10, .85);
    --line: rgba(255, 255, 255, .10);
    --shadow: 0 12px 30px rgba(0, 0, 0, .35);

    --container: 1200px;
    --radius: 10px;
    --radius-lg: 14px;
}

/* Base */
* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--bg1);
    color: var(--ink);
    overflow-x: hidden;
}

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

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 20px;
}

/* ==========================================================================
   HERO BACKDROP
   - Put your background image at: public/images/hero-bg.jpg
   ========================================================================== */
.hero-wrap {
    min-height: 92vh;
    background:
        linear-gradient(90deg, rgba(0, 0, 0, .78) 0%, rgba(0, 0, 0, .62) 45%, rgba(0, 0, 0, .72) 100%),
        radial-gradient(1200px 700px at 70% 30%, rgba(84, 180, 53, .16), rgba(0, 0, 0, 0)),
        url("../images/hero-bg.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* ✅ Never let hero overlay layers capture mouse events */
.hero-wrap::before,
.hero-wrap::after {
    pointer-events: none !important;
}

/* ✅ Ensure real content is above any overlays */
.site-header,
.hero,
.section,
.site-footer {
    position: relative;
    z-index: 2;
}

/* ==========================================================================
   Header (topbar + nav)
   ========================================================================== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(6px);
}

.topbar {
    background: rgba(0, 0, 0, .55);
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
}

.mark {
    width: 38px;
    height: auto;
    filter: brightness(1.2);
}

.topbar-call {
    font-weight: 600;
    color: var(--accent);
    text-align: center;
}

.topbar-call a {
    color: var(--accent);
}

.topbar-social {
    display: flex;
    gap: 10px;
    align-items: center;
}

.social {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: .9;
    transition: transform .08s ease, opacity .12s ease;
}

.social svg {
    width: 20px;
    height: 20px;
    fill: var(--accent);
}

.social:hover {
    transform: translateY(-1px);
    opacity: 1;
}

/* Nav row */
.navrow {
    background: rgba(0, 0, 0, .35);
    border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    gap: 16px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.nav a {
    font-weight: 700;
    color: rgba(255, 255, 255, .92);
    padding: 8px 6px;
    border-bottom: 2px solid transparent;
}

.nav a:hover {
    color: #fff;
}

.nav a.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Buttons */
.btn {
    appearance: none;
    border: 1px solid transparent;
    background: transparent;
    color: #fff;
    cursor: pointer;
    padding: 12px 18px;
    border-radius: 2px;
    /* squared like screenshot */
    font-weight: 800;
    letter-spacing: .02em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform .08s ease, background .12s ease, border-color .12s ease, opacity .12s ease;
}

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

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #071006;
}

.btn-primary:hover {
    background: #6ad345;
    border-color: #6ad345;
}

.btn-outline {
    border-color: rgba(255, 255, 255, .35);
    background: transparent;
    color: #fff;
}

.btn-outline:hover {
    border-color: #fff;
}

.btn-cta {
    background: var(--accent);
    border-color: var(--accent);
    color: #071006;
    padding: 12px 22px;
    min-width: 160px;
}

.btn-cta:hover {
    background: #6ad345;
    border-color: #6ad345;
}

/* ==========================================================================
   Hero content
   ========================================================================== */
.hero {
    padding: 70px 0 90px;
}

.hero-inner {
    max-width: 820px;
    padding-top: 40px;
}

.hero-kicker {
    color: var(--accent);
    font-weight: 700;
    font-size: 22px;
    margin: 0 0 10px 0;
}

.hero-title {
    margin: 0;
    font-size: clamp(44px, 6vw, 86px);
    font-weight: 900;
    letter-spacing: .04em;
    text-transform: uppercase;
    line-height: 1.02;
    color: #fff;
}

.hero-copy {
    margin: 18px 0 0;
    max-width: 720px;
    color: rgba(255, 255, 255, .86);
    font-size: 15px;
    line-height: 1.55;
}

.hero-actions {
    display: flex;
    gap: 16px;
    margin-top: 26px;
    flex-wrap: wrap;
}

/* ==========================================================================
   Sections
   ========================================================================== */
.section {
    padding: 64px 0;
    background: var(--bg1);
}

.section-services {
    background:
        linear-gradient(180deg, rgba(84, 180, 53, .18), rgba(84, 180, 53, 0) 40%),
        var(--bg1);
}

.section-about {
    background: #070a07;
}

.section-contact {
    background: #060806;
}

.section-head h2 {
    margin: 0;
    color: #fff;
    font-size: 30px;
    font-weight: 900;
    letter-spacing: .02em;
}

.section-head p {
    margin: 10px 0 0;
    color: rgba(255, 255, 255, .78);
    max-width: 840px;
}

.cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-top: 28px;
}

.card {
    background: rgba(0, 0, 0, .35);
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: var(--radius);
    padding: 18px 18px;
    box-shadow: 0 10px 22px rgba(0, 0, 0, .25);
}

.card h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 900;
    color: #fff;
}

.card p {
    margin: 0;
    color: rgba(255, 255, 255, .78);
    line-height: 1.45;
}

.section-actions {
    margin-top: 22px;
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-top: 26px;
}

.about-block {
    background: rgba(0, 0, 0, .35);
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: var(--radius);
    padding: 18px;
}

.about-block h3 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 900;
}

.about-block p {
    margin: 0;
    color: rgba(255, 255, 255, .78);
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 26px;
}

.contact-card {
    background: rgba(0, 0, 0, .35);
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: var(--radius);
    padding: 18px;
}

.contact-card h3 {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 900;
    color: #fff;
}

.contact-card p {
    margin: 0 0 16px;
    color: rgba(255, 255, 255, .78);
}

.contact-card a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.contact-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
    background: #040604;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.site-footer .container {
    padding: 18px 0;
    text-align: center;
}

.site-footer small {
    color: rgba(255, 255, 255, .68);
}

/* ==========================================================================
   Modal (Quote)
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    z-index: 80;
    opacity: 0;
    pointer-events: none;
    /* ✅ critical */
    transition: opacity .12s ease;
}

.modal-backdrop.open {
    opacity: 1;
    pointer-events: auto;
    /* ✅ only when open */
}

.modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 81;
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    /* ✅ critical */
    transition: opacity .12s ease, transform .12s ease;
}

.modal.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
    /* ✅ only when open */
}

/* ✅ If hidden attribute is present, do not render at all */
.modal[hidden],
.modal-backdrop[hidden] {
    display: none !important;
    pointer-events: none !important;
}


.modal-card {
    width: min(560px, calc(100vw - 24px));
    background: #0b0f0a;
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .6);
    border-radius: 8px;
    overflow: hidden;
}

.modal-hero {
    padding: 16px;
    background: linear-gradient(135deg, rgba(84, 180, 53, .35), rgba(0, 0, 0, .20));
    border-bottom: 1px solid rgba(255, 255, 255, .10);
}

.modal-hero-inner {
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 14px;
    align-items: center;
}

.modal-hero img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    filter: brightness(1.2);
}

.modal-hero h3 {
    margin: 0 0 2px 0;
    font-size: 18px;
    font-weight: 900;
    color: #fff;
}

.modal-hero p {
    margin: 0;
    color: rgba(255, 255, 255, .78);
    font-size: 13px;
}

.modal-body {
    padding: 16px;
}

.modal-body input,
.modal-body textarea {
    width: 100%;
    margin: 8px 0 0;
    padding: 12px 12px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(0, 0, 0, .25);
    color: #fff;
    outline: none;
}

.modal-body textarea {
    min-height: 110px;
    resize: vertical;
}

.modal-body input:focus,
.modal-body textarea:focus {
    border-color: rgba(84, 180, 53, .65);
    box-shadow: 0 0 0 3px rgba(84, 180, 53, .16);
}

.modal-fine {
    margin: 10px 0 0;
    color: rgba(255, 255, 255, .60);
    font-size: 12px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid rgba(255, 255, 255, .10);
}

/* ==========================================================================
   Chat Widget (FAB + Panel)
   ========================================================================== */
.chat-fab {
    position: fixed;
    right: 16px;
    bottom: 18px;
    z-index: 90;
    border: 0;
    background: #fff;
    color: #111;
    box-shadow: 0 14px 34px rgba(0, 0, 0, .35);
    border-radius: 999px;
    padding: 10px 12px 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.chat-fab-label {
    font-weight: 700;
    font-size: 13px;
}

.chat-fab-icon {
    width: 34px;
    height: 34px;
    background: #3b5bfd;
    /* small blue bubble like screenshot */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-fab-icon svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

.chat-panel {
    position: fixed;
    right: 16px;
    bottom: 70px;
    width: min(380px, calc(100vw - 32px));
    height: 540px;
    background: #0b0f0a;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 14px;
    box-shadow: 0 22px 60px rgba(0, 0, 0, .55);
    z-index: 91;
    overflow: hidden;

    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity .14s ease, transform .14s ease;
}

.chat-panel.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.chat-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 12px;
    background: rgba(0, 0, 0, .35);
    border-bottom: 1px solid rgba(255, 255, 255, .10);
}

.chat-panel-title strong {
    display: block;
    font-weight: 900;
    letter-spacing: .02em;
}

.chat-panel-sub {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, .65);
    margin-top: 2px;
}

.icon-btn {
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, .06);
}

.icon-btn svg {
    width: 20px;
    height: 20px;
    fill: #fff;
}

.chat {
    height: 390px;
    overflow: auto;
    padding: 12px;
    background:
        radial-gradient(700px 350px at 20% 10%, rgba(84, 180, 53, .10), rgba(0, 0, 0, 0)),
        #0b0f0a;
}

/* bubbles */
.msg {
    display: flex;
    margin: 8px 0;
}

.msg .bubble {
    max-width: 74%;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.35;
}

.msg.bot {
    justify-content: flex-start;
}

.msg.bot .bubble {
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .10);
    color: rgba(255, 255, 255, .92);
    border-bottom-left-radius: 6px;
}

.msg.user {
    justify-content: flex-end;
}

.msg.user .bubble {
    background: var(--accent);
    color: #061005;
    border-bottom-right-radius: 6px;
    font-weight: 600;
}

/* suggestions dock */
.suggestions-dock {
    position: sticky;
    bottom: 0;
    padding: 10px 0 8px;
    margin-top: 10px;
    background: linear-gradient(180deg, rgba(11, 15, 10, 0), rgba(11, 15, 10, .92) 35%, rgba(11, 15, 10, 1));
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .06);
    color: rgba(255, 255, 255, .92);
    padding: 9px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 12.5px;
    cursor: pointer;
}

.chip:hover {
    border-color: rgba(84, 180, 53, .55);
    background: rgba(84, 180, 53, .12);
}

.composer {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid rgba(255, 255, 255, .10);
    background: rgba(0, 0, 0, .32);
}

.composer input {
    flex: 1;
    padding: 12px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(0, 0, 0, .18);
    color: #fff;
    outline: none;
}

.composer input:focus {
    border-color: rgba(84, 180, 53, .65);
    box-shadow: 0 0 0 3px rgba(84, 180, 53, .16);
}

.chat-panel-footer {
    padding: 10px 12px 12px;
    background: rgba(0, 0, 0, .32);
    border-top: 1px solid rgba(255, 255, 255, .10);
}

.btn-wide {
    width: 100%;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
    .topbar-inner {
        flex-wrap: wrap;
        justify-content: center;
    }

    .topbar-left {
        display: none;
    }

    .nav-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .btn-cta {
        width: 100%;
    }

    .hero-inner {
        padding-top: 12px;
    }

    .cards {
        grid-template-columns: 1fr;
    }

    .about-grid {
        grid-template-columns: 1fr;
    }

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

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}