/* Page-specific overrides. Shared site-wide chrome lives in
   ../../assets/base.css (or ../assets/base.css), loaded before this file. */

:root { --accent: #6b5a3f; }

* { box-sizing: border-box; }
.site-header {
  text-align: center;
  padding: 36px 20px 20px;
  border-bottom: 1px solid var(--panel-border);
}
.form-panel, .preview-panel { flex: 1 1 420px; min-width: 320px; }
.preview-panel {
  position: sticky;
  top: 16px;
  align-self: flex-start;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

fieldset {
  border: none;
  border-top: 2px solid var(--gold);
  padding: 16px 0 4px;
  margin: 0 0 20px;
}
legend {
  font-family: 'Spectral', Georgia, serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--gold);
  padding: 0 2px;
}
label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 14px;
}
select, input[type="text"], textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 8px 10px;
  background: #f7f2e2;
  border: 1px solid var(--panel-border);
  color: var(--text);
  font-size: 0.95rem;
  font-family: 'Work Sans', sans-serif;
}
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.checkbox-row input { width: 16px; height: 16px; }
.checkbox-row label { margin: 0; }

.demo-row {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 10px;
}
.demo-row-top { display: flex; gap: 8px; margin-bottom: 8px; align-items: flex-end; }
.demo-row-top .demo-race { flex: 2; }
.demo-row-top .demo-weight { flex: 1; }
.demo-row-top label { margin: 0; font-size: 0.78rem; }
.demo-row select, .demo-row input[type="text"] { margin-top: 3px; }
.demo-culture { display: block; margin-bottom: 8px; font-size: 0.78rem; }
.demo-row-checks { display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.78rem; color: var(--text-dim); margin-bottom: 8px; }
.demo-row-checks label { display: flex; align-items: center; gap: 4px; margin: 0; }
.demo-row-checks input { width: 14px; height: 14px; }
.demo-remove-btn {
  width: 100%;
  padding: 6px;
  background: transparent;
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  font-size: 0.75rem;
  cursor: pointer;
  border-radius: 3px;
}
.demo-remove-btn:hover { border-color: #a85a4a; color: #8a4a2a; }

.race-tag { font-size: 0.78em; font-weight: normal; font-style: italic; color: #6b5a3f; }

.reroll-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.reroll-row button {
  flex: 1;
  min-width: 140px;
  padding: 9px 10px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
  border-radius: 3px;
}
.reroll-row button:hover { border-color: var(--gold); color: var(--gold); }
.randomize-bar .hint { margin: 8px 0 0; text-align: left; font-size: 0.78rem; color: var(--text-dim); }

/* ---- Card ---- */
#card-wrapper { display: flex; justify-content: center; }
#document-preview {
  width: 560px;
  background: #f3ecd8;
  color: #2a2216;
  border: 1px solid #2a2216;
  outline: 1px solid #2a2216;
  outline-offset: -4px;
  padding: 28px 32px 20px;
  font-family: 'Alegreya', Georgia, serif;
  position: relative;
  box-shadow: 0 4px 18px rgba(0,0,0,0.35);
  overflow-wrap: break-word;
  word-break: break-word;
}
.doc-title {
  font-size: 1.9rem;
  font-weight: 700;
  margin: 0 0 16px;
}

.form-section { margin-bottom: 6px; }
.form-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 6px;
  margin-bottom: 8px;
}
.form-section-header h3 {
  font-family: 'Spectral', Georgia, serif;
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--gold);
  margin: 0;
}
.section-toggle-btn {
  background: none;
  border: 1px solid var(--panel-border);
  color: var(--text-dim);
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: 3px;
  cursor: pointer;
}
.section-toggle-btn:hover { border-color: var(--gold); color: var(--gold); }
.question-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 0.9rem;
}
.question-row input { margin-top: 3px; width: 15px; height: 15px; flex: 0 0 auto; }
.question-row label { cursor: pointer; }

.doc-section { margin-bottom: 20px; }
.doc-section-title {
  font-family: 'Spectral', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #7a2020;
  border-bottom: 1px solid #a8a077;
  padding-bottom: 4px;
  margin-bottom: 10px;
}
.doc-question {
  margin: 0 0 14px;
  line-height: 1.5;
  font-size: 0.95rem;
  padding-bottom: 10px;
  border-bottom: 1px dotted #d8d0b8;
}
.doc-question:last-child { border-bottom: none; }
.doc-answer-space { display: block; height: 1px; margin-top: 8px; }

.card-footer {
  margin-top: 18px;
  padding-top: 10px;
  border-top: 1px dotted #a8a077;
  font-size: 0.7rem;
  color: #8a8264;
  text-align: center;
}

.export-controls { text-align: center; margin-top: 18px; display: flex; gap: 10px; justify-content: center; }
.export-controls button {
  padding: 10px 22px;
  background: var(--panel);
  border: 1px solid var(--gold);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  border-radius: 3px;
}
.export-controls button:hover { background: var(--gold); color: #f3ead8; }
@media (max-width: 760px) {
  .preview-panel { position: static; max-height: none; }
  #document-preview { width: 100%; }
}

/* Printing (or "Save as PDF" via the browser's print dialog) shows only
   the document preview itself, cleanly paginated, no site chrome, no
   form, no buttons. */
@media print {
  .site-header, .site-footer, .form-panel, .randomize-bar,
  .export-controls, #back-to-top, .back-link {
    display: none !important;
  }
  main { display: block; padding: 0; max-width: none; }
  .preview-panel { position: static; max-height: none; overflow: visible; }
  #document-preview {
    box-shadow: none;
    border: none;
    outline: none;
    width: 100%;
    max-width: none;
    padding: 0;
  }
  body { background: #fff; }
}
