/* global styles - variables, reset, navbar, footer, buttons */

:root {
    --apple-ease:    cubic-bezier(0.2, 0.8, 0.2, 1);

    /* Zen Garden Palette */
    /* ── background leaves: paste the static.igem.wiki URLs here; none = no leaves ── */
    /* touch: element leaves */
    --leaf: url('https://static.igem.wiki/teams/6457/wiki/elements/leaf-still.webp');
    /* desktop: fixed body background; soft = past the hero */
    --leaf-left:            url('https://static.igem.wiki/teams/6457/wiki/elements/leaf/leaf-left.webp');
    --leaf-right:           url('https://static.igem.wiki/teams/6457/wiki/elements/leaf/leaf-right.webp');
    --leaf-left-soft:       url('https://static.igem.wiki/teams/6457/wiki/elements/leaf/leaf-left-soft.webp');
    --leaf-right-soft:      url('https://static.igem.wiki/teams/6457/wiki/elements/leaf/leaf-right-soft.webp');
    --leaf-left-dark:       url('https://static.igem.wiki/teams/6457/wiki/elements/leaf/leaf-left-dark.webp');
    --leaf-right-dark:      url('https://static.igem.wiki/teams/6457/wiki/elements/leaf/leaf-right-dark.webp');
    --leaf-left-dark-soft:  url('https://static.igem.wiki/teams/6457/wiki/elements/leaf/leaf-left-dark-soft.webp');
    --leaf-right-dark-soft: url('https://static.igem.wiki/teams/6457/wiki/elements/leaf/leaf-right-dark-soft.webp');

    --primary:       #3A4B3A;   
    --primary-mid:   #2C3A2C;
    --primary-light: #5B705B;
    --primary-pale:  #9EAD9E;

    --secondary:     #A69B82;   
    --secondary-mid: #857B65;
    --secondary-pale:#C9C0A9;

    --tertiary:      #6F7D65;   
    --tertiary-dark: #525E49;
    --tertiary-pale: #B4BFA9;

    --neutral:       #D6CBAE;   

    --olive:         var(--tertiary);
    --olive-light:   #8C9C81;
    --olive-pale:    var(--tertiary-pale);
    --cream:         var(--neutral);
    --ink:           #243024;   
    --navy:          var(--primary);
    --navy-mid:      var(--primary-mid);

    /* ── state colours: encode meaning, stay distinct in every colour-vision type, AA on cream and white ── */
    --state-done:     #1A4F93;   /* deep blue  - done        */
    --state-progress: #8B3E04;   /* burnt ochre - in progress */
    --state-planned:  #3B3535;   /* neutral     - planned     */

    /* ── chart palette: four categorical series, CVD-safe, ≥ 3:1 on cream - four is the limit ── */
    --series-1:       #1C7A9C;   /* teal    - 3.02:1 on cream */
    --series-2:       #87601D;   /* bronze  - 3.50:1 on cream */
    --series-3:       #5C1F5C;   /* deep purple - 7.21:1 on cream */
    --series-4:       #2B2727;   /* charcoal - 9.15:1 on cream */

    /* ── text colours: AA on every background (worst ratio next to each) ── */
    --text-strong:       #243024;   /* headings   - worst 8.54:1 */
    --text-body:         #3A4B3A;   /* body text  - worst 5.79:1 */
    --text-muted:        #4B5A49;   /* captions, labels - worst 4.55:1 */

    /* on dark surfaces (footer, a11y panel, dropdown) */
    --text-on-dark:       rgba(255,255,255,0.92);  /* worst 8.23:1 */
    --text-on-dark-muted: rgba(255,255,255,0.72);  /* worst 5.79:1 */
    /* secondary text on dark surfaces - use instead of adding opacity */
    --text-on-dark-soft:  rgba(255,255,255,0.70);  /* worst 5.56:1 */

    /* navbar height and logo size on every page (TRIAL - previously 56px / 48px) */
    --nav-h:         50px;
    --nav-logo:      42px;

    /* one corner radius for every card surface */
    --radius-card:   30px;

    /* warm paper block (home "The Problem"): ground, ink and the column every row lines up to */
    --paper:         #FBEADC;
    --paper-ink:     #1B1B18;
    --paper-ink-mid: #4A443C;
    --measure:       960px;
}

