:root {
  --bg: #f0f7f4;
  --surface: #ffffff;
  --hero-bg: #1a4a3a;
  --hero-text: #e8f5f0;
  --hero-accent: #5dd9a4;
  --text: #142e24;
  --text-muted: #4a6b5c;
  --text-label: #1e3d2f;
  --accent: #1a4a3a;
  --accent-hover: #0f3028;
  --accent-soft: rgba(26, 74, 58, 0.08);
  --sage: #2d9e72;
  --sage-soft: #d4f0e4;
  --gold: #e6a817;
  --gold-soft: #fff8e1;
  --border: #b8d9cb;
  --field-bg: #ffffff;
  --shadow: 0 2px 16px rgba(26, 74, 58, 0.10);
  --shadow-lg: 0 8px 32px rgba(26, 74, 58, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

/* ── Hero Header ── */
.header {
  background: var(--hero-bg);
  text-align: center;
  padding: 2.5rem 1.5rem 2.75rem;
  margin-bottom: 0;
}

.eyebrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--hero-accent);
  opacity: 0.85;
  margin-bottom: 1rem;
}

.eyebrow-icon {
  font-size: 0.75rem;
}

.header h1 {
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 8vw, 4.25rem);
  font-weight: 700;
  margin: 0 0 0.75rem;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--hero-text);
}

.header h1 .word-spark {
  font-style: italic;
  color: var(--hero-accent);
}

.tagline {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--hero-text);
  opacity: 0.7;
  letter-spacing: 0.01em;
}

/* ── Header link ── */
.header-link {
  display: inline-block;
  margin-top: 1.25rem;
  padding: 0.45rem 1.1rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hero-bg);
  background: var(--hero-accent);
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.2s, opacity 0.2s;
}

.header-link:hover {
  background: #7aebbe;
  opacity: 0.95;
}

/* ── App wrapper ── */
.app {
  max-width: 860px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
}

@media (min-width: 640px) {
  .app {
    padding: 3rem 2rem 4rem;
  }
}

/* ── Form ── */
.form-section {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

.field {
  margin-bottom: 1.75rem;
}

.field:last-of-type {
  margin-bottom: 2rem;
}

label,
legend {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
  color: var(--text-label);
}

.optional-tag {
  font-weight: 400;
  font-style: italic;
  font-size: 0.85rem;
  color: var(--text-muted);
}

fieldset.age-field {
  border: none;
  padding: 0;
  margin: 0 0 1.75rem;
}

fieldset.age-field legend {
  padding: 0;
}

input[type="text"],
textarea#observation {
  width: 100%;
  padding: 0.9rem 1rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--field-bg);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
textarea#observation:focus {
  outline: none;
  border-color: var(--sage);
  box-shadow: 0 0 0 3px rgba(45, 158, 114, 0.15);
}

input[type="text"]::placeholder,
textarea#observation::placeholder {
  color: #9ab8ac;
  font-style: italic;
}

textarea#observation {
  resize: vertical;
  min-height: 130px;
  line-height: 1.6;
}

/* ── Age options ── */
.age-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}

@media (min-width: 540px) {
  .age-options {
    grid-template-columns: repeat(4, 1fr);
  }
}

.age-option {
  cursor: pointer;
}

.age-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.age-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: 60px;
  padding: 0.9rem 0.5rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--field-bg);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.age-label strong {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.age-label small {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.15rem;
}

.age-option input:focus-visible + .age-label {
  outline: 2px solid var(--sage);
  outline-offset: 2px;
}

.age-option input:checked + .age-label {
  border-color: var(--sage);
  background: var(--sage-soft);
  box-shadow: 0 0 0 1px var(--sage);
}

.age-option:hover .age-label {
  border-color: var(--sage);
}

/* ── Buttons ── */
.btn-submit {
  width: 100%;
  min-height: 54px;
  padding: 1rem 1.5rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.15rem;
  font-weight: 700;
  color: #ffffff;
  background: var(--hero-bg);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  letter-spacing: 0.01em;
  box-shadow: 0 4px 14px rgba(26, 74, 58, 0.35);
}

.btn-submit:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 6px 20px rgba(26, 74, 58, 0.45);
}

.btn-submit:active:not(:disabled) {
  transform: scale(0.99);
}

.btn-submit:disabled {
  opacity: 0.7;
  cursor: wait;
}

