/* Shared top chrome: App Store bar + mobile hamburger. */

html.app-bar-hidden .app-bar {
  display: none;
}

.app-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.35rem 0.35rem 0.35rem clamp(0.65rem, 3vw, 1.25rem);
  background: linear-gradient(180deg, #fff8e6 0%, #fffdf7 100%);
  border-bottom: 1px solid rgba(188, 162, 49, 0.4);
  color: var(--ink);
}

.app-bar-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  min-width: 0;
  flex: 1;
  padding: 0.15rem 0.5rem;
  color: inherit;
  text-decoration: none;
}

.app-bar-link:hover {
  background: linear-gradient(180deg, #fff3d4 0%, #fff8e6 100%);
}

.app-bar-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  flex-shrink: 0;
}

.app-bar-close:hover,
.app-bar-close:focus-visible {
  color: var(--ink);
}

.app-bar-close svg {
  width: 18px;
  height: 18px;
}

.app-bar-icon {
  width: 40px;
  height: 40px;
  max-width: none;
  border-radius: 9px;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(20, 18, 14, 0.18);
}

.footer-mark {
  display: block;
  width: 108px;
  height: auto;
  margin: 0 0 0.45rem;
}

.footer-name {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.08rem;
  line-height: 1.05;
}

.footer-name strong {
  font-family: var(--serif, "Cormorant Garamond", "Times New Roman", serif);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: #fff;
}

.footer-name > span {
  font-family: var(--sans, Montserrat, sans-serif);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-soft, #e2d48a);
}

.app-bar-copy {
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}

.app-bar-copy strong {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.25;
}