/* ── reusable pane: gradient glass. no backdrop blur - a flat ground has nothing to refract ── */
.pane {
    position: relative;
    border-radius: var(--pane-radius, 24px);
    background:
        radial-gradient(120% 95% at 10% 4%, rgba(255,255,255,0.98), rgba(255,255,255,0.62) 36%, rgba(255,255,255,0.30) 72%),
        linear-gradient(155deg, rgba(255,255,255,0.80), rgba(255,247,239,0.45) 52%, rgba(250,226,207,0.62));
    border: 1px solid rgba(255,255,255,0.62);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.95),
                inset 0 -1px 0 rgba(27,27,24,0.05),
                0 18px 45px rgba(27,27,24,0.09);
}

/* ── travelling ring: light running a panel's rim, driven by scroll-ring.js ──
   The rim itself - a crisp line and a soft glow falling inward, on the panel's exact curve - is a mask the
   script bakes once per size. Under it a beam turns with transform and a tinted beam fades with opacity:
   both compositor-only, so moving the light never repaints or re-blurs anything. */
.ring {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    -webkit-mask: var(--ring-rim) 0 0 / 100% 100% no-repeat;
            mask: var(--ring-rim) 0 0 / 100% 100% no-repeat;
    will-change: transform;
}

/* the beam: brightest where it points, fading both ways; --m is half its spread.
   The script turns .ring-rotor and fades .ring-bloom with inline transform/opacity; the gradients live
   one level down and never change, so a frame restyles two bare wrappers and repaints nothing. */
.ring-rotor {
    --m: 58deg;
    position: absolute;
    will-change: transform;
}
.ring-bloom {
    position: absolute;
    inset: 0;
    opacity: 0;
    will-change: opacity;
}
.ring-beam,
.ring-tint {
    position: absolute;
    inset: 0;
    border-radius: 50%;
}
.ring-beam {
    background: conic-gradient(from calc(-1 * var(--m)),
        transparent 0deg,
        color-mix(in srgb, var(--ring-light) 12%, transparent) calc(var(--m) * 0.35),
        color-mix(in srgb, var(--ring-light) 55%, transparent) calc(var(--m) * 0.7),
        var(--ring-light) var(--m),
        color-mix(in srgb, var(--ring-light) 55%, transparent) calc(var(--m) * 1.3),
        color-mix(in srgb, var(--ring-light) 12%, transparent) calc(var(--m) * 1.65),
        transparent calc(var(--m) * 2));
}
/* the tint lies along the beam - C trailing, B centre, A leading - so the meeting corner sees A → B → C
   as the beam sweeps over it; the script only fades it in near that corner */
.ring-tint {
    background: conic-gradient(from calc(-1 * var(--m)),
        transparent 0deg,
        color-mix(in srgb, var(--ring-c) 30%, transparent) calc(var(--m) * 0.4),
        var(--ring-c) calc(var(--m) * 0.7),
        var(--ring-b) var(--m),
        var(--ring-a) calc(var(--m) * 1.3),
        color-mix(in srgb, var(--ring-a) 30%, transparent) calc(var(--m) * 1.6),
        transparent calc(var(--m) * 2));
    opacity: var(--ring-mix, 0.45);
}
/* a flush-right panel's light runs anticlockwise, so its tint is laid the other way round */
.ring[data-flush="right"] .ring-tint { transform: scaleX(-1); }

/* --ring-core comes from the panel (dark.css dims it); white when nothing sets it */
.ring {
    --ring-light: var(--ring-core, rgba(255, 255, 255, 0.92));
    /* no data-ring-mode: plain white light */
    --ring-a: #FFFFFF;
    --ring-b: #FFFFFF;
    --ring-c: #FFFFFF;
}

