/* Shared page headings for tenant, public, market and operator screens.
   CSS only: form elements, navigation targets and application state stay intact. */
body.vp-shell {
  --vp-heading-background: linear-gradient(118deg, #262b31, #353b43);
  --vp-heading-text: #ffffff;
  --vp-heading-muted: #e2e8f0;
  --vp-heading-padding: clamp(20px, 3vw, 32px);
}

/* Default for every page title, including register/detail/error/auth screens.
   Future views automatically receive the same treatment through their h1. */
body.vp-shell h1 {
  box-sizing: border-box;
  min-width: 0;
  margin: 16px 0 24px;
  padding: var(--vp-heading-padding);
  border: 0;
  border-radius: 16px;
  background: var(--vp-heading-background);
  color: var(--vp-heading-text);
  font-size: clamp(1.55rem, 4vw, 2.35rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

/* Existing composed headings keep their actions and descriptions in one box.
   :has(h1) deliberately excludes section headings and record-card controls. */
body.vp-shell :is(
  header:has(h1), .heading:has(h1), .section-heading:has(h1),
  .market-heading:has(h1), .market-form-heading,
  .dashboard-hero, .login-demo, .demo-operator-hero, .market-hero
) {
  min-width: 0;
  padding: var(--vp-heading-padding);
  border: 0;
  border-radius: 16px;
  background: var(--vp-heading-background);
  color: var(--vp-heading-text);
}

body.vp-shell :is(
  header:has(h1), .heading:has(h1), .section-heading:has(h1),
  .market-heading:has(h1), .market-form-heading,
  .dashboard-hero, .login-demo, .demo-operator-hero, .market-hero
) h1 {
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--vp-heading-text);
}

body.vp-shell :is(
  header:has(h1), .heading:has(h1), .section-heading:has(h1),
  .market-heading:has(h1), .market-form-heading,
  .dashboard-hero, .login-demo, .demo-operator-hero, .market-hero
) :is(p, small, .eyebrow, .market-eyebrow, .section-kicker) {
  color: var(--vp-heading-muted);
}

body.vp-shell :is(
  header:has(h1), .heading:has(h1), .section-heading:has(h1),
  .market-heading:has(h1), .market-form-heading,
  .dashboard-hero, .login-demo, .demo-operator-hero, .market-hero
) a:not(.button):not(.primary-cta) {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--vp-heading-text);
  text-decoration: underline;
  text-underline-offset: 3px;
}

body.vp-shell :is(
  header:has(h1), .heading:has(h1), .section-heading:has(h1),
  .market-heading:has(h1), .market-form-heading,
  .dashboard-hero, .login-demo, .demo-operator-hero, .market-hero
) a:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}

body.vp-shell h1 a { color: inherit; }

/* Keep page actions usable beside long titles and on small screens. */
body.vp-shell :is(.heading, .section-heading, .market-heading):has(h1) {
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}
body.vp-shell :is(.heading, .section-heading, .market-heading):has(h1) > * {
  min-width: 0;
  max-width: 100%;
}
body.vp-shell .planning-head {
  flex-wrap: wrap;
  margin-bottom: 24px;
}
body.vp-shell .planning-head > div { min-width: 0; }
body.vp-shell .planning-head .primary-cta,
body.vp-shell .heading:has(h1) .button:not(.danger),
body.vp-shell .market-heading:has(h1) .button {
  background: #1d4ed8;
  color: #ffffff;
  min-height: 44px;
  max-width: 100%;
  white-space: normal;
}

/* Full-width heroes already inherit the rounded outer card. */
body.vp-shell :is(.dashboard-hero, .login-demo, .season-header, .demo-operator-hero) {
  border-radius: 0;
}
body.vp-shell .facility-page-head { margin-bottom: 24px; }
body.vp-shell .market-form-heading { max-width: none; }
body.vp-shell .market-hero .market-loop {
  border-color: #94a3b8;
  background: rgba(255, 255, 255, .06);
  color: #ffffff;
}
body.vp-shell .market-hero .market-loop b { color: #bfdbfe; }

@media (max-width: 430px) {
  body.vp-shell { --vp-heading-padding: 20px 18px; }
  body.vp-shell h1 { border-radius: 12px; }
}

/* Printed pages retain a plain, legible title without large ink-filled blocks. */
@media print {
  body.vp-shell h1,
  body.vp-shell :is(
    header:has(h1), .heading:has(h1), .section-heading:has(h1),
    .market-heading:has(h1), .market-form-heading,
    .dashboard-hero, .login-demo, .demo-operator-hero, .market-hero
  ) {
    background: none;
    color: #20242b;
  }
  body.vp-shell :is(
    header:has(h1), .heading:has(h1), .section-heading:has(h1),
    .market-heading:has(h1), .market-form-heading,
    .dashboard-hero, .login-demo, .demo-operator-hero, .market-hero
  ) :is(h1, p, small, a, .eyebrow, .market-eyebrow, .section-kicker) {
    color: #20242b;
  }
}
