/* Reclaim Your Time – Garden Retreat Calculator */

:root {
  --color-bg: #f8f6f3;
  --color-surface: #fff;
  --color-text: #1a1a1a;
  --color-text-muted: #555;
  --color-primary: #2d5a4a;
  --color-primary-hover: #234a3d;
  --color-secondary: #6b7f76;
  --color-border: #e5e2de;
  --color-before: #a8b5ae;
  --color-after: #2d5a4a;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 2px 12px rgba(45, 90, 74, 0.06);
  --max-width: 560px;
  --ease-calm: cubic-bezier(0.33, 1, 0.68, 1);
  --duration-calm: 0.55s;
}

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--color-primary);
  min-height: 100vh;
  background-color: transparent;
}

body.no-breathing-background {
  background-color: var(--color-bg);
}

/* Three.js breathing background – fixed behind content */
.breathing-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.breathing-background canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Fallback when Three.js fails to load or WebGL unavailable */
.breathing-background-fallback {
  background-color: #f8f6f3;
  background-position: 50% 40%;
  background-repeat: no-repeat;
  background-image: radial-gradient(
    ellipse 140% 140% at 50% 40%,
    rgba(45, 90, 74, 0.08) 0%,
    rgba(184, 194, 188, 0.04) 45%,
    transparent 70%
  );
  background-size: 100% 100%;
  animation: breath-fallback 8s ease-in-out infinite;
}

@keyframes breath-fallback {
  0%, 100% { background-size: 100% 100%; }
  50% { background-size: 150% 150%; }
}

@media (prefers-reduced-motion: reduce) {
  .breathing-background-fallback {
    animation: none;
  }
}

/* Content above the canvas */
.skip-link,
.header,
.app {
  position: relative;
  z-index: 1;
}

/* Skip link – visible on focus for accessibility */
.skip-link {
  position: absolute;
  top: -3rem;
  left: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-sm);
  z-index: 100;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 0.5rem;
  outline: 2px solid var(--color-text);
  outline-offset: 2px;
}

/* Header – matches planning-checker.malverngardenbuildings.co.uk */
.header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.header-logo {
  display: block;
  width: 48px;
  height: auto;
  max-height: 85px;
  object-fit: contain;
  transition: opacity 0.25s var(--ease-calm);
}

.header-content a:first-of-type:hover .header-logo {
  opacity: 0.85;
}

.header-button {
  font-size: 0.9375rem;
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.25s var(--ease-calm);
}

.header-button:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.header-button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.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;
}

.app {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.25rem;
  display: flex;
  align-items: center;
  height: 100vh;
  text-align: center;
}

.section {
  animation: fadeIn var(--duration-calm) var(--ease-calm);
}

.section.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Intro */
.section-intro h1 {
  margin: 0 0 0.75rem;
  font-size: 3.75rem;
  font-family: 'Gloock', serif;
}

