/* style.css */
/* ==========================================================================
   CSS "CLOTHING" FOR PLASTIC FREE PHUKET
   CSS gives the plain HTML its colours, fonts, spacing, layout and animation.
   Rules are grouped by the page part they dress; every group is labelled.
   ========================================================================== */

/* Palette + tokens - uses CSS variables so one edit re-themes the whole site. */
:root {
    --ocean:  #0B6E99;   /* ocean blue  — primary brand colour */
    --green:  #38A169;   /* sea green   — secondary accent      */
    --sand:   #F7F3E9;   /* warm sand   — soft section backdrop */
    --navy:   #12344D;   /* dark navy   — text + dark sections  */
    --white:  #ffffff;
    --shadow: 0 10px 30px rgba(18, 52, 77, 0.12);
    --radius: 18px;      /* shared rounded-corner size */
}

/* Global reset - uses the universal selector (*) to normalise spacing/box model. */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* Smooth scroll - uses scroll-behavior so anchor links glide instead of jump. */
html { scroll-behavior: smooth; scroll-padding-top: 80px; }

/* Body base - uses Poppins as the site-wide font over a white background. */
body {
    font-family: "Poppins", system-ui, Arial, sans-serif;
    color: var(--navy);
    background: var(--white);
    line-height: 1.7;
    overflow-x: hidden;   /* stop the drifting bubbles causing sideways scroll */
}

/* Headings - uses Montserrat to give titles a distinct, bolder voice. */
h1, h2, h3, h4 { font-family: "Montserrat", sans-serif; line-height: 1.2; }

