.public-page {
  min-height: 100dvh;
  background: var(--petra-paper);
  color: var(--petra-ink);
}

.public-header {
  position: relative;
  z-index: 20;
  width: 100%;
  border-bottom: 1px solid var(--petra-line);
  background: var(--petra-cream);
  color: var(--petra-ink);
}

.public-header--overlay {
  position: absolute;
  inset: 0 0 auto;
  border-color: rgba(252, 250, 245, 0.34);
  background: linear-gradient(180deg, rgba(25, 29, 27, 0.36), transparent);
  color: var(--petra-cream);
}

.public-header--light { background: var(--petra-cream); }

.public-header__inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  min-height: 5.15rem;
  align-items: center;
  gap: 1rem;
}

.brand {
  grid-column: 2;
  display: inline-flex;
  align-items: center;
  color: var(--petra-ink);
  font-family: var(--petra-serif);
  font-size: clamp(1.65rem, 2.25vw, 2.25rem);
  font-weight: 400;
  letter-spacing: 0.11em;
  line-height: 1;
  text-decoration: none;
}

.brand--light { color: var(--petra-cream); }
.brand__mark { display: none; }
.brand__text { white-space: nowrap; }

.public-nav {
  grid-column: 1;
  display: flex;
  align-items: center;
  justify-self: start;
  gap: clamp(0.75rem, 1.45vw, 1.45rem);
  margin: 0;
}

.public-header__actions {
  position: absolute;
  top: 50%;
  right: 0;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transform: translateY(-50%);
}

.public-nav a,
.header-link,
.compact-menu a,
.mobile-signin {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  color: inherit;
  font-size: 0.72rem;
  font-weight: 620;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.public-nav a:hover,
.header-link:hover,
.mobile-signin:hover { text-decoration: underline; text-underline-offset: 0.34rem; }

.public-nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 0.34rem; }
.header-link { display: none; }
.public-header__mobile-actions { display: none; }

.language-switcher {
  display: inline-flex;
  grid-column: 3;
  justify-self: end;
  min-width: 8.25rem;
  margin-right: 5.8rem;
  border: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
}

.language-switcher button {
  position: relative;
  min-width: 2.75rem;
  min-height: 44px;
  border: 0;
  padding: 0.15rem 0.3rem;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 620;
  letter-spacing: 0.02em;
  line-height: 1;
}

.language-switcher button::after {
  position: absolute;
  right: 0.62rem;
  bottom: 0.45rem;
  left: 0.62rem;
  height: 1px;
  background: currentColor;
  content: "";
  opacity: 0;
  transform: scaleX(0.35);
  transition: opacity 160ms ease, transform 160ms ease;
}

.language-switcher button[aria-pressed="true"]::after,
.language-switcher button:hover::after { opacity: 1; transform: scaleX(1); }

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--petra-ink);
  border-radius: 0;
  padding: 0.7rem 1.1rem;
  background: var(--petra-ink);
  color: var(--petra-cream);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 630;
  letter-spacing: 0.01em;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.button:hover:not(:disabled) {
  border-color: var(--petra-forest);
  background: var(--petra-forest);
}

.button:disabled,
.button[aria-disabled="true"] { cursor: not-allowed; opacity: 0.48; }

.public-header--overlay .button {
  border-color: rgba(252, 250, 245, 0.78);
  background: transparent;
  color: var(--petra-cream);
}

.public-header--overlay .button:hover:not(:disabled) {
  border-color: var(--petra-cream);
  background: rgba(252, 250, 245, 0.14);
}

.button--light {
  border-color: var(--petra-cream);
  background: var(--petra-cream);
  color: var(--petra-ink);
}

.button--light:hover:not(:disabled) {
  border-color: #fff;
  background: #fff;
}

.button--secondary {
  border-color: var(--petra-ink);
  background: transparent;
  color: var(--petra-ink);
}

.button--secondary:hover:not(:disabled) { background: rgba(29, 33, 31, 0.06); color: var(--petra-ink); }