/* ── coloured modes: the light runs a three-stop ramp as it crosses the meeting corner ──
   Switch with data-ring-mode on the section: "bi" | "trans" | "prism".
   TO REVERT to the plain white light: delete the attribute. */
[data-ring-mode] .ring { --ring-mix: 0.6; }

/* bi: blue → purple → magenta. holds its own against the warm paper */
[data-ring-mode="bi"] .ring {
    --ring-a: #2B5FD9;
    --ring-b: #9B4F96;
    --ring-c: #D6357F;
}

/* trans: sky → white → pink. the softest of the three, closest to plain light */
[data-ring-mode="trans"] .ring {
    --ring-a: #5BCEFA;
    --ring-b: #FFFFFF;
    --ring-c: #F5A9B8;
    --ring-mix: 0.7;
}

/* prism: a plain hue slide, no flag behind it */
[data-ring-mode="prism"] .ring {
    --ring-a: hsl(240 72% 74%);
    --ring-b: hsl(292 72% 74%);
    --ring-c: hsl(340 72% 74%);
}


/* ── reveal on scroll: any [data-reveal] block, staggered by --r-delay on each item ── */
[data-reveal].reveal-ready .reveal-item {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.85s var(--apple-ease), transform 0.85s var(--apple-ease);
    transition-delay: var(--r-delay, 0s);
}
[data-reveal].reveal-ready .reveal-item--lift { transform: translateY(28px) scale(0.98); }
/* anchored at its own bottom edge, so nothing opens a gap beneath it */
[data-reveal].reveal-ready .reveal-item--zoom {
    transform: scale(1.04);
    transform-origin: 50% 100%;
    transition-duration: 1.2s;
}
[data-reveal].in-view .reveal-item { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    [data-reveal].reveal-ready .reveal-item { opacity: 1; transform: none; transition: none; }
}

/* ── load order (load-order.js): a queued picture stays clear until its file is here, then fades in ── */
html.load-order img[data-src] { opacity: 0; }
/* a set held until all of it is decoded, so it appears in one frame */
html.load-order img[data-load-together] { opacity: 0; }
html.load-order img.load-in { transition: opacity 0.5s ease; }
/* !important: a gate, it must hold over any page's or theme's background */
html.load-order [data-load-bg] { background-image: none !important; }
html[data-reduce-motion] img.load-in { transition: none; }
@media (prefers-reduced-motion: reduce) {
    img.load-in { transition: none; }
}

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

/* ── clip horizontal overflow at the root (body alone does not clip in dark mode) ── */
html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    overflow-x: clip;
}

body {
    font-family: 'Quicksand', sans-serif;
    background-color: var(--navy-mid);
    /* overflow-x: clip, not hidden - hidden would break position: sticky */
    overflow-x: clip;
    width: 100vw;
}

/* ── Navbar (desktop) ─────────────────────────────────────── */
.navbar {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: var(--nav-h);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5rem;
    z-index: 200;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 400;
    font-size: 1.05rem;
    letter-spacing: 0.5px;
    color: inherit;
    font-family: 'Quicksand', sans-serif;
    text-decoration: none;
}

.logo-circle {
    width: 40px; height: 40px;
    border: 1.5px solid currentColor;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    /* only applies once the placeholder <div> becomes an <img src="...">; harmless on the div */
    object-fit: cover;
}
.logo-circle::after {
    content: '';
    width: 7px; height: 7px;
    background-color: currentColor;
    border-radius: 50%;
}

/* the real logo: no ring, no crop, natural proportions; height from --nav-logo */
img.logo-circle {
    height: var(--nav-logo, 42px);
    width: auto;
    border: 0;
    border-radius: 0;
    object-fit: contain;
}
img.logo-circle::after { content: none; }

.nav-links {
    list-style: none;
    display: flex;
    gap: 2.5rem;
}
/* navbar links: no opacity, weight 500, readable over any background */
.nav-links > li > :is(a, button) {
    text-decoration: none;
    color: inherit;
    font-weight: 500;
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    font-family: 'Quicksand', sans-serif;
    transition: text-decoration-color 0.2s ease;
}
.nav-links > li > :is(a, button):hover {
    text-decoration: underline;
    text-underline-offset: 6px;
    text-decoration-thickness: 1.5px;
}

