/* ------------------------------------------------------------------
   app.css — styles for the behaviour implemented in app.js.
   site.css holds the page styles; this file only adds what the plain
   JavaScript needs: mobile menu, content modals, form feedback.
   ------------------------------------------------------------------ */

/* The wrappers around former React islands take no space of their own, exactly
   like the <astro-island> elements they replaced. */
[data-island] {
  display: contents;
}

/* Mobile menu (opened by the header hamburger button) */
.mobile-nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background-color: rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms;
}

.mobile-nav-overlay[data-open] {
  opacity: 1;
  pointer-events: auto;
}

.mobile-nav-panel {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  z-index: 1001;
  inline-size: min(20rem, 85vw);
  padding: 1.5rem;
  background-color: var(--color-surface-dark);
  color: var(--color-on-dark);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transform: translateX(-100%);
  transition: transform 250ms ease;
  overflow-y: auto;
}

.mobile-nav-panel[data-open] {
  transform: translateX(0);
}

.mobile-nav-close {
  position: absolute;
  inset-block-start: 1rem;
  inset-inline-end: 1rem;
  background: none;
  border: none;
  color: inherit;
  opacity: 0.7;
  cursor: pointer;
  padding: 0.25rem;
  transition: opacity 150ms;
}

.mobile-nav-close:hover {
  opacity: 1;
}

.mobile-nav-list {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mobile-nav-list a {
  display: flex;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  color: var(--color-on-dark);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 150ms;
}

.mobile-nav-list a:hover,
.mobile-nav-list a[aria-current='page'] {
  background-color: var(--color-surface-charcoal);
}

@media (prefers-reduced-motion: reduce) {
  .mobile-nav-overlay,
  .mobile-nav-panel {
    transition: none;
  }
}

/* Content modals: <dialog class="content-modal"> opened from href="modal:<key>" */
.content-modal {
  inline-size: min(92vw, 40rem);
  max-block-size: 88vh;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border: none;
  border-radius: 1rem;
  background-color: var(--color-background);
  color: var(--color-foreground);
  box-shadow: var(--shadow-card, 0 12px 40px rgba(0, 0, 0, 0.25));
}

.content-modal::backdrop {
  background-color: rgba(0, 0, 0, 0.6);
}

.content-modal__close {
  position: absolute;
  inset-block-start: 1rem;
  inset-inline-end: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 2.5rem;
  block-size: 2.5rem;
  border: none;
  border-radius: 9999px;
  background-color: var(--color-muted);
  color: var(--color-foreground);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 150ms;
}

.content-modal__close:hover {
  background-color: var(--color-border);
}

.content-modal__image-wrap {
  margin-block-end: 1.5rem;
  border-radius: 0.75rem;
  overflow: hidden;
}

.content-modal__image {
  display: block;
  inline-size: 100%;
  block-size: auto;
  object-fit: cover;
}

.content-modal__title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  line-height: 1.1;
  margin: 0 2.5rem 1rem 0;
}

.content-modal__body {
  font-size: var(--font-size-body);
  line-height: 1.6;
  margin: 0;
  white-space: pre-line;
}

.content-modal__cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-block-start: 2rem;
  block-size: 48px;
  padding-inline: 2rem;
  border-radius: 9999px;
  background-color: var(--color-primary);
  color: var(--color-on-dark);
  font-weight: 700;
  text-decoration: none;
  transition: background-color 150ms;
}

.content-modal__cta:hover {
  background-color: var(--color-primary-hover);
}

/* Insight and case-study modals are native <dialog> elements; the original
   overlay element becomes the dialog backdrop. */
.insight-modal__dialog::backdrop,
.case-modal__dialog::backdrop {
  background-color: var(--overlay-dark, rgba(0, 0, 0, 0.6));
}

.insight-modal__dialog:not([open]),
.case-modal__dialog:not([open]) {
  display: none;
}

/* Turnstile: the server-rendered placeholder is 0x0 until the widget needs to show */
.cf-turnstile-ready {
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
}
