/* Shared responsive shell for all public pages. */
html,
body {
  max-width: 100%;
  overflow-x: clip;
}

:where(a, button, input, select, textarea):focus-visible {
  outline: 3px solid var(--gold, #D9A441);
  outline-offset: 3px;
}

.menu-toggle {
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  flex: 0 0 44px;
  border-radius: 10px;
}

body.dialog-open { overflow: hidden; }

.message-nav-link { gap: 7px; }
.message-count {
  display: none;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--copper, #C1651F);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}
.message-count.has-unread { display: inline-flex; }

.mobile-menu-section,
.mobile-menu-label { display: none; }

.auth-modal {
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  min-width: 0;
  width: min(420px, calc(100vw - 32px));
  max-width: 420px;
}

.modal-overlay > .modal {
  min-width: 0;
  width: min(560px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
}

@media (min-width: 1181px) {
  nav.main-links { display: flex !important; }
  .menu-toggle { display: none !important; }
}

@media (min-width: 1181px) and (max-width: 1400px) {
  header.site .nav-cta > a { display: none; }
  header.site .nav-row { gap: 16px; }
  header.site nav.main-links { justify-content: flex-end; }
}

@media (max-width: 1180px) {
  .topbar { display: none; }
  header.site { isolation: isolate; }
  header.site .nav-row { position: relative; }
  header.site .brand { min-width: 0; }
  header.site .nav-cta { margin-left: auto; gap: 0; }
  header.site .nav-cta > a { display: none; }
  header.site .menu-toggle { display: inline-flex; }

  header.site nav.main-links {
    display: none;
    position: absolute;
    z-index: 60;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    padding: 12px max(24px, calc((100vw - 1180px) / 2 + 24px)) 20px;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: var(--canal-deep, #082A44);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 16px 28px rgba(8, 42, 68, 0.24);
    max-height: calc(100dvh - 62px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  header.site nav.main-links.is-open { display: flex; }
  header.site nav.main-links a {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 10px 0;
  }
  header.site nav.main-links .mobile-menu-section {
    display: grid;
    gap: 2px;
    margin: 0 0 8px;
    padding: 4px 0 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  }
  header.site nav.main-links .mobile-menu-support {
    margin: 10px 0 0;
    padding: 14px 0 2px;
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    border-bottom: 0;
  }
  header.site nav.main-links .mobile-menu-label {
    display: block;
    padding: 4px 0 7px;
    color: var(--gold, #D9A441);
    font: 700 10px/1.2 var(--font-mono, monospace);
    letter-spacing: 1.5px;
    text-transform: uppercase;
  }
  header.site nav.main-links .mobile-account-name {
    min-height: 38px;
    display: flex;
    align-items: center;
    color: #fff;
    font-weight: 700;
  }
  header.site nav.main-links .mobile-menu-action {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 10px 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.88);
    font: 500 14.5px/1.2 var(--font-body, sans-serif);
    text-align: left;
  }
  header.site nav.main-links .mobile-menu-action:hover { color: #fff; }
  header.site nav.main-links .mobile-menu-support a {
    font-size: 13.5px;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 560px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .topbar .wrap {
    min-height: 44px;
    padding: 0 16px;
    flex-wrap: nowrap;
    gap: 10px;
  }
  .topbar-contact {
    min-width: 0;
    gap: 0;
    font-size: 11px;
  }
  .topbar-contact span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar-contact span:last-child { display: none; }
  #topbarAuthArea,
  .topbar-auth {
    margin-left: auto;
    flex: 0 0 auto;
    gap: 10px;
    font-size: 12px;
  }
  #topbarAuthArea a,
  .topbar-auth a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  header.site .nav-row { gap: 8px; padding: 8px 0; }
  header.site .brand { gap: 8px; }
  header.site .brand .mark { width: 34px; height: 34px; }
  header.site .brand-text { font-size: 20px; line-height: 1; }
  header.site .brand-text small {
    display: block;
    margin-top: 3px;
    font-size: 7px;
    line-height: 1.15;
    letter-spacing: .7px;
    white-space: nowrap;
  }
  header.site nav.main-links { padding-inline: 16px; }

  .auth-overlay,
  .modal-overlay {
    align-items: stretch !important;
    padding: 0 !important;
  }
  .auth-modal,
  .modal-overlay > .modal {
    width: 100% !important;
    max-width: none !important;
    height: 100vh;
    height: 100dvh;
    max-height: none !important;
    margin: 0;
    border-radius: 0 !important;
  }
  .auth-modal {
    overflow-y: auto;
    padding: max(64px, calc(env(safe-area-inset-top) + 48px)) 20px max(24px, env(safe-area-inset-bottom)) !important;
  }
  .auth-modal .modal-close,
  .modal .modal-close {
    width: 44px !important;
    height: 44px !important;
    top: max(10px, env(safe-area-inset-top)) !important;
    right: 12px !important;
  }
  .auth-form .field input,
  .auth-form .field select,
  .auth-form .field textarea {
    min-height: 48px;
    font-size: 16px !important;
  }
  .auth-tab,
  .auth-toggle-btn,
  .auth-form .btn {
    min-height: 44px;
  }
  .modal-overlay > .modal {
    display: flex;
    flex-direction: column;
    overflow: hidden !important;
  }
  .modal .modal-media {
    flex: 0 0 auto;
    height: min(36dvh, 300px) !important;
    min-height: 210px;
  }
  .modal .gallery-nav {
    width: 44px;
    height: 44px;
  }
  .modal .modal-gallery { flex: 0 0 auto; }
  .modal .gallery-thumb { flex-basis: 76px; height: 52px; }
  .modal .modal-body {
    min-height: 0;
    overflow-y: auto;
    padding: 22px 20px max(20px, env(safe-area-inset-bottom)) !important;
  }
  .modal .modal-actions {
    position: sticky;
    bottom: calc(-1 * max(20px, env(safe-area-inset-bottom)));
    z-index: 2;
    margin: 0 -20px;
    padding: 14px 20px max(14px, env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--line, rgba(16,32,31,.14));
    flex-direction: column;
  }
  .modal .modal-actions .btn { min-height: 48px; justify-content: center; }
  #purchaseMessage { font-size: 16px !important; }
}

.auth-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
  cursor: pointer;
}
.auth-consent input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--copper);
}
