/* ─────────────────────────────────────────────────────────────────────
   VIAS Design System
   - Semantic colour, type, spacing tokens
   - Component utilities so templates don't reinvent buttons/cards
   - All values pass WCAG-AA on white (4.5:1+); primary text passes AAA.
   ───────────────────────────────────────────────────────────────────── */

:root {
  /* Brand */
  --brand:       #008751;
  --brand-dark:  #006d41;
  --brand-tint:  #e6f4ed;
  --brand-ring:  rgba(0, 135, 81, 0.18);

  /* Accent */
  --accent-amber: #d97706;
  --accent-amber-tint: #fef3c7;
  --accent-red:   #dc2626;
  --accent-sky:   #0284c7;

  /* Ink ramp — all pass AA on white */
  --ink-1: #0f172a;   /* 18.6:1  — headings */
  --ink-2: #1f2937;   /* 15.1:1  — body strong */
  --ink-3: #374151;   /* 11.1:1  — body */
  --ink-4: #4b5563;   /*  7.5:1  — secondary text, labels */
  --ink-5: #6b7280;   /*  4.8:1  — captions, helpers (AA minimum) */
  --ink-disabled: #9ca3af; /* only for explicitly disabled states */

  /* Surfaces */
  --surface-0: #ffffff;
  --surface-1: #fafafa;
  --surface-2: #f5f5f4;   /* warmer than gray-100 for less screen-glare */
  --line-1:    #e5e7eb;
  --line-2:    #d1d5db;

  /* Type scale */
  --font-display: 'Outfit', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', Consolas, monospace;
}

[data-theme="dark"] {
  --ink-1: #f8fafc;
  --ink-2: #e2e8f0;
  --ink-3: #cbd5e1;
  --ink-4: #94a3b8;
  --ink-5: #64748b;
  --ink-disabled: #475569;
  --surface-0: #0b1220;
  --surface-1: #111827;
  --surface-2: #1f2937;
  --line-1:    #1f2937;
  --line-2:    #334155;
}

/* ─── Typography ──────────────────────────────────────────────────── */

.eyebrow {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-4);
  line-height: 1;
}

.eyebrow-brand { color: var(--brand); }

.heading-display {
  font-size: 28px;
  line-height: 1.1;
  font-weight: 900;
  letter-spacing: -0.022em;
  color: var(--ink-1);
}
.heading-1 {
  font-size: 22px;
  line-height: 1.15;
  font-weight: 900;
  letter-spacing: -0.018em;
  color: var(--ink-1);
}
.heading-2 {
  font-size: 17px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -0.012em;
  color: var(--ink-2);
}
.heading-3 {
  font-size: 14px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--ink-2);
}

.body { font-size: 14px; line-height: 1.55; color: var(--ink-3); }
.body-strong { font-size: 14px; line-height: 1.55; color: var(--ink-2); font-weight: 600; }
.body-sm    { font-size: 13px; line-height: 1.5;  color: var(--ink-4); }
.caption    { font-size: 12px; line-height: 1.5;  color: var(--ink-5); }
.caption-strong { font-size: 12px; line-height: 1.5;  color: var(--ink-3); font-weight: 600; }

.numeric    { font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }
.mono       { font-family: var(--font-mono); }

/* ─── Buttons ──────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  /* Defeat DaisyUI: it ships .btn with min-height:3rem / height:3rem (and
     .btn-lg with 4rem / 1.125rem font), which makes every CTA look bloated. */
  height: auto;
  min-height: 0;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.005em;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms, transform 80ms;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.2;
}
.btn:active:not(:disabled) { transform: scale(0.985); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* btn-lg/btn-sm need the same height reset to keep them sensible */
.btn-lg { padding: 12px 20px; font-size: 14px; border-radius: 12px; height: auto; min-height: 0; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; gap: 4px; height: auto; min-height: 0; }

.btn-primary {
  background: var(--brand);
  color: #fff;
}
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-primary:focus-visible { outline: 3px solid var(--brand-ring); outline-offset: 1px; }

.btn-secondary {
  background: var(--surface-0);
  color: var(--ink-2);
  border-color: var(--line-2);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--brand);
  color: var(--brand);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-4);
}
.btn-ghost:hover:not(:disabled) {
  color: var(--ink-1);
  background: var(--surface-2);
}

