/* surveys/ — single CSS for any survey rendered via build.mjs.
   Aesthetic: cream paper background, deep teal (湖) accent, warm gold (晨光) for active states.
   Mobile-first; readable without JS hover. */

:root {
  --bg: #f6f1e6;
  --bg-card: #fffaf0;
  --ink: #1f2a33;
  --ink-soft: #4a5b69;
  --rule: #d9cdb7;
  --rule-strong: #b8a989;
  --teal: #1f5d6e;
  --teal-soft: #cfe1e6;
  --gold: #c8923a;
  --gold-soft: #f3deb3;
  --error: #a8423b;
  --error-soft: #f4e0de;
  --shadow: 0 1px 2px rgba(31,42,51,.06), 0 8px 24px rgba(31,42,51,.06);
  --radius: 14px;
  --radius-sm: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181c;
    --bg-card: #1c2227;
    --ink: #e8e3d6;
    --ink-soft: #a3afba;
    --rule: #2d353c;
    --rule-strong: #475259;
    --teal: #6cb7c8;
    --teal-soft: #244a55;
    --gold: #e0b66d;
    --gold-soft: #4a3a1d;
    --error: #e08079;
    --error-soft: #3a201e;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.4);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Noto Sans TC", system-ui, -apple-system, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.survey {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 0 64px;
}

/* Hero */
.survey__hero {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--teal-soft);
}
.survey__hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.survey__hero-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 24px 24px 28px;
  background: linear-gradient(180deg, transparent 0%, rgba(20,28,34,.7) 100%);
  color: #fff;
}
.survey__title {
  font-family: "Noto Serif TC", "Noto Sans TC", serif;
  font-weight: 700;
  font-size: clamp(1.4rem, 4vw, 2rem);
  line-height: 1.3;
  margin: 0 0 4px;
  letter-spacing: .02em;
}
.survey__subtitle {
  margin: 0;
  font-size: .95rem;
  opacity: .9;
  font-weight: 400;
}

@media (min-width: 720px) {
  .survey { padding-top: 32px; }
  .survey__hero { border-radius: var(--radius); margin-top: 12px; }
}

/* Intro */
.survey__intro {
  padding: 28px 24px 8px;
  color: var(--ink-soft);
  font-size: .98rem;
  line-height: 1.7;
}
.survey__intro p {
  margin: 0;
  white-space: pre-line;
}

/* Form */
.survey__form {
  padding: 16px 24px 24px;
}

.q {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  margin: 16px 0;
  box-shadow: var(--shadow);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.q:focus-within {
  border-color: var(--teal);
  box-shadow: 0 1px 2px rgba(31,42,51,.06), 0 8px 24px rgba(31,93,110,.18);
}

.q__label {
  display: block;
  font-weight: 500;
  font-size: 1.02rem;
  line-height: 1.5;
  color: var(--ink);
  margin: 0 0 6px;
}
.q__required {
  color: var(--error);
  margin-left: 4px;
  font-weight: 500;
}
.q__help {
  display: block;
  margin: 0 0 14px;
  color: var(--ink-soft);
  font-size: .88rem;
  line-height: 1.6;
}
.q__error {
  display: block;
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--error-soft);
  color: var(--error);
  font-size: .85rem;
  border-radius: var(--radius-sm);
}
.q__error[hidden] { display: none; }

/* Inputs */
.q__input,
.q__textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  transition: border-color .12s ease, background .12s ease;
}
.q__input:focus,
.q__textarea:focus {
  outline: none;
  border-color: var(--teal);
  background: var(--bg-card);
}
.q__textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.6;
}
.q__input[aria-invalid="true"],
.q__textarea[aria-invalid="true"] {
  border-color: var(--error);
}

/* Choice lists */
.q__choices {
  display: grid;
  gap: 8px;
}
.q__choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
  font-size: .98rem;
}
.q__choice:hover { border-color: var(--rule-strong); }
.q__choice input {
  appearance: none;
  -webkit-appearance: none;
  width: 18px; height: 18px;
  margin: 0;
  border: 1.5px solid var(--rule-strong);
  background: var(--bg-card);
  flex-shrink: 0;
  cursor: pointer;
}
.q__choice input[type="radio"] { border-radius: 50%; }
.q__choice input[type="checkbox"] { border-radius: 4px; }
.q__choice input:checked {
  background: var(--teal);
  border-color: var(--teal);
  box-shadow: inset 0 0 0 3px var(--bg-card);
}
.q__choice:has(input:checked) {
  border-color: var(--teal);
  background: var(--teal-soft);
  color: var(--ink);
}

/* Submit */
.survey__actions {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}
.survey__submit {
  display: block;
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius);
  background: var(--teal);
  color: #fff;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: .03em;
  cursor: pointer;
  transition: background .12s ease, transform .04s ease;
  box-shadow: var(--shadow);
}
.survey__submit:hover { background: #174c5a; }
.survey__submit:active { transform: translateY(1px); }
.survey__submit:disabled {
  background: var(--rule-strong);
  cursor: not-allowed;
  opacity: .7;
}

.survey__submit-hint {
  margin: 0;
  text-align: center;
  font-size: .88rem;
  color: var(--error);
}

/* Thanks */
.survey__thanks {
  margin: 24px 24px 0;
  padding: 32px 24px;
  background: var(--bg-card);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  text-align: center;
  box-shadow: var(--shadow);
}
.survey__thanks h2 {
  font-family: "Noto Serif TC", serif;
  margin: 0 0 12px;
  font-size: 1.4rem;
  color: var(--gold);
}
.survey__thanks p {
  margin: 0;
  white-space: pre-line;
  color: var(--ink-soft);
}

/* Footer */
.survey__footer {
  margin-top: 32px;
  padding: 0 24px;
  text-align: center;
  font-size: .8rem;
  color: var(--ink-soft);
  opacity: .7;
}
.survey__footer p { margin: 0; }

/* Conditional */
.q[hidden] { display: none; }

/* Compact mobile tightening */
@media (max-width: 480px) {
  .q { padding: 18px 16px 14px; margin: 12px 0; }
  .survey__form { padding: 12px 16px 16px; }
  .survey__intro { padding: 24px 16px 4px; }
  .survey__hero-overlay { padding: 18px 16px 20px; }
}
