/* Scripture Memory Cards: layout layered on shared VerseTools primitives. */

#scripture-memory-cards {
  width: min(100% - 2rem, 68rem);
}

#scripture-memory-cards .header-link {
  display: none;
}

.memory-cards-header {
  display: grid;
}

.memory-cards-companion {
  margin: 0.85rem 0 0;
  color: var(--vt-muted);
  font: 700 0.86rem/1.4 var(--vt-sans);
}

.memory-cards-companion a {
  color: var(--vt-primary);
}

.memory-cards-controls {
  display: grid;
  gap: 1rem;
}

.memory-cards-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

#scripture-memory-cards .memory-cards-controls > .vt-section-heading {
  margin: 0;
  color: var(--vt-muted);
  font: 700 0.8rem/1.2 var(--vt-sans);
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.memory-cards-references textarea {
  min-height: 8.5rem;
  font-family: var(--vt-serif);
  line-height: 1.45;
}

.memory-cards-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

#scripture-memory-cards .vt-field > .vt-hint {
  color: var(--vt-muted);
  font: 400 0.84rem/1.45 var(--vt-sans);
}

#scripture-memory-cards .memory-cards-option-grid select {
  font-size: max(0.82rem, 16px);
}

.memory-cards-fieldset,
.memory-cards-metadata {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.memory-cards-fieldset {
  display: grid;
  align-content: start;
  gap: 0.45rem;
}

.memory-cards-fieldset legend {
  margin-bottom: 0.35rem;
  padding: 0;
}

.memory-cards-metadata {
  display: grid;
  gap: 0.85rem;
}

.memory-cards-metadata small {
  font-size: inherit;
  font-weight: 400;
}

.memory-cards-downloads {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

#scripture-memory-cards h2,
#scripture-memory-cards h3 {
  padding: 0;
  border: 0;
  color: var(--vt-primary);
  font-family: var(--vt-serif);
}

#scripture-memory-cards h2 {
  margin: 0 0 0.65rem;
  font-size: clamp(1.4rem, 4vw, 1.85rem);
}

#scripture-memory-cards h3 {
  margin: 1.5rem 0 0.35rem;
  font-size: 1.25rem;
}

.memory-cards-first-preview,
.memory-cards-summary {
  display: grid;
  gap: 0.75rem;
}

.memory-cards-first-preview {
  grid-template-columns: minmax(0, 1fr) minmax(12rem, 14rem);
  column-gap: 1.5rem;
  align-items: start;
}

.memory-cards-section-header {
  display: grid;
  align-content: start;
}

.memory-cards-top-preview {
  display: grid;
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  min-height: 8rem;
  padding: 0.5rem;
  place-items: center;
}

.memory-cards-top-preview p,
.memory-cards-page-preview p {
  margin: 0;
  color: var(--vt-muted);
  font: 400 0.86rem/1.4 var(--vt-sans);
}

.memory-cards-preview-canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(37, 31, 40, 0.12);
  background: #ffffff;
}

.memory-cards-downloads {
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--vt-border);
}

.memory-cards-downloads .vt-status {
  margin-top: 0.35rem;
  color: var(--vt-primary);
  font-weight: 700;
}

.memory-cards-download-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  flex: 0 0 calc(50% - 0.5rem);
  gap: 1rem;
  width: calc(50% - 0.5rem);
}

.memory-cards-download-actions .vt-button {
  width: 100%;
}

.memory-cards-download-actions .vt-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.memory-cards-summary-meta {
  margin: 0;
  color: var(--vt-text);
  font: 700 0.95rem/1.4 var(--vt-sans);
}

.memory-cards-table-wrap {
  max-height: 28rem;
  overflow: auto;
  border: 1px solid var(--vt-border);
  border-radius: 0.5rem;
  background: var(--vt-paper);
}

.memory-cards-table-wrap:focus-visible {
  outline: 3px solid var(--vt-primary);
  outline-offset: 3px;
}

.memory-cards-table-wrap table {
  display: table;
  width: 100%;
  min-width: 100%;
  margin: 0;
  border-collapse: collapse;
  overflow: visible;
  font: 400 0.82rem/1.35 var(--vt-sans);
}

.memory-cards-table-wrap th,
.memory-cards-table-wrap td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid rgba(64, 5, 97, 0.1);
  text-align: left;
  vertical-align: top;
}

.memory-cards-table-wrap th {
  position: sticky;
  z-index: 1;
  top: 0;
  background: var(--vt-primary);
  color: #ffffff;
}

.memory-cards-table-wrap td:nth-child(1),
.memory-cards-table-wrap td:nth-child(4),
.memory-cards-table-wrap td:nth-child(5) {
  text-align: center;
}

.memory-cards-page-previews {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 0.85rem;
}

.memory-cards-page-preview {
  display: grid;
  gap: 0.45rem;
  align-content: start;
  padding: 0.65rem;
}

.memory-cards-page-preview p {
  font-weight: 700;
}

.memory-cards-print-guide {
  margin-top: 1.25rem;
  padding: 1rem 1.1rem;
  border-left: 4px solid var(--vt-accent);
  background: rgba(64, 5, 97, 0.04);
}

.memory-cards-print-guide ul {
  margin: 0;
  padding-left: 1.25rem;
}

.memory-cards-print-guide li + li {
  margin-top: 0.35rem;
}

@media (max-width: 60rem) {
  .memory-cards-config-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 46rem) {
  .memory-cards-first-preview {
    grid-template-columns: 1fr;
  }

  .memory-cards-option-grid {
    grid-template-columns: 1fr;
  }

  .memory-cards-downloads {
    display: grid;
  }

  .memory-cards-top-preview {
    grid-column: 1;
    grid-row: auto;
    width: min(100%, 14rem);
    justify-self: center;
  }

  .memory-cards-download-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
}

@media (max-width: 35rem) {
  #scripture-memory-cards {
    width: min(100% - 1rem, 68rem);
  }

  .memory-cards-download-actions {
    grid-template-columns: 1fr;
  }

  .memory-cards-table-wrap th,
  .memory-cards-table-wrap td {
    padding: 0.45rem;
  }
}
