/* davvvNET Power BI viewer — soft slate, catalog + embed */

:root {
  --bg: #1c2130;
  --bg-elevated: #262c3d;
  --bg-panel: #2a3144;
  --text: #eef1f7;
  --text-muted: #9aa3b8;
  --text-faint: #7e879c;
  --accent: #6b95f0;
  --accent-soft: rgba(107, 149, 240, 0.12);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.16);
  --glow-blue: rgba(100, 140, 230, 0.18);
  --glow-violet: rgba(150, 100, 210, 0.12);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --topbar-h: 3.25rem;
  --crumb-h: 2.5rem;
  --danger: #f87171;
  --ok: #6ee7b7;
  --healthcare: #5eead4;
  --industry: #93c5fd;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  /* Do NOT lock height:100% — that pins the footer over scrolling catalog cards on mobile */
  height: auto;
  min-height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  /* Grow with content so the page scrolls; footer sits after cards, not on top of them */
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Embed mode: lock to viewport so the report frame fills remaining height */
body.mode-embed {
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 55% at 40% -5%, var(--glow-blue), transparent 58%),
    radial-gradient(ellipse 55% 45% at 100% 25%, var(--glow-violet), transparent 52%),
    linear-gradient(180deg, #222836 0%, var(--bg) 28%, #181d2a 100%);
}

/* —— Top bar —— */
.topbar {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
  background: rgba(28, 33, 48, 0.92);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--topbar-h);
  padding: 0.45rem 1.15rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.brand img {
  display: block;
  height: 30px;
  width: auto;
  border-radius: 6px;
  background: #fff;
  padding: 3px 8px;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pill {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--accent-soft);
  color: var(--accent);
}
.pill.ok {
  color: var(--ok);
  border-color: rgba(110, 231, 183, 0.35);
  background: rgba(110, 231, 183, 0.1);
}
.pill.err {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.1);
}

.link-quiet {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
}
.link-quiet:hover {
  color: var(--text);
}

/* Crumb only when embed is open */
.crumbbar {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--crumb-h);
  padding: 0.3rem 1.15rem 0.5rem;
  max-width: none;
  margin: 0 auto;
  width: 100%;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.crumbbar.is-visible {
  display: flex;
}

body.mode-embed .topbar-inner {
  max-width: none;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  min-width: 0;
}
.crumbs a {
  color: var(--accent);
  text-decoration: none;
}
.crumbs a:hover {
  text-decoration: underline;
}
.crumbs .sep {
  color: var(--text-faint);
}
#crumb-report {
  color: var(--text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(52vw, 32rem);
}

.crumb-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.btn {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 8px;
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
}
.btn:hover {
  border-color: var(--accent);
  background: var(--bg-elevated);
}

/* —— Main / views —— */
.main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  /* Extra bottom padding so last CTA clears the footer + iOS home indicator */
  padding: 1.5rem 1.25rem calc(2.5rem + env(safe-area-inset-bottom, 0px));
  min-height: 0;
}

