/**
 * Share / Export / Present format-picker (share/show) — transcribed from
 * docs/design-reference/extracted/modal-share.html.
 *
 * A 640px card (README.md §1, binding) inside the app's shared modal
 * <dialog> (see application.html.erb's `<dialog data-controller="dialog">`).
 * The formats are full-width cards stacked with a 0.45rem rhythm; the chosen
 * one fills teal with a 2px rule. Scope is a row of chips under a hairline.
 * The footer is the tray footer: actions left, the workbook download pushed
 * to the far end.
 *
 * Literal pixel type from the capture is written calc(Npx * var(--text-scale)),
 * the convention modules/hub.css established.
 */

/* The shared <dialog> backdrop is dimmer and blurred for the interview shell;
   this modal takes the reference's plain 50% scrim. */
dialog:has(.share-modal)::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: none;
}

.share-modal {
  width: min(640px, 100%);
  max-height: 90vh;
  margin: 0 auto;
  overflow-y: auto;
  background: var(--bg-primary);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.share-modal-body { padding: 1.5rem 1.75rem 1.25rem; }

/* ── Header ─────────────────────────────────────────────────── */

.share-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.share-modal-eyebrow {
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: var(--tracking-eyebrow, 0.12em);
  font-size: calc(0.8rem + var(--text-bump));
  color: var(--teal-ink);
  font-weight: 400;
  margin: 0 0 2px;
}

.share-modal-header h2 {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: calc(23px * var(--text-scale));
  color: var(--navy-primary);
  margin: 0;
}

.share-modal-close {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: calc(15px * var(--text-scale));
  line-height: 1;
  text-decoration: none;
}

.share-modal-close:hover { color: var(--navy-primary); }

/* ── Formats ────────────────────────────────────────────────── */

.share-format-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.share-format-card {
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  text-align: left;
  padding: 0.8rem 1rem;
  cursor: pointer;
  font-family: var(--font-body);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 0;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.share-format-card:hover { border-color: var(--teal-accent); }

/* The chosen format keeps a 2px rule, so the row height doesn't jump when
   selection moves (the reference's cards are 1px otherwise). */
.share-format-card.is-selected {
  background: var(--teal-light);
  border: 2px solid var(--teal-accent);
  padding: calc(0.8rem - 1px) calc(1rem - 1px);
}

.share-format-icon {
  flex-shrink: 0;
  margin-top: 2px;
  font-size: calc(17px * var(--text-scale));
  color: var(--text-secondary);
}

.share-format-card.is-selected .share-format-icon { color: var(--teal-ink); }

.share-format-text { min-width: 0; }

.share-format-label {
  display: block;
  font-family: var(--font-heading);
  font-size: calc(16px * var(--text-scale));
  font-weight: 500;
  color: var(--navy-primary);
}

.share-format-description {
  display: block;
  font-size: calc(13.5px * var(--text-scale));
  line-height: 1.5;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── How much of it ─────────────────────────────────────────── */

.share-scope {
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border-light);
}

.share-scope-label {
  display: block;
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: calc(10.5px * var(--text-scale));
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}

.share-scope-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* The radio stays in the DOM (the picker controller reads :checked) but the
   chip beside it is the hit target and the whole visual. */
.share-scope-option { margin: 0; }

.share-scope-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.share-scope-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border-light);
  border-radius: 5px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: calc(13px * var(--text-scale));
  cursor: pointer;
  transition: all var(--transition-fast);
}

.share-scope-option input:checked + .share-scope-chip {
  border-color: var(--teal-accent);
  background: var(--teal-light);
  color: var(--teal-ink);
}

/* ── Footer ─────────────────────────────────────────────────── */

.share-modal-footer {
  padding: 1.1rem 1.75rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.share-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

/* The footer's actions run larger than a tray button, per the reference. */
.share-action-btn {
  padding: 0.75rem 1.5rem;
  font-size: calc(14px + var(--text-bump));
}

/* Pushed to the far end, and stays there on the second line when the
   actions and the link together outrun the card. */
.share-download-link {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: none;
  background: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--font-body);
  font-size: calc(12.5px * var(--text-scale));
  color: var(--text-secondary);
  text-decoration: none;
}

.share-download-link:hover { color: var(--teal-ink); }