.intro-lead {
  margin: 0 0 1.5rem;
  color: var(--color-text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.35s var(--ease-calm), transform 0.2s var(--ease-calm), box-shadow 0.35s var(--ease-calm);
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: #f0eeeb;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Progress */
.progress-wrap {
  margin-bottom: 1.5rem;
}

.progress-text {
  margin: 0 0 0.5rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.progress-bar {
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 14.28%; /* 1/7 */
  max-width: 100%;
  background: var(--color-primary);
  border-radius: 3px;
  transition: width var(--duration-calm) var(--ease-calm);
}

/* Questionnaire */
.questionnaire-form {
  position: relative;
  background: var(--color-surface);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 220px;
}

.question-block {
  margin-bottom: 1.5rem;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  right: 1.5rem;
  transform: translateY(14px);
  transition: opacity var(--duration-calm) var(--ease-calm),
              transform var(--duration-calm) var(--ease-calm),
              visibility 0s linear var(--duration-calm);
}

.question-block.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  position: relative;
  top: 0;
  left: 0;
  right: 0;
  transform: translateY(0);
  transition: opacity var(--duration-calm) var(--ease-calm),
              transform var(--duration-calm) var(--ease-calm),
              visibility 0s linear 0s;
}

.question-block.optional {
  margin-bottom: 1rem;
}

.question-label {
  display: block;
  margin-bottom: 0.75rem;
  font-weight: 600;
  font-size: 1rem;
}

.input-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.option-card {
  flex: 1 1 calc(50% - 0.25rem);
  min-width: 120px;
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.option-card:hover {
  border-color: var(--color-secondary);
}

.option-card input {
  margin: 0 0.5rem 0 0;
}

.option-card input:checked + span,
.option-card:has(input:checked) {
  font-weight: 600;
}

.option-card:has(input:checked) {
  border-color: var(--color-primary);
  background: rgba(45, 90, 74, 0.08);
}

.input-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.checkbox-card {
  flex: 1 1 calc(50% - 0.25rem);
  min-width: 160px;
  display: flex;
  align-items: center;
  padding: 0.6rem 0.75rem;
  background: var(--color-bg);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.checkbox-card:hover {
  border-color: var(--color-secondary);
}

.checkbox-card input {
  margin: 0 0.5rem 0 0;
}

.checkbox-card:has(input:checked) {
  border-color: var(--color-primary);
  background: rgba(45, 90, 74, 0.08);
}

/* Sliders */
.slider-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.25rem;
}

.slider-wrap input[type="range"] {
  flex: 1;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--color-border);
  border-radius: 4px;
}

.slider-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--color-primary);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.slider-wrap input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--color-primary);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.slider-wrap output {
  min-width: 4rem;
  font-weight: 600;
  text-align: right;
}

.input-hint {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

/* Select */
select {
  width: 100%;
  max-width: 20rem;
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  cursor: pointer;
}

select:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Form actions */
.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.form-actions .btn-secondary {
  margin-right: auto;
}

.form-actions .btn.hidden {
  display: none;
}

/* Results */
.section-results h2 {
  margin: 0 0 1rem;
  font-size: 1.5rem;
}

.results-headline {
  font-size: 1.125rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.results-headline strong {
  color: var(--color-primary);
}

.before-after-wrap {
  background: var(--color-surface);
  padding: 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.before-after-bar {
  --bar-max: 20;
}

.bar-row {
  display: grid;
  grid-template-columns: 4rem 1fr 5rem;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.bar-row:last-child {
  margin-bottom: 0;
}

.bar-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.bar-track {
  height: 24px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width var(--duration-calm) var(--ease-calm);
}

.bar-before {
  background: var(--color-before);
}

.bar-after {
  background: var(--color-after);
}

.bar-value {
  font-size: 0.875rem;
  font-weight: 600;
  text-align: right;
}

.suggested-uses {
  margin-bottom: 1.5rem;
}

.suggested-uses h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.suggested-uses ul {
  margin: 0;
  padding-left: 1.25rem;
}

.suggested-uses li {
  margin-bottom: 0.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.suggested-uses .activity-icon {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  font-size: 1.25rem;
  line-height: 1;
}

.equivalents {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: rgba(45, 90, 74, 0.08);
  border-radius: var(--radius);
  border-left: 4px solid var(--color-primary);
}

.equivalents p {
  margin: 0 0 0.5rem;
  font-size: 0.9375rem;
}

.equivalents p:last-child {
  margin-bottom: 0;
}

.results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

footer{
  position: absolute;
  margin: auto;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: .8em;
  bottom: 0;
}

/* Responsive */
@media (max-width: 480px) {
  .app {
    padding: 1.25rem 1rem;
  }

  .option-card,
  .checkbox-card {
    flex: 1 1 100%;
  }

  .form-actions {
    flex-wrap: wrap;
  }

  .form-actions .btn {
    flex: 1 1 auto;
  }

  .bar-row {
    grid-template-columns: 3.5rem 1fr 4rem;
    gap: 0.5rem;
  }

  .bar-value {
    font-size: 0.8125rem;
  }
}
