/* ==========================================================================
   HypoPara Australia rebrand (Direction C, L2 Paired, R1 Ribbon). LIVE since 21 Nov 2026.
   Enqueued only by includes/rebrand.php when casr_rebrand_is_live(), and every
   rule is scoped to body.casr-rebrand, so it applies only while the switch is on.
   Measurements behind the breakpoint: launch-kit/WEBSITE-PLAN.md.
   ========================================================================== */

/* ---------- Paired lockup (shared by header and footer) ---------- */
.casr-rebrand .casr-rb-brand {
  --rb-mark: 44px;          /* butterfly box */
  --rb-shield: 38px;        /* visible shield height (content box + 4% pad) */
  --rb-type: 15px;          /* wordmark size */
  --rb-gap: 9px;            /* mark to words */
  --rb-split: 14px;         /* half to divider */
  display: inline-flex;
  align-items: center;
  gap: var(--rb-split);
  text-decoration: none;
  flex-shrink: 0;
}
.casr-rebrand .casr-rb-half {
  display: inline-flex;
  align-items: center;
  gap: var(--rb-gap);
}
.casr-rebrand .casr-rb-butterfly {
  width: var(--rb-mark);
  height: var(--rb-mark);
  flex: none;
  display: block;
}
.casr-rebrand .casr-rb-divider {
  width: 2px;
  align-self: stretch;
  margin: 4px 0;
  background: #D1D5DB;
}
.casr-rebrand .casr-rb-word {
  display: flex;
  flex-direction: column;
  font-family: 'Plus Jakarta Sans', Inter, system-ui, sans-serif;
  font-size: var(--rb-type);
  line-height: 1.02;
  white-space: nowrap;
}
.casr-rebrand .casr-rb-word__a {
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--casr-navy, #1A2332);
}
.casr-rebrand .casr-rb-word__b {
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--casr-primary, #0A6E6E);
}

/* Canonical shield PNG cropped to its content box (colour: 78,75 to 433,427 of
   512, plus a 4% pad = a 383 x 380 window from 64,61). Never redrawn. */
.casr-rebrand .casr-rb-shield {
  position: relative;
  display: inline-block;
  flex: none;
  overflow: hidden;
  height: var(--rb-shield);
  width: calc(var(--rb-shield) * 383 / 380);
}
.casr-rebrand .casr-rb-shield img {
  position: absolute;
  max-width: none;
  width: calc(var(--rb-shield) * 512 / 380);
  height: calc(var(--rb-shield) * 512 / 380);
  left: calc(var(--rb-shield) * -64 / 380);
  top: calc(var(--rb-shield) * -61 / 380);
}
/* Reversed PNG: content 85,90 to 426,421 plus pad = 367 x 357 window from 72,77.
   Served as the keyed copy (transparent field, same geometry), so no tile shows on navy. */
.casr-rebrand .casr-rb-shield--dark {
  width: calc(var(--rb-shield) * 367 / 357);
}
.casr-rebrand .casr-rb-shield--dark img {
  width: calc(var(--rb-shield) * 512 / 357);
  height: calc(var(--rb-shield) * 512 / 357);
  left: calc(var(--rb-shield) * -72 / 357);
  top: calc(var(--rb-shield) * -77 / 357);
}

