/* ==========================================================================
   ABONEX Solutions — Components: logo, nav, buttons, tags, accordion, form
   ========================================================================== */

/* ------------------------------------------------------------------- LOGO */

.logo {
  display: inline-flex;
  align-items: center;
  flex: none;

  /* The supplied artwork is navy, and two surfaces here are also navy: the
     bar before it sticks, and the footer card. Rather than recolour a single
     pixel of it, the logo gets a paper card to sit on in those two places.

     The padding is present in every state and cancelled by an equal negative
     margin, so the artwork itself never moves - the card fades in and out
     around a logo that stays put, instead of nudging it sideways on scroll.
     Paper rather than pure white so it disappears completely once the bar is
     paper too (stuck, and behind the open mobile menu). */
  padding: 6px 12px;
  margin-inline: -12px;
  border-radius: var(--r-md);
  background: transparent;
  transition: background var(--dur-micro) var(--ease-out-quart);
}

.on-ink .logo,
.nav:not(.is-stuck) .logo { background: var(--paper); }

/* The supplied lockup, used as given - one image, original colours, no
   recolouring. 6.137:1, so the height drives it and the width follows. */
.logo__img {
  height: 34px;
  width: auto;
  flex: none;
  transition: height var(--dur-reveal) var(--ease-out-expo);
}

@media (max-width: 1100px) { .logo__img { height: 30px; } }
@media (max-width: 420px)  { .logo__img { height: 26px; } }

/* -------------------------------------------------------------------- NAV */

/* Held back from the very first paint so the entrance never shows the bar,
   hide it, then fade it in. Removed by gsap-nav.js, or by the failsafe in the
   head if that never runs. */
.nav-intro .nav .logo,
.nav-intro .nav .nav__link,
.nav-intro .nav .nav__actions > * { opacity: 0; }

.nav {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: var(--nav-h);
  z-index: var(--z-nav);
  display: flex;
  align-items: center;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition:
    background var(--dur-micro) var(--ease-out-quart),
    border-color var(--dur-micro) var(--ease-out-quart),
    box-shadow var(--dur-micro) var(--ease-out-quart),
    height var(--dur-reveal) var(--ease-out-expo);
}

.nav.is-stuck {
  height: var(--nav-h-stuck);
  background: rgba(250, 249, 246, .9);
  border-bottom-color: var(--hairline);
  box-shadow: var(--shadow-1);
}

/* The lockup tightens with the bar so the two stay in proportion */
.nav.is-stuck .logo__img { height: 30px; }

@supports (backdrop-filter: blur(1px)) {
  /* Kept near-opaque on purpose: at lower alpha the bar turns muddy grey
     where it crosses the navy CTA and footer. */
  .nav.is-stuck {
    background: rgba(250, 249, 246, .94);
    backdrop-filter: blur(14px) saturate(160%);
  }
}

.nav__inner {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
}

.nav__links { display: none; }

@media (min-width: 1024px) {
  .nav__links {
    display: flex;
    align-items: center;
    gap: clamp(var(--space-5), 2.2vw, var(--space-10));
  }
}

.nav__link {
  position: relative;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--type-muted);
  padding-block: var(--space-2);
  transition: color var(--dur-micro) var(--ease-out-quart);
}

.nav__link::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--accent-hi);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-micro) var(--ease-out-quart);
}

.nav__link:hover { color: var(--type); }
.nav__link:hover::after { transform: scaleX(1); }

.nav__link[aria-current="true"] { color: var(--type); }
.nav__link[aria-current="true"]::after { transform: scaleX(1); }

/* ── Nav over the dark hero ───────────────────────────────────────────────
   Unstuck, the nav floats on the navy hero and must read light. Once
   .is-stuck fires it sits on the cream body and reverts to dark. The two
   states share the same markup; only colour changes. */

.nav:not(.is-stuck) .nav__link       { color: var(--on-ink-muted); }
.nav:not(.is-stuck) .nav__link:hover,
.nav:not(.is-stuck) .nav__link[aria-current="true"] { color: var(--on-ink); }
.nav:not(.is-stuck) .nav__toggle span { background: var(--on-ink); }
.nav:not(.is-stuck) .nav__cta {
  --btn-bg: var(--accent-hi);
  --btn-fg: var(--ink);
  --btn-bd: var(--accent-hi);
  --btn-fill: var(--on-ink);
  --btn-fill-fg: var(--ink);
}
.nav:not(.is-stuck) :focus-visible { outline-color: var(--accent-on-ink); }

