@import url('fonts.css');

/* ==========================================================================
   Indikator — design tokens

   The instrument, not the software, sets the palette. A psychometric profile
   has always been printed on paper: cool stock, dark ink, one signal colour.
   Petrol carries the instrument; clay appears only where the reader must look
   (a factor outside the target range, a validity warning). Nothing else is
   coloured, so colour always means something.
   ========================================================================== */

:root {
  --paper:        #f7f6f2;
  --paper-raised: #fffffe;
  --paper-sunk:   #efeee8;

  --ink:          #16211f;
  --ink-muted:    #56635f;
  --ink-faint:    #8b9691;

  --petrol:       #0f4c4a;
  --petrol-lift:  #1b6b66;
  --petrol-wash:  #e4ecea;

  --clay:         #a6462f;
  --clay-wash:    #f6e9e4;

  --mist:         #dfe3de;
  --mist-strong:  #c5ccc6;
  --sand:         #ece9e0;

  --display: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  --body:    'Public Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Major-third-ish scale, tightened at the top so headings stay institutional
     rather than editorial. */
  --t-xs:   0.75rem;
  --t-sm:   0.8125rem;
  --t-base: 0.9375rem;
  --t-md:   1.0625rem;
  --t-lg:   1.3125rem;
  --t-xl:   1.75rem;
  --t-2xl:  2.375rem;
  --t-3xl:  3.125rem;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;

  --radius:    3px;
  --radius-lg: 5px;

  --measure: 62ch;
  --shell:   1180px;

  --ease: cubic-bezier(0.32, 0.72, 0.3, 1);
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--t-base);
  line-height: 1.6;
  font-feature-settings: 'kern' 1;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--display);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.012em;
}

p { margin: 0 0 var(--space-4); }
p:last-child { margin-bottom: 0; }

a { color: var(--petrol); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--petrol-lift); }

img, svg { max-width: 100%; height: auto; display: block; }

table { border-collapse: collapse; width: 100%; }

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

::selection { background: var(--petrol); color: var(--paper); }

/* --------------------------------------------------------------------------
   Typographic roles
   -------------------------------------------------------------------------- */

.display  { font-family: var(--display); font-size: var(--t-2xl); font-weight: 500; }
.title    { font-family: var(--display); font-size: var(--t-xl); font-weight: 500; }
.subtitle { font-family: var(--display); font-size: var(--t-lg); font-weight: 500; }

/* Eyebrow: a category label, used only where the thing genuinely belongs to a
   named group (a domain, a report section). Never as decoration. */
