/* Art & Science Generator - Teal accent (#0d9488), consistent with Lectionary/Bible Topic/Book Guide */
/* Design cues from other SeekerPNW generators; anchor color for Art & Science pillar */

:root {
  /* Align with main site: --background-page #f1f5f9 */
  --bg-color: #f1f5f9;
  --card-bg: #ffffff;
  --text-primary: #212529;
  --text-secondary: #495057;
  --text-muted: #6b7280;
  --border-color: #dee2e6;
  --accent: #0d9488;
  --accent-hover: #0f766e;
  --accent-focus: rgba(13, 148, 136, 0.2);
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* Output visible: avoid tall empty iframe; tuck handout toward top (matches learning-topic) */
body.has-output {
  min-height: auto;
}

body.has-output .container {
  padding-top: 0.5rem;
  padding-bottom: 1rem;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Input Section - matches Lectionary structure */
.input-section {
  text-align: center;
  padding: 2rem 0 2.5rem;
  min-height: auto;
  display: flex;
  flex-direction: column;
}

.input-section .attribution {
  margin-top: auto;
  padding-top: 3rem;
}

.header {
  margin-bottom: 2.5rem;
}

.logo-link {
  text-decoration: none;
  color: inherit;
  display: inline-block;
}
.logo-link:hover {
  opacity: 0.85;
}

.logo-link:focus-visible,
.generate-btn:focus-visible,
.btn-secondary:focus-visible,
.action-btn:focus-visible,
.about-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.logo svg {
  height: 44px;
  margin-bottom: 1rem;
}

.title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 1.0625rem;
  color: var(--text-muted);
  font-weight: 400;
}

.intro-text {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 520px;
  margin: 0 auto 1.5rem;
}

/* Instructions block - collapsible, below Shuffle / Clear / Generate */
.instructions-block {
  text-align: left;
  max-width: 560px;
  margin: 1.5rem auto 0;
  padding: 0.75rem 1rem;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.instructions-block summary {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.instructions-block summary:hover {
  color: var(--text-primary);
}

.instructions-list {
  margin: 0.75rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.instructions-list li {
  margin-bottom: 0.5rem;
}

.instructions-list li:last-child {
  margin-bottom: 0;
}

.pool-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.orbit-note {
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* Type your own section (directly under orbit preview) */
.type-your-own {
  margin-top: 1rem;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  padding: 1rem 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.type-your-own-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.type-your-own-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.type-your-own-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.type-your-own-row:last-of-type {
  margin-bottom: 0;
}

.custom-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  font-family: var(--font-family);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  min-width: 0;
}

.custom-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-focus);
}

.btn-add-custom {
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-family);
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-add-custom:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-add-custom:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.checkbox-row {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.checkbox-label input {
  width: 1rem;
  height: 1rem;
}

/* Button Row — after pool + status; sits above "How does this work?" */
.button-row {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
}

.generate-btn {
  padding: 0.875rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: var(--font-family);
  color: white;
  background-color: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}
.generate-btn:hover:not(:disabled) {
  background-color: var(--accent-hover);
}
.generate-btn:active:not(:disabled) {
  transform: scale(0.98);
}
.generate-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-secondary {
  padding: 0.875rem 1.5rem;
  font-size: 0.95rem;
  font-family: var(--font-family);
  color: var(--text-primary);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-secondary:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.btn-secondary:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-focus);
}
.generate-btn:focus:not(:disabled) {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-focus);
}

.btn-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Orbit Preview - card with subtle pillar tint, matches site cards */
.orbit-preview {
  margin-bottom: 1.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--card-bg);
  border: 2px solid rgba(13, 148, 136, 0.2);
  border-radius: 12px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.orbit-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.orbit-sublabel {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.orbit-blocks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Rounded-edge blocks (match pillar diagram), not pill shape */
.orbit-block {
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: 12px;
  color: white;
  line-height: 1.3;
}
.orbit-block.art {
  background: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.orbit-block.science {
  background: #1d4ed8;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.orbit-legend {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

.orbit-block-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.orbit-block-remove {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.2s, background 0.2s;
}

.orbit-block-remove:hover {
  opacity: 1;
  background: rgba(0, 0, 0, 0.15);
}

/* Pool section - add from pool */
.pool-section {
  margin-top: 1.5rem;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

.pool-section summary {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.pool-section summary:hover {
  color: var(--text-primary);
}

.pool-filters {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  margin-bottom: 0.5rem;
}

.pool-filter {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-family: var(--font-family);
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.pool-filter:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.pool-filter.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.pool-blocks {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pool-block-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  background: var(--bg-color);
  border-radius: 6px;
  font-size: 0.85rem;
}

.pool-block-row .pool-block-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pool-block-row .pool-block-add {
  flex-shrink: 0;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-family);
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.pool-block-row .pool-block-add:hover:not(:disabled) {
  background: var(--accent-hover);
}

.pool-block-row .pool-block-add:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pool-block-row .pool-block-added {
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-shrink: 0;
}
.legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  vertical-align: middle;
  margin-right: 0.25rem;
}
.legend-art {
  background: var(--accent);
}
.legend-science {
  background: #1d4ed8;
}

/* Status Message - matches Lectionary */
.status-message {
  margin-top: 1rem;
  padding: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  background-color: var(--card-bg);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  animation: fadeIn 0.3s ease;
}

.status-message.loading {
  animation: fadeIn 0.3s ease, pulse 2s ease-in-out infinite;
}

.status-message.error {
  color: #dc2626;
  border-color: #fecaca;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.rate-info {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* About Section - gray block, matches Lectionary/Bible Topic */
.about-section {
  margin-top: 2rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
  background-color: var(--bg-color);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-color);
}

.about-toggle {
  background: none;
  border: none;
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem 0;
  letter-spacing: 0.03em;
  transition: color 0.2s ease;
}

.about-toggle:hover {
  color: var(--text-secondary);
}

.about-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, opacity 0.3s ease;
  opacity: 0;
}

.about-section.open .about-toggle {
  color: var(--text-secondary);
}

.about-section.open .about-content {
  max-height: 500px;
  opacity: 1;
}

.about-content p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 0.75rem;
}

.about-content p:last-child {
  margin-bottom: 0;
}

.about-content a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.about-content a:hover {
  text-decoration: underline;
}

.attribution {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.attribution p {
  margin: 0;
}

/* Output Section */
.output-section {
  animation: fadeIn 0.5s ease;
  padding-top: 0;
  margin-top: 0;
}

/* Artwork section (curated images from Met + Harvard) */
.artwork-section {
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
}

.artwork-heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.artwork-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 12px;
}

.artwork-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card-bg);
  transition: box-shadow 0.2s;
}

.artwork-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.artwork-thumb {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.artwork-info {
  padding: 8px 10px;
  font-size: 0.85em;
}

.artwork-info strong {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
}

.artwork-artist {
  display: block;
  font-size: 0.8em;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-regen {
  padding: 6px 12px;
  font-size: 0.85em;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-secondary);
}

.btn-regen:hover:not(:disabled) {
  background: #eee;
  color: var(--text-primary);
}

.handout-content {
  margin-bottom: 1.5rem;
}

/* Single document sheet: matches Lectionary/Bible topic framing */
.handout {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 2rem;
  line-height: 1.6;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.content-box {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  line-height: 1.6;
  box-shadow: none;
}

.content-box h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  text-align: center;
  color: var(--text-primary);
}

.content-box .item-block {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.content-box .item-block:last-of-type {
  border-bottom: none;
}

.content-box .item-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.content-box .item-recap {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.content-box .item-content {
  margin-bottom: 0.5rem;
}

.content-box .item-question {
  font-style: italic;
  color: var(--text-primary);
  border-left: 4px solid var(--accent);
  padding-left: 0.75rem;
}

.content-box .straddle-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.content-box .straddle-section h3 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.content-box .straddle-list {
  list-style: decimal;
  padding-left: 1.25rem;
}

.content-box .straddle-list li {
  margin-bottom: 0.5rem;
}

/* Action Buttons - matches Lectionary pattern */
.action-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  align-items: stretch;
  margin-bottom: 2rem;
}

.action-btn {
  flex: 1 1 160px;
  min-width: 140px;
  max-width: 220px;
  min-height: 44px;
  padding: 0.75rem 1.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-family);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn:hover {
  background-color: var(--bg-color);
  border-color: var(--text-muted);
}

.action-btn.save-db-btn {
  background-color: var(--accent);
  color: white;
  border-color: var(--accent);
}

.action-btn.save-db-btn:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* Print */
@media print {
  .input-section,
  .action-buttons,
  .attribution {
    display: none !important;
  }

  .output-section {
    display: block !important;
  }

  .handout {
    border: none;
    box-shadow: none;
    padding: 1.5rem;
  }

  .content-box {
    border: none;
    box-shadow: none;
  }
}

/* Responsive */
@media (max-width: 640px) {
  .container {
    padding: 1.5rem 1rem;
  }

  .title {
    font-size: 1.5rem;
  }

  .handout {
    padding: 1.5rem;
  }

  .button-row {
    flex-direction: column;
    align-items: center;
  }

  .generate-btn,
  .btn-secondary {
    width: 100%;
    max-width: 280px;
  }

  .action-buttons {
    flex-direction: column;
  }

  .action-btn {
    width: 100%;
    max-width: none;
    margin: 0 auto;
  }
}

/* Compact layout when embedded in admin modal (?admin=true) */
body.embed {
  min-height: auto;
}
body.embed .container {
  padding: 1rem 1.25rem;
}

body.embed.has-output .container {
  padding-top: 0.5rem;
}
body.embed .input-section {
  padding: 1rem 0;
  min-height: auto;
}
body.embed .input-section .attribution {
  margin-top: 1rem;
  padding-top: 1rem;
}
body.embed .header {
  margin-bottom: 1rem;
}
body.embed .logo svg {
  height: 28px;
  margin-bottom: 0.5rem;
}
body.embed .title {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}
body.embed .subtitle {
  font-size: 0.875rem;
}
body.embed .orbit-note {
  margin-bottom: 1rem;
  font-size: 0.8125rem;
}
body.embed .button-row {
  margin-bottom: 1rem;
}
body.embed .about-section {
  margin-top: 1rem;
}
body.embed .attribution p {
  font-size: 0.7rem;
}