.nav__actions { display: flex; align-items: center; gap: var(--space-4); flex: none; }

/* Scoped to .nav so it outranks `.btn { display: inline-flex }`, which is
   defined later in this file at equal specificity. Below 640px the nav stays
   logo + hamburger; the mobile menu carries its own full-width CTA. */
.nav .nav__cta { display: none; }
@media (min-width: 640px) { .nav .nav__cta { display: inline-flex; } }

/* Hamburger: two hairlines that cross into an X */

.nav__toggle {
  width: 44px; height: 44px;
  display: grid;
  place-content: center;
  gap: 6px;
  margin-right: -10px;
}
@media (min-width: 1024px) { .nav__toggle { display: none; } }

.nav__toggle span {
  display: block;
  width: 22px; height: 1.5px;
  background: var(--type);
  border-radius: 2px;
  transition: transform var(--dur-micro) var(--ease-out-quart),
              opacity var(--dur-micro) linear;
}

.nav__toggle[aria-expanded="true"] span:first-child { transform: translateY(3.75px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:last-child  { transform: translateY(-3.75px) rotate(-45deg); }

/* ------------------------------------------------------------ MOBILE MENU */

.menu {
  position: fixed;
  inset: 0;
  z-index: var(--z-menu);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  padding: var(--nav-h) var(--gutter) var(--space-10);
  /* The six links plus the footer CTA overrun a short phone, and an overlay
     that clips its own primary button is worse than one that scrolls.
     `overscroll-behavior` stops a flick at the end of the list from chaining
     into the locked body underneath. */
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: calc(var(--space-10) + env(safe-area-inset-bottom, 0px));
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity var(--dur-micro) var(--ease-out-quart),
              transform var(--dur-micro) var(--ease-out-quart),
              visibility var(--dur-micro) linear;
}

/* The overlay is opaque and outranks the bar, so an open menu used to bury the
   very control that closes it. Lifting the nav over the menu is what makes the
   X reachable; the bar itself is transparent, so only the logo and the toggle
   come with it. Keyed off the body class the menu already sets. */
body.is-locked .nav {
  z-index: calc(var(--z-menu) + 1);
  /* Opaque for the same reason: the menu now scrolls *under* the bar, and a
     transparent bar would let headings slide across the logo. */
  background: var(--paper);
  border-bottom-color: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

/* ...and over paper the unstuck, hero-facing light treatment goes invisible.
   These outrank the `.nav:not(.is-stuck)` block above on specificity. */
body.is-locked .nav .nav__toggle span { background: var(--type); }


/* 640-1023px is the one range where the header CTA and the hamburger are both
   on screen, so an open menu shows it too. Back to the paper-side primary —
   the cyan fill is the hero-only variant. */
body.is-locked .nav .nav__cta {
  --btn-bg: var(--ink);
  --btn-fg: var(--on-ink);
  --btn-bd: var(--ink);
  --btn-fill: var(--accent-hi);
  --btn-fill-fg: var(--ink);
}

.menu.is-open { opacity: 1; visibility: visible; transform: none; }

.menu__links {
  margin-top: var(--space-6);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.menu__links a {
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
  padding-block: var(--space-5);
  border-top: 1px solid var(--hairline);
  /* Eased down from clamp(1.5rem, 7vw, 2.25rem). The preferred term carries
     the change - 6vw against 7vw is about 14% off at any width - with the
     bounds pulled in by the same proportion so the ends do not clip the
     curve back to the old size on very small or very large screens. */
  font-size: clamp(1.375rem, 6vw, 2rem);
  font-weight: 500;
  letter-spacing: var(--ls-tight);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--dur-reveal) var(--ease-out-expo),
              transform var(--dur-reveal) var(--ease-out-expo);
  transition-delay: calc(var(--d, 0) * 50ms + 80ms);
}

.menu.is-open .menu__links a { opacity: 1; transform: none; }
.menu__links a:last-child { border-bottom: 1px solid var(--hairline); }
.menu__links a .meta { color: var(--type-faint); }

.menu__foot { display: grid; gap: var(--space-5); margin-top: var(--space-8); }

/* Short viewports — a 667px phone, or any phone held in landscape. Tightening
   the list is what lets the CTA and the email land above the fold instead of
   relying on the scroll above. */
@media (max-height: 760px) {
  .menu__links a {
    padding-block: var(--space-4);
    /* Stepped down by the same proportion, so a short screen stays visibly
       tighter than a tall one rather than the two converging. */
    font-size: clamp(1.125rem, 4.8vw, 1.5rem);
  }
  .menu__links { margin-top: var(--space-4); }
  .menu__foot  { margin-top: var(--space-6); }
}

@media (prefers-reduced-motion: reduce) {
  .menu__links a { opacity: 1 !important; transform: none !important; }
}

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

.btn {
  --btn-bg: transparent;
  --btn-fg: var(--type);
  --btn-bd: transparent;
  --btn-fill: var(--accent-hi);
  --btn-fill-fg: var(--ink);

  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  min-height: 48px;
  padding: var(--space-3) var(--space-6);
  border: 1px solid var(--btn-bd);
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: var(--fs-sm);
  font-weight: 500;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  transition: color var(--dur-micro) var(--ease-out-quart),
              border-color var(--dur-micro) var(--ease-out-quart),
              transform var(--dur-micro) var(--ease-out-quart);
}

/* The sliding fill: rises from the bottom edge on hover */
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--btn-fill);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform var(--dur-reveal) var(--ease-out-expo);
}

.btn:hover::before,
.btn:focus-visible::before { transform: scaleY(1); }
.btn:hover, .btn:focus-visible { color: var(--btn-fill-fg); }
.btn:active { transform: translateY(1px); }

.btn__arrow {
  width: 14px; height: 14px;
  flex: none;
  transition: transform var(--dur-micro) var(--ease-out-quart);
}
.btn:hover .btn__arrow { transform: translateX(4px); }

.btn--sm { min-height: 40px; padding: var(--space-2) var(--space-5); font-size: var(--fs-xs); }
.btn--lg { min-height: 56px; padding: var(--space-4) var(--space-8); font-size: var(--fs-body); }

/* Navy fill resolving to brand cyan on hover: the primary action on paper */
.btn--primary {
  --btn-bg: var(--ink);
  --btn-fg: var(--on-ink);
  --btn-bd: var(--ink);
  --btn-fill: var(--accent-hi);
  --btn-fill-fg: var(--ink);
}
.btn--primary:hover, .btn--primary:focus-visible { border-color: var(--accent-hi); }

/* Brand cyan fill: reserved for the dark CTA section */
.btn--accent {
  --btn-bg: var(--accent-hi);
  --btn-fg: var(--ink);
  --btn-bd: var(--accent-hi);
  --btn-fill: var(--on-ink);
  --btn-fill-fg: var(--ink);
}
.btn--accent:hover, .btn--accent:focus-visible { border-color: var(--on-ink); }

/* Hairline outline */
.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--type);
  --btn-bd: var(--hairline-strong);
  --btn-fill: var(--ink);
  --btn-fill-fg: var(--on-ink);
}
.btn--ghost:hover, .btn--ghost:focus-visible { border-color: var(--ink); }