body.mode-embed .main {
  max-width: none;
  padding: 0.5rem 0.65rem 0.35rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

/* Only the active view is in the layout */
.view {
  display: none !important;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}
.view.is-active {
  display: flex !important;
}

.hero {
  margin-bottom: 1.5rem;
}
.eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.hero h1 {
  margin: 0 0 0.45rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.lede {
  margin: 0;
  color: var(--text-muted);
  max-width: 38rem;
  font-size: 0.98rem;
}

.banner {
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}
.banner.muted {
  color: var(--text-muted);
}
.banner.error {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(127, 29, 29, 0.25);
  white-space: pre-wrap;
}

/* —— Catalog —— */
.catalog {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.ws-block {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(42, 49, 68, 0.45);
  overflow: hidden;
}

.ws-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.95rem 1.15rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.14);
}
.ws-head h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.badge {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.22rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.badge.capacity {
  color: var(--ok);
  border-color: rgba(110, 231, 183, 0.3);
}

.category-block {
  padding: 1rem 1.1rem 1.15rem;
}
.category-block + .category-block {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.category-title {
  margin: 0 0 0.75rem;
}
.category-pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.15);
}
.category-block:has(.category-pill) .category-pill {
  /* fallback when :has unsupported still looks fine */
}
.category-title .category-pill {
  color: var(--healthcare);
  border-color: rgba(94, 234, 212, 0.28);
  background: rgba(94, 234, 212, 0.08);
}
.category-block:nth-of-type(n) .category-title .category-pill {
  /* default healthcare tint; industry override via data attr in future */
}

/* Industry category pill — match by text via sibling structure: second category often Industry */
.category-block .category-pill {
  color: var(--industry);
  border-color: rgba(147, 197, 253, 0.3);
  background: rgba(147, 197, 253, 0.08);
}

/* Prefer data attribute when JS adds it — JS will set data-category */
.category-block[data-category="Healthcare"] .category-pill {
  color: var(--healthcare);
  border-color: rgba(94, 234, 212, 0.28);
  background: rgba(94, 234, 212, 0.08);
}
.category-block[data-category="Industry"] .category-pill {
  color: var(--industry);
  border-color: rgba(147, 197, 253, 0.3);
  background: rgba(147, 197, 253, 0.08);
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
}

.report-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1rem 1.05rem;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(28, 33, 48, 0.55);
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.15s var(--ease);
  min-height: 8.5rem;
}
.report-card:hover {
  background: var(--accent-soft);
  border-color: rgba(107, 149, 240, 0.4);
  transform: translateY(-1px);
}

.report-card-title {
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.report-desc {
  margin: 0;
  flex: 1;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.report-card-cta {
  margin-top: 0.25rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
}

.empty {
  padding: 1rem 1.15rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* —— Embed frame —— */
.report-frame {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  height: calc(100dvh - var(--topbar-h) - var(--crumb-h) - 1rem);
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  overflow: hidden;
  position: relative;
}

.report-frame iframe,
.report-frame > * {
  border: 0 !important;
  width: 100% !important;
  height: 100% !important;
  display: block;
}
.report-frame > div {
  width: 100% !important;
  height: 100% !important;
}

/* —— Footer (aligned with davvv.net /v2 site footer) —— */
.site-footer {
  flex: 0 0 auto;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.7rem;
  margin-top: auto;
  padding: 1.2rem 1.25rem calc(1rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border-strong);
  background: rgba(18, 22, 32, 0.96);
  color: var(--text-faint);
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1.25rem;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

.footer-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1.15rem;
}

.status-link,
.social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.7rem 0.32rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: inherit;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
  transition:
    color 0.2s var(--ease),
    border-color 0.2s var(--ease),
    background 0.2s var(--ease);
}

.status-link {
  gap: 0.45rem;
  padding: 0.32rem 0.65rem 0.32rem 0.5rem;
}

.status-link:hover {
  color: var(--text);
  border-color: rgba(110, 200, 140, 0.4);
  background: rgba(80, 180, 110, 0.08);
}

.social-link:hover {
  color: var(--text);
  border-color: rgba(10, 102, 194, 0.55);
  background: rgba(10, 102, 194, 0.12);
}

.status-link:focus-visible,
.social-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #5dcc86;
  box-shadow: 0 0 0 3px rgba(93, 204, 134, 0.18);
  animation: status-pulse 2.4s ease-in-out infinite;
}

@keyframes status-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(93, 204, 134, 0.18);
    opacity: 1;
  }
  50% {
    box-shadow: 0 0 0 5px rgba(93, 204, 134, 0.1);
    opacity: 0.85;
  }
}

@media (prefers-reduced-motion: reduce) {
  .status-dot {
    animation: none;
  }
}

.status-hint {
  color: var(--text-faint);
  font-weight: 400;
  font-size: 0.7rem;
}

.social-link-icon {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  max-width: 16px;
  max-height: 16px;
  flex: 0 0 16px;
  flex-shrink: 0;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #0a66c2;
  color: #fff;
  line-height: 0;
}

.social-link-icon svg {
  width: 10px !important;
  height: 10px !important;
  max-width: 10px;
  max-height: 10px;
  display: block;
  flex-shrink: 0;
}

/* Never let any footer SVG blow out on iOS if a rule is missed */
.site-footer svg {
  max-width: 1.25rem;
  max-height: 1.25rem;
}

.social-link:hover .social-link-icon {
  background: #0c7adb;
}

