/* GDPR Engineering Playbook — Bulma theme + design tokens + a few custom bits.
   Bulma does the heavy lifting. This sets the brand colour, keeps the legacy
   design tokens that the flow/tool styles still reference, and styles the
   handful of things Bulma has no component for. */

:root {
  /* lift Bulma's "small" from 12px to 14px: the playbook's body text
     (every `content is-small` block) rides on this token */
  --bulma-size-small: .875rem;

  /* brand blue #027AC2 as Bulma's primary + link */
  --bulma-primary-h: 201deg;
  --bulma-primary-s: 98%;
  --bulma-primary-l: 38%;
  --bulma-link-h: 201deg;
  --bulma-link-s: 98%;
  --bulma-link-l: 38%;
  /* ProductDock "Important Red" #EA592A as Bulma's danger (the Art. 9 chip) */
  --bulma-danger-h: 15deg;
  --bulma-danger-s: 81%;
  --bulma-danger-l: 54%;

  /* legacy design tokens used by flows.css and tools.css */
  --white: #ffffff;
  --ink: #0a0c0e;
  --muted: rgba(10, 12, 14, .62);
  --faint: rgba(10, 12, 14, .45);
  --brand: #027ac2;
  --brand-d: #02639e;
  --red: #ea592a;
  --red-d: #c8461c;
  --emissive: #eef9ff;
  --lightred: #fff4f0;
  --beige: #fff7e7;
  --metal: #eff9f6;
  --gray: #f1f5f8;
  --line: #e2e8f0;
  --card: #ffffff;
  --tint: var(--emissive);

  /* accent family: saturated forms of the pale tints (see .matrix lanes) */
  --gold: #9a7b1e;
  --teal: #2a9d8f;
  --slate: #64748b;
  /* supporting roles */
  --label: #6b7783;        /* mini-heading / reference text */
  --panel: #f7fafc;        /* collapsible + reference panel fill */
  --ok-line: #b7e3d4;      /* "in the clear" verdict border */
  --warn-line: #f3c9b9;    /* "you're in scope" verdict border */
  --on-accent: #ffffff;    /* text on filled accent buttons, both themes */
}

/* dark theme: same ProductDock hues, flipped values. Bulma handles its own
   components via prefers-color-scheme; this flips our token layer to match.
   Accents are lightened so they keep contrast on dark surfaces. */
@media (prefers-color-scheme: dark) {
  :root {
    --bulma-link-l: 60%;   /* 38%-lightness links vanish on dark */
    --white: #14181d;      /* "white" is the card surface, not literal white */
    --ink: #e7ecf1;
    --muted: rgba(231, 236, 241, .64);
    --faint: rgba(231, 236, 241, .45);
    --brand: #3aa5e6;
    --brand-d: #6fc0ef;
    --red: #f0764e;
    --red-d: #f5967a;
    --emissive: #10222f;
    --lightred: #291712;
    --beige: #262013;
    --metal: #13241f;
    --gray: #1a2027;
    --line: #2c343e;
    --card: #14181d;
    --gold: #c9ab52;
    --teal: #43bfae;
    --slate: #97a8ba;
    --label: #94a2af;
    --panel: #1a2027;
    --ok-line: #2f5c4e;
    --warn-line: #5e3527;
  }

  /* Bulma paints these literally and never flips them */
  .has-text-dark { color: var(--ink) !important; }
  .tag.is-danger.is-light {
    background-color: var(--lightred);
    color: var(--red);
  }
  .button.is-link.is-light {
    background-color: var(--emissive);
    color: var(--brand);
  }
  .button.is-link.is-light:hover {
    background-color: color-mix(in srgb, var(--brand) 14%, var(--white));
    color: var(--brand);
  }
  .button.is-warning.is-light {
    background-color: var(--beige);
    color: var(--gold);
  }
  .button.is-warning.is-light:hover {
    background-color: color-mix(in srgb, var(--gold) 14%, var(--white));
    color: var(--gold);
  }
  .notification.is-light:not(.is-primary) {
    background-color: var(--gray);
    color: var(--ink);
  }
  .notification.is-info.is-light {
    background-color: var(--emissive);
    color: var(--ink);
  }
}

