/* =========================================================
   The Medicine Man — themedicineman.co.nz
   Palette: white base + kawakawa greens, earthy browns,
   river-blue accents. Motifs: koru + fern (SVG).
   ========================================================= */

:root {
    --bg:            #ffffff;
    --bg-soft:       #f6f8f4;   /* faint kawakawa wash */
    --bg-sage:       #eef3ea;
    --ink:           #24312a;   /* deep forest ink for text */
    --ink-soft:      #56645b;
    --kawakawa:      #3f6b3a;   /* primary green */
    --kawakawa-dk:   #2e4f2b;
    --kawakawa-lt:   #6d9a5f;
    --river:         #3b7a8c;   /* river-water blue accent */
    --earth:         #8a6a44;   /* earthy brown */
    --gold:          #c9a24b;
    --line:          #e2e8dd;
    --shadow:        0 12px 30px -12px rgba(36, 49, 42, 0.28);
    --shadow-sm:     0 4px 14px -6px rgba(36, 49, 42, 0.25);
    --radius:        16px;
    --radius-sm:     10px;
    --maxw:          1120px;
    --ease:          cubic-bezier(0.22, 0.61, 0.36, 1);
    --font-display:  'Cormorant Garamond', Georgia, 'Times New Roman', serif;
    --font-body:     'Nunito Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 108px; }

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--bg);
    line-height: 1.65;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

img { max-width: 100%; display: block; }

a { color: var(--river); text-decoration: none; transition: color 0.2s var(--ease); }
a:hover { color: var(--kawakawa-dk); }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.12; color: var(--ink); margin: 0 0 0.4em; }
h1 { font-size: clamp(2.2rem, 6vw, 3.9rem); }
h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1rem; }

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1.1rem, 4vw, 2.5rem); }

.section { padding-block: clamp(3.5rem, 8vw, 6.5rem); position: relative; }

.section-eyebrow, .hero-eyebrow {
    display: inline-block;
    font-size: 0.78rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--kawakawa);
    margin-bottom: 0.6rem;
}

.section-head { max-width: 640px; margin-bottom: 2.6rem; }
.section-sub { color: var(--ink-soft); font-size: 1.08rem; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.7rem;
    border-radius: 999px;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.98rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.25s var(--ease), color 0.25s var(--ease);
    will-change: transform;
}
.btn-primary { background: var(--kawakawa); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--kawakawa-dk); color: #fff; transform: translateY(-2px); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; color: var(--kawakawa-dk); border-color: var(--kawakawa-lt); }
.btn-ghost:hover { background: var(--bg-sage); transform: translateY(-2px); }
.btn-block { width: 100%; }

/* ---------- Header / Nav ---------- */
.site-header {
    position: sticky; top: 0; z-index: 60;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 92px; }

/* Square logo sits fully inside the taller header, vertically centred. */
.brand { display: inline-flex; align-items: center; gap: 0.7rem; color: var(--ink); }
.brand-logo {
    width: 72px; height: 72px;
    object-fit: contain;
}
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; letter-spacing: 0.01em; }

