/*
 * Layout tokens.
 *
 * Every value that used to be duplicated across a ladder of pixel breakpoints
 * lives here once, as a fluid expression. Downstream rules derive from these
 * instead of restating magic numbers, so the logo, its clearance, the nav
 * circle and its overlap can never drift apart again.
 */

:root {
    /* --- Brand palette ----------------------------------------------------
     * Canonical values from the CI document — see BRAND.md. The theme
     * previously hardcoded #07B89E for teal, which is a visibly greener
     * colour than the identity's #01B8AD.
     *
     * --brand-teal / --brand-yellow are identity colours: logotype, large
     * display type, rules, borders, fills. They do NOT pass WCAG AA on white
     * (2.5:1 and 1.3:1), so anything that has to be *read* uses the -ink
     * variants below, which do.
     */
    --brand-teal: #01B8AD;
    --brand-yellow: #FDDF3F;
    --brand-cream: #F4E9C9;

    --brand-teal-ink: #058a6e;
    --brand-yellow-ink: #8a7a00;
    --brand-yellow-rule: #d4b800;

    /*
     * Inner-page bottom nav bar: the footer's grey (Bootstrap's .bg-dark), on
     * the customer's request. It was a lighter #565d64 so the two bands would
     * read as separate surfaces; the bar's shadow now does that job alone.
     *
     * The nav circle's fill and its glow both use this: if the glow stayed white
     * while the bar is grey you would get a pale halo on the bar's top edge.
     * navcircle.js paints the p5 disc the same colour — keep them in sync.
     *
     * The contact links on this surface are #d8d8d8, 8.1:1 here.
     */
    --navbar-bg: #343a40;

    /* --- Logo -------------------------------------------------------------
     * The tab now holds logo.png, which is square (166x166), where it used to
     * hold the 303x166 wordmark. Height is therefore the driving dimension and
     * width is derived from it, instead of the other way round — otherwise the
     * square mark would float in a pool of empty white on the right.
     *
     * --logo-inset is the breathing room between the mark and the tab's edges;
     * the tab is one mark plus that inset wide.
     */
    /* Taken down about a sixth from clamp(96px, 3.76vw + 82px, 136px) on the
       customer's note that the tab was too heavy for the corner. The ramp is
       the same shape, just lower at both ends: 80px on a 375px phone against
       the old 96px, 112px from ~1420px up against the old 136px. --logo-w and
       --logo-clear derive from it, so the hero's reserved space follows. */
    --logo-h: clamp(80px, 3.06vw + 68.5px, 112px);
    --logo-inset: clamp(14px, 1.1vw, 24px);
    --logo-w: calc(var(--logo-h) + var(--logo-inset));
    --logo-top: clamp(15px, 1.74vw, 25px);

    /* Vertical room the front page must leave for the absolutely-positioned
     * logo. Derived, not guessed: the old hardcoded 180px/200px clearances
     * drifted out of sync with the logo and left ~75px of dead space.
     * Inner pages carry no logo and use --page-top instead. */
    --logo-clear: calc(var(--logo-top) + var(--logo-h) + 15px);

    /* Inner-page hero band: how much of the background photograph shows above
     * the white content card. This used to be --logo-clear, sized to clear a
     * logo that inner pages no longer render. It is now an independent design
     * value — enough band for the image to read as more than a stripe. */
    --page-top: clamp(56px, 4.6vw, 90px);

    /* --- Inner-page sticky return rail ------------------------------------
     * Everything the document stacks *above* .content, derived rather than
     * measured: the return button is --topbar-btn-h tall and the rail pads it
     * by --topbar-pad, so 54px.
     *
     * Two things need it. .content subtracts it from its min-height, so the
     * inner-page composition — hero band, white card, nav bar — is exactly one
     * viewport tall and the only thing below the fold is the footer. And
     * #content offsets its scroll target by it, so landing on the anchor puts
     * the page at true zero instead of one topbar height down.
     *
     * The .admin-bar override below folds in WordPress's `html { margin-top }`,
     * which is also space above .content and would otherwise reintroduce the
     * same stray scroll for logged-in users.
     *
     * Exact at every width now that the rail holds one button and nothing
     * else: it used to also carry the institute name, which wrapped to a
     * second line on a narrow screen and made the real bar taller than this
     * arithmetic claimed.
     */
    --topbar-pad: 9px;
    /* The return button's height. Down from --tap (44px) on the customer's note
       that it may be smaller: it floats over the hero photograph on every
       content page and read as heavier than a way back needs to be. 36px is
       still half again WCAG 2.5.8's 24px minimum target. */
    --topbar-btn-h: 36px;
    --above-content: calc(var(--topbar-btn-h) + 2 * var(--topbar-pad));

    /* --- Nav circle -------------------------------------------------------
     * --nav-size-full : home page / hover state
     * --nav-size      : resting size on inner pages
     * --navbar-h      : height of the inner-page sticky bar
     * --nav-peek      : how far the circle rises above that bar's top edge
     *
     * On inner pages the circle is anchored to the *bottom* of the bar rather
     * than sitting in flow on negative margins. That coupling matters: the bar
     * used to be ~250px tall because it carried a copy of the footer, and the
     * circle's downward extent was swallowed by it. Now that the bar is 76px,
     * the old geometry pushed 195px of circle straight through it and over the
     * footer below.
     *
     * --nav-peek is therefore derived from the sizes it actually depends on
     * instead of being an independent guess, so the clearance content leaves
     * for the circle can never again disagree with where the circle really is.
     */
    --nav-size-full: min(88vw, clamp(400px, 39vw, 560px));

    /*
     * Front-page circle. Sized against viewport *height* as well as width,
     * which the width-only version was not: on a 1920x1080 screen it resolved
     * to 560px, the hero to 660px, and the whole composition ran 1260px tall —
     * so the circle hung out of the bottom of the viewport and the Aktuelles
     * panel was cut off. Tying it to vh keeps hero + panels inside one screen
     * on a landscape monitor, which is the only place this layout is three-up.
     */
    --nav-size-home: min(76vw, 38vh, 440px);
    /*
     * Resting size trimmed from clamp(220px, 33vw, 300px).
     *
     * The 300px circle was sized for a bar ~250px tall, which contained most of
     * it. Against the 76px bar it protrudes 234px instead of the old 105px and
     * covers that much body text on a long page while you scroll. Shrinking the
     * *resting* size is what --nav-size is for — hover still expands it to
     * --nav-size-full, so nothing is lost when the circle is actually in use.
     *
     * Raise this if the labels feel too small; every clearance derives from it.
     *
     * The floor came down from 170px to 145px for phones, where the circle was
     * both visually heavy and crowding the bar: it is centred on the bar while
     * the contact button and the CTA sit either side of it, and at 170px on a
     * 360px screen there was no room left for the CTA. 145px leaves ~8px of
     * clearance at 360px, the narrowest width worth designing for.
     *
     * The desktop end then came down again, from clamp(145px, 18vw, 220px), on
     * the customer's note that it is still too large on a content page. Only
     * the top of the ramp moved: the 145px floor is untouched and governs
     * every width up to ~967px, so a phone sees exactly the circle it saw
     * before. Hover still opens it to --nav-size-full, which is where the
     * slice labels are meant to be read — the resting size only has to say
     * that navigation is there.
     *
     * The top came down once more, from 15vw/180px to 150px, when the bar
     * became a slim strip (September 2026): a 180px disc standing on a 26px
     * strip read as heavier than it had sitting half inside a 76px bar. The
     * 145px floor still holds, for the label-size reason under the 380px
     * query at the end of this file.
     */
    --nav-size: clamp(145px, 12vw, 150px);
    /* A third of the old 76px: one line of 12–13px contact text either side of
       the circle, and nothing that needs more room than that. */
    --navbar-h: 26px;
    --navbar-pad: 20px;
    --nav-bottom-inset: 4px;
    --nav-peek: calc(var(--nav-size) - var(--navbar-h) + var(--nav-bottom-inset));

    /* Vertical room page content must leave at its end so the last line does
     * not scroll under the circle. The circle protrudes --nav-peek above the
     * sticky bar and carries a 60px-blur / 15px-spread white glow on top of
     * that, which washes out text well before the circle itself reaches it. */
    /* Reach of the circle's bloom, which washes out text before the circle
       itself gets there. Down from 55px with the tighter dark glow. */
    --nav-glow: 32px;
    --nav-clear: calc(var(--nav-peek) + var(--nav-glow));

    /* --- Produktübersicht book cards -------------------------------------- */
    --pu-w: clamp(230px, 20vw + 92px, 280px);
    --pu-h: max(330px, calc(var(--pu-w) * 1.357));

    /* --- Home hero band ---------------------------------------------------
     * How tall the band of photographs above the white bar on the front page
     * is. The photographs themselves are sized from it — see the background
     * tokens below — and aimed in bar-filler.css.
     *
     * The ceiling is what keeps the front page to one screen: hero plus the
     * three panels under it have to fit, and on a 900px-tall laptop that is
     * 576 + ~314. Raising it pushes the Aktuelles panel below the fold, so
     * more of the picture has to be bought by cropping rather than by height.
     */
    --hero-h: min(66vh, clamp(240px, 40vw, 720px));

    /* --- Background photographs -------------------------------------------
     * The tree in the hand and the tree in the book, each in its own half of
     * the page: the hero band on the front page (bar-filler.css), a fixed
     * backdrop on inner pages (background.css).
     *
     * They used to be one pre-joined bg.png stretched over the band with
     * `cover`, and one picture cannot hold its subjects still across screen
     * shapes. The band runs from 1.5:1 on a phone to 3.6:1 on a 2560x1440
     * monitor, and the wider it got, the more `cover` cut off the top — the
     * butterfly went first.
     *
     * Each photograph is now sized from the band's *height*: the hand at twice
     * --hero-h, the book at 1.48 times. That makes the two trees the same
     * height, since their canopies fill different shares of their pictures,
     * and keeps that height a fixed share of the band on every screen — a
     * wider screen only shows more of each photograph's sides.
     *
     *   min(…, 100vw / 74vw)  phones: a half is narrower than a canopy at full
     *                         size, so both photographs come down together
     *   max(--hero-h, …)      never shorter than the band
     *   max(…, 33.4vw)        never narrower than a half — both files are 3:2,
     *                         so a height of 50vw / 1.5 fills one
     */
    --bg-hand-size: max(var(--hero-h), min(calc(var(--hero-h) * 2), 100vw), 33.4vw);
    --bg-book-size: max(var(--hero-h), min(calc(var(--hero-h) * 1.48), 74vw), 33.4vw);

    /* --- Semantic stacking order -----------------------------------------
     * Replaces the loose 10/20/30/31/40/100 literals scattered across files.
     */
    --z-sticky: 10;
    --z-logo: 20;
    --z-backdrop: 30;
    --z-lifted: 31;
    --z-float: 40;
    --z-skip: 100;

    /* Minimum comfortable touch target (WCAG 2.5.8 / Apple HIG). */
    --tap: 44px;
}

/* The WordPress admin bar is position:fixed and would sit on top of the
 * absolutely-positioned logo. Push everything down by its real height. */
.admin-bar {
    --logo-top: calc(clamp(15px, 1.74vw, 25px) + 32px);
    --above-content: calc(var(--topbar-btn-h) + 2 * var(--topbar-pad) + 32px);
}

/*
 * Phones below ~380px. The bar's 20px of padding is a meaningful slice of the
 * width there, and the contact icons either side of the circle need it more
 * than the edges do.
 *
 * The circle deliberately does *not* shrink further here. Its slice labels are
 * drawn at radius/20 — about 6.5px at 145px — so taking more off the diameter
 * buys clearance by making the navigation unreadable.
 */
@media (max-width: 380px) {
    :root {
        --navbar-pad: 12px;
    }
}

@media screen and (max-width: 782px) {
    .admin-bar {
        --logo-top: calc(clamp(15px, 1.74vw, 25px) + 46px);
        --above-content: calc(var(--topbar-btn-h) + 2 * var(--topbar-pad) + 46px);
    }
}
