/* "Hvorfor er du her?" — version 2.
   Route: /hvorfor-er-du-her-2
   Loaded after /css/hvorfor-er-du-her.css (the body carries both classes) and
   only adds what differs: the demo unfolds inside the argument card, as in the
   v20 prototype, and the open card widens while the "savn" tabs slim down.
   Every selector is scoped to body.page-hvorfor-er-du-her-2. */

/* ─── The card: argument on top, "Sådan virker det" unfolding below ───── */

body.page-hvorfor-er-du-her-2 .hv2-card {
  padding: 0;
}

body.page-hvorfor-er-du-her-2 .hv2-card__arg {
  display: flex;
  flex-direction: column;
  padding: calc(var(--hv-pad) * 1.1) var(--hv-pad) var(--hv-pad);
}

/* The savn label is the card's h2 here; keep the small caps look of v1. */
body.page-hvorfor-er-du-her-2 .hv2-card .hv-arg__label {
  font-family: var(--font-sans);
  line-height: 1.3;
}

/* The CTA is a button in v2; buttons centre their text by default. */
body.page-hvorfor-er-du-her-2 .hv2-toggle {
  border: 0;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

/* Open: the CTA turns into "Skjul igen" with its arrow pointing up. */
body.page-hvorfor-er-du-her-2 .hv2-card.is-open .hv-cta::after,
body.page-hvorfor-er-du-her-2 .hv2-card.is-open .hv-cta__hint {
  display: none;
}

body.page-hvorfor-er-du-her-2 .hv2-card.is-open .hv-cta__icon {
  animation: none;
  transform: rotate(180deg);
}

body.page-hvorfor-er-du-her-2 .hv-cta__icon {
  transition: transform 0.5s var(--hv-ease), background-color 0.3s;
}

/* Unfolding: rows 0fr → 1fr, content fades up once there is room for it. */
body.page-hvorfor-er-du-her-2 .hv2-show {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.8s var(--hv-ease);
}

body.page-hvorfor-er-du-her-2 .hv2-show[data-state='opening'],
body.page-hvorfor-er-du-her-2 .hv2-show[data-state='closing'] {
  grid-template-rows: 0fr;
}

body.page-hvorfor-er-du-her-2 .hv2-show__clip {
  min-height: 0;
}

/* Clip only while moving, so focus rings and demo popovers are never cut. */
body.page-hvorfor-er-du-her-2 .hv2-show[data-state]:not([data-state='shown']) .hv2-show__clip {
  overflow: hidden;
}

body.page-hvorfor-er-du-her-2 .hv2-show__body {
  display: flex;
  flex-direction: column;
  gap: clamp(1.75rem, 3vw, 2.75rem);
  padding: clamp(1.75rem, 3vw, 2.5rem) clamp(1rem, 2.4vw, 2.25rem) clamp(2rem, 3.5vw, 3rem);
  border-top: 1px solid var(--hv-hair);
  transition: opacity 0.45s var(--hv-ease), transform 0.6s var(--hv-ease);
}

body.page-hvorfor-er-du-her-2 .hv2-show[data-state='opening'] .hv2-show__body,
body.page-hvorfor-er-du-her-2 .hv2-show[data-state='closing'] .hv2-show__body {
  opacity: 0;
  transform: translateY(-8px);
}

/* Fade in only after the card has finished widening (0.5s), so a demo that
   picks its layout from its width never visibly switches mid-unfold. */
body.page-hvorfor-er-du-her-2 .hv2-show[data-state='open'] .hv2-show__body {
  transition-delay: 0.5s;
}

body.page-hvorfor-er-du-her-2 .hv2-show__head {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-inline: calc(var(--hv-pad) - clamp(1rem, 2.4vw, 2.25rem));
}

body.page-hvorfor-er-du-her-2 .hv2-show__label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--hv-soft);
  font-size: 0.75rem;
  font-weight: var(--fw-medium);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

body.page-hvorfor-er-du-her-2 .hv2-show__label::before {
  content: '';
  width: var(--bullet-size);
  height: var(--bullet-size);
  background: var(--hv-green);
}

