:root {
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 48px;
  --space-7: 64px;
  --page-gutter: var(--space-6);
  --section-space: var(--space-7);
  --story-space: var(--space-6);
  --case-width: 1000px;
  --radius-inner: 8px;
  --radius-surface: 12px;
  --radius-control: 999px;
  --touch-target: 48px;
  --motion-enter: 180ms;
  --ease-enter: cubic-bezier(0, 0, .2, 1);
}

@media (max-width: 900px) {
  :root {
    --page-gutter: var(--space-5);
    --section-space: var(--space-6);
    --story-space: var(--space-5);
  }
}

@media (max-width: 700px), (max-width: 1000px) and (max-height: 500px) {
  :root {
    --page-gutter: var(--space-3);
    --motion-enter: 260ms;
  }
}

.hero,
.section,
footer,
.case-shell {
  padding-left: max(var(--page-gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--page-gutter), env(safe-area-inset-right, 0px));
}

.section {
  padding-top: var(--section-space);
}

.section-heading {
  margin-bottom: var(--space-4);
}

.signal-hero + .work {
  padding-top: var(--space-5);
}

.work .section-heading {
  border-top: 1px solid var(--line);
  padding-top: var(--space-5);
}

.project {
  gap: var(--story-space);
  padding-block: var(--space-5);
}

.project-copy h3 {
  margin-block: var(--space-3);
}

.project-copy p {
  margin-bottom: var(--space-3);
}

.work > .project:last-child {
  border-bottom: 1px solid var(--line);
}

.broker-project {
  margin-top: 0;
}

.about {
  gap: var(--story-space);
  padding-bottom: var(--section-space);
}

.identity-base .identity-intro {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.identity-base .insurance-hook {
  font-size: 18px;
  max-width: 52ch;
  margin: 0;
}

.identity-base .insurance-role {
  color: var(--muted);
  font-size: 14px;
  max-width: 56ch;
  margin: 0;
}

.identity-spotlight {
  display: none;
}

.signal-bottom {
  gap: var(--space-4);
  padding-block: var(--space-3);
}

.case-shell,
body:has(#case-page:not([hidden])) footer {
  max-width: var(--case-width);
}

.case-shell {
  padding-top: var(--story-space);
}

.case-type,
.case-shell h1 {
  margin-top: var(--space-4);
}

.case-facts {
  column-gap: var(--story-space);
  margin-block: var(--space-5);
  padding-block: var(--space-4);
}

.story {
  padding-block: var(--story-space);
}

.story h2 {
  margin-block: var(--space-2) var(--space-3);
}

.story p:not(.eyebrow) {
  max-width: 66ch;
}

.story p.design-question {
  margin-top: var(--space-4);
  max-width: 45ch;
}

.case-shell > .story:last-child {
  padding-bottom: var(--story-space);
}

.underwriter-cover {
  padding: var(--space-4);
  border-radius: var(--radius-surface);
}

.underwriter-cover img {
  border-width: var(--space-1);
  border-radius: var(--radius-inner);
}

.design-frame {
  margin-block: var(--space-4) var(--space-2);
}

.design-frame figcaption {
  margin-top: var(--space-2);
}

.panel-story {
  gap: var(--story-space);
}

.panel-story figure {
  margin: 0;
}

footer,
body:has(#case-page:not([hidden])) footer {
  padding-top: var(--space-5);
}

.footer-cta {
  gap: var(--space-4);
  margin-block: 0 var(--story-space);
}

.footer-bottom {
  padding-block: var(--space-3);
}

@media (max-width: 700px), (max-width: 1000px) and (max-height: 500px) {
  .identity-base .identity-intro {
    /* Leave at least 21px beyond the lower edge of the spotlight. */
    margin-top: var(--space-6);
  }

  .identity-base .insurance-hook {
    font-size: 16px;
  }

  .signal-hero .signal-bottom {
    display: none;
  }

  .signal-hero + .work,
  .work .section-heading {
    padding-top: var(--space-4);
  }

  .project-copy {
    padding-top: var(--space-4);
  }

  .broker-project .project-copy {
    padding-top: 0;
  }

  .underwriter-cover {
    padding: var(--space-3);
  }

  .mobile-bottom-nav {
    border-radius: var(--radius-surface);
  }

  .mobile-bottom-nav.is-compact,
  body:has(#case-page:not([hidden])) .mobile-case-back {
    border-radius: var(--radius-control);
  }

  .mobile-bottom-nav a,
  body:has(#case-page:not([hidden])) .mobile-case-back {
    min-height: var(--touch-target);
  }
}

@media (max-width: 700px) and (forced-colors: none),
  (max-width: 1000px) and (max-height: 500px) and (forced-colors: none) {
  .identity-spotlight {
    --spotlight-radius: clamp(58px, 20vw, 88px);
    --spotlight-x: min(63%, 290px);
    --spotlight-y: calc(var(--spotlight-name-bottom, 60%) - var(--spotlight-radius) * .7);
    display: block;
    position: absolute;
    inset: 0;
    z-index: 4;
    clip-path: circle(var(--spotlight-radius) at var(--spotlight-x) var(--spotlight-y));
    background: var(--accent);
    color: #17140c;
    pointer-events: none;
    user-select: none;
  }

  .spotlight-bat {
    position: absolute;
    top: calc(var(--spotlight-name-bottom, 60%) + 1px);
    left: var(--spotlight-x);
    width: 30px;
    height: auto;
    display: block;
    color: inherit;
    fill: currentColor;
    transform: translateX(-50%);
  }

  .identity-spotlight :is(.insurance-hook, .insurance-role) {
    color: inherit;
  }
}

@media (max-width: 640px) {
  .panel-story figure {
    margin-top: var(--space-4);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .case-shell.is-entering,
  .has-arrived {
    animation: enter-view var(--motion-enter) var(--ease-enter);
  }

  @keyframes enter-view {
    from { opacity: .65; transform: translateY(var(--space-3)); }
    to { opacity: 1; transform: translateY(0); }
  }
}

/* Reading progress sits above the page without taking up layout space. */
.reading-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: 2px;
  pointer-events: none;
}

.reading-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
}

