:root {
  /* Brand: see ../latincy-project/docs/brand.md for canonical color +
     typeface values. --accent is the Primary stop; #1d70c7 = 5.0:1 on
     white (WCAG AA). Lexend is the LatinCy typeface across all
     surfaces (replaced spaCy-aligned typeface in the 2026-05-01 reset). */
  font-family: "Lexend", -apple-system, system-ui, sans-serif;
  --accent: #1d70c7;
  --accent-text: #fff;
}
body { max-width: 60rem; margin: 2rem auto; padding: 0 1rem; line-height: 1.5; }

.visually-hidden {
  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;
  top: -40px;
  left: 0.5rem;
  background: var(--accent);
  color: var(--accent-text);
  padding: 0.4rem 0.75rem;
  border-radius: 0 0 4px 4px;
  z-index: 100;
  text-decoration: none;
}
.skip-link:focus { top: 0; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
header { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid #ccc; padding-bottom: 0.5rem; }
.brand {
  text-decoration: none;
  color: var(--accent);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand .brand-lexicon { color: #000; }
table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
th, td { text-align: left; padding: 0.3rem 0.5rem; border-bottom: 1px solid #eee; }
th { background: #fafafa; }
footer { margin-top: 4rem; color: #666; }
.lede { font-size: 1.05rem; margin: 1.5rem 0; }
form.lookup { display: flex; gap: 0.5rem; margin: 1.5rem 0; }
form.lookup input[type="text"] {
  flex: 1;
  padding: 0.75rem 1rem;
  font: inherit;
  font-size: 1.15rem;
  border: 1px solid #767676;  /* 4.5:1 on white — passes WCAG 1.4.11 */
  border-radius: 4px;
}
form.lookup button {
  padding: 0.75rem 1.25rem;
  font-size: 1.05rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
form.lookup button:hover { opacity: 0.9; }
.expand-btn {
  background: transparent;
  border: 1px solid #767676;  /* non-text contrast 4.5:1 */
  border-radius: 3px;
  padding: 0.25rem 0.6rem;
  font: inherit;
  font-size: 1rem;
  color: #666;
  cursor: pointer;
  min-width: 2rem;
  min-height: 24px;  /* WCAG 2.5.8 AA touch-target floor */
}
.expand-btn:hover { background: #f5f5f5; color: var(--accent); }
.expand-btn[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
.entry {
  border: 2px solid #767676;  /* non-text 4.5:1 */
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  color: #6b6b6b;  /* 5:1 — readable while still visibly de-emphasized */
}
.entry--top-sense {
  border-color: var(--accent);
  color: inherit;
}
.pos-match-badge {
  margin-left: 0.3rem;
  color: var(--accent);
  font-weight: 600;
}
.paradigm-count { color: #888; margin-bottom: 1.5rem; }
.paradigm-query-note {
  color: #555;
  margin: -0.4rem 0 0.8rem 0;
  font-size: 0.95rem;
}
.paradigm-query-form { font-style: italic; }
.paradigm-query-gloss { color: #555; font-style: italic; font-size: 0.95rem; }
.paradigm-table td.paradigm-hit {
  border: 2px solid var(--accent);
  border-radius: 6px;
}
.paradigm-table td.paradigm-hit mark {
  background: transparent;
  font-weight: 600;
  color: inherit;
}
.paradigm-gloss { color: #555; font-style: italic; margin-top: -0.4rem; }
.paradigm-table {
  width: auto;
  min-width: 28rem;
  margin: 0.4rem 0 1.25rem 0;
  font-size: 0.95rem;
}
.paradigm-table th,
.paradigm-table td {
  text-align: left;
  padding: 0.3rem 0.7rem;
  border-bottom: 1px solid #eee;
  vertical-align: top;
}
.paradigm-table thead th {
  background: #fafafa;
  font-weight: 600;
  color: #555;
  font-size: 0.85rem;
  text-transform: none;
}
.paradigm-table tbody th {
  background: #fafafa;
  font-weight: 500;
  color: #444;
  white-space: nowrap;
}
.paradigm-list th {
  width: 12rem;
  font-weight: 500;
  color: #555;
}
.paradigm-alternates {
  margin: 1.5rem 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fafafa;
}
.paradigm-alternates summary { cursor: pointer; color: #555; }
.paradigm-alternates ul {
  margin: 0.5rem 0 0 0;
  padding-left: 1.5rem;
  columns: 2;
  font-size: 0.9rem;
}
.flag-btn {
  background: transparent;
  border: 1px solid transparent;
  padding: 0.25rem 0.6rem;  /* meet 24px touch target */
  cursor: pointer;
  color: #6b6b6b;  /* 5:1 on white */
  font: inherit;
  font-size: 1rem;
  vertical-align: middle;
  min-height: 24px;
}
.flag-btn:hover { color: var(--accent); }
.flag-btn[aria-expanded="true"] { color: var(--accent); }
.flag-panel {
  display: block;
  margin: 0.5rem 0 0.75rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fafafa;
  font-size: 0.9rem;
}
.flag-panel label {
  display: block;
  margin-bottom: 0.5rem;
}
.flag-panel select,
.flag-panel textarea {
  display: block;
  width: 100%;
  max-width: 28rem;
  padding: 0.3rem 0.4rem;
  margin-top: 0.2rem;
  font: inherit;
  font-size: 0.9rem;
  border: 1px solid #bbb;
  border-radius: 3px;
}
.flag-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.flag-submit {
  padding: 0.3rem 0.75rem;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
}
.flag-submit:hover { opacity: 0.9; }
.flag-cancel {
  padding: 0.3rem 0.75rem;
  background: transparent;
  color: #666;
  border: 1px solid #bbb;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
}
.flag-status { color: #666; font-size: 0.85rem; }
.flag-thanks { margin: 0; color: #555; font-size: 0.9rem; }
.notice {
  background: #fff8e6;
  border-left: 3px solid #d9a441;
  padding: 0.5rem 0.75rem;
  margin: 1rem 0;
  font-size: 0.95rem;
}

.paradigm-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0.4rem 0 1.25rem 0;
}
.paradigm-scroll > .paradigm-table { margin: 0; }

@media (max-width: 640px) {
  body { margin: 1rem auto; }
  h1 { font-size: 1.6rem; }

  /* Sentence table → stacked cards. Each <tr> becomes a card; each <td>
     gets its column header inlined via data-label. The expand-row and any
     injected flag-panel-row span full width without a label. */
  .sentence-table,
  .sentence-table tbody,
  .sentence-table tr,
  .sentence-table td {
    display: block;
    width: 100%;
  }
  .sentence-table thead { display: none; }
  .sentence-table tr {
    border: 1px solid #e3e3e3;
    border-radius: 6px;
    margin: 0.6rem 0;
    padding: 0.5rem 0.75rem;
  }
  .sentence-table tr.expand-row,
  .sentence-table tr.flag-panel-row {
    border: none;
    padding: 0;
    margin: 0;
  }
  .sentence-table td {
    border: none;
    padding: 0.2rem 0;
  }
  .sentence-table td[data-label]::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 5.5rem;
    color: #666;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .sentence-table td.row-actions {
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }
  .sentence-table tr.expand-row td:empty { display: none; }

  /* Paradigm tables: keep the grid intact but allow horizontal pan, with
     the row-label column pinned so callers can read across. */
  .paradigm-table { min-width: 0; }
  .paradigm-scroll .paradigm-table tbody th,
  .paradigm-scroll .paradigm-table thead th:first-child {
    position: sticky;
    left: 0;
    background: #fafafa;
    z-index: 1;
  }
}
