/* app.css — the single stylesheet for the application. No CSS lives in
 * templates (enforced by the no-CSS-in-templates lint guard); all styling is
 * here, driven by the :root design tokens below. */

:root {
  /* Surface + brand (Apple/white aesthetic) */
  --color-bg: #f5f5f7;
  --color-surface: #ffffff;
  --color-text: #1d1d1f;
  --color-text-muted: #6e6e73;
  --color-accent: #4f46e5; /* indigo — single brand accent */
  --color-border: #d2d2d7; /* hairline */

  /* Semantic action trio (used later by results views) */
  --color-pause: #c0392b; /* muted red   -> pause */
  --color-scale: #2e7d52; /* muted green -> scale */
  --color-test: #2f6db5; /* muted blue  -> test  */

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 3rem;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Type */
  --font-sans:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.25rem;
  --text-xl: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem);

  /* Layout */
  --content-max: 1080px;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.5;
}

/* Header --------------------------------------------------------------- */
.site-header {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
}

.nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  max-width: var(--content-max);
  margin-inline: auto;
  padding: var(--space-3) clamp(var(--space-4), 4vw, var(--space-6));
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: inherit;
  text-decoration: none;
}

/* Hamburger: hidden on wide screens, shown below the breakpoint. */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-accent);
  cursor: pointer;
}

.nav-toggle-icon {
  width: 1.5rem;
  height: 1.5rem;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-accent);
  font-weight: 600;
  text-decoration: none;
}

.nav-icon {
  width: 1.1rem;
  height: 1.1rem;
}

@media (max-width: 640px) {
  .nav-toggle {
    display: inline-flex;
  }
  .nav-menu {
    display: none;
    position: absolute;
    inset-inline: 0;
    top: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-4) clamp(var(--space-4), 4vw, var(--space-6));
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    z-index: 10;
  }
  .nav-menu.open {
    display: flex;
  }
}

.brand-logo {
  display: block;
  height: 24px; /* scales the 2:1 mark to nav size */
  width: auto;
}

.brand-name {
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Content column ------------------------------------------------------- */
.content {
  max-width: var(--content-max);
  margin-inline: auto;
  padding: clamp(var(--space-5), 5vw, var(--space-8))
    clamp(var(--space-4), 4vw, var(--space-6));
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: clamp(var(--space-5), 4vw, var(--space-6));
}

.card h1 {
  margin: 0 0 var(--space-3);
  font-size: var(--text-xl);
  letter-spacing: -0.02em;
}

.lede {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--text-lg);
}

/* Buttons -------------------------------------------------------------- */
.button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-md);
  background: var(--color-accent);
  color: var(--color-surface);
  font: inherit;
  cursor: pointer;
}

/* Results grid: cards on small screens, a table-like grid on large ------ */
.results {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .results {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }
}

/* Action-state accents for pause/scale/test */
.action-pause {
  color: var(--color-pause);
}
.action-scale {
  color: var(--color-scale);
}
.action-test {
  color: var(--color-test);
}

/* Shared muted text + pills ------------------------------------------------ */
.muted {
  color: var(--color-text-muted);
}

.pill {
  display: inline-block;
  margin: 0 var(--space-1) var(--space-1) 0;
  padding: 0 var(--space-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}

/* Upload form -------------------------------------------------------------- */
.upload-form {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-5);
}

.field {
  display: grid;
  gap: var(--space-1);
}

.field label {
  font-weight: 600;
}

.field input[type="file"] {
  font: inherit;
}

.req {
  color: var(--color-accent);
  font-size: var(--text-sm);
  font-weight: 500;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.button-secondary {
  background: transparent;
  color: var(--color-accent);
}

/* Results region ----------------------------------------------------------- */
.results-region {
  margin-top: var(--space-5);
  display: grid;
  gap: var(--space-4);
}

.results-summary h2 {
  margin: 0 0 var(--space-1);
}

.actions {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);
}

.action-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-3);
}

.action-kind {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: var(--text-sm);
  font-weight: 700;
  border: 1px solid currentcolor;
  border-radius: var(--radius-sm);
  padding: 0 var(--space-2);
}

.action-creative {
  font-weight: 600;
}

.rationale {
  margin: var(--space-2) 0 0;
}

.supporting {
  margin: var(--space-2) 0 0;
  font-size: var(--text-sm);
}

/* Diagnostics -------------------------------------------------------------- */
.diagnostics h3 {
  margin: 0 0 var(--space-3);
}

.diag {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.diag th,
.diag td {
  text-align: left;
  padding: var(--space-1) var(--space-2);
  border-bottom: 1px solid var(--color-border);
}

.diag th {
  font-weight: 500;
  color: var(--color-text-muted);
}

.diag td {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.skipped,
.notes {
  margin: var(--space-2) 0 0;
  padding-left: var(--space-5);
  font-size: var(--text-sm);
}

/* Error card --------------------------------------------------------------- */
.error-card {
  background: var(--color-surface);
  border: 1px solid var(--color-pause);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  color: var(--color-pause);
}

.error-card p {
  margin: var(--space-2) 0 0;
  color: var(--color-text);
}

/* Wizard --------------------------------------------------------------- */
.wizard {
  display: grid;
  gap: var(--space-5);
}

.wizard-indicator {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
}

/* Steps: one visible at a time. JS toggles .is-active; CSS owns show/hide. */
.wizard-step {
  display: none;
}

.wizard-step.is-active {
  display: block;
}

.wizard-step h2 {
  margin: 0 0 var(--space-2);
}

.wizard-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
}

.csv-excerpt {
  overflow-x: auto;
  margin: var(--space-2) 0 var(--space-4);
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  font-size: var(--text-sm);
  white-space: pre;
}

.score-row {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
}

.score-id {
  font-weight: 600;
  margin-right: var(--space-2);
}

.score-metrics {
  margin: var(--space-2) 0 0;
  padding-left: var(--space-5);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.confidence-high {
  color: var(--color-scale);
}

.confidence-low {
  color: var(--color-text-muted);
}