/* Section title - uses a centred heading with a short underline accent bar. */
.section-title {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    text-align: center;
    color: var(--navy);
    margin-bottom: 0.4rem;
}
.section-title::after {
    content: "";
    display: block;
    width: 70px; height: 4px;
    margin: 0.8rem auto 0;
    background: linear-gradient(90deg, var(--ocean), var(--green));
    border-radius: 4px;
}
.section-title.light { color: var(--white); }
.section-title.light::after { background: var(--white); }
.section-lead { text-align: center; color: #4a6070; margin-bottom: 2rem; }

/* --------------------------------------------------------------------------
   BUTTONS
   -------------------------------------------------------------------------- */

/* Button base - uses padding, pill shape and a hover-lift for all buttons. */
.btn {
    display: inline-block;
    font-family: "Montserrat", sans-serif;
    font-weight: 600;
    text-decoration: none;
    padding: 0.85rem 2rem;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.btn-primary   { background: var(--green); color: var(--white); }
.btn-primary:hover { background: #2f8a58; }
.btn-outline   { background: transparent; color: var(--white); border: 2px solid var(--white); }
.btn-outline:hover { background: var(--white); color: var(--ocean); }
.btn-instagram { background: linear-gradient(45deg, #f09433, #dc2743, #bc1888); color: #fff; }

/* --------------------------------------------------------------------------
   FIXED NAVBAR
   -------------------------------------------------------------------------- */

/* Navbar - uses position:fixed so it stays pinned to the top while scrolling. */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 2rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);      /* frosted-glass effect over content */
    box-shadow: 0 2px 12px rgba(18, 52, 77, 0.08);
}
/* Scrolled state - JS adds .scrolled to shrink the bar once you scroll down. */
.navbar.scrolled { padding: 0.4rem 2rem; }
.nav-brand { display: flex; align-items: center; gap: 0.6rem;
             font-family: "Montserrat"; font-weight: 700; color: var(--navy);
             text-decoration: none; }
.nav-logo { height: 40px; width: auto; }

/* Nav links - uses flexbox to lay the six menu links out in a row. */
.nav-links { display: flex; gap: 0.4rem; }
.nav-links a {
    color: var(--navy);
    text-decoration: none;
    font-weight: 500;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    transition: background 0.2s, color 0.2s;
}
.nav-links a:hover { background: var(--ocean); color: var(--white); }

/* Mobile menu toggle - uses a hidden checkbox to open the menu without JS. */
.nav-toggle { display: none; }
.nav-burger { display: none; font-size: 1.6rem; cursor: pointer; color: var(--navy); }

/* --------------------------------------------------------------------------
   FLOATING BUBBLES (decorative)
   -------------------------------------------------------------------------- */

/* Bubble field - uses fixed positioning so bubbles float behind all content. */
.bubbles { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
/* Each bubble - uses the @keyframes 'rise' animation to drift upward and fade. */
.bubbles span {
    position: absolute;
    bottom: -60px;
    width: 24px; height: 24px;
    background: rgba(11, 110, 153, 0.12);
    border-radius: 50%;
    animation: rise 14s infinite ease-in;
}
/* nth-child - uses different left positions/sizes/delays to vary each bubble. */
.bubbles span:nth-child(1) { left: 10%; animation-delay: 0s;  }
.bubbles span:nth-child(2) { left: 25%; width: 14px; height: 14px; animation-delay: 3s; }
.bubbles span:nth-child(3) { left: 40%; width: 32px; height: 32px; animation-delay: 6s; }
.bubbles span:nth-child(4) { left: 55%; animation-delay: 1.5s; }
.bubbles span:nth-child(5) { left: 68%; width: 18px; height: 18px; animation-delay: 4.5s; }
.bubbles span:nth-child(6) { left: 80%; width: 28px; height: 28px; animation-delay: 2s; }
.bubbles span:nth-child(7) { left: 90%; width: 12px; height: 12px; animation-delay: 7s; }
.bubbles span:nth-child(8) { left: 48%; width: 20px; height: 20px; animation-delay: 9s; }

/* Rise keyframes - uses percentages to move each bubble up and shrink it away. */
@keyframes rise {
    0%   { transform: translateY(0) scale(1);    opacity: 0; }
    10%  { opacity: 1; }
    100% { transform: translateY(-105vh) scale(0.4); opacity: 0; }
}

/* Content sits above the bubbles. */
main, .navbar, .site-footer { position: relative; z-index: 1; }

/* --------------------------------------------------------------------------
   SECTION 1 — HERO
   -------------------------------------------------------------------------- */

/* Hero - uses a full-viewport background image (set inline) with centred text. */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--white);
    background-size: cover;
    background-position: center;
    padding: 6rem 1.5rem;
}
.hero-inner { max-width: 800px; }
.hero-title { font-size: clamp(2.6rem, 8vw, 5rem); font-weight: 800; margin-bottom: 1rem; }
.hero-subtitle { font-size: clamp(1.1rem, 2.5vw, 1.5rem); font-weight: 600; margin-bottom: 1.2rem; }
.hero-desc { font-size: 1.05rem; max-width: 640px; margin: 0 auto 2rem; opacity: 0.95; }

/* Wave divider - uses an absolutely-positioned SVG to make a wavy bottom edge. */
.wave-divider { position: absolute; bottom: -1px; left: 0; width: 100%; line-height: 0; }
.wave-divider svg { width: 100%; height: 90px; display: block; }
.wave-divider path { fill: var(--white); }

/* --------------------------------------------------------------------------
   SECTION 2 — WHO WE ARE
   -------------------------------------------------------------------------- */

/* Who-we-are - uses CSS grid to place text and image side by side. */
.who {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    max-width: 1100px;
    margin: 0 auto;
    padding: 5rem 1.5rem;
}
.who-text .section-title { text-align: left; }
.who-text .section-title::after { margin-left: 0; }
.who-text p { margin-bottom: 1rem; color: #3c5464; }
.who-highlight { font-weight: 700; color: var(--green); font-size: 1.15rem; }
.who-image img { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow); }

/* --------------------------------------------------------------------------
   SECTION 3 — WHAT WE DO
   -------------------------------------------------------------------------- */

/* What-we-do band - uses the sand colour to separate it from white sections. */
.what { background: var(--sand); padding: 5rem 1.5rem; }
/* Card grid - uses auto-fit grid so cards reflow into 1–3 columns responsively. */
.do-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.8rem;
    max-width: 1100px;
    margin: 2.5rem auto 0;
}
/* Do-card - uses a white rounded panel that LIFTS on hover (transform). */
.do-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.do-card:hover { transform: translateY(-10px); box-shadow: 0 18px 40px rgba(18,52,77,0.18); }
.do-emoji { font-size: 3rem; margin-bottom: 0.8rem; }
.do-card h3 { color: var(--ocean); margin-bottom: 0.6rem; }
.do-card p { color: #4a6070; }

/* --------------------------------------------------------------------------
   SECTION 4 — OUR IMPACT (dark)
   -------------------------------------------------------------------------- */

/* Impact band - uses the dark navy background the plan asked for. */
.impact { background: var(--navy); color: var(--white); padding: 5rem 1.5rem; }
/* Stats row - uses flexbox to space the animated counters evenly. */
.stats-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2.5rem;
    max-width: 1000px;
    margin: 2.5rem auto 0;
}
.stat { text-align: center; min-width: 200px; }
.stat-number {
    font-family: "Montserrat";
    font-size: clamp(2.5rem, 6vw, 3.8rem);
    font-weight: 700;
    color: #6fd0e8;
}
.stat-label { font-size: 1.05rem; opacity: 0.9; }

/* --------------------------------------------------------------------------
   SECTION 5 — PHOTO GALLERY
   -------------------------------------------------------------------------- */

.gallery { padding: 5rem 1.5rem; max-width: 1200px; margin: 0 auto; }
/* Masonry-ish gallery - uses CSS columns so photos stack like a Pinterest board. */
.gallery-grid { column-count: 3; column-gap: 1rem; }
.gallery-item {
    break-inside: avoid;       /* keep each photo whole across columns */
    margin-bottom: 1rem;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
}
.gallery-item img {
    width: 100%;
    display: block;
    transition: transform 0.4s ease;
}
/* Hover zoom - uses transform:scale to enlarge a photo when hovered. */
.gallery-item:hover img { transform: scale(1.08); }

/* --------------------------------------------------------------------------
   SECTION 6 — WHY JOIN
   -------------------------------------------------------------------------- */

.why { background: var(--sand); padding: 5rem 1.5rem; text-align: center; }
/* Reasons row - uses flexbox to lay the five icon cards out and wrap them. */
.reasons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    max-width: 1100px;
    margin: 2.5rem auto;
}
.reason {
    background: var(--white);
    border-radius: var(--radius);
    padding: 1.8rem 1.4rem;
    width: 190px;
    box-shadow: var(--shadow);
    transition: transform 0.25s ease;
}
.reason:hover { transform: translateY(-8px); }
.reason-icon { font-size: 2.4rem; display: block; margin-bottom: 0.6rem; }
.reason p { font-weight: 600; color: var(--navy); }
.why-closer { font-size: 1.2rem; font-weight: 600; color: var(--ocean); margin-top: 1rem; }

