/* ===== OPTIMUS v1 — "Property Desk" editorial theme ===== */
:root {
  --paper: #f3eee2;
  --paper-2: #ece5d4;
  --surface: #fcfaf3;
  --surface-hi: #ffffff;
  --ink: #211f18;
  --ink-soft: #4d483c;
  --muted: #847c69;
  --faint: #a89e86;
  --line: #ded5c0;
  --line-strong: #cdc3a8;
  --green: #1c5d44;
  --green-d: #14442f;
  --green-soft: #e3ecdf;
  --gold: #9a7b2e;
  --danger: #a23a2f;
  --danger-soft: #f4e6df;
  --shadow: 0 18px 40px -26px rgba(48, 40, 18, 0.45);
  --shadow-sm: 0 8px 22px -16px rgba(48, 40, 18, 0.4);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Hanken Grotesk", system-ui, -apple-system, sans-serif;
  --r: 14px;
}

* { box-sizing: border-box; }

/* Let the HTML [hidden] attribute win over class rules that set display. */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(1100px 600px at 85% -5%, rgba(28, 93, 68, 0.06), transparent 60%),
    radial-gradient(900px 500px at 0% 0%, rgba(154, 123, 46, 0.05), transparent 55%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--green); }

/* Shared bits ------------------------------------------------ */
.eyebrow {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--green);
  margin: 0 0 14px;
}
.muted { color: var(--muted); }
.ital { font-style: italic; color: var(--green); }

/* ===== Top bar ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px clamp(18px, 5vw, 56px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 13px; text-decoration: none; color: var(--ink); }
.logo-mark { color: var(--green); display: grid; place-items: center; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 24px;
  letter-spacing: -0.01em;
}
.brand-name .ver {
  font-family: var(--sans);
  font-size: 11px; font-weight: 600;
  color: var(--gold);
  vertical-align: super;
  margin-left: 4px;
  letter-spacing: 0.02em;
}
.brand-sub {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 3px;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }

.provider-pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600;
  color: var(--muted);
  padding: 7px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
}
.provider-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.provider-pill.live { color: var(--ink); border-color: var(--green); }
.provider-pill.live .dot { background: var(--green); }

.ghost-btn {
  font-family: var(--sans);
  font-size: 13px; font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  padding: 9px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.16s;
}
.ghost-btn:hover { background: var(--paper-2); border-color: var(--ink-soft); }

/* ===== Settings ===== */
.settings {
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
  animation: fade 0.22s ease;
}
@keyframes fade { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.settings-inner { max-width: 680px; margin: 0 auto; padding: 30px clamp(18px, 5vw, 56px) 36px; }
.settings-title { font-family: var(--serif); font-weight: 600; font-size: 26px; margin: 0 0 6px; }
.settings-note { margin: 0 0 22px; color: var(--muted); font-size: 14px; line-height: 1.55; max-width: 52ch; }

.field { margin-bottom: 18px; }
.field-label {
  display: block;
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.opt-tag { font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--faint); font-size: 11px; }
.settings input[type="password"], .settings input[type="text"] {
  width: 100%;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--surface-hi);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 12px 14px;
  outline: none;
  transition: 0.16s;
}
.settings input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(28, 93, 68, 0.13); }
.hint { display: block; margin-top: 7px; font-size: 12.5px; color: var(--muted); }
.hint a { text-decoration: none; font-weight: 600; }
.hint a:hover { text-decoration: underline; }

.seg {
  display: inline-flex; flex-wrap: wrap;
  background: var(--surface-hi);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 4px; gap: 4px;
}
.seg-opt { position: relative; }
.seg-opt input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.seg-opt span {
  display: block;
  font-size: 13px; font-weight: 600;
  padding: 9px 16px;
  border-radius: 9px;
  color: var(--muted);
  cursor: pointer;
  transition: 0.16s;
  white-space: nowrap;
}
.seg-opt input:checked + span { color: var(--surface-hi); background: var(--green); }