.container { max-width: 1080px; }

/* hero: gradient + rounded card + soft corner glow, instead of a flat rectangle */
/* hero: a light "soft card" — gentle accent gradient + a corner glow, a slim
   accent edge, and a big faint watermark — richer than plain text but lighter
   than a solid coloured block */
.hero.is-primary {
  position: relative;
  overflow: hidden;
  color: var(--ink);
  background-color: var(--white);
  background-image:
    radial-gradient(130% 130% at 100% 0%, color-mix(in srgb, var(--accent, var(--brand)) 16%, transparent) 0%, transparent 55%),
    linear-gradient(135deg, color-mix(in srgb, var(--accent, var(--brand)) 7%, var(--white)) 0%, var(--white) 62%);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 6px 24px -10px rgba(10, 12, 14, .15);
}
.hero.is-primary .hero-body { position: relative; z-index: 1; padding: 1.6rem 1.9rem; }
.hero.is-primary .title { color: var(--ink); }
.hero.is-primary .subtitle { color: var(--muted); max-width: 62ch; }
/* eyebrow: an accent kicker preceded by a short accent dash */
.hero.is-primary .hero-body > p:first-child {
  display: inline-flex;
  align-items: center;
  gap: .55em;
  color: var(--accent, var(--brand));
}
.hero.is-primary .hero-body > p:first-child::before {
  content: "";
  width: 26px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent, var(--brand));
}
/* big faint watermark (the part number) bleeding off the corner */
.hero.is-primary::after {
  content: var(--hero-mark, "");
  position: absolute;
  right: 1.4rem;
  bottom: -1.6rem;
  font-size: 8rem;
  font-weight: 800;
  line-height: 1;
  color: var(--line);
  color: color-mix(in srgb, var(--accent, var(--brand)) 14%, transparent);
  pointer-events: none;
  user-select: none;
  z-index: 0;
}
/* the index ribbon pills stay visible on the light header */
.hero .tags .tag.is-white {
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--ink);
}

/* brand elements take the page's accent (a part page sets --accent on <body>;
   pages without it fall back to ProductDock blue) */
.tag.is-primary {
  background-color: var(--accent, var(--brand));
  border-color: var(--accent, var(--brand));
}
/* the "The rule" callout sits on the part's pale tint */
.notification.is-primary.is-light {
  background-color: var(--lane-tint, var(--emissive));
  color: var(--ink);
}
/* top-bar tabs: the active part takes the page accent, not always blue */
.tabs.is-toggle li.is-active a {
  background-color: var(--accent, var(--brand));
  border-color: var(--accent, var(--brand));
}

/* per-part tint + matching accent, keyed to each navigator lane. Tints are the
   ProductDock pale palette; the accent is each tint's saturated form (blue and
   red are PD-exact; gold/teal/slate are the saturated form of beige/metal/gray). */
.matrix .lane:nth-of-type(1) { --lane-tint: var(--emissive); --accent: var(--brand); }
.matrix .lane:nth-of-type(2) { --lane-tint: var(--beige);    --accent: var(--gold); }
.matrix .lane:nth-of-type(3) { --lane-tint: var(--metal);    --accent: var(--teal); }
.matrix .lane:nth-of-type(4) { --lane-tint: var(--gray);     --accent: var(--slate); }
.matrix .lane:nth-of-type(5) { --lane-tint: var(--lightred); --accent: var(--red); }

/* navigator lane: each part is a softly tinted zone, so the sections read as
   distinct without off-brand colours; white cards sit on the tint */
.lane {
  background: var(--lane-tint, var(--gray));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.1rem 1.25rem 1.25rem;
}
.lane > .level {
  margin-bottom: 1rem !important;
  padding-bottom: .55rem;
}
.lane > .level strong { font-size: 1.1rem; }
.lane > .level .tag.is-primary {
  border-radius: 999px;
  width: 1.85rem;
  height: 1.85rem;
  font-weight: 700;
  font-size: .9rem;
  background-color: var(--accent, var(--brand));
  border-color: var(--accent, var(--brand));
}
.lane .lc { font-variant-numeric: tabular-nums; }