.eyebrow {
  font-family: var(--mono);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.lede  { font-size: var(--t-md); color: var(--ink-muted); max-width: var(--measure); }
.muted { color: var(--ink-muted); }
.faint { color: var(--ink-faint); }
.small { font-size: var(--t-sm); }

/* Numbers, codes and identifiers read as instrument output, not prose. */
.data { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.measure { max-width: var(--measure); }

/* --------------------------------------------------------------------------
   Shell
   -------------------------------------------------------------------------- */

.shell {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

.shell--narrow { max-width: 760px; }
.shell--wide   { max-width: 1400px; }

.stack > * + * { margin-top: var(--space-4); }
.stack-lg > * + * { margin-top: var(--space-6); }
.stack-sm > * + * { margin-top: var(--space-2); }

.row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }

.section { padding: var(--space-7) 0; }

.rule {
  border: 0;
  border-top: 1px solid var(--mist);
  margin: var(--space-6) 0;
}

/* --------------------------------------------------------------------------
   Wordmark

   The "i" is dotted with a petrol square sitting at the position of sten 6 —
   the first point above the mean. The mark is the instrument's own reading.
   -------------------------------------------------------------------------- */

.wordmark {
  font-family: var(--display);
  font-size: var(--t-md);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.45em;
}
.wordmark::before {
  content: '';
  width: 0.4em;
  height: 0.4em;
  background: var(--petrol);
  transform: translateY(-0.05em);
}
.wordmark:hover { color: var(--ink); }

/* --------------------------------------------------------------------------
   Surfaces
   -------------------------------------------------------------------------- */

.card {
  background: var(--paper-raised);
  border: 1px solid var(--mist);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

.card--flush { padding: 0; overflow: hidden; }

.panel {
  background: var(--paper-sunk);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

/* A note that needs the reader's attention without alarming them. */
.notice {
  border-left: 3px solid var(--petrol);
  background: var(--petrol-wash);
  padding: var(--space-4) var(--space-5);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.notice--warn { border-left-color: var(--clay); background: var(--clay-wash); }

/* --------------------------------------------------------------------------
   Controls
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 46px;
  padding: 0 var(--space-5);
  border: 1px solid var(--petrol);
  border-radius: var(--radius);
  background: var(--petrol);
  color: var(--paper);
  font-family: var(--body);
  font-size: var(--t-base);
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.btn:hover { background: var(--petrol-lift); border-color: var(--petrol-lift); color: var(--paper); }
.btn:disabled, .btn[aria-disabled='true'] {
  background: var(--mist-strong);
  border-color: var(--mist-strong);
  color: var(--paper);
  cursor: not-allowed;
}

.btn--ghost {
  background: transparent;
  color: var(--petrol);
  border-color: var(--mist-strong);
}
.btn--ghost:hover { background: var(--petrol-wash); color: var(--petrol); border-color: var(--petrol); }

.btn--quiet {
  background: transparent;
  border-color: transparent;
  color: var(--ink-muted);
  padding: 0 var(--space-3);
}
.btn--quiet:hover { background: var(--paper-sunk); color: var(--ink); border-color: transparent; }

.btn--danger { background: var(--clay); border-color: var(--clay); }
.btn--danger:hover { background: #8d3a27; border-color: #8d3a27; }

.btn--sm { min-height: 34px; padding: 0 var(--space-3); font-size: var(--t-sm); }
.btn--block { width: 100%; }

.field { display: block; margin-bottom: var(--space-4); }

.field > label,
.label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--t-sm);
  font-weight: 600;
  color: var(--ink);
}

.hint {
  margin-top: var(--space-2);
  font-size: var(--t-sm);
  color: var(--ink-muted);
}

.input, .select, .textarea {
  width: 100%;
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--mist-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--t-base);
  line-height: 1.5;
}
.textarea { min-height: 132px; resize: vertical; padding: var(--space-3); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--petrol);
  outline: 2px solid var(--petrol-wash);
  outline-offset: 0;
}
.input[aria-invalid='true'], .textarea[aria-invalid='true'] { border-color: var(--clay); }

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='7' viewBox='0 0 11 7'%3E%3Cpath d='M1 1l4.5 4.5L10 1' fill='none' stroke='%2356635f' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-6);
}

.error-text { color: var(--clay); font-size: var(--t-sm); margin-top: var(--space-2); }

/* --------------------------------------------------------------------------
   Status pills
   -------------------------------------------------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.15em 0.6em;
  border-radius: 999px;
  background: var(--paper-sunk);
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.pill--ok    { background: var(--petrol-wash); color: var(--petrol); }
.pill--warn  { background: var(--clay-wash);   color: var(--clay); }
.pill::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.pill--plain::before { display: none; }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table { font-size: var(--t-sm); }
.table th {
  text-align: left;
  font-family: var(--mono);
  font-size: var(--t-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 0 var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--mist);
  white-space: nowrap;
}
.table td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--mist);
  vertical-align: middle;
}
.table tbody tr:hover { background: var(--paper-sunk); }
.table tbody tr:last-child td { border-bottom: 0; }
.table a { text-decoration: none; font-weight: 600; }
.table a:hover { text-decoration: underline; }

.table-wrap { overflow-x: auto; }

/* --------------------------------------------------------------------------
   Empty states — an invitation to act, not an apology.
   -------------------------------------------------------------------------- */

.empty {
  padding: var(--space-7) var(--space-5);
  text-align: center;
  border: 1px dashed var(--mist-strong);
  border-radius: var(--radius-lg);
  color: var(--ink-muted);
}
.empty h3 { font-size: var(--t-lg); margin-bottom: var(--space-2); color: var(--ink); }

/* --------------------------------------------------------------------------
   Flash messages
   -------------------------------------------------------------------------- */

.flash {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  border-left: 3px solid var(--petrol);
  background: var(--petrol-wash);
  font-size: var(--t-sm);
}
.flash--error { border-left-color: var(--clay); background: var(--clay-wash); color: var(--clay); }

/* --------------------------------------------------------------------------
   Skip link
   -------------------------------------------------------------------------- */

.skip {
  position: absolute;
  left: -9999px;
  top: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: var(--petrol);
  color: var(--paper);
  border-radius: var(--radius);
  z-index: 100;
}
.skip:focus { left: var(--space-4); color: var(--paper); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
