/* =========================================================================
   DisclosureIQ Mobile App Shell stylesheet (May 2026)

   Active when html has `diq-app-shell-active` (mobile + streamline root).
   Layers a real native-app feel on top of the existing site:
   - Hides ALL website chrome on mobile (brokerage bar, nav, hero block)
   - Top app bar (56px navy gradient, MS monogram, dynamic title, menu)
   - Bottom tab bar (60px + safe-area, 4 tabs, icons + labels + badge)
   - "You" sheet for install + brand info

   Brand: navy #0F1B2D + gold #C9A961 + cream #FAF7F2. No em dashes.
   ========================================================================= */

/* ============================================================
   Mobile activation: nuke website chrome so the app shell owns the view
   ============================================================ */
@media (max-width: 720px) {
  html.diq-app-shell-active body {
    padding: 0;
    margin: 0;
    background: #FAF7F2;
  }
  html.diq-app-shell-active .brokerage-bar,
  html.diq-app-shell-active .nav,
  html.diq-app-shell-active .hero,
  html.diq-app-shell-active .skip-link,
  html.diq-app-shell-active .cf-bar {
    display: none !important;
  }
  /* The client landing has its own top-of-page chrome (cf-hero) AND the
     embedded tool. When the app shell activates on mobile, the app bar
     replaces the cf-bar; the cf-hero stays visible above the tool but
     pads under the app bar. */
  html.diq-app-shell-active .cf-hero {
    padding-top: calc(56px + env(safe-area-inset-top) + 24px);
  }
  /* Pad page content so it clears the fixed app bar + tab bar */
  html.diq-app-shell-active .app,
  html.diq-app-shell-active main {
    padding-top: calc(56px + env(safe-area-inset-top)) !important;
    padding-bottom: calc(72px + env(safe-area-inset-bottom)) !important;
  }
  /* Library panel: when surfaced via Saved tab, fill the content area */
  html.diq-app-shell-active .api-key-panel.diq-app-shell-active-panel {
    display: block !important;
  }
}

/* ============================================================
   Top app bar
   ============================================================ */
.diq-app-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(56px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  padding-left: max(14px, env(safe-area-inset-left));
  padding-right: max(14px, env(safe-area-inset-right));
  background: linear-gradient(135deg, #0F1B2D 0%, #08111E 100%);
  border-bottom: 1px solid rgba(201, 169, 97, 0.18);
  z-index: 99996;
  display: none;
  align-items: center;
  gap: 12px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: #FAF7F2;
  box-shadow: 0 4px 14px -8px rgba(15, 27, 45, 0.45);
}
@media (max-width: 720px) {
  html.diq-app-shell-active .diq-app-bar { display: flex; }
}
.diq-app-bar-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid rgba(201, 169, 97, 0.55);
  background: rgba(201, 169, 97, 0.10);
  color: #C9A961;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  padding: 0;
}
.diq-app-bar-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.diq-app-bar-title-wrap {
  flex: 1;
  min-width: 0;
}
.diq-app-bar-eyebrow {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: #C9A961;
  line-height: 1;
  margin-bottom: 3px;
}
.diq-app-bar-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #FAF7F2;
  line-height: 1.2;
}
.diq-app-bar-action {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 0;
  color: #FAF7F2;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: inherit;
}
.diq-app-bar-action:hover { background: rgba(255, 255, 255, 0.14); }
.diq-app-bar-action:focus-visible {
  outline: 2px solid #C9A961;
  outline-offset: 2px;
}

/* ============================================================
   Bottom tab bar
   ============================================================ */
.diq-tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 27, 45, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(201, 169, 97, 0.18);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 99996;
  display: none;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
@media (max-width: 720px) {
  html.diq-app-shell-active .diq-tab-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
  }
}
.diq-tab {
  position: relative;
  background: transparent;
  border: 0;
  color: rgba(250, 247, 242, 0.55);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 9px 4px 8px;
  min-height: 56px;
  font-family: inherit;
  transition: color 160ms;
}
.diq-tab svg { color: currentColor; transition: transform 200ms cubic-bezier(0.2, 0.7, 0.1, 1); }
.diq-tab-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
  line-height: 1;
}
.diq-tab.is-active {
  color: #C9A961;
}
.diq-tab.is-active svg { transform: translateY(-1px); }
.diq-tab.is-active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 3px;
  background: #C9A961;
  border-radius: 0 0 4px 4px;
}
.diq-tab:focus-visible {
  outline: 2px solid #C9A961;
  outline-offset: -4px;
  border-radius: 6px;
}
.diq-tab-badge {
  position: absolute;
  top: 6px;
  right: 22%;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #C9A961;
  color: #0F1B2D;
  font-size: 9.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0;
  box-shadow: 0 0 0 2px #0F1B2D;
}

