/* ==========================================================================
   components.css · reusable building blocks
   ========================================================================== */

/* ---------- Buttons ---------- */
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 50px;
  padding: 0.8rem 1.4rem;
  border: 1px solid var(--forest);
  background: var(--forest);
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease);
}
.btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  transition: transform 0.25s var(--ease);
}
.btn:hover { background: var(--sienna-ink); border-color: var(--sienna-ink); }
.btn:hover svg { transform: translateX(3px); }

.btn--ghost { background: transparent; color: var(--forest); border-color: var(--rule-strong); }
.btn--ghost:hover { background: var(--forest); color: var(--white); border-color: var(--forest); }

.on-dark .btn { background: var(--almond); color: var(--forest); border-color: var(--almond); }
.on-dark .btn:hover { background: var(--sienna-light); border-color: var(--sienna-light); color: var(--forest-night); }
.on-dark .btn--ghost { background: transparent; color: var(--almond-soft); border-color: var(--rule-light); }
.on-dark .btn--ghost:hover { background: var(--almond); color: var(--forest); border-color: var(--almond); }

.btn[disabled] { opacity: 0.6; cursor: progress; }

/* ---------- Citations ---------- */
.cite {
  display: inline-block;
  margin-left: 0.12em;
  padding: 0 0.28em;
  font-family: var(--font-mono);
  font-size: 0.66em;
  line-height: 1.4;
  vertical-align: super;
  color: var(--sienna-ink);
  text-decoration: none;
  border: 1px solid rgba(140, 75, 47, 0.35);
}
.cite:hover { background: var(--sienna-ink); color: var(--white); }
.on-dark .cite { color: var(--sienna-light); border-color: rgba(227, 165, 132, 0.45); }
.on-dark .cite:hover { background: var(--sienna-light); color: var(--forest-night); }

/* Sources register at page end */
.sources {
  border-top: 1px solid var(--rule-strong);
  padding-block: clamp(3rem, 2rem + 3vw, 4.5rem);
  background: var(--almond-soft);
}
.sources__grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 2fr);
  gap: 2rem 4rem;
}
.sources h2 { font-size: var(--step-3); }
.sources__intro { margin-top: 1rem; font-size: 0.94rem; color: var(--charcoal-soft); max-width: 36ch; }
.sources__list { list-style: none; counter-reset: src; }
.sources__list li {
  counter-increment: src;
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr);
  gap: 0.5rem;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.93rem;
  line-height: 1.55;
}
.sources__list li:first-child { border-top: 1px solid var(--rule); }
.sources__list li::before {
  content: "[" counter(src) "]";
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--sienna-ink);
  padding-top: 0.12rem;
}
.sources__list li:target { background: var(--almond); }
.sources__list a {
  color: var(--forest);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: rgba(24, 60, 53, 0.35);
  text-underline-offset: 0.2em;
  overflow-wrap: anywhere;
}
.sources__list a:hover { color: var(--sienna-ink); text-decoration-color: currentColor; }
.sources__list span { color: var(--charcoal-soft); }

/* ---------- Attributed statement ---------- */
.statement {
  position: relative;
  padding-left: clamp(2.6rem, 2rem + 2vw, 4rem);
}
.statement::before {
  content: "\201C";
  position: absolute;
  left: 0;
  top: -0.12em;
  font-family: var(--font-display);
  font-size: clamp(4rem, 3rem + 3vw, 6.5rem);
  line-height: 1;
  color: var(--sienna);
}
.statement blockquote p {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-style: italic;
  font-weight: 400;
  line-height: 1.45;
  color: var(--forest);
}
.statement figcaption {
  margin-top: 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  line-height: 1.6;
  color: var(--charcoal-soft);
}
.statement figcaption strong { display: block; color: var(--charcoal); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.on-dark .statement blockquote p { color: var(--white); }
.on-dark .statement figcaption { color: var(--bluegrey); }
.on-dark .statement figcaption strong { color: var(--almond-soft); }
.on-dark .statement::before { color: var(--sienna-light); }

.statement--compact blockquote p { font-size: var(--step-1); }

/* ---------- Scope note (record limitations) ---------- */
.scope-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 1rem 1.3rem;
  padding: clamp(1.3rem, 1rem + 1vw, 2rem);
  border: 1px dashed var(--rule-strong);
  background: var(--paper);
}
.scope-note__mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--mineral);
  color: var(--mineral-ink);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.3rem;
}
.scope-note h3 { font-size: var(--step-1); margin-bottom: 0.4rem; }
.scope-note p { font-size: 0.96rem; color: var(--charcoal-soft); }
.on-dark .scope-note { background: transparent; border-color: var(--rule-light); }
.on-dark .scope-note p { color: var(--almond-soft); }
.on-dark .scope-note__mark { border-color: var(--bluegrey); color: var(--bluegrey); }

