/* ============================================================
   Table expand — full-screen pop-out for wide tables.

   Scan rollups (compliance, throughput) carry tables far wider than the
   Material content column, where horizontal scrolling makes them unreadable.
   assets/js/table-expand.js adds an "Expand" chip to any table that overflows
   and clones it into the overlay styled here. First step toward a full
   reading mode for long scan documents.
   ============================================================ */

.wu-table-host {
  position: relative;
}

.wu-table-expand {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--md-default-fg-color--lighter);
  border-radius: 0.6rem;
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color--light);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease, color 120ms ease, border-color 120ms ease;
}

/* Beats the `display` above, which would otherwise defeat the hidden attribute. */
.wu-table-expand[hidden] { display: none; }

.wu-table-host:hover .wu-table-expand,
.wu-table-expand:focus-visible {
  opacity: 1;
}

.wu-table-expand:hover,
.wu-table-expand:focus-visible {
  color: var(--md-accent-fg-color);
  border-color: var(--md-accent-fg-color);
}

/* Touch and keyboard users get no hover, so keep the affordance visible. */
@media (hover: none) {
  .wu-table-expand { opacity: 1; }
}

/* ---------- Overlay ---------- */

.wu-table-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  background: var(--md-default-bg-color);
}

.wu-table-overlay[hidden] { display: none; }

.wu-table-overlay__head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
}

.wu-table-overlay__title {
  margin: 0;
  font-family: var(--font-display), var(--md-text-font), system-ui, sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--md-default-fg-color);
}

.wu-table-overlay__hint {
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--md-default-fg-color--light);
}

.wu-table-overlay__close {
  margin-left: auto;
  padding: 0.25rem 0.7rem;
  border: 1px solid var(--md-default-fg-color--lighter);
  border-radius: 0.6rem;
  background: transparent;
  color: var(--md-default-fg-color--light);
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
}

.wu-table-overlay__close:hover,
.wu-table-overlay__close:focus-visible {
  color: var(--md-accent-fg-color);
  border-color: var(--md-accent-fg-color);
}

.wu-table-overlay__body {
  flex: 1;
  overflow: auto;
  padding: 1.2rem;
}

.wu-table-overlay__body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}

.wu-table-overlay__body th,
.wu-table-overlay__body td {
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
  text-align: left;
  vertical-align: top;
}

.wu-table-overlay__body thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--md-default-bg-color);
  border-bottom: 2px solid var(--md-default-fg-color--lighter);
  font-weight: 700;
  white-space: nowrap;
}

.wu-table-overlay__body tbody tr:hover {
  background: var(--md-accent-fg-color--transparent);
}

body.wu-table-open {
  overflow: hidden;
}

@media print {
  .wu-table-expand,
  .wu-table-overlay { display: none !important; }
}
