/* Visual system matched to Will's "AI in Practice" in-service deck (Q4 2026). */
:root {
  /* Ground and ink */
  --bg: #F4F4F4;
  --ink: #344E5E;        /* titles, body, labels (8:1 on bg) */
  --ink-deep: #22343F;   /* text on mid-tone fills */
  --muted: #52616C;      /* secondary text (5.8:1 on bg) */
  --rule: #C9CED2;
  --axis-blue: #3D73A0;  /* axis names; deck's #7FB0D8 deepened for contrast */
  --axis-light: #D3D8DC;

  /* Grid fills, sampled from the deck */
  --red: #C33E3F;
  --amber-1: #FBF0DE;
  --amber-2: #FBE8C0;
  --amber-3: #FDD58D;
  --amber-4: #FBC34C;
  --amber-5: #FBAB18;
  --peach: #FAC593;
  --white: #FBFBFB;
  --blue-1: #CDDDED;
  --blue-2: #8EB4D9;

  /* Type */
  --serif: "Libre Baskerville", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Segoe UI", system-ui, sans-serif;

  /* Spacing */
  --space-1: 6px;
  --space-2: 12px;
  --space-3: 24px;
  --space-4: 40px;
  --space-5: 72px;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 18px;
  line-height: 1.55;
}

main {
  max-width: 60rem;
  margin: 0 auto;
  padding: var(--space-4) 16px var(--space-5);
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  margin: 0;
}

p { margin: 0 0 var(--space-2); max-width: 65ch; }
p:last-child { margin-bottom: 0; }

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Header: centred title with an italic serif subtitle, as on the deck's title slides */
main > header {
  text-align: center;
  margin-bottom: var(--space-4);
}
main > header h1 {
  font-size: clamp(1.75rem, 5vw, 3rem);
  line-height: 1.15;
}
main > header p {
  margin: var(--space-2) auto 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--ink);
}

/* Grid: row labels | engagement arrow | three cells; then discernment arrow and column labels */
.grid {
  display: grid;
  grid-template-columns: auto 22px repeat(3, minmax(0, 1fr));
  gap: var(--space-1);
  max-width: 46rem;
  margin: 0 auto;
}

.row-head, .col-head {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 13px;
  line-height: 1.2;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}
.row-head {
  grid-column: 1;
  display: flex;
  align-items: center;
  padding-right: var(--space-2);
}
.axis-x + .col-head { grid-column: 3; }
.col-head { text-align: center; padding-top: var(--space-1); }

/* Axis arrows: light-to-slate gradient shafts with the axis name set on them */
.axis { position: relative; color: var(--axis-blue); }
.axis span {
  position: relative;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.axis::before { content: ""; position: absolute; }

.axis-y {
  grid-column: 2;
  grid-row: 1 / 5;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding-bottom: var(--space-1);
}
.axis-y::before {
  inset: 0 3px;
  background: linear-gradient(to top, var(--bg), var(--axis-light) 25%, var(--ink));
  clip-path: polygon(50% 0, 100% 22px, 100% 100%, 0 100%, 0 22px);
}
.axis-y span { writing-mode: vertical-rl; transform: rotate(180deg); }

.axis-x {
  grid-column: 2 / 6;
  height: 22px;
  display: flex;
  align-items: center;
  padding-left: var(--space-2);
  margin-top: var(--space-1);
}
.axis-x::before {
  inset: 3px 0;
  background: linear-gradient(to right, var(--bg), var(--axis-light) 25%, var(--ink));
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 50%, calc(100% - 22px) 100%, 0 100%);
}

/* Cell fills, matched to the deck. --on is the text colour on that fill. */
[data-cell="4A"] { --fill: var(--red);     --on: #FFFFFF; }
[data-cell="4B"] { --fill: var(--amber-4); }
[data-cell="4C"] { --fill: var(--amber-5); }
[data-cell="3A"] { --fill: var(--peach); }
[data-cell="3B"] { --fill: var(--amber-3); }
[data-cell="3C"] { --fill: var(--amber-4); }
[data-cell="2A"] { --fill: var(--amber-1); }
[data-cell="2B"] { --fill: var(--amber-2); }
[data-cell="2C"] { --fill: var(--amber-3); }
[data-cell="1A"] { --fill: var(--white); }
[data-cell="1B"] { --fill: var(--blue-1); }
[data-cell="1C"] { --fill: var(--blue-2);  --on: var(--ink-deep); }

.cell {
  aspect-ratio: 8 / 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: var(--space-1);
  border: 0;
  border-radius: 0;
  background: var(--fill);
  color: var(--on, var(--ink));
  font-family: var(--serif);
  cursor: pointer;
  transition: filter 120ms ease, box-shadow 120ms ease;
}
.cell:hover { filter: brightness(0.96); }
.cell-key {
  font-weight: 700;
  font-size: clamp(1.25rem, 3.5vw, 2rem);
  line-height: 1;
}
.cell-name {
  font-style: italic;
  font-size: clamp(0.625rem, 1.4vw, 0.8125rem);
  line-height: 1.2;
  text-align: center;
}

/* Selected cell: inset ring in the cell's own text colour */
.cell[aria-expanded="true"] {
  box-shadow: inset 0 0 0 4px var(--on, var(--ink));
}

/* Detail panel: laid out like the deck's "Named Corners" slides */
#cell-detail:not([hidden]) {
  display: grid;
  grid-template-columns: minmax(9rem, 16rem) 1fr;
  gap: var(--space-4);
  align-items: center;
  max-width: 46rem;
  margin: var(--space-4) auto 0;
  padding-top: var(--space-4);
  border-top: 1px solid var(--rule);
}
.swatch {
  aspect-ratio: 8 / 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-2);
  background: var(--fill);
  color: var(--on, var(--ink));
  font-family: var(--serif);
  text-align: center;
}
.swatch-key { font-weight: 700; font-size: clamp(2rem, 6vw, 3.25rem); line-height: 1; }
.swatch-name { font-style: italic; font-size: clamp(0.875rem, 2vw, 1.125rem); }

.detail-axes {
  margin-bottom: var(--space-1);
  font-family: var(--serif);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
#cell-detail h3 {
  font-size: clamp(1.375rem, 3vw, 1.75rem);
  line-height: 1.25;
  margin-bottom: var(--space-2);
}
#cell-detail .flag-note {
  font-weight: 700;
  font-style: italic;
}

@media (max-width: 36rem) {
  .grid { grid-template-columns: auto 16px repeat(3, minmax(0, 1fr)); gap: 4px; }
  .row-head, .col-head { font-size: 10px; letter-spacing: 0.06em; }
  .row-head { padding-right: 4px; }
  .axis span { font-size: 10px; letter-spacing: 0.12em; }
  .axis-y::before { inset: 0 1px; }
  .cell { aspect-ratio: 1 / 1; }
  #cell-detail:not([hidden]) { grid-template-columns: 1fr; gap: var(--space-3); }
  .swatch { max-width: 9rem; }
  .swatch-key { font-size: 1.75rem; }
  .swatch-name { font-size: 0.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
