/* ============================================
   Bygpas Design System — Phase 0+1
   Result display tokens, animations, and layout overrides.
   Loaded ONLY on index.html alongside style.css.
   Does NOT contain body/reset rules — those stay in style.css.
   ============================================ */


/* =============================================
   ANIMATION TOKENS
   ============================================= */
:root {
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 400ms;
  --easing-out: cubic-bezier(0.16, 1, 0.3, 1);
}


/* =============================================
   SCORE BAND BACKGROUND TOKENS
   Used by band classes and score-dependent components.
   ============================================= */
:root {
  /* Editorial rebrand 2026-04-25: aligned to bygpas-editorial.css
     --risk-soft / --warn-soft / --accent-tint so legacy result-container
     and editorial surfaces paint the same hue. */
  --score-band-low: #f5d9d3;    /* editorial --risk-soft */
  --score-band-mid: #f3e4c3;    /* editorial --warn-soft */
  --score-band-high: #e6eed4;   /* editorial --accent-tint */
}


/* =============================================
   SCORE BAND CLASSES
   5 bands: fraraades, forsigtig, acceptabel, god, fremragende
   Each sets local --band-color, --band-bg, --band-border
   for use by child components.

   Editorial rebrand 2026-04-25: palette aligned to
   bygpas-editorial.css --risk / --warn / --accent so the
   5-band system paints in the editorial cream-paper aesthetic.
   ============================================= */
.band-fraraades {
  --band-color: #b03a2e;
  --band-bg: #f5d9d3;
  --band-border: #e8b9af;
}

.band-forsigtig {
  --band-color: #9a6b1d;
  --band-bg: #f3e4c3;
  --band-border: #e0c890;
}

.band-acceptabel {
  --band-color: #9a6b1d;
  --band-bg: #f3e4c3;
  --band-border: #e0c890;
}

.band-god {
  --band-color: #3d5128;
  --band-bg: #e6eed4;
  --band-border: #c5d2a8;
}

.band-fremragende {
  --band-color: #3d5128;
  --band-bg: #e6eed4;
  --band-border: #c5d2a8;
}


/* =============================================
   SKELETON SHIMMER
   Animated placeholder for loading states.
   Apply .skeleton to any element to show a pulsing
   gradient while content loads.
   ============================================= */
@keyframes shimmer {
  0% {
    background-position: -400px 0;
  }
  100% {
    background-position: 400px 0;
  }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--gray-100) 25%,
    #e2e8f0 37%,
    var(--gray-100) 63%
  );
  background-size: 800px 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: var(--radius-sm);
  color: transparent !important;
  user-select: none;
  pointer-events: none;
}

/* Skeleton shape variants — used by component-states.js */
.skeleton-line {
  height: 16px;
  border-radius: 4px;
}

.skeleton-line-lg {
  height: 32px;
  border-radius: 6px;
}

.skeleton-circle {
  border-radius: 50%;
}


/* =============================================
   TABULAR NUMBERS
   Prevents score digits from shifting layout
   when values change (e.g. during count-up).
   ============================================= */
.tabular-nums {
  font-variant-numeric: tabular-nums;
}


/* =============================================
   SCORE NUMBER
   Large centered score digit in the ring.
   ============================================= */
.score-number {
  font-family: 'Instrument Serif', serif;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: -0.04em;
}


/* =============================================
   FOCUS VISIBLE OVERRIDE
   Global keyboard focus ring. Green ring, 2px,
   offset 2px. Only shows on keyboard navigation
   (not mouse clicks).
   ============================================= */
*:focus-visible {
  outline: 2px solid #3d5128;
  outline-offset: 2px;
}


/* =============================================
   REDUCED MOTION
   Respects user preference. Disables all
   animations and transitions globally.
   ============================================= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .skeleton {
    animation: none;
    background: var(--gray-100);
  }
}


/* =============================================
   RESULT CONTAINER LAYOUT OVERRIDE
   Changes from CSS grid (320px + 1fr) to a
   single-column flex layout. Max 960px centered.
   This stacks score card on top, data cards below.
   ============================================= */
.result-container {
  display: flex;
  flex-direction: column;
  max-width: 960px;
  gap: 24px;
}

/* Grid-column no longer applies — flex child */
.result-container .search-again {
  grid-column: unset;
}

/* AI disclaimer also loses grid-column */
.result-container .ai-disclaimer {
  grid-column: unset;
}


/* =============================================
   SCORE CARD — CENTERED
   Max 480px, centered horizontally in the flex
   container. No longer sticky (stacking layout).
   ============================================= */
.score-card {
  position: static;
  max-width: 480px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}


/* =============================================
   DIMENSION CARDS
   Individual score dimension with expandable detail.
   White background, border, hover transition.
   ============================================= */
.dimension-card {
  background: var(--card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  transition: border-color var(--duration-base) var(--easing-out);
  cursor: default;
}

.dimension-card:hover {
  border-color: var(--border-hover);
}

/* Dimension header row — label left, score right */
.dimension-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.dimension-label {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--dark);
}

.dimension-score {
  font-family: 'Instrument Serif', serif;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--band-color, var(--dark));
}

/* Progress bar within dimension card */
.dimension-bar {
  width: 100%;
  height: 3px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 2px;
  margin-top: 12px;
  overflow: hidden;
}

.dimension-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--band-color, var(--gray-300));
  width: 0;
  transition: width 1s ease;
}

/* Detail panel — hidden by default, shown on expand */
.dimension-detail {
  display: none;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 0.5px solid var(--border);
  font-size: 13px;
  color: var(--gray-500);
  line-height: 1.7;
}