/* current page: weight + underline, not colour alone (SC 1.4.1) */
/* the group holding the current page gets the same mark */
.nav-links > li > :is(a, button)[aria-current="page"],
.nav-links > li.is-current-section > .nav-dropbtn {
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 6px;
    text-decoration-thickness: 2px;
}

/* ── dropdown: max-content width, full-width rows, the last two menus open leftward ── */
.nav-dropdown { position: relative; }
/* group heading is a <button>: strip its browser chrome */
.nav-dropbtn {
    appearance: none;
    background: none;
    border: 0;
    margin: 0;
    line-height: inherit;
    cursor: pointer;
}

.nav-dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 250;
    width: max-content;
    min-width: 200px;
    padding: 6px;
    background-color: var(--navy-mid);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    box-shadow: 0 14px 36px rgba(0,0,0,0.28);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}
.nav-links > li:nth-last-child(-n+2) > .nav-dropdown-content {
    left: auto;
    right: 0;
}
.nav-dropdown:hover > .nav-dropdown-content,
.nav-dropdown[data-kb-open] > .nav-dropdown-content {
    visibility: visible;
    opacity: 1;
    transform: none;
}
/* Esc / second click while hovered: stay hidden until the pointer leaves (WCAG 1.4.13) */
.nav-links > li.nav-dropdown[data-dismissed] > .nav-dropdown-content {
    visibility: hidden;
    opacity: 0;
}

.nav-dropdown-content a {
    display: block;
    white-space: nowrap;
    padding: 11px 14px;            /* ~37px tall: above the 24px of WCAG 2.5.8 */
    border-radius: 8px;
    color: rgba(255,255,255,0.88);
    font-family: 'Quicksand', sans-serif;
    font-size: 0.76rem;
    font-weight: 500;
    letter-spacing: 1.4px;         /* same as the top bar - see the note on .nav-links > li > :is(a, button) */
    line-height: 1.2;
    text-transform: uppercase;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.nav-dropdown-content a:hover {
    background-color: rgba(255,255,255,0.08);
    color: #fff;
}
/* current page: tint + bold */
.nav-dropdown-content a[aria-current="page"] {
    background-color: rgba(255,255,255,0.10);
    color: #fff;
    font-weight: 700;
}

/* ── Hamburger menu & Mobile Nav ──────────────────────────── */
.hamburger {
    display: none; 
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px; height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: inherit;
    z-index: 210;
}
.hamburger span {
    display: block;
    width: 24px; height: 1.5px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
    transform-origin: center;
}
.hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* the mobile drawer lives in style.css */

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary {
    display: inline-block;
    font-family: 'Quicksand', sans-serif;
    font-size: 0.76rem;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-decoration: none;
    background: var(--primary);
    color: var(--cream);
    padding: 0.9rem 2rem;
    border-radius: 3px;
    transition: background 0.25s ease, transform 0.2s ease;
}
.btn-primary:hover { background: var(--secondary); transform: translateY(-1px); }

/* ── tactility: press-in on :active, hover highlight only with a real mouse; :where() = zero specificity ── */
:where(button, [role="button"], a.btn-primary, a.mnav-direct,
       .mnav-social, .footer-social-link,
       .glass-icon-btn, .modal-btn) {
    transition: transform 0.13s ease;
}
:where(button, [role="button"], a.btn-primary, a.mnav-direct,
       .mnav-social, .footer-social-link,
       .glass-icon-btn, .modal-btn):active {
    transform: scale(0.95);
}
@media (hover: hover) {
    :where(button, [role="button"], a.btn-primary, a.mnav-direct,
           .mnav-social, .footer-social-link,
           .glass-icon-btn, .modal-btn):hover {
        filter: brightness(1.06);
    }
}
/* reduce-motion: no press-in (respect the setting) */
html[data-reduce-motion] :where(button, [role="button"], a.btn-primary,
       a.mnav-direct, .mnav-social, .footer-social-link,
       .glass-icon-btn, .modal-btn):active {
    transform: none;
}

.btn-secondary {
    display: inline-block;
    font-family: 'Quicksand', sans-serif;
    font-size: 0.76rem;
    font-weight: 400;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--text-muted);
    border-bottom: 1px solid var(--tertiary-pale);
    padding-bottom: 2px;
    transition: border-color 0.25s ease, color 0.25s ease;
}
.btn-secondary:hover { color: var(--primary); border-color: var(--primary); }