.button--outline-light {
  border-color: rgba(252, 250, 245, 0.74);
  background: transparent;
  color: var(--petra-cream);
}

.button--outline-light:hover:not(:disabled) { border-color: var(--petra-cream); background: rgba(252, 250, 245, 0.12); }

.compact-menu {
  position: relative;
  display: none;
}

.compact-menu summary {
  display: inline-flex;
  width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 0;
  color: inherit;
  cursor: pointer;
  font-size: 1.15rem;
  list-style: none;
}

.compact-menu summary::-webkit-details-marker { display: none; }

.compact-menu nav {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  display: grid;
  min-width: min(16rem, calc(100vw - 2rem));
  gap: 0;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--petra-line);
  background: var(--petra-cream);
  box-shadow: var(--petra-shadow);
}

.compact-menu nav a { padding-inline: 0.25rem; color: var(--petra-ink); }

.form-field {
  display: grid;
  min-width: 0;
  min-inline-size: 0;
  gap: 0.45rem;
  color: var(--petra-ink);
  font-size: 0.84rem;
  font-weight: 720;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--petra-line);
  border-radius: 0;
  padding: 0.7rem 0.75rem;
  background: var(--petra-cream);
  color: var(--petra-ink);
  font-weight: 520;
}

.form-field input[type="date"] {
  min-width: 0;
  min-inline-size: 0;
  max-width: 100%;
  max-inline-size: 100%;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--petra-forest);
  outline: 2px solid rgba(85, 97, 75, 0.18);
  outline-offset: 0;
}

.form-field input[aria-invalid="true"],
.form-field select[aria-invalid="true"] { border-color: var(--petra-danger); }

.form-message { margin: 0; color: var(--petra-danger); font-size: 0.88rem; font-weight: 650; }
.form-message[data-state="success"] { color: var(--petra-forest); }
.form-note { margin: 0; color: var(--petra-stone); font-size: 0.86rem; }

.back-link,
.text-link {
  color: inherit;
  font-weight: 720;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.28rem;
}

@media (max-width: 67rem) {
  .public-nav { gap: 0.65rem; }
  .public-nav a { font-size: 0.62rem; }
}

@media (max-width: 47.99rem) {
  .public-header__inner {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    min-height: 4.05rem;
    gap: 0;
  }

  .brand {
    position: absolute;
    left: 50%;
    grid-column: 2;
    justify-self: center;
    font-size: clamp(1.38rem, 6vw, 1.8rem);
    letter-spacing: 0.1em;
    transform: translateX(-50%);
  }
  .public-nav--desktop,
  .public-header__actions { display: none; }

  .public-header__mobile-actions {
    display: flex;
    grid-column: 1;
    grid-row: 1;
    align-items: center;
    justify-self: start;
  }

  .mobile-signin { display: none; }
  .compact-menu { display: block; }

  .language-switcher {
    position: static;
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    min-width: 0;
    margin: 0;
    color: inherit;
  }

  .language-switcher button {
    min-width: 2rem;
    padding-inline: .18rem;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .01em;
  }
  .language-switcher button::after { right: .35rem; bottom: .38rem; left: .35rem; }
  .compact-menu nav { left: 0; }

  /* Auth, review and account have a compact non-grid header. Keep the
     persistent locale control in a real second header row instead of clipping
     it below the page shell on phones. */
  .auth-header,
  .review-header,
  .account-header { padding-bottom: 2.75rem; }

  .auth-header__inner,
  .review-header__inner,
  .account-header__inner {
    position: relative;
    min-height: 4.05rem;
  }

  .auth-header .language-switcher,
  .review-header .language-switcher,
  .account-header .language-switcher {
    position: absolute;
    grid-column: auto;
    grid-row: auto;
    top: 100%;
    right: auto !important;
    left: -0.45rem !important;
    z-index: 2;
    justify-self: auto;
    min-width: 0;
    margin: 0;
    color: var(--petra-cream);
  }
}

@media (max-width: 23rem) {
  .brand { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