/* When app shell is active, push existing fixed elements above the tab bar */
@media (max-width: 720px) {
  html.diq-app-shell-active .diq-share-trigger {
    bottom: calc(72px + env(safe-area-inset-bottom)) !important;
  }
  html.diq-app-shell-active .diq-pwa-install-chip {
    /* Align with the app bar instead of free-floating */
    top: calc(env(safe-area-inset-top) + 14px) !important;
    right: calc(58px + env(safe-area-inset-right)) !important;
    background: rgba(255, 255, 255, 0.10) !important;
    color: #C9A961 !important;
    border-color: rgba(201, 169, 97, 0.4) !important;
  }
  html.diq-app-shell-active .diq-rm-show-pill {
    bottom: calc(72px + env(safe-area-inset-bottom)) !important;
  }
}

/* ============================================================
   "You" sheet (Profile / Settings / Install)
   ============================================================ */
.diq-you-sheet {
  position: fixed;
  inset: 0;
  z-index: 99997;
  background: rgba(15, 27, 45, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms cubic-bezier(0.2, 0.7, 0.1, 1);
}
.diq-you-sheet.is-open {
  opacity: 1;
  pointer-events: auto;
}
.diq-you-sheet-card {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: white;
  border-radius: 22px 22px 0 0;
  padding: 28px 22px max(28px, calc(env(safe-area-inset-bottom) + 80px));
  transform: translateY(110%);
  transition: transform 320ms cubic-bezier(0.2, 0.7, 0.1, 1);
  box-shadow: 0 -20px 40px -10px rgba(15, 27, 45, 0.25);
  text-align: center;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
.diq-you-sheet.is-open .diq-you-sheet-card { transform: translateY(0); }
.diq-you-sheet-card::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: rgba(15, 27, 45, 0.18);
  border-radius: 2px;
  margin: -12px auto 18px;
}
.diq-you-sheet-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(15, 27, 45, 0.06);
  border: 0;
  font-size: 16px;
  color: #0F1B2D;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.diq-you-sheet-mark,
.diq-you-sheet-photo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 2.5px solid #C9A961;
  margin: 0 auto 14px;
  display: block;
  object-fit: cover;
  box-shadow: 0 12px 28px -10px rgba(15, 27, 45, 0.35);
}
.diq-you-sheet-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: #0F1B2D;
  margin-bottom: 4px;
  letter-spacing: -0.2px;
}
.diq-you-sheet-sub {
  font-size: 12.5px;
  color: #5A6470;
  line-height: 1.5;
  margin-bottom: 20px;
}
.diq-you-sheet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: #FAF7F2;
  border: 1px solid rgba(201, 169, 97, 0.22);
  border-radius: 14px;
  margin-bottom: 10px;
  text-align: left;
  text-decoration: none;
  color: inherit;
}
.diq-you-row-text { flex: 1; min-width: 0; }
.diq-you-row-title {
  font-size: 14px;
  font-weight: 600;
  color: #0F1B2D;
  margin-bottom: 2px;
}
.diq-you-row-sub {
  font-size: 12px;
  color: #5A6470;
  line-height: 1.4;
}
.diq-you-row-btn {
  background: #0F1B2D;
  color: #C9A961;
  border: 1px solid rgba(201, 169, 97, 0.4);
  border-radius: 999px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  cursor: pointer;
  flex-shrink: 0;
}
.diq-you-row-btn:hover { background: #1a2d49; }
.diq-you-row-chev {
  font-size: 20px;
  color: #B39847;
  font-weight: 600;
  flex-shrink: 0;
}
.diq-you-sheet-foot {
  font-size: 11px;
  color: #8C6E2E;
  letter-spacing: 0.4px;
  margin-top: 14px;
}

@media (prefers-reduced-motion: reduce) {
  .diq-you-sheet,
  .diq-you-sheet-card { transition: opacity 0ms; transform: none; }
  .diq-tab svg { transition: none; }
}
