/* Motion layer — additive. Nothing here changes layout or content, so it ports
   across content editions and can be removed by dropping two <link>/<script>
   lines from Base.astro.

   Rules this file keeps to:
   - Only opacity and transform animate. Never width/height/top/left, so no
     layout shift and no paint-bound scrolling.
   - Anything hidden to start is hidden only when JS is running (.js) AND the
     visitor has not asked for reduced motion. Content is never unreachable.
   - Hover effects are gated behind (hover: hover) so a phone never gets a
     stuck :hover state.
*/

@media (prefers-reduced-motion: no-preference) {
  /* ---- Scroll reveal -------------------------------------------------- */
  .js [data-reveal] {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity .55s cubic-bezier(.22,.61,.36,1),
                transform .55s cubic-bezier(.22,.61,.36,1);
    transition-delay: var(--reveal-delay, 0ms);
    will-change: opacity, transform;
  }
  .js [data-reveal].is-in {
    opacity: 1;
    transform: none;
  }
  /* Drop will-change once settled so we are not holding layers forever. */
  .js [data-reveal].is-done { will-change: auto; }

  /* ---- Card lift ------------------------------------------------------ */
  @media (hover: hover) and (pointer: fine) {
    .card, .offer-card, .result, .post-card {
      transition: transform .25s cubic-bezier(.22,.61,.36,1), box-shadow .25s;
    }
    .card:hover, .offer-card:hover, .post-card:hover {
      transform: translateY(-4px);
      box-shadow: 0 14px 34px rgba(0, 0, 0, .13);
    }
  }

  /* ---- Button press feedback ------------------------------------------ */
  .btn { transition: background .15s, color .15s, transform .12s; }
  .btn:not(:disabled):active { transform: translateY(1px) scale(.985); }

  /* ---- Dialog ---------------------------------------------------------- */
  dialog[data-quick]::backdrop { opacity: 0; transition: opacity .25s; }
  dialog[data-quick][open]::backdrop { opacity: 1; }
  dialog[data-quick] {
    opacity: 0;
    transform: translateY(10px) scale(.99);
    transition: opacity .25s, transform .25s cubic-bezier(.22,.61,.36,1);
  }
  dialog[data-quick][open] { opacity: 1; transform: none; }
}

/* Reduced motion: everything is visible and static. The reveal selectors above
   never apply, so no override is needed — but be explicit for the dialog,
   which is created by script. */
@media (prefers-reduced-motion: reduce) {
  dialog[data-quick], dialog[data-quick]::backdrop { transition: none; opacity: 1; transform: none; }
}

/* ---- Count-up -------------------------------------------------------- */
/* Reserve the width so counting from 0 to 12 cannot shift the line. */
.proof strong { font-variant-numeric: tabular-nums; }