.model-row { display: flex; gap: 8px; }
#modelSelect {
  flex: 1; min-width: 0;
  font-family: var(--sans); font-size: 14px; color: var(--ink);
  background: var(--surface-hi);
  border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 11px 14px;
  outline: none; appearance: none; cursor: pointer;
}
#modelSelect:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(28, 93, 68, 0.13); }
.reload-btn {
  flex: none; width: 46px;
  font-size: 17px; color: var(--ink-soft);
  background: var(--surface-hi);
  border: 1px solid var(--line-strong);
  border-radius: 10px; cursor: pointer; transition: 0.16s;
}
.reload-btn:hover { background: var(--paper-2); border-color: var(--green); color: var(--green); }
.reload-btn:active { transform: rotate(90deg); }

.settings-actions { display: flex; align-items: center; gap: 16px; margin-top: 24px; }
.primary-btn {
  font-family: var(--sans);
  font-weight: 700; font-size: 14px;
  color: var(--surface-hi);
  background: var(--green);
  border: none;
  padding: 12px 24px;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.16s;
}
.primary-btn:hover { background: var(--green-d); transform: translateY(-1px); }
.save-status { font-size: 13px; color: var(--green); font-weight: 700; }

/* ===== Container / hero ===== */
.container { max-width: 1000px; margin: 0 auto; padding: clamp(34px, 6vw, 68px) clamp(18px, 5vw, 56px) 64px; }
.hero { max-width: 760px; margin: 0 0 38px; }
.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(36px, 6.4vw, 62px);
  line-height: 1.03;
  letter-spacing: -0.015em;
  margin: 0 0 20px;
}
.lede { color: var(--ink-soft); font-size: clamp(15px, 1.8vw, 18px); line-height: 1.6; max-width: 56ch; margin: 0; }

/* ===== Input card ===== */
.input-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 24px;
  box-shadow: var(--shadow);
}
.block-label {
  display: block;
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.address-row { display: flex; gap: 12px; }
.address-field { position: relative; flex: 1; min-width: 0; }
#addressInput {
  width: 100%;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
  background: var(--surface-hi);
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  padding: 15px 18px;
  outline: none;
  transition: 0.16s;
}