/* concept tiles land cleanly when you arrive via an anchor from the navigator */
.concept { scroll-margin-top: 1rem; }

/* small uppercase mini-headings ("Why we care", "Key patterns", ...) */
.minihead {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .72rem;
  font-weight: 800;
  color: var(--label);
  margin-bottom: .4rem;
}

/* gotchas: red bullet markers */
.gotchas ul { list-style: none; margin-left: 0; }
.gotchas li { position: relative; padding-left: 1.25em; }
.gotchas li::before {
  content: "";
  position: absolute;
  left: .2em;
  top: .55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red);
}

/* native collapsibles (references, cloud notes) */
details.collapse {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .55rem .85rem;
}
details summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "▸ "; color: var(--accent, var(--brand)); font-weight: 800; }
details[open] summary::before { content: "▾ "; }
details[open] summary { margin-bottom: .5rem; }

/* references: a clear pill toggle that opens into a tidy panel */
.refs > summary {
  display: inline-flex;
  align-items: center;
  gap: .35em;
  width: max-content;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--label);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .2rem .7rem;
  transition: color .12s, border-color .12s;
}
.refs > summary:hover {
  color: var(--accent, var(--brand));
  border-color: var(--accent, var(--brand));
}
.refs[open] > summary { margin-bottom: .55rem; }
.refs > p {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .6rem .85rem;
  font-size: .78rem;
  line-height: 1.7;
  color: var(--label);
}
.refs > p a { color: var(--accent, var(--brand)); font-weight: 600; }

/* the role-chain diagram in 1.3 */
.rolechain .tag { width: 100%; }
.rolechain .arrow { color: var(--brand); font-weight: 800; font-size: 1.3rem; }

/* ---- "how to use" legend (index.html): three steps that double as the key to
   the deep-dive / tool badge icons on the cards ---- */
.howto {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
}
.howto-step {
  flex: 1 1 220px;
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .7rem .9rem;
}
.howto-ico {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--brand) 10%, var(--white));
  color: var(--brand);
  font-size: 1.05rem;
  line-height: 1;
}
/* glyph fills the flex centre; drop bootstrap-icons' baseline offset */
.howto-ico .bi { display: block; line-height: 1; }
.howto-ico .bi::before { display: block; vertical-align: 0; }
.howto-step div strong { display: block; font-size: .92rem; line-height: 1.25; }
.howto-step div span { display: block; font-size: .78rem; color: var(--muted); }

/* ---- navigator (index.html): filter states driven by navigator.js ---- */
.cell.is-off { display: none; }
.lane.is-empty { display: none; }
.nav-empty { display: none; }
.nav-empty.show { display: block; }
.fchip[aria-pressed="true"],
.toggle[aria-pressed="true"] { background-color: var(--brand); border-color: var(--brand); color: var(--on-accent); }
.cell .box {
  height: 100%;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: none;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.cell .box:hover {
  border-color: var(--accent, var(--brand));
  box-shadow: 0 8px 20px rgba(10, 12, 14, .12);
  transform: translateY(-2px);
}
/* card number: a small accent-coloured index, not a filled badge */
.cell .box > .tag.is-primary {
  background-color: transparent;
  color: var(--accent, var(--brand));
  padding: 0 !important;
  height: auto;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .03em;
}
.cell .cell-main p { margin-top: .2rem !important; }

/* Bootstrap Icons: baseline alignment, heading spacing, semantic gotcha colour */
.bi { vertical-align: -.125em; }
.minihead .bi { margin-right: .15em; }
.minihead .bi-x-circle { color: var(--red); }
.badges { position: absolute; top: .55rem; right: .55rem; display: inline-flex; gap: .25rem; }
.badges .b {
  display: inline-grid; place-items: center; width: 1.45rem; height: 1.45rem;
  border: 1px solid var(--line); border-radius: 6px; background: var(--white);
  color: var(--brand); font-size: .8rem; line-height: 1; text-decoration: none;
}
.badges .b:hover { border-color: var(--brand); }