.hero .btn--ghost,
.section--ink .btn--ghost,
.on-ink .btn--ghost {
  --btn-fg: var(--on-ink);
  --btn-bd: var(--hairline-ink-str);
  --btn-fill: var(--on-ink);
  --btn-fill-fg: var(--ink);
}
.hero .btn--ghost:hover,
.section--ink .btn--ghost:hover,
.on-ink .btn--ghost:hover { border-color: var(--on-ink); }

.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: center; }

/* ------------------------------------------------------------------- TAGS */

.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 5px var(--space-3);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  font-weight: 500;
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--type-muted);
  background: var(--paper);
}

.tag::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent-hi);
  flex: none;
}

/* -------------------------------------------------------------- ACCORDION
   Built on native details/summary: correct for screen readers, and the FAQ
   stays fully usable with JavaScript disabled. */

.accordion { border-top: 1px solid var(--hairline-strong); }

.accordion__item { border-bottom: 1px solid var(--hairline); }

.accordion__item summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-6);
  padding-block: clamp(var(--space-5), 2.5vw, var(--space-8));
  cursor: pointer;
  list-style: none;
  font-size: clamp(1.0625rem, 1.8vw, 1.375rem);
  font-weight: 500;
  letter-spacing: var(--ls-tight);
  line-height: 1.35;
  transition: color var(--dur-micro) var(--ease-out-quart);
}

.accordion__item summary::-webkit-details-marker { display: none; }
.accordion__item summary:hover { color: var(--accent); }