/* ---- Quick enquiry dialog (layout, not motion) ------------------------ */
dialog[data-quick] {
  border: 0;
  border-radius: 14px;
  padding: 0;
  width: min(32rem, calc(100dvw - 2rem));
  background: var(--ground, #f6f7eb);
  color: var(--text, #1f1f1f);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
}
dialog[data-quick]::backdrop { background: rgba(0, 32, 33, .55); }
.quick-inner { padding: var(--space-md) var(--space-md) var(--space-md); }
/* Keep clear of the close button in the corner: the brief heading wraps to
   two lines at this width and ran underneath it. */
.quick-inner h2 { margin: 0 0 .3rem; padding-right: 44px; }
.quick-inner .lede { margin: 0 0 1.1rem; }
.quick-close {
  position: absolute; top: 10px; right: 10px;
  width: 44px; height: 44px;            /* full tap target */
  border: 0; background: transparent; cursor: pointer;
  font-size: 1.4rem; line-height: 1; color: var(--text, #1f1f1f);
  border-radius: 50%;
}
@media (hover: hover) { .quick-close:hover { background: var(--hover-wash, rgba(0,0,0,.07)); } }
.quick-alt { margin: 1rem 0 0; font-size: .95rem; }


/* ---- Mobile navigation ---------------------------------------------------
   Only applies once script has added the toggle (.has-nav-toggle), so with
   JavaScript off the nav stays visible and complete. The booking CTA is
   excluded throughout: the stylesheet pins it to the bottom of the screen,
   and collapsing the menu must not take it away. */
.nav-toggle { display: none; }

@media (max-width: 640px) {
  .has-nav-toggle .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2xs);
    min-height: 44px;
    padding: var(--space-2xs) var(--space-sm) var(--space-2xs) var(--space-xs);
    margin-left: auto;
    font: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text, #1f1f1f);
    background: transparent;
    border: 1.5px solid var(--control-edge, rgba(31, 31, 31, .55));
    border-radius: 999px;
    cursor: pointer;
  }
  .has-nav-toggle .nav-toggle-bars {
    position: relative;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
  }
  .has-nav-toggle .nav-toggle-bars::before,
  .has-nav-toggle .nav-toggle-bars::after {
    content: "";
    position: absolute;
    left: 0;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
  }
  .has-nav-toggle .nav-toggle-bars::before { top: -6px; }
  .has-nav-toggle .nav-toggle-bars::after { top: 6px; }

  /* Collapsed: hide the links, never the pinned CTA. */
  .has-nav-toggle .nav a:not(.btn) { display: none; }
  .has-nav-toggle body.nav-open .nav a:not(.btn) { display: flex; }

  .has-nav-toggle body.nav-open .nav {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-top: var(--space-2xs);
  }
  .has-nav-toggle body.nav-open .nav a:not(.btn) {
    min-height: 48px;
    align-items: center;
    border-top: 1px solid rgba(0, 0, 0, .08);
  }
}

@media (max-width: 640px) and (prefers-reduced-motion: no-preference) {
  .has-nav-toggle .nav-toggle-bars,
  .has-nav-toggle .nav-toggle-bars::before,
  .has-nav-toggle .nav-toggle-bars::after { transition: transform .18s, opacity .18s; }
  .has-nav-toggle body.nav-open .nav-toggle-bars { background: transparent; }
  .has-nav-toggle body.nav-open .nav-toggle-bars::before { transform: translateY(6px) rotate(45deg); }
  .has-nav-toggle body.nav-open .nav-toggle-bars::after { transform: translateY(-6px) rotate(-45deg); }
}
@media (max-width: 640px) and (prefers-reduced-motion: reduce) {
  .has-nav-toggle body.nav-open .nav-toggle-bars { background: transparent; }
  .has-nav-toggle body.nav-open .nav-toggle-bars::before { transform: translateY(6px) rotate(45deg); }
  .has-nav-toggle body.nav-open .nav-toggle-bars::after { transform: translateY(-6px) rotate(-45deg); }
}

/* ---- Quick brief dialog: fields on a light background ------------------ */
/* The dialog is cream, the Contact page hero is teal. The chip styles in
   styles.css are written for the dark hero, so they need inverting here.
   Border opacity .55 over cream measures 3.6:1 and clears WCAG 1.4.11; .45,
   which is prettier, measures 2.6:1 and does not. */
/* dvh, not vh: 100vh ignores the mobile browser toolbar, so the foot of the
   dialog -- the Send brief button -- could sit under it. */
dialog[data-quick] { max-height: calc(100dvh - 2rem); overflow-y: auto; overscroll-behavior: contain; }
.quick-inner .brief-topics { border: 0; padding: 0; margin: 0 0 1rem; min-width: 0; }
/* --text, not --ink: --ink is the brand value and stays near-black, so on the
   night dialog this heading measured 1.07:1 -- the only string in the dialog
   still pinned to a brand colour rather than to the role. */
.quick-inner .brief-topics legend { color: var(--text, #1f1f1f); font-weight: 600; padding: 0; }
.quick-inner .brief-hint { font-size: 0.9rem; margin: 2px 0 var(--space-xs); }
.quick-inner .topic-chips { display: flex; flex-wrap: wrap; gap: var(--space-2xs); }
.quick-inner .topic-chips label { position: relative; cursor: pointer; }
.quick-inner .topic-chips input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.quick-inner .topic-chips span {
  display: inline-block; padding: var(--space-2xs) var(--space-sm); border-radius: 999px;
  border: 1.5px solid var(--chip-edge, rgba(31, 31, 31, .55)); color: var(--text, #1f1f1f); font-size: 0.93rem;
}
.quick-inner .topic-chips input:checked + span::before { content: "\2713\00a0"; font-weight: 700; }
.quick-inner .topic-chips input:checked + span {
  background: var(--accent, #005a5d); border-color: var(--accent, #005a5d); color: var(--on-accent, #f6f7eb); font-weight: 600;
}
.quick-inner .topic-chips input:focus-visible + span { outline: 3px solid var(--accent, #005a5d); outline-offset: 3px; }


/* ---- Night mode -------------------------------------------------------
   Values only. The tokens come from styles.css, which loads first; --chip-edge
   is the one that exists only in this file. The dialog, the chips and the
   mobile nav read --ground, --text, --accent and --control-edge, so they
   follow the scheme without further rules.

   Written twice for the same reason as the night block in styles.css: the
   operating system's setting and a stored choice cannot share one rule. Keep
   the two in step. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* .55 of ink is a boundary against a light chip. Against a dark one it is
       invisible, so the chip edge becomes a light hairline instead: 3:1 on
       the dialog's ground, which is what WCAG 1.4.11 asks of a control. */
    --chip-edge: rgba(246, 247, 235, .62);
  }
  /* A stronger scrim: the dialog is no longer a bright card against the page,
     so the backdrop has to do more of the separating. */
  :root:not([data-theme="light"]) dialog[data-quick]::backdrop { background: rgba(0, 0, 0, .68); }
  :root:not([data-theme="light"]) dialog[data-quick] { box-shadow: 0 24px 60px rgba(0, 0, 0, .6); }
}

:root[data-theme="dark"] {
  --chip-edge: rgba(246, 247, 235, .62);
}
:root[data-theme="dark"] dialog[data-quick]::backdrop { background: rgba(0, 0, 0, .68); }
:root[data-theme="dark"] dialog[data-quick] { box-shadow: 0 24px 60px rgba(0, 0, 0, .6); }