.case-measurement {
  display: grid;
  grid-template-columns: minmax(6rem, 10rem) 1fr;
  gap: var(--space-3) var(--space-4);
  max-width: 72ch;
  margin: var(--space-4) 0 0;
}

.case-measurement dt {
  font-weight: 600;
}

.case-measurement dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

@media (max-width: 700px) {
  .case-measurement {
    grid-template-columns: 1fr;
    row-gap: var(--space-2);
  }

  .case-measurement dd + dt {
    margin-top: var(--space-3);
  }
}

/* The case narrative and its original design excerpts share the same edges. */
.underwriter-case .story :is(h2, p),
.underwriter-case .case-measurement {
  max-width: none;
}

.underwriter-case :is(h1, h2) {
  text-wrap: wrap;
}

.underwriter-case .story p.design-question {
  max-width: 44ch;
}

.underwriter-case .design-frame {
  margin-block: var(--space-4) 0;
}

.underwriter-case .design-frame img {
  border-radius: var(--radius-inner);
  background: white;
  outline: 1px solid rgb(20 30 36 / 16%);
  outline-offset: -1px;
}

.underwriter-case .design-frame figcaption {
  max-width: 68ch;
}

.underwriter-case figcaption strong {
  color: var(--text);
  font-weight: 600;
}

.program-example h3 {
  margin-block: var(--space-4) var(--space-2);
  text-wrap: wrap;
}

.program-example + .program-example {
  margin-top: var(--story-space);
}

.evidence-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  align-items: start;
}

.underwriter-case .design-frame .pricing-crops {
  display: none;
}

.handoff-evidence .design-frame {
  max-width: 425px;
}

.handoff-evidence .design-frame img {
  width: auto;
  max-width: 100%;
}

@media (min-width: 901px) {
  .handoff-evidence .design-frame img {
    max-height: 27rem;
  }
}

@media (max-width: 600px) {
  .evidence-pair {
    grid-template-columns: minmax(0, 1fr);
  }

  .underwriter-case .design-frame .pricing-overview {
    display: none;
  }

  .underwriter-case .design-frame .pricing-crops {
    display: grid;
    gap: var(--space-2);
  }
}