/* ---------- Tags ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.5;
  border: 1px solid var(--rule-strong);
  color: var(--charcoal-soft);
  white-space: nowrap;
}
.tag--sienna { border-color: rgba(140, 75, 47, 0.5); color: var(--sienna-ink); }
.tag--mineral { border-color: rgba(61, 92, 83, 0.5); color: var(--mineral-ink); }
.tag-row { display: flex; flex-wrap: wrap; gap: 0.45rem; }

/* ---------- Section heading block ---------- */
.section-head { max-width: 62ch; margin-bottom: clamp(2.2rem, 1.6rem + 2vw, 3.5rem); }
.section-head .label { margin-bottom: 1.1rem; }
.section-head h2 + p { margin-top: 1.1rem; color: var(--charcoal-soft); }
.on-dark .section-head h2 + p { color: var(--almond-soft); }

/* ---------- Page continuation (next page link) ---------- */
.continue {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 1.5rem;
  padding-block: clamp(2.5rem, 2rem + 2vw, 3.5rem);
  border-top: 1px solid var(--rule-strong);
  text-decoration: none;
  color: var(--forest);
}
.continue__label { display: block; margin-bottom: 0.5rem; }
.continue__title {
  font-family: var(--font-display);
  font-size: var(--step-4);
  line-height: 1.05;
  transition: color 0.25s var(--ease);
}
.continue__arrow {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1px solid var(--forest);
  transition: background-color 0.25s var(--ease), color 0.25s var(--ease);
}
.continue__arrow svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.continue:hover .continue__title { color: var(--sienna-ink); }
.continue:hover .continue__arrow { background: var(--forest); color: var(--white); }

/* ---------- Form ---------- */
.form { display: grid; gap: 1.5rem; }
.form__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }

.field { display: grid; gap: 0.45rem; }
.field label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--forest);
}
.field__hint {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--charcoal-soft);
}
.field input,
.field textarea {
  width: 100%;
  min-height: 52px;
  padding: 0.8rem 0.95rem;
  background: var(--white);
  border: 1px solid var(--rule-strong);
  border-bottom: 2px solid var(--forest);
  border-radius: 0;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--charcoal);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
.field textarea { min-height: 170px; resize: vertical; }
.field input:hover,
.field textarea:hover { border-color: var(--mineral); }
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--sienna);
  box-shadow: 0 0 0 3px rgba(182, 110, 77, 0.28);
}
.field.has-error input,
.field.has-error textarea { border-color: #a23a2a; border-bottom-color: #a23a2a; background: #fff8f6; }
.field__error {
  display: none;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.86rem;
  font-weight: 500;
  color: #9b3322;
}
.field.has-error .field__error { display: flex; }
.field__error::before { content: "!"; display: grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: #9b3322; color: var(--white); font-size: 0.7rem; font-weight: 700; }

.form__trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}
.form__privacy { font-size: 0.85rem; color: var(--charcoal-soft); max-width: 44ch; }

.form-status {
  display: none;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.9rem;
  padding: 1.1rem 1.25rem;
  border-left: 4px solid;
  font-size: 0.96rem;
}
.form-status.is-visible { display: grid; }
.form-status svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; margin-top: 0.1rem; }
.form-status strong { display: block; margin-bottom: 0.2rem; }
.form-status p { margin: 0; }
.form-status a { color: inherit; font-weight: 600; text-underline-offset: 0.2em; }
.form-status--success { background: #e6efe9; border-color: var(--mineral); color: #1f4136; }
.form-status--error { background: #f8e9e3; border-color: #a23a2a; color: #7c2a1d; }

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.is-sending .spinner { display: inline-block; }
.is-sending .btn__arrow { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Lightbox ---------- */
.lightbox {
  width: min(96vw, 1100px);
  max-width: none;
  max-height: 94vh;
  padding: 0;
  border: 0;
  background: var(--forest-night);
  color: var(--almond-soft);
}
.lightbox::backdrop { background: rgba(10, 22, 19, 0.88); }
.lightbox__inner {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: 94vh;
}
.lightbox__bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0.75rem 0.75rem 1.25rem;
  border-bottom: 1px solid var(--rule-light);
}
.lightbox__bar .label { color: var(--bluegrey); }
.lightbox__close {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.4rem 0.9rem;
  background: transparent;
  border: 1px solid var(--rule-light);
  color: var(--white);
  cursor: pointer;
}
.lightbox__close:hover { background: var(--almond); color: var(--forest); }
.lightbox__close:focus-visible { outline-color: var(--sienna-light); }
.lightbox__stage {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 1rem;
  overflow: auto;
}
.lightbox__stage img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(94vh - 160px);
  object-fit: contain;
}
.lightbox__caption { padding: 0.9rem 1.25rem 1.1rem; font-size: 0.9rem; color: var(--bluegrey); border-top: 1px solid var(--rule-light); }
.sources h2 { margin-top: 1rem; }