.btn-danger {
  background: var(--surface-0);
  color: var(--accent-red);
  border-color: var(--line-2);
}
.btn-danger:hover:not(:disabled) { background: #fef2f2; border-color: var(--accent-red); }

/* ─── Cards ──────────────────────────────────────────────────── */

/* `display: block` defeats DaisyUI's .card which sets flex-direction:column —
   without this, any `<form class="card flex flex-wrap">` ends up stacked
   vertically because DaisyUI's column direction sneaks through. */
.card {
  display: block;
  background: var(--surface-0);
  border: 1px solid var(--line-1);
  border-radius: 14px;
}
/* When the card opts into flex layout, respect it (Tailwind's .flex still wins
   on specificity but be explicit so any global rules can't reverse direction) */
.card.flex { display: flex; flex-direction: row; }
.card.flex.flex-col { flex-direction: column; }
.card.grid { display: grid; }
.card-pad { padding: 20px; }
.card-pad-lg { padding: 24px; }
.card-elevated {
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 2px 8px rgba(15, 23, 42, 0.03);
}
.card-feature {
  background: var(--surface-0);
  border: 1px solid var(--line-1);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

/* ─── Forms ──────────────────────────────────────────────────── */

.input,
.textarea,
.select {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: var(--surface-0);
  font-size: 14px;
  font-family: var(--font-display);
  color: var(--ink-2);
  transition: border-color 120ms, box-shadow 120ms;
  line-height: 1.45;
}
.input::placeholder,
.textarea::placeholder { color: var(--ink-5); opacity: 1; }

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.textarea { resize: vertical; min-height: 88px; line-height: 1.55; }
.select { padding-right: 36px; appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234B5563' stroke-width='2.5'%3E%3Cpath d='M5 8l7 7 7-7'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; }

.label {
  display: block;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-bottom: 6px;
}
.label-helper {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-5);
  margin-left: 6px;
}

/* ─── Tags / Chips / Status pills ──────────────────────────────── */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
  border: 1px solid;
}
.tag-brand { background: var(--brand-tint); color: var(--brand-dark); border-color: rgba(0, 135, 81, 0.25); }
.tag-amber { background: var(--accent-amber-tint); color: #92400e; border-color: rgba(217, 119, 6, 0.3); }
.tag-red { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.tag-sky { background: #f0f9ff; color: #075985; border-color: #bae6fd; }
.tag-gray { background: var(--surface-2); color: var(--ink-4); border-color: var(--line-1); }
.tag-emerald { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }

/* status dot — for tag-with-dot patterns */
.dot { width: 6px; height: 6px; border-radius: 999px; display: inline-block; }
.dot-amber { background: var(--accent-amber); }
.dot-emerald { background: #10b981; }
.dot-red { background: var(--accent-red); }
.dot-pulse { animation: dot-pulse 1.4s ease-in-out infinite; }
@keyframes dot-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* ─── KPI tile ─────────────────────────────────────────────────── */

.kpi {
  background: var(--surface-0);
  border: 1px solid var(--line-1);
  border-radius: 12px;
  padding: 14px 16px;
}
.kpi-num {
  font-size: 22px;
  line-height: 1;
  font-weight: 900;
  color: var(--ink-1);
  letter-spacing: -0.015em;
  font-feature-settings: "tnum";
}
.kpi-num-brand { color: var(--brand); }
.kpi-num-amber { color: var(--accent-amber); }
.kpi-num-red   { color: var(--accent-red); }
.kpi-num-muted { color: var(--ink-5); }
.kpi-label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-5);
  margin-top: 8px;
}

/* ─── Pageheader pattern ───────────────────────────────────────── */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.page-title-block .eyebrow { margin-bottom: 6px; }
.page-title-block h1 { margin: 0; }
.page-title-block p { margin-top: 6px; color: var(--ink-4); font-size: 13px; }

/* ─── Anchors ─────────────────────────────────────────────────── */

.link-brand {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
  transition: color 120ms;
}
.link-brand:hover { color: var(--brand-dark); text-decoration: underline; }

/* ─── Scroll containers ───────────────────────────────────────── */

.scroll-shell { background: #fafafa; }
[data-theme="dark"] .scroll-shell { background: var(--surface-1); }

/* ─── Misc utility ─────────────────────────────────────────────── */

.divider {
  height: 1px;
  background: var(--line-1);
  border: 0;
}

.focus-ring:focus-visible {
  outline: 3px solid var(--brand-ring);
  outline-offset: 1px;
  border-radius: 6px;
}

/* ─── Mobile tightening ────────────────────────────────────────── */

@media (max-width: 640px) {
  .heading-display { font-size: 24px; }
  .heading-1 { font-size: 19px; }
  .heading-2 { font-size: 16px; }
  .card-pad { padding: 16px; }
  .card-pad-lg { padding: 18px; }
  .btn-lg { padding: 11px 16px; }
}
