/* Module 07 — Attention. Only what styles.css does not already provide:
   the word chips that shade by weight, the ranked weight list, the grid
   heatmap, and the head strips. Everything sizes down to 390 px; only the
   grid scrolls, and it scrolls inside its own box. */

:root {
  /* the shared accent (#1d4ed8) as channels, so weight can drive the alpha */
  --att-accent-rgb: 29, 78, 216;
  --att-cell: 30px;
  --att-label: 88px;
}

/* ------------------------------------------------------------- sentence */

.att-sentence {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 6px;
}

.att-word {
  font: inherit;
  font-size: .98rem;
  font-weight: 600;
  line-height: 1.2;
  min-height: 44px;
  padding: 10px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: rgba(var(--att-accent-rgb), calc(var(--w, 0) * .92));
  color: var(--ink);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease;
}
.att-word.hot { color: #fff; border-color: var(--accent-dark); }
.att-word:hover { border-color: var(--accent); }
.att-word[aria-pressed="true"] {
  border: 2px solid var(--accent-dark);
  background: var(--surface);
  color: var(--accent-dark);
  padding: 9px 10px;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
/* the head strips are read-only: smaller, and not pretending to be buttons */
.att-word.static {
  cursor: default;
  min-height: 0;
  padding: 7px 9px;
  font-size: .93rem;
}
.att-word.static.marked {
  border: 2px solid var(--accent-dark);
  background: var(--surface);
  color: var(--accent-dark);
  padding: 6px 8px;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.att-word.punct { padding-left: 8px; padding-right: 8px; color: var(--ink-faint); }

/* words the selected one is not allowed to see yet — the causal mask, made
   visible on the sentence itself and not only in the grid */
.att-word.future {
  opacity: .48;
  border-style: dashed;
  color: var(--ink-faint);
}
.att-word[aria-pressed="true"].punct { color: var(--accent-dark); }

.att-caption {
  font-size: .84rem;
  color: var(--ink-faint);
  font-style: italic;
  margin: 2px 0 14px;
}

.att-teaches {
  font-size: .93rem;
  color: var(--ink-soft);
  margin: 10px 0 6px;
}
.att-teaches strong { color: var(--ink); }

/* ------------------------------------------------------- weights list */

.att-weights { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.att-wrow {
  display: grid;
  grid-template-columns: minmax(74px, 30%) 1fr 46px;
  align-items: center;
  gap: 9px;
  font-size: .92rem;
}
.att-wword { font-weight: 700; overflow-wrap: anywhere; }
.att-wword .self { font-weight: 500; color: var(--ink-faint); font-size: .82rem; }
.att-wtrack { height: 10px; border-radius: 999px; background: #e3e9f2; overflow: hidden; }
.att-wfill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .2s ease;
}
.att-wnum {
  font-family: var(--mono);
  font-size: .84rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}

.att-split {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
  margin-top: 16px;
}
@media (min-width: 860px) {
  .att-split { grid-template-columns: 1.15fr 1fr; align-items: start; }
}

.att-sub {
  font-size: .86rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 9px;
}

/* -------------------------------------------------------------- matrix */

.att-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 8px 8px 10px;
}

.att-grid {
  display: grid;
  grid-template-columns: var(--att-label) repeat(var(--n, 1), var(--att-cell));
  gap: 2px;
  width: max-content;
}

.att-corner { background: transparent; }

.att-colhead {
  writing-mode: vertical-rl;
  height: 80px;
  font-size: .72rem;
  font-weight: 700;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  justify-self: center;
}

.att-rowhead {
  font-size: .78rem;
  font-weight: 700;
  color: var(--ink-soft);
  height: var(--att-cell);
  line-height: var(--att-cell);
  padding-right: 8px;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  position: sticky;
  left: 0;
  background: var(--surface);
  z-index: 1;
}
.att-rowhead.on { color: var(--accent-dark); }

.att-cell {
  height: var(--att-cell);
  border-radius: 3px;
  background: rgba(var(--att-accent-rgb), calc(var(--w, 0) * .95));
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: .62rem;
  line-height: calc(var(--att-cell) - 2px);
  text-align: center;
  color: var(--accent-dark);
  cursor: pointer;
  overflow: hidden;
}
.att-cell.hot { color: #fff; }
.att-cell.on { outline: 2px solid var(--accent-dark); outline-offset: -2px; }
.att-cell.masked {
  cursor: default;
  color: transparent;
  border-style: dashed;
  border-color: var(--line);
  background:
    repeating-linear-gradient(135deg,
      var(--surface-alt) 0 3px,
      #eef2f8 3px 6px);
}
.att-cell.in-row { border-color: var(--accent-line); }

.att-readout {
  font-size: .9rem;
  color: var(--ink-soft);
  margin: 10px 0 0;
  min-height: 1.6em;
}
.att-readout strong { color: var(--ink); }

.att-legend {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  font-size: .82rem;
  color: var(--ink-faint);
  margin-top: 10px;
}
.att-swatches { display: flex; gap: 3px; }
.att-swatch {
  width: 22px; height: 12px; border-radius: 3px;
  border: 1px solid var(--line);
  background: rgba(var(--att-accent-rgb), calc(var(--w, 0) * .95));
}
.att-swatch.masked {
  background: repeating-linear-gradient(135deg, var(--surface-alt) 0 3px, #eef2f8 3px 6px);
  border-style: dashed;
}

/* --------------------------------------------------------------- heads */

.att-head { margin-bottom: 14px; }
.att-head-name {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}
.att-head-name h4 { margin: 0; font-size: 1rem; }
.att-head-what { font-size: .89rem; color: var(--ink-soft); margin: 0 0 8px; }
.att-head[hidden] { display: none; }

/* --------------------------------------------------------------- misc */

.att-pick { margin-bottom: 14px; }
.att-pick .chips { gap: 8px; }
.att-pick .chip { min-height: 44px; }

@media (min-width: 700px) {
  :root { --att-cell: 34px; --att-label: 104px; }
  .att-cell { font-size: .68rem; }
}

@media (prefers-reduced-motion: reduce) {
  .att-word, .att-wfill, .att-cell { transition: none; }
}