/* ── Footer ──────────────────────────────────────────────── */
.site-footer {
    background: var(--primary);
    color: rgba(255,255,255,0.7);
    font-family: 'Quicksand', sans-serif;
    position: relative;
    z-index: 10;
}
.site-footer::before {
    content: '';
    display: block;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(118,148,126,0.5), rgba(74,102,82,0.6), transparent);
}
.footer-main {
    padding: 4rem 5rem;
    display: grid;
    grid-template-columns: 1.8fr 1fr;
    gap: 3rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.footer-brand .footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,0.85);
    font-size: 1rem;
    letter-spacing: 0.5px;
    margin-bottom: 1.2rem;
    text-decoration: none;
}
.footer-logo .logo-circle {
    width: 34px; height: 34px;
    border-color: rgba(255,255,255,0.4);
}
.footer-logo img.logo-circle { width: auto; height: 48px; }
.footer-brand p {
    font-size: 0.84rem;
    line-height: 1.75;
    color: var(--text-on-dark-muted);
    max-width: 280px;
}
.footer-col h4,
.footer-col .footer-col-title {
    font-family: 'Quicksand', sans-serif;
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--text-on-dark-muted);
    margin-bottom: 1.4rem;
}

.footer-contact-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-size: 0.86rem;
    font-weight: 300;
    color: var(--text-on-dark-muted);
    line-height: 1.5;
}
.footer-contact-item + .footer-contact-item { margin-top: 0.75rem; }
.footer-contact-icon {
    flex-shrink: 0;
    width: 16px; height: 16px;
    margin-top: 2px;
    opacity: 0.5;
}

.footer-socials {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}
.footer-social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    color: var(--text-on-dark-muted);
    text-decoration: none;
    font-size: 0.7rem;
    letter-spacing: 0.5px;
    transition: border-color 0.2s ease, color 0.2s ease;
}
.footer-social-link:hover {
    border-color: rgba(122,150,72,0.5);
    color: var(--olive-pale);
}

.footer-bottom {
    padding: 1.5rem 5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.footer-bottom p {
    font-size: 0.76rem;
    color: var(--text-on-dark-muted);
    line-height: 1.6;
}
.footer-bottom a {
    color: var(--tertiary-pale);
    text-decoration: none;
    border-bottom: 1px solid rgba(178,198,182,0.25);
    transition: color 0.2s ease, border-color 0.2s ease;
}
.footer-bottom a:hover {
    color: #fff;
    border-color: rgba(255,255,255,0.4);
}
.footer-cc-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-on-dark-muted);
    font-size: 0.74rem;
}
.footer-cc-badge svg { opacity: 0.4; }

/* ── Responsive - Global ──────────────────────── */
@media (max-width: 900px) {
    .navbar { padding: 0 2.5rem; }
    .nav-links { display: none; }
    .hamburger { display: flex; }
    .mobile-nav { display: flex; }
    .footer-main {
        grid-template-columns: 1fr 1fr;
        padding: 3rem 2.5rem;
        gap: 2.5rem;
    }
    .footer-bottom { padding: 1.5rem 2.5rem; }
}

@media (max-width: 600px) {
    .navbar { padding: 0 1.5rem; }
    .footer-main {
        grid-template-columns: 1fr;
        padding: 2.5rem 1.5rem;
        gap: 2rem;
    }
    .footer-brand { grid-column: auto; }
    .footer-bottom {
        padding: 1.5rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}