/* --------------------------------------------------------------------------
   SECTION 10 — INSTAGRAM
   -------------------------------------------------------------------------- */

.instagram { padding: 5rem 1.5rem; text-align: center; max-width: 900px; margin: 0 auto; }
/* IG grid - uses a fixed 3-column grid so all six photos are equal squares. */
.ig-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
    margin: 2.5rem 0;
}
.ig-item {
    aspect-ratio: 1 / 1;   /* forces a perfect square regardless of photo size */
    border-radius: var(--radius);
    overflow: hidden;
    display: block;
}
.ig-item img {
    width: 100%; height: 100%;
    object-fit: cover;     /* fills the square, cropping as needed */
    transition: transform 0.35s ease;
}
/* Hover zoom - uses transform:scale to slightly enlarge each IG photo. */
.ig-item:hover img { transform: scale(1.1); }

/* --------------------------------------------------------------------------
   SECTION 11 — CALL TO ACTION
   -------------------------------------------------------------------------- */

/* CTA - uses an ocean-to-green gradient band to end the page on a bold note. */
.cta {
    background: linear-gradient(120deg, var(--ocean), var(--green));
    color: var(--white);
    text-align: center;
    padding: 5rem 1.5rem;
}
.cta h2 { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: 1rem; }
.cta p { max-width: 620px; margin: 0 auto 1.5rem; font-size: 1.1rem; }
.cta-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.cta-contact { margin-top: 1.8rem; font-weight: 600; }

/* --------------------------------------------------------------------------
   FOOTER
   -------------------------------------------------------------------------- */

.site-footer { background: var(--navy); color: #cdd9e2; padding: 3rem 1.5rem 1.5rem; }
/* Footer grid - uses auto-fit columns for the org info blocks. */
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto 2rem;
}
.site-footer h4 { color: var(--white); margin-bottom: 0.6rem; }
.site-footer a { color: #6fd0e8; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.copyright { text-align: center; border-top: 1px solid rgba(255,255,255,0.15);
             padding-top: 1.2rem; font-size: 0.9rem; }

/* --------------------------------------------------------------------------
   LIGHTBOX (click-to-enlarge)
   -------------------------------------------------------------------------- */

/* Lightbox overlay - uses a full-screen fixed layer hidden until JS opens it. */
.lightbox {
    display: none;
    position: fixed; inset: 0; z-index: 200;
    background: rgba(18, 52, 77, 0.92);
    align-items: center; justify-content: center;
    padding: 2rem; cursor: zoom-out;
}
.lightbox.open { display: flex; }   /* JS adds .open to show it */
.lightbox img { max-width: 92%; max-height: 92%; border-radius: 10px; box-shadow: var(--shadow); }

/* --------------------------------------------------------------------------
   SCROLL-REVEAL ANIMATION
   -------------------------------------------------------------------------- */

/* Reveal - elements start faded/shifted down; JS adds .visible to animate in.
   The --delay variable (set per card in Python) staggers the effect. */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.7s ease var(--delay, 0s),
                transform 0.7s ease var(--delay, 0s);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* Reduced motion - uses a media query to switch animations off for users who
   prefer less motion (accessibility). */
@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
    .bubbles { display: none; }
    html { scroll-behavior: auto; }
}

/* --------------------------------------------------------------------------
   RESPONSIVE / MOBILE
   -------------------------------------------------------------------------- */

/* Tablet+down - uses a media query to restack the two-column sections. */
@media (max-width: 820px) {
    .who { grid-template-columns: 1fr; }
    .gallery-grid { column-count: 2; }

    /* Mobile menu - hide the row of links, show the burger, and reveal the
       links as a drop-down panel when the hidden checkbox is ticked. */
    .nav-burger { display: block; }
    .nav-links {
        position: absolute;
        top: 100%; left: 0; right: 0;
        flex-direction: column;
        background: var(--white);
        padding: 1rem;
        box-shadow: var(--shadow);
        display: none;
    }
    .nav-toggle:checked ~ .nav-links { display: flex; }
}

/* Phone - uses a media query to drop the gallery to a single column. */
@media (max-width: 520px) {
    .gallery-grid { column-count: 1; }
    .ig-grid { grid-template-columns: repeat(2, 1fr); }
    .navbar { padding: 0.6rem 1rem; }
}