.btn-secondary {
  display: block;
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.9rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1rem;
  font-weight: 600;
  color: var(--hero-bg);
  background: var(--field-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.btn-secondary:hover {
  border-color: var(--sage);
  background: var(--sage-soft);
}

.spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  margin-right: 0.4rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -0.15em;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Loading status message ── */
.loading-status {
  min-height: 1.5rem;
  margin-top: 1rem;
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.98rem;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.loading-status.visible {
  opacity: 1;
}

/* ── Error ── */
.error-banner {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  background: #fff0f0;
  border: 1.5px solid #f5c0c0;
  border-radius: var(--radius-sm);
  color: #b91c1c;
  font-size: 0.95rem;
}

/* ── Results ── */
.results {
  margin-top: 2.5rem;
  animation: fadeIn 0.4s ease;
}

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

.results-header {
  margin-bottom: 1.5rem;
}

.results-eyebrow {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 0.25rem;
}

.results-header h2,
.results-meta {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}

/* ── Cards grid ── */
.cards-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .card-full {
    grid-column: 1 / -1;
  }
}

.card {
  background: var(--field-bg);
  border-radius: var(--radius);
  padding: 1.35rem 1.5rem;
  box-shadow: var(--shadow);
  border: 1.5px solid transparent;
}

.card h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 1rem;
}

.card-icon {
  font-size: 1.2rem;
}

/* Card colour accents */
.card-env {
  border-color: #7dd4b0;
  border-top: 4px solid #2d9e72;
}

.card-env h3 { color: #1a6644; }

.card-inquiry {
  border-color: #90bce8;
  border-top: 4px solid #2a7dc4;
}

.card-inquiry h3 { color: #164d80; }

.card-materials {
  border-color: #f5cf7a;
  border-top: 4px solid #e6a817;
}

.card-materials h3 { color: #7a5200; }

.card-anchor {
  border-color: #f0a090;
  border-top: 4px solid #e05a3a;
  background: linear-gradient(135deg, #fff 0%, #fff5f3 100%);
}

.card-anchor h3 { color: #8c2e18; }

.card-setup {
  border-color: #b8a8e0;
  border-top: 4px solid #6c52c8;
}

.card-setup h3 { color: #3d2880; }

.card-wherenext {
  border-color: #f5d080;
  border-top: 4px solid #d4940a;
}

.card-wherenext h3 { color: #7a4e00; }

/* ── Card list ── */
.card-list {
  margin: 0;
  padding-left: 1.25rem;
}

.card-list li {
  margin-bottom: 0.7rem;
  padding-left: 0.25rem;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-label);
}

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

/* ── Materials chips ── */
.materials-list {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
}

.materials-list li {
  margin: 0;
  padding: 0.4rem 0.85rem;
  background: var(--gold-soft);
  border: 1.5px solid #f5cf7a;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  color: #7a5200;
}

/* ── Anchor quote ── */
.anchor-quote {
  margin: 0;
  padding: 0;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 4.5vw, 1.4rem);
  font-weight: 700;
  font-style: italic;
  line-height: 1.45;
  color: #8c2e18;
  border: none;
}

/* ── Environment setup ── */
.env-setup-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .env-setup-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .setup-doc {
    grid-column: 1 / -1;
  }
}

.setup-item {
  background: #f5faf7;
  border: 1.5px solid #c8e8d8;
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
}

.setup-item strong {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #1a6644;
  margin-bottom: 0.5rem;
}

.setup-item p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-label);
}

.doc-grid {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 540px) {
  .doc-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.doc-grid em {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1a6644;
  margin-bottom: 0.3rem;
  font-style: normal;
}

.doc-grid p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-label);
}

/* ── Where next ── */
.where-next-text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text-label);
}

/* ── Before setup banner ── */
.before-setup-banner {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-top: 1rem;
  padding: 1.1rem 1.25rem;
  background: #eaf7f2;
  border: 1.5px solid #7dd4b0;
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-label);
}

.before-setup-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.before-setup-banner p {
  margin: 0;
}

/* ── Footer ── */
.footer {
  margin-top: 3rem;
  text-align: center;
}

.footer p {
  margin: 0 0 0.25rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.install-tip {
  font-size: 0.85rem !important;
  line-height: 1.45;
  max-width: 28rem;
  margin-left: auto !important;
  margin-right: auto !important;
  margin-bottom: 0.75rem !important;
}

@media (min-width: 768px) {
  .install-tip { display: none; }
}

@media (display-mode: standalone) {
  .install-tip { display: none; }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