.dimension-detail.open {
  display: block;
}


/* =============================================
   COMPONENT STATE CONTAINERS
   Styles for skeleton/empty/error/partial states
   rendered by component-states.js
   ============================================= */

/* Skeleton layout containers */
.skeleton-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skeleton-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Empty state */
.state-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.state-empty-icon {
  width: 48px;
  height: 48px;
  color: var(--gray-400);
  margin-bottom: 16px;
}

.state-empty-title {
  font-family: 'Instrument Serif', serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--dark);
  margin-bottom: 6px;
}

.state-empty-message {
  font-size: 13px;
  color: var(--gray-500);
  max-width: 320px;
  line-height: 1.6;
  margin-bottom: 20px;
}

.state-empty-action {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--dark);
  background: none;
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-sm);
  padding: 8px 20px;
  cursor: pointer;
  transition: background var(--duration-fast), border-color var(--duration-fast);
}

.state-empty-action:hover {
  background: var(--gray-100);
  border-color: var(--gray-300);
}

/* Error state */
.state-error {
  background: var(--red-light);
  border: 1px solid #e8b9af;
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.state-error-icon {
  width: 24px;
  height: 24px;
  color: var(--red-text);
  margin-bottom: 4px;
}

.state-error-title {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--red-text);
}

.state-error-message {
  font-size: 13px;
  color: var(--red-text);
  opacity: 0.85;
  line-height: 1.5;
}

.state-error-retry {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--red-text);
  background: none;
  border: 1px solid rgba(176, 58, 46, 0.25);
  border-radius: var(--radius-sm);
  padding: 8px 20px;
  margin-top: 8px;
  cursor: pointer;
  transition: background var(--duration-fast);
}

.state-error-retry:hover {
  background: rgba(176, 58, 46, 0.08);
}

/* Partial data warning banner */
.state-partial {
  background: var(--yellow-light);
  border: 1px solid #e0c890;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.state-partial-icon {
  width: 20px;
  height: 20px;
  color: var(--yellow-text);
  flex-shrink: 0;
  margin-top: 1px;
}

.state-partial-content {
  flex: 1;
  min-width: 0;
}

.state-partial-title {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--yellow-text);
  margin-bottom: 2px;
}

.state-partial-message {
  font-size: 12px;
  color: var(--yellow-text);
  opacity: 0.85;
  line-height: 1.5;
}

.state-partial-sources {
  font-size: 11px;
  color: var(--yellow-text);
  opacity: 0.7;
  margin-top: 4px;
}


/* =============================================
   REPORT BUY BUTTON — PRIMARY CTA HOVER
   Replaces previous inline onmouseover/onmouseout handlers
   (which were blocked by our CSP). Subtle lift + lighter
   background on hover to signal clickability.
   ============================================= */
#report-buy-btn {
  transition: background-color var(--duration-fast) var(--easing-out),
              transform var(--duration-fast) var(--easing-out);
}

#report-buy-btn:hover {
  background-color: #333;
  transform: translateY(-1px);
}

#report-buy-btn:active {
  transform: translateY(0);
}


/* =============================================
   BYGPAS-DISCLAIMER (Opgave 2, plan v1.1)
   =============================================
   Statisk markup på rapport.html. Samme juridiske posture som
   renderLegalDisclaimer() i design-components.js og PDF-footer i
   generate-report/index.ts. Tilbageholdt stil — transparent bg,
   border-top, smallere tekst — så iframen/rapporten forbliver den
   visuelle hero.
   ============================================= */
.bygpas-disclaimer {
  max-width: 760px;
  margin: 32px auto 24px;
  padding: 24px 24px 20px;
  background: transparent;
  border-top: 0.5px solid var(--border);
  font-family: 'Inter', sans-serif;
}

.bygpas-disclaimer-eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gray-400);
  font-weight: 500;
  margin-bottom: 10px;
}

.bygpas-disclaimer-title {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 18px;
  font-weight: 600;
  color: var(--dark);
  margin: 0 0 14px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.bygpas-disclaimer p {
  font-size: 13px;
  color: var(--gray-500);
  line-height: 1.7;
  margin: 0 0 12px;
}

.bygpas-disclaimer p:last-of-type {
  margin-bottom: 16px;
}

.bygpas-disclaimer abbr {
  text-decoration: none;
  border-bottom: 0.5px dotted var(--gray-400);
  cursor: help;
}

.bygpas-disclaimer a {
  color: var(--dark);
  text-decoration: underline;
  text-decoration-color: var(--border-hover);
  text-underline-offset: 2px;
  font-weight: 500;
}

.bygpas-disclaimer a:hover {
  text-decoration-color: var(--dark);
}

.bygpas-disclaimer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 4px;
}

.bygpas-disclaimer-links a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--dark);
  text-decoration: none;
  border-bottom: 1px solid var(--border-hover);
  padding-bottom: 1px;
}

.bygpas-disclaimer-links a:hover {
  border-bottom-color: var(--dark);
}


/* =============================================
   RESPONSIVE: MOBILE (< 600px)
   ============================================= */
@media (max-width: 600px) {
  /* Smaller score number on mobile */
  .score-number {
    font-size: 40px;
  }

  /* Full-width score card on mobile */
  .score-card {
    max-width: 100%;
    padding: 28px 20px;
  }

  /* Tighter dimension cards */
  .dimension-card {
    padding: 16px 18px;
  }

  /* Adjust state containers for mobile */
  .state-empty {
    padding: 32px 20px;
  }

  .state-partial {
    padding: 12px 14px;
  }
}
