/*
 * licences.css — Licences view: a card per licence with its grade path
 *                chart, the steps in path order and their edit controls.
 *
 * @copyright  2026 Karl Dyson
 * @license    Apache-2.0
 * @version    1.11.0
 */

#view-licences {
  --lic-line: var(--color-primary);
  --lic-grid: #eceef2;

  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.lic-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}
.lic-page-head h2 { margin-bottom: 0; }
.lic-back { font-size: 0.85rem; display: inline-block; margin-bottom: 0.25rem; }
.lic-intro { color: var(--color-text-muted); font-size: 0.9rem; margin: 0; }
.lic-empty { color: var(--color-text-muted); }

/* ---------------------------------------------------------------------------
   Cards
   --------------------------------------------------------------------------- */

.lic-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1rem 1.15rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
}
.lic-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
}
.lic-card-head h3 { font-size: 1rem; }
.lic-current { font-weight: 600; }
.lic-ended { color: var(--color-text-muted); }

/* ---------------------------------------------------------------------------
   Path chart
   --------------------------------------------------------------------------- */

.lic-chart { width: 100%; }
.lic-svg { width: 100%; height: auto; display: block; }
.lic-grid { stroke: var(--lic-grid); stroke-width: 1; }
.lic-grid-v { stroke-dasharray: 2 4; }
.lic-axis { font-size: 12px; fill: var(--color-text-muted); }
.lic-axis-muted { font-style: italic; }
.lic-line { stroke: var(--lic-line); stroke-width: 2; fill: none; }
.lic-line-ended { stroke: var(--color-text-muted); }
.lic-unsure { stroke-dasharray: 5 4; opacity: 0.75; }
.lic-lead { opacity: 0.45; }
.lic-hit { fill: transparent; cursor: pointer; }
.lic-dot { fill: var(--lic-line); stroke: var(--color-surface); stroke-width: 2; pointer-events: none; }
.lic-dot-unsure { fill: var(--color-surface); stroke: var(--lic-line); }
.lic-marker-hl .lic-dot { stroke: var(--color-text); stroke-width: 2.5; }

/* ---------------------------------------------------------------------------
   Steps
   --------------------------------------------------------------------------- */

.lic-path { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }

.lic-step {
  display: grid;
  /* Fixed tools column: rows are separate grids, so it must not vary with
     which buttons a row has, or the columns stop lining up */
  grid-template-columns: 1.5rem minmax(7rem, 1fr) minmax(7rem, 0.8fr) minmax(10rem, 1.3fr) 15rem;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.4rem;
  border-radius: 4px;
}
.lic-step:has(.lic-form) { display: block; }
.lic-step.lic-hl { background: #e8f1fd; }
.lic-n { color: var(--color-text-muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.lic-grade { font-weight: 600; }
.lic-date { font-variant-numeric: tabular-nums; }
.lic-unknown { color: var(--color-text-muted); font-style: italic; }
.lic-change { color: var(--color-text-muted); font-size: 0.85rem; }
.lic-tools { display: inline-flex; gap: 0.15rem; justify-content: flex-end; }
.lic-tools .btn { padding: 0.1rem 0.45rem; }

/* "insert a step here" slots between steps: quiet until hovered */
.lic-slot { padding-left: 2rem; line-height: 1; }
.lic-slot-btn {
  font: inherit;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  background: none;
  border: none;
  padding: 0.15rem 0.3rem;
  cursor: pointer;
  opacity: 0.55;
}
.lic-slot-btn:hover,
.lic-slot-btn:focus-visible { opacity: 1; color: var(--color-primary); }
.lic-slot-open { padding: 0.3rem 0 0.3rem 2rem; }

.lic-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem;
  background: var(--color-bg);
  border-radius: var(--radius);
}
.lic-form select,
.lic-form input { font-size: 0.9rem; }
.lic-f-hint { font-size: 0.78rem; color: var(--color-text-muted); }

.lic-end { padding-top: 0.15rem; }

@media (max-width: 640px) {
  .lic-step { grid-template-columns: 1.5rem 1fr auto; }
  .lic-step .lic-date,
  .lic-step .lic-change { grid-column: 2; }
  .lic-tools { grid-column: 3; grid-row: 1; }
}
