:root {
  color-scheme: light;
  --bg: #f3efe6;
  --paper: #fffaf1;
  --paper-strong: #ffffff;
  --text: #18231e;
  --muted: #69736b;
  --line: #ded5c6;
  --stone: #d8d3c8;
  --green: #1f3f31;
  --green-soft: #e7eee6;
  --wood: #9a6f45;
  --wood-soft: #eadcc8;
  --danger: #9d3527;
  --shadow: 0 18px 44px rgba(35, 45, 38, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.92) 0%, rgba(243, 239, 230, 0.96) 48%, #e6e9e0 100%),
    radial-gradient(circle at 12% 8%, rgba(154, 111, 69, 0.12), transparent 34%);
  color: var(--text);
  font: 15px/1.58 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select,
input,
textarea {
  font: inherit;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(154, 111, 69, 0.45);
  outline-offset: 3px;
}

a {
  color: var(--green);
  font-weight: 750;
}

[data-flow-step][hidden] {
  display: none;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 60px;
}

.flow-progress {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  gap: 8px;
  border-bottom: 1px solid rgba(104, 112, 102, 0.18);
  background: rgba(243, 239, 230, 0.94);
  padding: 10px 0 12px;
  backdrop-filter: blur(10px);
}

.flow-progress span {
  color: var(--green);
  font-size: 13px;
  font-weight: 850;
}

.flow-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(31, 63, 49, 0.12);
}

#flowProgressBar {
  width: 14.28%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--wood));
  transition: width 180ms ease;
}

.hero-section {
  min-height: 74vh;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(420px, 1.08fr);
  align-items: center;
  gap: 34px;
  padding: 22px 0 34px;
}

.hero-copy {
  padding: 18px 0;
}

.eyebrow,
.step-label {
  margin: 0 0 9px;
  color: var(--wood);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 16px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(38px, 5.8vw, 70px);
  font-weight: 650;
  line-height: 1.04;
  letter-spacing: 0;
}

.subtitle {
  max-width: 620px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 18px;
}

.hero-status {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(31, 63, 49, 0.2);
  border-radius: 999px;
  background: rgba(255, 250, 241, 0.8);
  color: var(--green);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 800;
}

.step-action {
  width: min(100%, 240px);
  margin-top: 10px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(31, 63, 49, 0.12);
}

.hero-visual {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  border: 1px solid rgba(104, 112, 102, 0.22);
  border-radius: 8px;
  background: var(--stone);
  box-shadow: var(--shadow);
}

.hero-visual img {
  width: 100%;
  height: 100%;
  min-height: 520px;
  display: block;
  object-fit: cover;
}

.hero-note {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 22px;
  border: 1px solid rgba(255, 250, 241, 0.42);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.88);
  box-shadow: 0 12px 28px rgba(26, 38, 31, 0.18);
  padding: 16px 18px;
  backdrop-filter: blur(10px);
}

.hero-note strong,
.hero-note span {
  display: block;
}

.hero-note strong {
  color: var(--green);
}

.hero-note span {
  margin-top: 5px;
  color: var(--muted);
}

.section-block {
  padding: 38px 0;
  border-top: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 650;
  letter-spacing: 0;
}

.case-wall {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.case-card {
  min-height: 448px;
  display: grid;
  grid-template-rows: 214px 1fr auto;
  overflow: hidden;
  border: 1px solid rgba(104, 112, 102, 0.22);
  border-radius: 8px;
  background: var(--paper-strong);
  box-shadow: 0 10px 28px rgba(35, 45, 38, 0.08);
}

.case-card.is-selected {
  border-color: rgba(31, 63, 49, 0.68);
  box-shadow: 0 0 0 3px rgba(31, 63, 49, 0.12), var(--shadow);
}

.villa-preview {
  position: relative;
  overflow: hidden;
  background: #e9e2d5;
}

.villa-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.villa-preview::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 46%;
  background: linear-gradient(180deg, transparent, rgba(20, 32, 27, 0.3));
  pointer-events: none;
}

.case-body {
  padding: 16px 16px 14px;
}

.case-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.case-title-row h3 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  font-weight: 650;
}

.template-chip {
  max-width: 128px;
  overflow: hidden;
  border: 1px solid rgba(31, 63, 49, 0.18);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-row,
.param-grid,
.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag-row {
  margin: 12px 0;
}

.tag,
.param-grid span {
  border-radius: 999px;
  font-size: 12px;
}

.tag {
  border: 1px solid #e4d7c4;
  padding: 3px 8px;
  background: #fbf4e8;
  color: #6a5238;
}

.param-grid span {
  border: 1px solid #ebe4d8;
  background: #faf7ef;
  color: #47544c;
  padding: 5px 9px;
}

.case-action,
.primary-action,
.secondary-action {
  height: 46px;
  border: 0;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  cursor: pointer;
  font-weight: 850;
}

.case-action {
  width: calc(100% - 32px);
  margin: 0 16px 16px;
}

.case-action:hover,
.primary-action:hover,
.secondary-action:hover {
  background: #163126;
}

.primary-action:disabled,
.secondary-action:disabled {
  cursor: wait;
  opacity: 0.72;
}

.secondary-action {
  width: min(100%, 260px);
  background: #6f5133;
}

.requirements-panel,
.result-panel {
  scroll-margin-top: 18px;
}

.selected-summary,
.status-box,
.business-outcome,
.gallery-panel,
.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.9);
  padding: 16px;
}

