/*
 * Inlyra site quality layer v3
 * Loaded last. Fixes navigation, page density, responsive tables, CTA consistency,
 * and confirmation-page hierarchy without changing product claims.
 */

html { scroll-padding-top: 96px; }
body { overflow-x: clip; }
body[data-layout-version="3"] { min-width: 0; }

.site-header {
  position: fixed;
  z-index: 400;
  top: 0;
  right: 0;
  left: 0;
}
.site-header .nav { transition: min-height 180ms ease, border-color 180ms ease; }
.site-header.is-scrolled .nav { min-height: 70px; border-color: rgba(255,255,255,.08); }
body.menu-open .site-header {
  background: rgba(5,18,43,.98);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
}

.hero { min-height: min(820px, 100svh); padding-top: 150px; }
.hero-grid { align-items: center; }
.hero h1 { max-width: 760px; font-size: clamp(3.25rem, 7.25vw, 6.45rem); line-height: .98; text-wrap: balance; }
.hero .lead { max-width: 680px; }

.page-hero {
  min-height: 390px;
  padding: 132px 0 68px;
}
.page-hero h1 {
  max-width: 920px;
  font-size: clamp(2.75rem, 5.7vw, 5rem);
  line-height: 1;
}
.page-hero .lead { max-width: 740px; }
.page-hero.legal-hero { min-height: 330px; padding-bottom: 58px; }
.page-hero.center { min-height: auto; padding: 145px 0 92px; }

.section { padding: 88px 0; }
.band { padding: 72px 0; }
.section-head { margin-bottom: 40px; }
.section-head > p { max-width: 620px; }
.split { gap: clamp(34px, 5vw, 64px); }

/* Never stretch arbitrary fourth cards. Only the seven-card security overview gets a deliberate final row. */
.cards.three article:last-child:nth-child(3n + 1) { grid-column: auto; min-height: 245px; }
body[data-page="security"] .cards.three > article:nth-child(7):last-child {
  grid-column: 1 / -1;
  min-height: 190px;
}
.cards article,
.contact-grid article { min-width: 0; }
.cards article h3,
.contact-grid article h3 { text-wrap: balance; }
.cards article p,
.contact-grid article p { max-width: 62ch; }