body.page-hvorfor-er-du-her-2 .hv2-show__title {
  max-width: 24ch;
  font-size: clamp(1.75rem, 2.6vw, 2.5rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

body.page-hvorfor-er-du-her-2 .hv2-show__demo {
  min-width: 0;
}

body.page-hvorfor-er-du-her-2 .hv2-show .hv-statement {
  margin-inline: calc(var(--hv-pad) - clamp(1rem, 2.4vw, 2.25rem));
  font-size: clamp(1.35rem, 2vw, 1.85rem);
}

/* Keyboard focus inside the open card must not land under the sticky nav. */
body.page-hvorfor-er-du-her-2 .hv2-show :is(a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex='-1'])) {
  scroll-margin-top: calc(var(--nav-height) + var(--space-6));
}

/* Same offset as the sticky savn rail, so a scrolled-to card lines up with it. */
body.page-hvorfor-er-du-her-2 .hv2-card {
  scroll-margin-top: calc(var(--nav-height) + var(--space-6));
}

/* ─── Proof: one block that follows the open card ────────────────────── */

body.page-hvorfor-er-du-her-2 .hv2-show__proof {
  /* Proof headings line up with the statement and the show title. */
  --hv-proof-inset: calc(var(--hv-pad) - clamp(1rem, 2.4vw, 2.25rem));
}

body.page-hvorfor-er-du-her-2 .hv2-show__proof:empty {
  display: none;
}

body.page-hvorfor-er-du-her-2 .hv2-show__proof > * {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.7s var(--hv-ease), transform 0.8s var(--hv-ease);
}

body.page-hvorfor-er-du-her-2 .hv2-show__proof > .is-shown {
  opacity: 1;
  transform: none;
}

/* Without JS the proof stays after the cards; with JS it waits for a card. */
body.page-hvorfor-er-du-her-2 .hv2-proof-home {
  margin-top: clamp(3rem, 6vw, 5rem);
}

body.page-hvorfor-er-du-her-2 .hv-page.is-ready .hv2-proof-home {
  display: none;
}

/* ─── Desktop: the open card takes the room the quotes gave up ───────── */

@media (min-width: 1024px) {
  body.page-hvorfor-er-du-her-2 .hv-why__grid {
    transition: grid-template-columns 0.5s var(--hv-ease);
  }

  body.page-hvorfor-er-du-her-2 .hv-why__grid[data-open] {
    grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
  }

  /* The rail slims down with the columns instead of jumping. */
  body.page-hvorfor-er-du-her-2 .hv-savn__tab {
    transition: color 0.3s var(--hv-ease), row-gap 0.5s var(--hv-ease);
  }

  body.page-hvorfor-er-du-her-2 .hv-savn__t {
    transition: font-size 0.5s var(--hv-ease);
  }

  body.page-hvorfor-er-du-her-2 .hv-savn__q {
    max-height: 6em;
    overflow: hidden;
    transition: max-height 0.5s var(--hv-ease), opacity 0.3s var(--hv-ease);
  }

  body.page-hvorfor-er-du-her-2 .hv-why__grid[data-open] .hv-savn__tab {
    row-gap: 0;
  }

  body.page-hvorfor-er-du-her-2 .hv-why__grid[data-open] .hv-savn__q {
    max-height: 0;
    opacity: 0;
    visibility: hidden;
    transition: max-height 0.5s var(--hv-ease), opacity 0.2s var(--hv-ease), visibility 0s 0.5s;
  }

  body.page-hvorfor-er-du-her-2 .hv-why__grid[data-open] .hv-savn__t {
    font-size: clamp(1.25rem, 1.6vw, 1.5rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.page-hvorfor-er-du-her-2 .hv-why__grid,
  body.page-hvorfor-er-du-her-2 .hv-savn__tab,
  body.page-hvorfor-er-du-her-2 .hv-savn__t,
  body.page-hvorfor-er-du-her-2 .hv-savn__q,
  body.page-hvorfor-er-du-her-2 .hv2-show,
  body.page-hvorfor-er-du-her-2 .hv2-show__body,
  body.page-hvorfor-er-du-her-2 .hv2-show__proof > * {
    transition: none;
  }
}