/* The marker: two hairlines, one of which rotates away on open */
.accordion__icon {
  position: relative;
  width: 18px; height: 18px;
  flex: none;
  margin-top: 4px;
}
.accordion__icon::before,
.accordion__icon::after {
  content: "";
  position: absolute;
  top: 50%; left: 0;
  width: 100%; height: 1.5px;
  background: var(--type);
  border-radius: 2px;
  transition: transform var(--dur-reveal) var(--ease-out-expo),
              background var(--dur-micro) linear;
}
.accordion__icon::after { transform: rotate(90deg); }

.accordion__item[open] .accordion__icon::after { transform: rotate(0deg); }
.accordion__item[open] .accordion__icon::before,
.accordion__item[open] .accordion__icon::after { background: var(--accent-hi); }

.accordion__answer {
  padding-right: clamp(0px, 8vw, 128px);
  padding-bottom: clamp(var(--space-5), 2.5vw, var(--space-8));
  color: var(--type-muted);
  max-width: 58ch;
}

.accordion__item[open] .accordion__answer {
  animation: accordion-open var(--dur-reveal) var(--ease-out-expo) both;
}

@keyframes accordion-open {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------- FORM */

.form { display: grid; gap: var(--space-8); }
/* A `display` declaration outranks the UA's [hidden] rule, so the success
   swap in form.js would not have hidden the form without this. */
.form[hidden] { display: none; }

.form__row { display: grid; gap: var(--space-8); }
@media (min-width: 640px) { .form__row--2 { grid-template-columns: 1fr 1fr; } }

/* Underline-only fields. No boxes: the hairline system extends into the
   form, which is what keeps it feeling designed rather than bolted on. */
.field { position: relative; display: grid; gap: var(--space-2); }

.field__label {
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  font-weight: 500;
  letter-spacing: var(--ls-meta);
  text-transform: uppercase;
  color: var(--type-muted);
}

.field__label .req { color: var(--accent); }

.field__control {
  position: relative;
  border-bottom: 1px solid var(--hairline-strong);
}

/* The cyan rule that draws in on focus */
.field__control::after {
  content: "";
  position: absolute;
  left: 0; bottom: -1px;
  width: 100%; height: 1.5px;
  background: var(--accent-hi);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-reveal) var(--ease-out-expo);
}
.field__control:focus-within::after { transform: scaleX(1); }

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: var(--space-3) 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: var(--fs-body);
  color: var(--type);
}

/* Three lines, not five. The empty box used to open a hole in the form
   between the fields above it and the submit row below; it still drags
   taller for anyone who needs the room. */
.field textarea { resize: vertical; min-height: 84px; line-height: var(--lh-normal); }

.field select {
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  padding-right: var(--space-8);
  color: var(--type);
}

.field__control--select::before {
  content: "";
  position: absolute;
  right: 4px; top: 50%;
  width: 8px; height: 8px;
  margin-top: -6px;
  border-right: 1.5px solid var(--type-muted);
  border-bottom: 1.5px solid var(--type-muted);
  transform: rotate(45deg);
  pointer-events: none;
}

.field__error {
  font-family: var(--font-mono);
  font-size: var(--fs-meta);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--danger);
}
.field__error:empty { display: none; }

.field.has-error .field__control { border-bottom-color: var(--danger); }
.field.has-error .field__control::after { background: var(--danger); transform: scaleX(1); }

.form__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-5);
  justify-content: space-between;
}

.form__note { font-size: var(--fs-xs); color: var(--type-faint); max-width: 34ch; }

.form__status {
  padding: var(--space-5) var(--space-6);
  border: 1px solid var(--hairline-strong);
  border-left: 2px solid var(--accent-hi);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  background: var(--accent-wash);
  font-size: var(--fs-sm);
}
.form__status[hidden] { display: none; }
.form__status--error { border-left-color: var(--danger); background: rgba(179, 38, 30, .06); }

/* Success state replaces the form entirely */
.form-success { display: grid; gap: var(--space-5); padding-block: var(--space-8); }
.form-success[hidden] { display: none; }
.form-success__mark {
  width: 48px; height: 48px;
  display: grid; place-content: center;
  border-radius: 50%;
  /* Green, not the brand cyan: this is the one mark on the page whose whole
     job is to say "that worked", and it should not look like every other
     accent. Light tick on green rather than the old dark-on-cyan - the
     conventional success pairing, and the stronger contrast of the two. */
  background: var(--success);
  color: var(--paper);
}

.btn[aria-busy="true"] { opacity: .6; pointer-events: none; }