/* Product page density: process and boundaries are informative, not decorative filler. */
.workflow-section { overflow: hidden; }
.workflow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.workflow-step {
  position: relative;
  min-width: 0;
  padding: 30px;
  border: 1px solid rgba(16,48,104,.13);
  border-radius: 24px;
  background: rgba(255,255,255,.78);
  box-shadow: 0 18px 50px rgba(16,48,104,.07);
}
.workflow-step span {
  display: inline-grid;
  width: 38px;
  height: 38px;
  margin-bottom: 28px;
  place-items: center;
  color: #05203b;
  border-radius: 12px;
  background: #00b2c5;
  font-size: .75rem;
  font-weight: 850;
}
.workflow-step h3 { margin-bottom: 10px; }
.workflow-step p { margin: 0; color: var(--muted); }
.boundary-note {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  gap: 36px;
  align-items: start;
  margin-top: 22px;
  padding: 34px;
  color: #eaf5ff;
  border: 1px solid rgba(0,178,197,.18);
  border-radius: 26px;
  background: linear-gradient(145deg, #081a38, #103068);
}
.boundary-note p { margin: 0; color: #abc0d6; }
.boundary-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.boundary-list li { position: relative; padding-left: 22px; color: #d8e8f5; }
.boundary-list li::before { position: absolute; left: 0; content: "✓"; color: #00b2c5; font-weight: 900; }

/* Pricing and forms should align naturally instead of relying on fake fixed heights. */
.price { display: flex; flex-direction: column; }
.price ul { min-height: 0; }
.price .button { align-self: flex-start; margin-top: auto; }
.price-examples article { min-width: 0; }
.pilot-form button[type="submit"] { min-width: 180px; }
.pilot-form button[disabled] { cursor: wait; opacity: .72; transform: none; }
.pilot-form[aria-busy="true"] { box-shadow: 0 0 0 4px rgba(0,178,197,.08), 0 20px 58px rgba(16,48,104,.075); }

/* Table semantics remain understandable when the header row collapses on mobile. */
.permission-row > * { min-width: 0; overflow-wrap: anywhere; }

/* Legal pages: readable measure and a calmer transition from hero to policy text. */
.legal { padding-top: 62px; }
.legal h2 { scroll-margin-top: 105px; }
.legal p, .legal li { font-size: 1rem; line-height: 1.72; }

/* Confirmation page: clear next steps, no second application CTA. */
.confirmation-shell { max-width: 980px; }
.confirmation-card {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, .95fr);
  gap: 22px;
  margin-top: 36px;
  text-align: left;
}
.confirmation-main,
.confirmation-side {
  padding: 30px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 26px;
  background: rgba(255,255,255,.055);
  box-shadow: 0 24px 70px rgba(2,14,34,.24);
}
.confirmation-main h2,
.confirmation-side h2 { font-size: clamp(1.55rem, 3vw, 2.25rem); }
.confirmation-main p,
.confirmation-side p { color: #b6cadc; }
.confirmation-steps { display: grid; gap: 14px; margin: 24px 0 0; padding: 0; list-style: none; }
.confirmation-steps li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; }
.confirmation-steps span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: #05203b;
  border-radius: 10px;
  background: #00b2c5;
  font-size: .72rem;
  font-weight: 850;
}
.confirmation-steps b { display: block; color: #fff; }
.confirmation-steps small { display: block; color: #9fb6c9; line-height: 1.45; }
.confirmation-side .actions { margin-bottom: 0; }
.confirmation-help { margin-top: 20px; color: #9fb6c9; font-size: .9rem; }
.confirmation-help a { color: #7be0eb; text-decoration: underline; text-underline-offset: 3px; }

/* Footer and contact cards need stronger separation on long pages. */
.footer { padding-top: 62px; }
.footer-grid a { line-height: 1.35; }
.contact-grid article a { text-decoration-thickness: 1px; text-underline-offset: 4px; }

@media (max-width: 1080px) {
  .nav-links { gap: 18px; font-size: .86rem; }
  .nav-app-link { margin-left: 0; }
  .hero { min-height: auto; }
  .page-hero { min-height: 360px; }
}

@media (max-width: 980px) {
  .workflow-grid { grid-template-columns: 1fr; }
  .boundary-note { grid-template-columns: 1fr; }
  body[data-page="security"] .cards.three > article:nth-child(7):last-child { grid-column: 1 / -1; }
  .confirmation-card { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  html { scroll-padding-top: 78px; }
  .site-header .nav { min-height: 74px; }
  .site-header.is-scrolled .nav { min-height: 66px; }
  .nav-links {
    inset: 0;
    z-index: -1;
    display: flex;
    padding: 98px 20px 28px;
    overflow-y: auto;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    background: linear-gradient(180deg, rgba(5,18,43,.995), rgba(8,30,62,.995));
    transition: opacity 160ms ease, transform 160ms ease, visibility 160ms step-end;
  }
  .menu-open .nav-links {
    visibility: visible;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    transition: opacity 160ms ease, transform 160ms ease;
  }
  .nav-links a { min-height: 48px; display: flex; align-items: center; }
  .nav-links .button { justify-content: center; margin-top: 4px; }
  .hero { padding: 128px 0 68px; }
  .hero h1 { font-size: clamp(2.9rem, 13vw, 4.35rem); }
  .page-hero,
  .page-hero.legal-hero { min-height: auto; padding: 118px 0 58px; }
  .page-hero.center { padding: 122px 0 70px; }
  .page-hero h1 { font-size: clamp(2.55rem, 12vw, 3.9rem); }
  .section { padding: 68px 0; }
  .band { padding: 60px 0; }
  .cards.three article:last-child:nth-child(3n + 1),
  body[data-page="security"] .cards.three > article:nth-child(7):last-child { grid-column: auto; min-height: auto; }
  .permission-row:not(.head) { gap: 12px; padding: 20px; }
  .permission-row:not(.head) > * { display: grid; gap: 4px; }
  .permission-row:not(.head) > *::before {
    color: #60718a;
    font-size: .65rem;
    font-weight: 850;
    letter-spacing: .11em;
    text-transform: uppercase;
  }
  .permission-row:not(.head) > *:nth-child(1)::before { content: "Stage"; }
  .permission-row:not(.head) > *:nth-child(2)::before { content: "Permissions"; }
  .permission-row:not(.head) > *:nth-child(3)::before { content: "Purpose"; }
  .pilot-form .button,
  .confirmation-side .button { width: 100%; }
  .confirmation-main,
  .confirmation-side { padding: 24px; }
  .confirmation-side .actions { display: grid; }
  .boundary-note { padding: 26px; }
}

@media (max-width: 420px) {
  .hero h1 { font-size: clamp(2.65rem, 13.6vw, 3.65rem); }
  .page-hero h1 { font-size: clamp(2.35rem, 12vw, 3.25rem); }
  .workflow-step { padding: 24px; }
  .confirmation-main,
  .confirmation-side { padding: 21px; border-radius: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  .nav-links { transition: none; }
}
