/* OPAL Confidential — the ONLY file that declares a color.
 *
 * If you find yourself typing a hex value outside this file, the token you need
 * either exists or should. Every ratio in a comment below is MEASURED, and
 * tests/test_brand_tokens.py recomputes all of them on every run.
 *
 * The brand color is split three ways — ink, fill, glow — because one token used
 * as both text and a button surface produces white-on-pale in dark mode. They
 * cannot move together across themes.
 */

:root {
  color-scheme: light;

  /* Ground and ink */
  --bg:            #F7F5F1;
  --bg-raised:     #FFFFFF;
  --bg-sunken:     #EFEBE4;
  --border:        #DFD9CF;
  --ink:           #16293F;  /* 13.55:1 on --bg */
  --ink-soft:      #4A5768;  /*  6.76:1 on --bg */

  /* Brand, split three ways */
  --accent:        #0F5C5A;  /*  7.15:1 on --bg — text, links, focus ring */
  --brand-fill:    #0B4644;  /* 10.64:1 carrying white — button SURFACE */
  --brand-on-fill: #FFFFFF;
  --brand-glow:    #5FC9C4;  /*  1.81:1 — GRADIENTS ONLY, never under text */

  /* Status. Fills at 3:1; text always from the matching -ink token. */
  --warn-fill:     #F5E6C8;
  --warn-ink:      #6B4E12;  /* 6.9:1 on --warn-fill */

  /* The OPAL 360 domains. Fixed by the brand brief — DO NOT EDIT THESE SIX.
   *
   * Measured against --bg they run 2.20:1 to 3.14:1. Every one fails the 4.5:1
   * text floor and all but Professional fail 3:1 as non-text UI. They are legal
   * here under ONE condition: a domain swatch is decorative and never the sole
   * carrier of meaning — it always sits beside its own text label, so the color
   * is redundant encoding. For anything a person must READ, use the -ink token.
   */
  --domain-professional:      #239A96;
  --domain-family:            #D98E63;
  --domain-caregiving:        #9B8FC7;
  --domain-partnership:       #C77E96;
  --domain-home:              #5FA8A2;
  --domain-self:              #C9A24B;

  /* Derived text tokens: each fill darkened until it clears 4.5:1 on --bg. */
  --domain-professional-ink:  #1C7C79;  /* 4.58:1 */
  --domain-family-ink:        #9A6446;  /* 4.50:1 */
  --domain-caregiving-ink:    #746B95;  /* 4.51:1 */
  --domain-partnership-ink:   #975F72;  /* 4.60:1 */
  --domain-home-ink:          #447874;  /* 4.61:1 */
  --domain-self-ink:          #866C32;  /* 4.59:1 */

  --measure: 34rem;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(22, 41, 63, .06), 0 8px 24px rgba(22, 41, 63, .06);

  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-text: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

:root[data-theme='dark'] {
  color-scheme: dark;

  --bg:            #14202F;
  --bg-raised:     #1B2A3C;
  --bg-sunken:     #101A26;
  --border:        #2B3B4F;
  --ink:           #E8EDF2;  /* 13.96:1 on --bg */
  --ink-soft:      #A8B4C2;  /*  7.81:1 on --bg */

  /* DARKER, not lighter: it must still hold white at 4.5:1 as a surface, and
   * clear 4.5:1 as text on the dark ground. Lightening both roles together is
   * the bug this split exists to prevent. */
  --accent:        #7FD4CF;  /* 9.57:1 on --bg */
  --brand-fill:    #0B4644;  /* 10.64:1 carrying white — unchanged across themes:
                              * it is a SURFACE, and a surface that lightens in
                              * dark mode stops holding white. */
  --brand-on-fill: #FFFFFF;

  --warn-fill:     #3A2F14;
  --warn-ink:      #F0D79B;

  /* In dark mode the brief's own hex IS the text token: all six clear 4.80:1
   * on --bg, so no second derived set is needed. */
  --domain-professional-ink:  #239A96;
  --domain-family-ink:        #D98E63;
  --domain-caregiving-ink:    #9B8FC7;
  --domain-partnership-ink:   #C77E96;
  --domain-home-ink:          #5FA8A2;
  --domain-self-ink:          #C9A24B;
}

/* ---------- reset and base ---------- */

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

/* An authored display: grid silently beats the user agent's [hidden] rule. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--font-text);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); letter-spacing: -.02em; margin: 0 0 .5em; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin: 2.5rem 0 .75rem; }
p  { max-width: var(--measure); }
a  { color: var(--accent); text-underline-offset: .18em; }

/* ---------- accessibility ---------- */

/* Defined ONCE, on a bare selector, so every interactive element inherits it.
 * A per-component ring is a ring that half the components lack. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute; left: -9999px;
  background: var(--bg-raised); color: var(--ink);
  padding: .75rem 1rem; z-index: 10; border-radius: var(--radius);
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ---------- layout ---------- */

.wrap { max-width: 62rem; margin: 0 auto; padding: 0 1.25rem; }
.narrow { max-width: 38rem; }

header.site {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1.25rem 0;
}
.wordmark {
  font-family: var(--font-display); font-size: 1.15rem; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink); text-decoration: none;
}
.wordmark span { color: var(--accent); }

