/* gratus by NeoDerm — registration flow */
:root {
    --color-primary: #ff5a6e;
    --color-primary-hover: #e84d62;
    --color-text: #2c3d4f;
    --color-muted: #6b7c8f;
    --color-border: #e2e6eb;
    --color-bg: #f5f6f8;
    --color-card: #ffffff;
    --color-disabled: #c8cdd4;
    --color-req: #e53935;
    --radius-card: 20px;
    --radius-btn: 999px;
    --font: "Noto Sans TC", system-ui, -apple-system, sans-serif;
    /* Same column width & gutters as .form-view / .main-card */
    --content-max: 480px;
    /*--page-gutter: 16px;*/
}

@media (min-width: 600px) {
  :root {
    --page-gutter: 24px;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

a {
  color: var(--color-primary);
}

/* Hero — same max width & horizontal padding as .form-view */
.hero {
  margin-top: 0;
  padding: 0 var(--page-gutter);
}

.hero-bg {
    position: relative;
    width: 100%;
    max-width: var(--content-max);
    margin: 0 auto;
    aspect-ratio: 750 / 574;
    background: url(https://oss.gratus.com.hk/gratus/PublicImages/EDM/gratus/DGMT11122CA01N/IS-2166_kv2.png) top / cover no-repeat;
}

/* Card */
.main-card {
  position: relative;
  margin: -40px 0 0;
  padding: 0 var(--page-gutter) 32px;
  z-index: 2;
}

.form-view,
.success-view {
  position: relative;
  max-width: var(--content-max);
  margin: 0 auto;
  background: var(--color-card);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  box-shadow: 0 -4px 24px rgba(44, 61, 79, 0.08);
  padding: 24px 20px 28px;
}

.form-share-btn {
  position: absolute;
  top: 16px;
  right: 14px;
  z-index: 3;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--color-text);
  border-radius: 10px;
}

.form-share-btn:hover {
  background: rgba(44, 61, 79, 0.06);
}

.form-share-btn:focus-visible {
  outline: 2px solid rgba(255, 90, 110, 0.45);
  outline-offset: 2px;
}

.form-share-icon {
  flex-shrink: 0;
}

.form-title-banner {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 0 0 20px;
}

.form-title-img {
  display: block;
  max-width: min(100%, 360px);
  width: auto;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.form-title {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-text);
}

.form-subtitle {
  margin: 0 0 24px;
  font-size: 0.95rem;
  color: var(--color-muted);
}

form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.form-block {
  margin: 20px 0 40px;
  padding: 0;
  border: none;
  min-width: 0;
}

.form-block:last-of-type {
  margin-bottom: 8px;
}

.question-label,
.field-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 10px;
}

.req {
  color: var(--color-req);
  font-weight: 500;
  font-size: 0.85em;
}

.req--hidden {
  display: none;
}

.field-error {
  margin: 8px 0 0;
  font-size: 0.85rem;
  color: var(--color-req);
  line-height: 1.4;
}

.input-text.input-text--invalid {
  border-color: var(--color-req);
}

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
}

.radio-label,
.check-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  color: var(--color-text);
  cursor: pointer;
  
}

.radio-label input,
.check-label input {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary);
}

.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
}

.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.check-label--terms {
  align-items: flex-start;
  line-height: 1.5;
}

.check-label--terms input {
  margin-top: 3px;
  flex-shrink: 0;
}

.link {
  color: var(--color-primary);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.input-text {
  width: 100%;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: #fafbfc;
  color: var(--color-text);
  resize: vertical;
  min-height: 44px;
}

.input-text:focus {
  outline: 2px solid rgba(255, 90, 110, 0.35);
  outline-offset: 0;
  border-color: var(--color-primary);
}

.input-text::placeholder {
  color: #a8b0ba;
}

.reason-other-input {
  margin-top: 10px;
}

.expanded-fields {
  display: flex;
  flex-direction: column;
}

/* 「是」: 姓名/電話 → 長問卷 → 條款；「否」: 顧慮/吸引 → 姓名/電話 → 條款 */
.expanded-fields.join-yes .block-contact {
  order: 1;
}
.expanded-fields.join-yes .block-long-yes {
  order: 2;
}
.expanded-fields.join-yes .block-terms {
  order: 3;
}

.expanded-fields.join-no .block-concerns {
  order: 1;
}
.expanded-fields.join-no .block-contact {
  order: 2;
}
.expanded-fields.join-no .block-terms {
  order: 3;
}

.long-form-yes {
  margin-top: 20px;
}

.hidden,
[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Buttons */
.btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 16px 24px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

.btn-primary:disabled {
  background: var(--color-disabled);
  color: #fff;
  cursor: not-allowed;
  opacity: 0.95;
}

.btn-search {
  margin-top: 20px;
  text-align: center;
  text-decoration: none;
}

/* Success */
.success-view {
  text-align: center;
  padding-top: 32px;
  padding-bottom: 36px;
}

.success-icon-wrap {
  margin: 0 auto 20px;
  max-width: 100%;
}

.success-hero-img {
  display: block;
  width: 100%;
  max-width: 320px;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.success-title {
  margin: 0 0 12px;
  font-size: 1.35rem;
  font-weight: 700;
}

.success-text {
  margin: 0 0 8px;
  font-size: 0.95rem;
  color: var(--color-muted);
  line-height: 1.5;
}

.redirect-hint {
  margin: 0 0 8px;
  font-size: 0.88rem;
  color: var(--color-muted);
}

#count-seconds {
  font-weight: 700;
  color: var(--color-primary);
}

@media (min-width: 600px) {
  .form-view,
  .success-view {
    border-radius: var(--radius-card);
    margin-top: -56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn {
    transition: none;
  }
}