/* Address autocomplete dropdown */
.ac-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  z-index: 30;
  margin: 0; padding: 6px;
  list-style: none;
  background: var(--surface-hi);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: 320px;
  overflow-y: auto;
}
.ac-item {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.ac-item::before {
  content: "⌖";
  color: var(--green);
  font-size: 13px;
  align-self: center;
}
.ac-item.active { background: var(--green-soft); }
.ac-main { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.ac-sec { font-size: 12.5px; color: var(--muted); }
.ac-note { margin: 12px 2px 0; font-size: 12.5px; color: var(--muted); }
#addressInput::placeholder { color: var(--faint); }
#addressInput:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(28, 93, 68, 0.13); }

.build-btn {
  font-family: var(--sans);
  font-weight: 700; font-size: 16px;
  color: var(--surface-hi);
  background: var(--green);
  border: none;
  border-radius: 11px;
  padding: 0 28px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 10px;
  transition: 0.16s;
  box-shadow: var(--shadow-sm);
}
.build-btn .arrow { transition: transform 0.16s; }
.build-btn:hover:not(:disabled) { background: var(--green-d); }
.build-btn:hover:not(:disabled) .arrow { transform: translateX(3px); }
.build-btn:disabled { opacity: 0.6; cursor: progress; }

.details { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.details summary {
  cursor: pointer; user-select: none; list-style: none;
  font-size: 13.5px; font-weight: 600; color: var(--green);
}
.details summary::-webkit-details-marker { display: none; }
.details summary::before { content: "+ "; font-weight: 700; }
.details[open] summary::before { content: "– "; }
.details-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 18px; }
.mini-field { display: flex; flex-direction: column; }
.mini-field.wide { grid-column: span 4; }
.mini-field label { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; }
.mini-field input, .mini-field select {
  font-family: var(--sans);
  font-size: 14px; color: var(--ink);
  background: var(--surface-hi);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  outline: none;
}
.mini-field input:focus, .mini-field select:focus { border-color: var(--green); }
.mini-field select { appearance: none; cursor: pointer; }

/* Photo upload */
.uploads { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.upload-zone {
  margin-top: 10px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 12px;
  padding: 22px;
  text-align: center;
  cursor: pointer;
  transition: 0.16s;
  background: var(--surface-hi);
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--green); background: var(--green-soft); }
.upload-cta { font-size: 14px; color: var(--ink-soft); font-weight: 500; }
.upload-cta .plus { color: var(--green); font-weight: 700; margin-right: 5px; }
.upload-previews { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 12px; }
.upl-thumb {
  position: relative; aspect-ratio: 1;
  border-radius: 8px; overflow: hidden; border: 1px solid var(--line);
}
.upl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.upl-rm {
  position: absolute; top: 3px; right: 3px;
  width: 20px; height: 20px;
  border: none; border-radius: 50%;
  background: rgba(33, 31, 24, 0.72); color: #fff;
  font-size: 14px; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
}
.upl-rm:hover { background: var(--danger); }

/* ===== Blocks ===== */
.block {
  margin-top: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 24px;
}
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.block h3 { font-family: var(--serif); font-weight: 600; font-size: 19px; margin: 0; }

/* Images */
.img-card {
  margin: 0; border-radius: 11px; overflow: hidden;
  border: 1px solid var(--line); background: var(--paper-2);
  position: relative;
}
.img-card img, .img-card iframe { width: 100%; height: 200px; object-fit: cover; display: block; border: 0; }

/* Big live map hero */
.map-hero { margin: 0 0 14px; }
.img-card.map-hero iframe { height: 460px; }

/* Real property photos pulled for the address */
.photo-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.img-card.photo img { height: 156px; }
.img-card figcaption {
  position: absolute; left: 10px; bottom: 10px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink);
  background: rgba(252, 250, 243, 0.92);
  border: 1px solid var(--line);
  padding: 4px 9px; border-radius: 6px;
}

/* Loading */
.loading-panel { display: flex; align-items: center; gap: 16px; }
.loading-panel p { margin: 0; color: var(--ink-soft); font-size: 14.5px; }
.spinner {
  width: 22px; height: 22px; flex: none;
  border: 2.5px solid var(--line-strong);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Error */
.error-panel { display: flex; gap: 14px; align-items: flex-start; border-color: rgba(162, 58, 47, 0.4); background: var(--danger-soft); }
.err-mark {
  flex: none; width: 24px; height: 24px;
  display: grid; place-items: center;
  font-family: var(--serif); font-weight: 700;
  color: var(--surface-hi); background: var(--danger);
  border-radius: 50%; font-size: 15px;
}
.error-panel strong { display: block; margin-bottom: 4px; font-size: 15px; }
.error-panel p { margin: 0; color: var(--ink-soft); font-size: 13.5px; line-height: 1.55; word-break: break-word; }

/* ===== Results ===== */
.results { animation: fade 0.28s ease; }

.ad-preview {
  margin-top: 22px;
  display: grid;
  grid-template-columns: 340px 1fr;
  background: var(--surface-hi);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.ad-media { position: relative; min-height: 260px; background: var(--paper-2); }
.ad-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ad-price {
  position: absolute; top: 14px; left: 14px;
  font-family: var(--serif); font-weight: 600; font-size: 19px;
  color: var(--surface-hi); background: var(--green);
  padding: 6px 14px; border-radius: 8px;
  box-shadow: var(--shadow-sm);
}
.ad-body { padding: 28px; }
.ad-body h2 { font-family: var(--serif); font-weight: 600; font-size: 27px; line-height: 1.15; margin: 0 0 10px; letter-spacing: -0.01em; }
.ad-sub { color: var(--green); font-weight: 600; margin: 0 0 16px; font-size: 15px; }
.ad-copy { color: var(--ink-soft); line-height: 1.72; font-size: 15px; margin: 0 0 18px; white-space: pre-wrap; }

.copy-btn {
  font-family: var(--sans);
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--green);
  background: var(--green-soft);
  border: 1px solid transparent;
  padding: 8px 15px; border-radius: 8px;
  cursor: pointer; transition: 0.16s;
}
.copy-btn:hover { background: #d6e3d2; }
.copy-btn.copied { color: var(--surface-hi); background: var(--green); }

.ad-gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 18px; }
.ad-gallery img {
  width: 100%; height: 78px; object-fit: cover; display: block;
  border-radius: 8px; border: 1px solid var(--line);
}

.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 2px; }
.result-card h3 { margin-bottom: 16px; }

.tick-list, .num-list, .channel-list { margin: 0; padding: 0; list-style: none; }
.tick-list li, .num-list li {
  position: relative; padding: 9px 0 9px 26px;
  color: var(--ink-soft); font-size: 14.5px; line-height: 1.5;
  border-bottom: 1px solid var(--line);
}
.tick-list li:last-child, .num-list li:last-child { border-bottom: none; }
.tick-list li::before { content: "◆"; position: absolute; left: 0; top: 9px; color: var(--green); font-size: 11px; }
.num-list { counter-reset: q; }
.num-list li { counter-increment: q; }
.num-list li::before {
  content: counter(q);
  position: absolute; left: 0; top: 8px;
  width: 19px; height: 19px;
  font-family: var(--serif); font-size: 12px; font-weight: 600;
  color: var(--green); border: 1px solid var(--line-strong);
  border-radius: 50%; display: grid; place-items: center;
}
.channel-list { counter-reset: c; }
.channel-list li { counter-increment: c; padding: 13px 0; border-bottom: 1px solid var(--line); }
.channel-list li:last-child { border-bottom: none; }
.channel-name { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14.5px; color: var(--ink); margin-bottom: 4px; }
.channel-name::before {
  content: counter(c);
  flex: none; width: 22px; height: 22px;
  font-family: var(--serif); font-size: 12px; font-weight: 600;
  color: var(--surface-hi); background: var(--green);
  border-radius: 50%; display: grid; place-items: center;
}
.channel-reason { color: var(--muted); font-size: 13.5px; line-height: 1.5; padding-left: 32px; }

.pricing-text { color: var(--ink-soft); line-height: 1.65; font-size: 14.5px; margin: 0; }
.social-h { margin-top: 24px !important; }
.social-text {
  color: var(--ink-soft); line-height: 1.6; font-size: 14px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px; margin: 0 0 14px; white-space: pre-wrap;
}

/* Footer */
.site-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  max-width: 1000px; margin: 0 auto;
  padding: 26px clamp(18px, 5vw, 56px) 44px;
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12.5px;
}
.foot-brand { font-family: var(--serif); font-weight: 600; font-size: 15px; color: var(--ink); }
.foot-meta { color: var(--muted); }

/* ===== Responsive ===== */
@media (max-width: 760px) {
  .address-row { flex-direction: column; }
  .build-btn { padding: 15px; justify-content: center; }
  .details-grid { grid-template-columns: repeat(2, 1fr); }
  .mini-field.wide { grid-column: span 2; }
  .photo-strip { grid-template-columns: repeat(2, 1fr); }
  .upload-previews { grid-template-columns: repeat(4, 1fr); }
  .img-card.map-hero iframe { height: 300px; }
  .ad-preview { grid-template-columns: 1fr; }
  .ad-media { min-height: 220px; }
  .result-grid { grid-template-columns: 1fr; }
}