.footer-legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 0.75rem;
  margin-left: auto;
  font-size: 0.8125rem;
  color: var(--text-faint);
}

.footer-legal a {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
  white-space: nowrap;
}

.footer-legal a:hover {
  color: var(--text);
  border-bottom-color: rgba(255, 255, 255, 0.22);
}

.footer-legal a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.footer-legal .sep {
  color: var(--text-faint);
  opacity: 0.5;
  user-select: none;
}

.footer-label-short {
  display: none;
}

.footer-label-full {
  display: inline;
}

.footer-copy {
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  width: 100%;
  max-width: 1100px;
  font-size: 0.75rem;
  line-height: 1.5;
  letter-spacing: 0.01em;
  text-align: right;
  font-weight: 500;
  color: var(--text-faint);
}

.footer-copy-main {
  background: linear-gradient(90deg, #9a3a78 0%, #5c4fa8 42%, #2f6fad 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  font-weight: 500;
}

.footer-copy-main > *,
.footer-copy-main em {
  color: inherit;
  -webkit-text-fill-color: inherit;
  background: none;
}

@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .footer-copy-main {
    color: #5a7aaa;
    background: none;
    -webkit-text-fill-color: currentColor;
  }
}

.footer-copy-year {
  font-weight: 650;
  letter-spacing: -0.01em;
}

.footer-copy-brand {
  margin-left: 0.4em;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.footer-copy-sep {
  margin: 0 0.4em;
  opacity: 0.85;
  user-select: none;
}

.footer-copy-entity {
  font-style: italic;
  font-weight: 550;
}

.footer-copy-rights {
  display: block;
  font-weight: 500;
  color: var(--text-faint);
  -webkit-text-fill-color: var(--text-faint);
  background: none;
}

.footer-brand {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 0.15rem 0 0;
  padding: 0;
}

.footer-brand img {
  display: block;
  width: 36px;
  height: 36px;
  object-fit: contain;
  opacity: 0.95;
  border-radius: 8px;
}

.footer-brand a {
  line-height: 0;
  border-radius: 8px;
}

.footer-brand a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.footer-token-expiry {
  display: none;
}

@media (max-width: 420px) {
  .status-hint {
    display: none;
  }
}

@media (max-width: 639px) {
  .footer-top {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }

  .footer-left {
    justify-content: center;
    width: 100%;
  }

  .footer-legal {
    width: 100%;
    margin-left: 0;
    justify-content: center;
    text-align: center;
    gap: 0.35rem 0.55rem;
  }

  .footer-label-full {
    display: none;
  }

  .footer-label-short {
    display: inline;
  }

  .footer-copy {
    text-align: center;
    align-items: center;
  }

  .footer-brand {
    margin-top: 0.35rem;
  }
}

@media (max-width: 640px) {
  .topbar-inner,
  .crumbbar {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .topbar-meta {
    gap: 0.45rem;
  }

  .link-quiet {
    font-size: 0.8rem;
  }

  .main {
    padding: 1.1rem 0.85rem calc(3rem + env(safe-area-inset-bottom, 0px));
  }

  body.mode-embed .main {
    padding: 0.35rem 0.4rem;
  }

  .hero h1 {
    font-size: 1.45rem;
  }

  .lede {
    font-size: 0.92rem;
  }

  .ws-head {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.85rem 0.9rem;
  }

  .ws-head h2 {
    font-size: 1rem;
    line-height: 1.3;
  }

  .category-block {
    padding: 0.85rem 0.85rem 1rem;
  }

  .report-grid {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }

  .report-card {
    min-height: 0;
    padding: 0.9rem 0.95rem 1rem;
  }

  .report-desc {
    -webkit-line-clamp: 5;
    font-size: 0.8rem;
  }

  /* Keep CTA fully visible above the footer on small screens */
  .report-card-cta {
    margin-top: 0.4rem;
    padding-bottom: 0.1rem;
  }

  .site-footer {
    background: #181d2a;
  }

  body.mode-embed .report-frame {
    height: calc(100dvh - var(--topbar-h) - var(--crumb-h) - 0.75rem);
    /* account for iOS safe area when in embed */
    height: calc(100dvh - var(--topbar-h) - var(--crumb-h) - 0.75rem - env(safe-area-inset-bottom, 0px));
  }
}