.selected-summary {
  margin-bottom: 14px;
  color: var(--green);
  font-weight: 750;
}

.requirements-form {
  display: grid;
  gap: 16px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: #4e5a52;
  font-size: 13px;
  font-weight: 800;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdf8;
  color: var(--text);
  outline: none;
}

select {
  height: 44px;
  padding: 0 10px;
}

input {
  min-height: 44px;
  padding: 0 10px;
}

textarea {
  min-height: 102px;
  resize: vertical;
  padding: 10px;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 63, 49, 0.1);
}

[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(157, 53, 39, 0.1);
}

.field-error {
  min-height: 18px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 750;
}

.form-error {
  display: block;
  margin: -4px 0 8px;
}

.toggle-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.58);
  padding: 12px 14px 14px;
}

.toggle-grid legend {
  padding: 0 6px;
  color: #4e5a52;
  font-size: 13px;
  font-weight: 800;
}

.toggle-grid label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-weight: 650;
}

.wide-field {
  display: grid;
}

.requirements-form .primary-action {
  width: min(100%, 280px);
  margin: 0;
}

.step-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.step-actions .primary-action,
.step-actions .secondary-action {
  min-height: 44px;
}

.status-box {
  margin-bottom: 14px;
  color: var(--green);
  font-weight: 800;
}

.status-box.is-error {
  color: var(--danger);
}

.business-outcome {
  margin-bottom: 14px;
  color: #435047;
}

.budget-export-panel {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 0 0 14px;
}

.budget-status {
  color: var(--muted);
  font-size: 13px;
}

.business-outcome strong {
  display: block;
  color: var(--green);
}

.business-outcome ol {
  margin: 8px 0 0 20px;
  padding: 0;
}

.review-summary {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.9);
  padding: 16px;
}

.review-row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 14px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(222, 213, 198, 0.72);
}

.review-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.review-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.review-row strong,
.review-extra {
  overflow-wrap: anywhere;
}

.review-extra {
  margin: 2px 0 0;
  color: var(--muted);
}

.generation-steps {
  display: grid;
  gap: 10px;
  max-width: 620px;
}

.generation-steps span {
  min-height: 44px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.9);
  color: var(--green);
  padding: 0 14px;
  font-weight: 800;
}

.result-cards {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.1fr) minmax(0, 1.2fr);
  gap: 14px;
  margin-bottom: 14px;
}

.result-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.result-card strong {
  overflow-wrap: anywhere;
}

.result-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

.gallery-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.gallery-heading h3 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: 650;
}

.gallery-heading span,
.empty-state {
  color: var(--muted);
  font-size: 13px;
}

.render-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.history-card {
  overflow: hidden;
  border: 1px solid #e1d8c8;
  border-radius: 8px;
  background: #fff;
}

.history-thumb {
  height: 132px;
  display: grid;
  place-items: center;
  background: #ece7dd;
  color: var(--muted);
  text-align: center;
  padding: 12px;
}

.history-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.history-body {
  padding: 12px;
}

.history-body strong {
  display: block;
}

.history-body span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 980px) {
  .hero-section,
  .case-wall,
  .field-grid,
  .result-cards,
  .render-gallery {
    grid-template-columns: 1fr;
  }

  .hero-section {
    min-height: auto;
    padding-top: 38px;
  }

  .hero-visual,
  .hero-visual img {
    min-height: 420px;
  }

  .section-heading,
  .gallery-heading {
    display: block;
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 16px;
  }

  h1 {
    font-size: 36px;
  }

  .subtitle {
    font-size: 16px;
  }

  .hero-visual,
  .hero-visual img {
    min-height: 320px;
  }

  .hero-note {
    position: static;
    border-width: 0;
    border-top: 1px solid rgba(104, 112, 102, 0.18);
    border-radius: 0;
    box-shadow: none;
  }

  .case-card {
    min-height: 0;
  }

  .template-chip {
    max-width: 104px;
  }

  .requirements-form .primary-action {
    width: 100%;
  }

  .step-actions {
    display: grid;
  }

  .step-actions .primary-action,
  .step-actions .secondary-action {
    width: 100%;
  }

  .review-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  #flowProgressBar {
    transition: none;
  }
}