.primary-nav ul { display: flex; align-items: center; gap: 0.4rem; list-style: none; margin: 0; padding: 0; }
.primary-nav a {
    display: inline-block; padding: 0.55rem 0.95rem; border-radius: 999px;
    color: var(--ink); font-weight: 600; font-size: 0.98rem;
    transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.primary-nav a:hover { background: var(--bg-sage); color: var(--kawakawa-dk); }
.primary-nav .nav-cta { background: var(--kawakawa); color: #fff; }
.primary-nav .nav-cta:hover { background: var(--kawakawa-dk); color: #fff; }

.nav-toggle {
    display: none;
    flex-direction: column; justify-content: center; gap: 5px;
    width: 44px; height: 44px; padding: 0;
    background: transparent; border: none; cursor: pointer;
}
.nav-toggle-bar {
    display: block; width: 24px; height: 2.5px; border-radius: 2px;
    background: var(--ink); margin-inline: auto;
    transition: transform 0.3s var(--ease), opacity 0.2s var(--ease);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
    position: relative; overflow: hidden;
    padding-block: clamp(4rem, 12vw, 8rem);
    background:
        radial-gradient(1200px 500px at 80% -10%, var(--bg-sage), transparent 60%),
        linear-gradient(180deg, var(--bg-soft), var(--bg));
}
.hero-inner { max-width: 760px; position: relative; z-index: 2; }
.hero-lede { font-size: clamp(1.05rem, 2.4vw, 1.35rem); color: var(--ink-soft); max-width: 60ch; margin-bottom: 1.8rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; }

/* Decorative koru motifs */
.koru-motif { position: absolute; color: var(--kawakawa-lt); opacity: 0.14; pointer-events: none; z-index: 1; }
.koru-hero { width: min(48vw, 460px); right: -6%; bottom: -14%; transform: rotate(12deg); }
.koru-enquiry { width: min(34vw, 300px); left: -4%; top: -8%; opacity: 0.1; transform: rotate(-18deg); }

/* ---------- Story ---------- */
.story { background: var(--bg); }
.story-inner { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: clamp(1.8rem, 5vw, 4rem); align-items: center; }
.story-photo { position: relative; }
.story-photo img {
    width: 100%; border-radius: var(--radius); box-shadow: var(--shadow);
    aspect-ratio: 4 / 5; object-fit: cover;
}
.story-photo::before {
    content: ""; position: absolute; inset: 14px -14px -14px 14px; z-index: -1;
    border: 2px solid var(--kawakawa-lt); border-radius: var(--radius); opacity: 0.5;
}
.story-text p { color: var(--ink-soft); }

/* ---------- Products ---------- */
.products { background: linear-gradient(180deg, var(--bg-soft), var(--bg)); }
.product-grid {
    display: grid; gap: 1.6rem;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.product-card {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow-sm);
    transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
    display: flex; flex-direction: column;
}
.product-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.product-media { position: relative; overflow: hidden; aspect-ratio: 4 / 3; background: var(--bg-sage); }
.product-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); }
.product-card:hover .product-media img { transform: scale(1.06); }
.product-badge {
    position: absolute; top: 12px; left: 12px;
    background: rgba(46, 79, 43, 0.92); color: #fff;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
    padding: 0.35rem 0.7rem; border-radius: 999px;
}
.product-body { padding: 1.3rem 1.4rem 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.product-item + .product-item { border-top: 1px solid var(--line); padding-top: 1rem; }
.product-item-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; }
.product-item h3 { margin: 0; }
.product-price { font-family: var(--font-display); font-weight: 600; font-size: 1.2rem; color: var(--kawakawa); white-space: nowrap; }
.product-item p { margin: 0.35rem 0 0; color: var(--ink-soft); font-size: 0.96rem; }

/* ---------- Enquiry form ---------- */
.enquiry { background: var(--bg-sage); position: relative; overflow: hidden; }
.enquiry-inner { position: relative; z-index: 2; max-width: 720px; margin-inline: auto; }
.enquiry-form {
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: clamp(1.4rem, 4vw, 2.4rem); box-shadow: var(--shadow);
    display: flex; flex-direction: column; gap: 1.15rem;
}
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field label, .field legend { font-weight: 600; font-size: 0.95rem; color: var(--ink); }
.req { color: var(--river); }

.field input[type="text"],
.field input[type="email"],
.field textarea {
    width: 100%; font: inherit; color: var(--ink);
    padding: 0.75rem 0.9rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    background: #fdfefc; transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.field textarea { resize: vertical; }
.field input:focus, .field textarea:focus {
    outline: none; border-color: var(--kawakawa-lt);
    box-shadow: 0 0 0 3px rgba(109, 154, 95, 0.22);
}
.field input:invalid:not(:placeholder-shown),
.field textarea:invalid:not(:placeholder-shown) { border-color: #c25b4e; }

.field-products { border: none; margin: 0; padding: 0; }
.field-products legend { padding: 0; margin-bottom: 0.6rem; }
.product-choices { display: grid; grid-template-columns: 1fr; gap: 0.55rem; }
.choice {
    display: flex; align-items: flex-start; gap: 0.65rem;
    padding: 0.7rem 0.9rem; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
    cursor: pointer; transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.choice:hover { border-color: var(--kawakawa-lt); background: var(--bg-soft); }
.choice input { margin-top: 0.28rem; width: 18px; height: 18px; accent-color: var(--kawakawa); flex: none; }
.choice-label { font-weight: 600; font-size: 0.96rem; }
.choice-price { color: var(--kawakawa); font-weight: 700; }

/* Honeypot — visually removed but present in DOM */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form-alert { padding: 1rem 1.2rem; border-radius: var(--radius-sm); margin-bottom: 1.4rem; font-weight: 600; }
.form-alert-success { background: #e7f3e4; color: var(--kawakawa-dk); border: 1px solid var(--kawakawa-lt); }
.form-alert-error { background: #fbeae7; color: #9c3d31; border: 1px solid #e0a79d; }

/* ---------- Legal pages (privacy.php) ----------------------------------
 *
 * Added with the staff area. One long column of prose, capped at a readable
 * measure — everything else on this site is a grid or a hero, and neither shape
 * suits a policy somebody actually has to read.
 *
 * NOTE THE ABSENCE OF .reveal ANYWHERE ON privacy.php. See the comment in that
 * file: an element that starts at opacity 0 and waits for JavaScript is a blank
 * page to anyone with scripts off, which is not an acceptable way to serve a
 * privacy policy. Nothing here should reintroduce it.
 */
.legal { padding-top: clamp(2.5rem, 6vw, 4rem); }
.legal-inner { max-width: 68ch; }
.legal-inner h1 { margin-bottom: 0.5rem; }
.legal-inner h2 {
    font-size: clamp(1.35rem, 2.6vw, 1.75rem);
    margin-top: 2.4rem;
    padding-top: 1.6rem;
    border-top: 1px solid var(--line);
}
.legal-inner h2:first-of-type { border-top: none; padding-top: 0; }
.legal-inner .section-sub { margin-bottom: 1.8rem; }
.legal-inner ul { padding-left: 1.3rem; margin: 0 0 1rem; }
.legal-inner li { margin-bottom: 0.5rem; }
.legal-inner code {
    background: var(--bg-sage);
    border-radius: 4px;
    padding: 0.1em 0.4em;
    font-size: 0.92em;
}
/* Anchor targets sit under the 92px sticky header without html's
   scroll-padding-top, which only applies to same-page smooth scrolling. */
.legal-inner [id] { scroll-margin-top: 108px; }

/* ---------- Footer ---------- */
.site-footer { position: relative; overflow: hidden; background: var(--kawakawa-dk); color: #e9efe6; }
.footer-inner { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 2rem; padding-block: clamp(2.5rem, 6vw, 3.5rem); position: relative; z-index: 2; }
.site-footer h3 { color: #fff; font-size: 1.5rem; margin-bottom: 0.5rem; }
.site-footer h4 { color: #cfe0c6; font-family: var(--font-body); font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.78rem; margin: 0 0 0.5rem; }
.site-footer p { color: #cbd8c3; margin: 0 0 0.4rem; }
.site-footer strong { color: #fff; }
.site-footer a { color: #bfe0c8; }
.site-footer a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.14); position: relative; z-index: 2; }
.footer-bottom p { text-align: center; padding-block: 1.1rem; font-size: 0.88rem; color: #a9bda1; margin: 0; }
.fern-motif { position: absolute; right: 4%; top: 50%; transform: translateY(-50%); height: 150%; color: #ffffff; opacity: 0.06; z-index: 1; pointer-events: none; }

/* ---------- Footer tail: legal, staff ----------------------------------
 *
 * Added with the staff area. Three elements now close the footer, and they are
 * ranked on purpose:
 *
 *   .footer-bottom > p:first-child   the copyright — the business's own line
 *   .site-footer__legal              the privacy policy: a notice owed to the public
 *   .site-footer__staff              the staff door: quietest thing on the page
 *
 * THE ORDERING IS THE REQUIREMENT, NOT THE EXACT SIZES. A redesign that leaves
 * the staff link looking like a peer of the privacy link has published a back
 * door as a public feature. If these values change, keep the descent.
 *
 * ─────────────────────────────────────────────────────────────────────────────
 * THE DESCENT IS CARRIED BY SIZE AND WEIGHT, NOT BY DROPPING BELOW AA.
 *
 * dynastygrazing.co.nz ranks the same two links by fading the staff one to
 * 0.42 alpha, which lands under 4.5:1. That is not copied here. The footer
 * ground is --kawakawa-dk #2e4f2b, and both links are measured against it:
 *
 *     copyright  #a9bda1  4.62:1   (pre-existing, unchanged)
 *     legal      #c0ccbd  5.56:1
 *     staff      #adbcaa  4.65:1
 *
 * The staff link is smaller, dimmer and wider-tracked than the privacy link
 * above it, which reads as furniture to anyone not looking for it — and it is
 * still legible to someone who is, including anyone who needs the contrast.
 * "Discreet" was never the same requirement as "hard to read".
 * ─────────────────────────────────────────────────────────────────────────────
 *
 * Both stay a 44px touch target: the padding is on the ANCHOR, which is what
 * the target is measured on — the <p> around it is not tappable. The <p>'s own
 * padding-block is zeroed here because .footer-bottom p sets 1.1rem, which
 * would otherwise stack three tall blocks under the copyright.
 */
/* ⚠ SCOPED TO .footer-bottom ON PURPOSE — DO NOT SIMPLIFY THESE SELECTORS.
   `.footer-bottom p` above sets padding-block: 1.1rem at specificity (0,1,1).
   A bare `.site-footer__legal` is (0,1,0) and LOSES to it, leaving three tall
   blocks stacked under the copyright. The descendant selector makes these
   (0,2,0) and lets the reset land. */
.footer-bottom .site-footer__legal,
.footer-bottom .site-footer__staff {
    margin: 0;
    padding-block: 0;
    text-align: center;
    line-height: 1;
}

.site-footer__legal a,
.site-footer__staff a {
    display: inline-block;
    /* 0.75rem of type on a 1 line-height, plus 2 x 0.9rem, clears 44px. */
    padding-block: 0.9rem;
    padding-inline: 0.75rem;
    text-decoration: none;
    transition: color 0.25s var(--ease);
}

.site-footer__legal a {
    color: #c0ccbd;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.site-footer__staff a {
    color: #adbcaa;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
}

.site-footer__legal a:hover,
.site-footer__legal a:focus-visible,
.site-footer__staff a:hover,
.site-footer__staff a:focus-visible { color: #fff; }

/* Both links are quiet by design, which makes an outline the only reliable
   focus signal for them — a colour shift alone would be too subtle to see. */
.site-footer__legal a:focus-visible,
.site-footer__staff a:focus-visible {
    outline: 2px solid #bfe0c8;
    outline-offset: 2px;
    border-radius: 2px;
}

/* The tail sits closer to the copyright than the 1.1rem above it, so the three
   read as one group rather than three separate rows. */
.footer-bottom > .container > p:first-child { padding-bottom: 0.35rem; }

/* =========================================================
   Animations
   ========================================================= */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }

/* Image load fade-in */
.fade-img { opacity: 0; transform: scale(1.02); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.fade-img.loaded { opacity: 1; transform: none; }

/* =========================================================
   Responsive — mobile menu + layout
   ========================================================= */
@media (max-width: 820px) {
    .nav-toggle { display: flex; }

    .primary-nav {
        position: fixed; inset: 92px 0 auto 0;
        background: #fff; border-bottom: 1px solid var(--line);
        box-shadow: var(--shadow);
        max-height: 0; overflow: hidden;
        transition: max-height 0.35s var(--ease);
    }
    .primary-nav.open { max-height: 340px; }
    .primary-nav ul { flex-direction: column; align-items: stretch; gap: 0; padding: 0.6rem clamp(1.1rem, 4vw, 2.5rem) 1.1rem; }
    .primary-nav li { width: 100%; }
    .primary-nav a { display: block; width: 100%; padding: 0.9rem 1rem; border-radius: var(--radius-sm); }
    .primary-nav .nav-cta { text-align: center; margin-top: 0.4rem; }

    .story-inner { grid-template-columns: 1fr; }
    .story-photo { max-width: 460px; margin-inline: auto; }
    .story-photo::before { inset: 10px -10px -10px 10px; }
}

/* =========================================================
   Reduced motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
    .reveal { opacity: 1; transform: none; }
    .fade-img { opacity: 1; transform: none; }
}