.hero { padding: clamp(2.5rem, 8vw, 6rem) 0 clamp(2rem, 5vw, 4rem); }
.lede { font-size: 1.2rem; color: var(--ink-soft); max-width: var(--measure); }

/* ---------- controls ---------- */

.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .85rem 1.6rem; border: 0; border-radius: var(--radius);
  background: var(--brand-fill); color: var(--brand-on-fill);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { filter: brightness(1.12); }
.btn[disabled] { opacity: .55; cursor: not-allowed; filter: none; }
.btn--quiet {
  background: transparent; color: var(--accent);
  border: 1px solid var(--border);
}

label { display: block; font-weight: 600; margin: 1.25rem 0 .35rem; }
.hint { display: block; font-weight: 400; color: var(--ink-soft); font-size: .9rem; }
input, textarea {
  width: 100%; padding: .7rem .85rem; font: inherit;
  color: var(--ink); background: var(--bg-raised);
  border: 1px solid var(--border); border-radius: var(--radius);
}
textarea { min-height: 7rem; resize: vertical; }

.check { display: flex; gap: .65rem; align-items: flex-start; margin: 1.5rem 0; }
.check input { width: auto; margin-top: .3rem; }

/* ---------- surfaces ---------- */

.card {
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }

.notice {
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.15rem; margin: 1.5rem 0;
  max-width: var(--measure);
}
.notice--warn { background: var(--warn-fill); color: var(--warn-ink); border-color: transparent; }

.empty { color: var(--ink-soft); font-style: italic; }

/* ---------- the six domains ---------- */

.domain {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .85rem; font-weight: 600; color: var(--domain-ink, var(--ink-soft));
}
/* Decorative only. The label beside it always carries the meaning. */
.domain::before {
  content: ""; width: .6rem; height: .6rem; border-radius: 50%;
  background: var(--domain-fill, var(--ink-soft)); flex: none;
}
.domain[data-domain='professional'] { --domain-fill: var(--domain-professional); --domain-ink: var(--domain-professional-ink); }
.domain[data-domain='family']       { --domain-fill: var(--domain-family);       --domain-ink: var(--domain-family-ink); }
.domain[data-domain='caregiving']   { --domain-fill: var(--domain-caregiving);   --domain-ink: var(--domain-caregiving-ink); }
.domain[data-domain='partnership']  { --domain-fill: var(--domain-partnership);  --domain-ink: var(--domain-partnership-ink); }
.domain[data-domain='home']         { --domain-fill: var(--domain-home);         --domain-ink: var(--domain-home-ink); }
.domain[data-domain='self']         { --domain-fill: var(--domain-self);         --domain-ink: var(--domain-self-ink); }

/* ---------- motion ---------- */

.fade { transition: opacity .25s ease; }

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

footer.site {
  margin-top: 5rem; padding: 2rem 0 3rem;
  border-top: 1px solid var(--border); color: var(--ink-soft); font-size: .9rem;
}
