/* AlertaObra design tokens and shared components (SPEC 3). Colours must come from these variables. */

@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/space-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --brand: #E8590C;
  --brand-hover: #D9480F;
  --brand-soft: #FFF1E8;
  --navy: #14202E;
  --navy-soft: #E8EEF6;
  --ink: #1B2430;
  --muted: #5B6573;
  --line: #E3E6EB;
  --bg: #FFFFFF;
  --bg-alt: #F6F7F9;
  --success: #2F9E44;
  --warning: #F59F00;
  --danger: #C92A2A;
  --success-soft: #E6F4E9;
  --success-ink: #1F6B2E;
  --danger-soft: #FBEAEA;

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, sans-serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 2px rgba(20, 32, 46, .06), 0 4px 16px rgba(20, 32, 46, .06);
}

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

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--navy);
  margin: 0 0 16px;
}
h1 { font-size: clamp(2.1rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.25rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 16px; }

a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-hover); }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--radius-sm); }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Logo */
.logo { display: inline-flex; align-items: center; text-decoration: none; }
.logo__text { font-family: var(--font-display); letter-spacing: -0.03em; line-height: 1; color: var(--navy); font-weight: 400; }
.logo__text strong { font-weight: 700; }
.logo--dark .logo__text { color: #FFFFFF; }

.icon { flex: none; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 20px;
  font: 600 1rem var(--font-body);
  border: 1px solid transparent; border-radius: var(--radius-md);
  background: var(--brand); color: #FFFFFF;
  text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--brand-hover); color: #FFFFFF; }
.btn--ghost { background: transparent; color: var(--navy); border-color: var(--line); }
.btn--ghost:hover { background: var(--bg-alt); color: var(--navy); }
.btn--danger { background: transparent; color: var(--danger); border-color: var(--line); }
.btn--danger:hover { background: var(--bg-alt); color: var(--danger); }
.btn--block { width: 100%; }

/* Forms */
label { display: block; font-weight: 500; font-size: .9375rem; margin-bottom: 6px; color: var(--navy); }
.input, select.input {
  width: 100%; min-height: 44px; padding: 10px 12px;
  font: 400 1rem var(--font-body); color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-md);
}
.input:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.field { margin-bottom: 16px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: .875rem; color: var(--muted); min-height: 44px; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }
.hp { position: absolute; left: -9999px; }

/* Surfaces */
.card {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: 24px;
}
.badge {
  display: inline-block; padding: 2px 10px; border-radius: var(--radius-pill);
  background: var(--brand-soft); color: var(--brand-hover);
  font-size: .8125rem; font-weight: 600;
}
.badge--neutral { background: var(--navy-soft); color: var(--navy); }
.badge--success { background: var(--success-soft); color: var(--success-ink); }

.alert { padding: 12px 16px; border-radius: var(--radius-md); margin-bottom: 16px; font-size: .9375rem; }
.alert--error { background: var(--danger-soft); color: var(--danger); }
.alert--ok { background: var(--success-soft); color: var(--success-ink); }

.table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table th { font-weight: 600; color: var(--muted); font-size: .8125rem; text-transform: uppercase; letter-spacing: .04em; }
.table-wrap { overflow-x: auto; }