/* Footer: reversed colourway on navy. */
.casr-rebrand .casr-rb-brand--dark .casr-rb-divider { background: rgba(255, 255, 255, .35); }
.casr-rebrand .casr-rb-brand--dark .casr-rb-word__a { color: #FFFFFF; }
.casr-rebrand .casr-rb-brand--dark .casr-rb-word__b { color: #F1CE6A; }
.casr-rebrand .casr-footer__logo.casr-rb-brand { margin-bottom: 20px; }

/* ---------- Header width budget ----------
   Live, measured 21 Nov 2026 at 1920px: nav 1106 + actions 185 + old brand 146
   = 1437px in a 1512px content box (1560 cap - 48 padding), 75px slack.
   The paired lockup measures 313.5px (old brand 146), so content is 1605px.
   Keeping the same 75px slack needs a 1680px content box: cap 1728px (1680 + 48
   padding), reached at a 1792px viewport (1728 + 64 header padding). */
.casr-rebrand .casr-header__inner {
  max-width: 1728px;
}

/* Between 1641px and 1792px the full nav no longer fits: collapse it there too.
   The open-menu rules below repeat theme.css's 1640px block, which only applies
   up to 1640px. Keep the two in step. */
@media (min-width: 1641px) and (max-width: 1792px) {
  .casr-rebrand .casr-header__nav {
    display: none !important;
  }

  .casr-rebrand .casr-header__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Join and Donate sit right, beside the hamburger (theme.css 1.75.1 rule, repeated here). */
  .casr-rebrand .casr-header__actions {
    margin-left: auto;
    margin-right: 8px;
  }

  .casr-rebrand .casr-header__nav.casr-header__nav--open {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--casr-white);
    padding: 16px 24px 24px;
    box-shadow: 0 8px 24px rgba(26, 35, 50, 0.15);
    gap: 4px;
    z-index: 999;
    border-top: 1px solid var(--casr-silver);
  }

  .casr-rebrand .casr-header__nav.casr-header__nav--open ul,
  .casr-rebrand .casr-header__nav.casr-header__nav--open .casr-nav-menu,
  .casr-rebrand .casr-header__nav.casr-header__nav--open .menu {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .casr-rebrand .casr-header__nav.casr-header__nav--open a,
  .casr-rebrand .casr-header__nav.casr-header__nav--open .menu-item a {
    display: block;
    padding: 14px 16px;
    min-height: 48px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--casr-navy);
    text-decoration: none;
    border-radius: 8px;
    transition: background var(--casr-transition);
  }

  .casr-rebrand .casr-header__nav.casr-header__nav--open a:hover,
  .casr-rebrand .casr-header__nav.casr-header__nav--open .menu-item a:hover,
  .casr-rebrand .casr-header__nav.casr-header__nav--open a:active,
  .casr-rebrand .casr-header__nav.casr-header__nav--open .menu-item a:active {
    background: var(--casr-primary-light, #E6F5F5);
    color: var(--casr-primary-dark);
  }
}

/* ---------- Tablet and phone ---------- */
@media (max-width: 1100px) {
  .casr-rebrand .casr-header__brand.casr-rb-brand {
    --rb-mark: 38px;
    --rb-shield: 33px;
    --rb-type: 13.5px;
    --rb-gap: 7px;
    --rb-split: 10px;
  }
}
@media (max-width: 640px) {
  .casr-rebrand .casr-header__brand.casr-rb-brand {
    --rb-mark: 32px;
    --rb-shield: 27px;
    --rb-type: 11.5px;
    --rb-gap: 5px;
    --rb-split: 7px;
  }
}
/* Phones (<=560px): the old brand had about 115px here (measured 390px wide: brand
   115.5 + Join/Donate 132 + toggle 40 in a 294px box, 7px slack). The paired
   names cannot fit, so the header shows the two marks only, still co-equal; the
   link's aria-label carries both names, and the footer shows the full lockup. */
@media (max-width: 560px) {
  .casr-rebrand .casr-header__brand.casr-rb-brand {
    --rb-mark: 34px;
    --rb-shield: 28px;
    --rb-split: 8px;
  }
  .casr-rebrand .casr-header__brand .casr-rb-word,
  .casr-rebrand .casr-header__brand .casr-rb-divider { display: none; }
  .casr-rebrand .casr-header__brand .casr-rb-half { gap: 0; }
}

/* Footer on phones: the full lockup (313px) is wider than a 320px footer column,
   so the two halves stack, each keeping its own name. */
@media (max-width: 560px) {
  .casr-rebrand .casr-footer__logo.casr-rb-brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .casr-rebrand .casr-footer__logo .casr-rb-divider { display: none; }
}

/* Home hero watermark: both marks (butterfly + shield) in place of the lone shield. */
.casr-rebrand .casr-hero__shield.casr-rb-hero-marks {
  width: 460px;
  height: auto;
  max-width: 100%;
}