.app-bar-sub {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.app-bar-badge {
  height: 32px;
  width: auto;
  max-width: none;
  flex-shrink: 0;
}

.footer-app {
  width: 100%;
  margin-top: 1rem;
  padding-top: 0.85rem;
}

.footer-app-link {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0;
  color: var(--gold);
  text-decoration: none;
}

.footer-app-title {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.25;
  color: var(--gold);
}

.footer-app-link:hover .footer-app-title,
.footer-app-link:focus-visible .footer-app-title {
  color: var(--gold-soft);
}

.footer-app-badge {
  height: 40px;
  width: auto;
  flex-shrink: 0;
}

.header-nav {
  position: relative;
}

.nav-panel {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(188, 162, 49, 0.45);
  background: linear-gradient(180deg, #fffdf7 0%, var(--ivory) 100%);
  color: var(--gold-deep);
  cursor: pointer;
}

.nav-toggle:hover {
  border-color: rgba(188, 162, 49, 0.75);
  box-shadow: 0 6px 18px rgba(20, 18, 14, 0.06);
}

.nav-toggle svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-toggle .nav-toggle-close {
  display: none;
}

.header-nav.is-open .nav-toggle .nav-toggle-open {
  display: none;
}

.header-nav.is-open .nav-toggle .nav-toggle-close {
  display: block;
}

@media (max-width: 900px) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav-panel {
    display: none;
    position: absolute;
    top: calc(100% + 0.7rem);
    right: 0;
    z-index: 60;
    min-width: 16.75rem;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
    padding: 0.35rem 0;
    background: var(--ivory);
    border: 1px solid var(--line);
    box-shadow: 0 14px 36px rgba(20, 18, 14, 0.12);
  }

  .header-nav.is-open .nav-panel {
    display: flex;
  }

  .nav-panel a {
    padding: 0.85rem 1.15rem;
  }

  .nav-panel a:hover,
  .nav-panel a:focus-visible {
    background: #fff8e6;
    color: var(--gold-deep);
  }
}

@media (max-width: 560px) {
  .app-bar {
    gap: 0.15rem;
    padding: 0.3rem 0.15rem 0.3rem 0.65rem;
    justify-content: flex-start;
  }

  .app-bar-link {
    gap: 0.55rem;
    justify-content: flex-start;
    padding: 0.1rem 0.25rem;
  }

  .app-bar-sub {
    display: none;
  }

  .app-bar-copy strong {
    font-size: 0.68rem;
  }

  .app-bar-badge {
    height: 28px;
    margin-left: auto;
  }

  .app-bar-icon {
    width: 32px;
    height: 32px;
    border-radius: 7px;
  }
}

/* Image and PDF preview. The page stays put underneath. */
.file-dialog {
  position: fixed;
  inset: 0;
  z-index: 100;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(4.75rem + env(safe-area-inset-top, 0px))
    max(2rem, env(safe-area-inset-right, 0px))
    max(2rem, env(safe-area-inset-bottom, 0px))
    max(2rem, env(safe-area-inset-left, 0px));
  background: rgba(10, 10, 10, 0.78);
  overscroll-behavior: none;
}

.file-dialog[hidden] {
  display: none !important;
}

.file-dialog-close {
  position: absolute;
  z-index: 1;
  top: max(0.75rem, env(safe-area-inset-top, 0px));
  right: max(0.75rem, env(safe-area-inset-right, 0px));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(188, 162, 49, 0.9);
  background: #fffcf5;
  color: #14120e;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  touch-action: manipulation;
}

.file-dialog-close svg {
  width: 26px;
  height: 26px;
}

.file-dialog-close:hover,
.file-dialog-close:focus-visible {
  background: #fff3d4;
  outline: 2px solid #BCA231;
  outline-offset: 2px;
}

.file-dialog-stage {
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-dialog-status {
  margin: 0;
  color: #fffcf5;
  font-family: var(--sans, Montserrat, sans-serif);
  font-size: 0.95rem;
  font-weight: 500;
}

.file-dialog-stage img {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 4rem);
  max-height: calc(100dvh - 7.5rem);
  object-fit: contain;
  background: #0a0a0a;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.file-dialog-pages {
  width: min(960px, 100%);
  height: calc(100dvh - 7.5rem);
  max-height: 100%;
  overflow: auto;
  background: #2a2a2a;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.file-dialog-pages canvas {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  background: #fff;
}

.file-dialog-pages canvas + canvas {
  margin-top: 8px;
}

.file-dialog-stage iframe {
  width: min(960px, calc(100vw - 4rem));
  height: calc(100dvh - 7.5rem);
  border: 0;
  background: #fff;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

html.file-dialog-open {
  overflow: hidden;
}

html.file-dialog-open body {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
}

/* Store badges on Home, Social, Resources, and the App page. Other pages keep the older bar. */
.app-bar.app-bar-stores {
  justify-content: center;
  gap: 0.75rem;
}

.app-bar-stores .app-bar-title {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.25;
  white-space: nowrap;
}

.app-bar-stores .app-bar-sub {
  white-space: nowrap;
}

.app-bar-stores .app-bar-end {
  display: contents;
}

.app-bar-stores .app-bar-badge-link,
.footer-app-badge-link {
  display: inline-flex;
  line-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.app-bar-stores .app-bar-badge,
.footer-app-badge {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.app-bar-stores .app-bar-badge {
  height: 32px;
  width: auto;
}

.app-bar-stores .app-bar-badge.app-bar-badge-play {
  /* Official file includes its clear space. This height makes the painted badge 32px. */
  height: 47.62px;
}

.footer-app {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 0.85rem;
}

.footer-app-badge.footer-app-badge-play {
  /* Official file includes its clear space. This height makes the painted badge 40px. */
  height: 59.52px;
  width: auto;
}

@media (max-width: 560px) {
  .app-bar.app-bar-stores {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.28rem;
    padding: 0.55rem 0.75rem 0.65rem;
  }

  .app-bar-stores .app-bar-title,
  .app-bar-stores .app-bar-sub {
    white-space: normal;
  }

  .app-bar-stores .app-bar-sub {
    display: block;
  }

  .app-bar-stores .app-bar-icon {
    width: 40px;
    height: 40px;
    border-radius: 9px;
  }

  .app-bar-stores .app-bar-end {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
  }

  .app-bar-stores .app-bar-badge {
    height: 32px;
    margin-left: 0;
  }

  .app-bar-stores .app-bar-badge.app-bar-badge-play {
    height: 47.62px;
  }
}
