/* Self-hosted variable fonts (CSP is 'self'-only — no third-party requests). */
@font-face {
  font-family: 'Lora';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/lora.woff2') format('woff2');
}
@font-face {
  font-family: 'Lora';
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/lora-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Karla';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('/fonts/karla.woff2') format('woff2');
}

:root {
  --bg: #f1ebdf;
  --card: #fbf8f0;
  --ink: #241f19;
  --ink-mid: #4d4638;
  --ink-firm: #5f5745;
  --ink-soft: #8a7d64;
  --ink-faint: #a5977c;
  --ink-ghost: #b3a58a;
  --line: #ddd2bc;
  --line-soft: #e4dac4;
  --line-dash: #cfc2a6;
  --pine: #1e4736;
  --pine-dark: #173d2c;
  --green: #2a6b4f;
  --cream: #f6f0e2;
  --sage: #a8c4a2;
  --rust: #96543a;
  --serif: 'Lora', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  font-family: 'Karla', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green); }
a:hover { color: var(--pine-dark); }
input, select, textarea { font-family: inherit; }

.page { max-width: 936px; margin: 0 auto; padding: 34px 28px 90px; }

.muted { color: var(--ink-faint); font-size: 14px; padding: 36px 28px; }

/* ---------- Hero (list view) ---------- */

.hero {
  background: var(--pine);
  background-image: radial-gradient(ellipse 120% 90% at 85% -10%, rgba(122, 168, 116, 0.28), transparent 55%);
  padding: 52px 28px 100px;
}
.hero-inner { max-width: 880px; margin: 0 auto; }
.hero-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.hero-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--sage); margin-bottom: 14px;
}
.hero h1 {
  font-family: var(--serif); font-weight: 500; font-style: italic; font-size: 46px;
  line-height: 1; margin: 0; color: var(--cream); letter-spacing: -0.01em;
}
.btn-hero {
  flex: none; background: var(--cream); color: var(--pine); border: none; border-radius: 99px;
  padding: 12px 22px; font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.btn-hero:hover { background: #fffdf6; box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25); }

.hero-stats {
  display: flex; gap: 34px; margin-top: 30px;
  border-top: 1px solid rgba(246, 240, 226, 0.18); padding-top: 20px;
}
.stat-num { font-family: var(--serif); font-size: 26px; font-weight: 600; color: var(--cream); }
.stat-label {
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--sage);
}

/* List content overlaps the bottom of the hero. */
.list-content { max-width: 936px; margin: -56px auto 0; padding: 0 28px 90px; }

.section-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 16px; }
.section-head h2 { font-family: var(--serif); font-weight: 600; font-size: 21px; margin: 0; }
.section-head .rule { flex: 1; height: 1px; align-self: center; }
.section-head.on-hero h2 { color: var(--cream); }
.section-head.on-hero .rule { background: rgba(246, 240, 226, 0.25); }
.section-head.past h2 { color: #7a6f5a; }
.section-head.past .rule { background: var(--line); }

/* ---------- Upcoming cards ---------- */

.card-list { display: flex; flex-direction: column; gap: 16px; margin-bottom: 56px; }

.card-wrap { position: relative; width: 100%; }

.card {
  display: flex; align-items: stretch; width: 100%; padding: 0;
  background: var(--card); border: none; border-radius: 16px; overflow: hidden;
  cursor: pointer; text-align: left; font: inherit; color: inherit;
  box-shadow: 0 1px 2px rgba(36, 31, 25, 0.06), 0 8px 24px rgba(36, 31, 25, 0.07);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.card:hover {
  box-shadow: 0 2px 4px rgba(36, 31, 25, 0.08), 0 14px 36px rgba(30, 71, 54, 0.18);
  transform: translateY(-2px);
}

.photo {
  display: flex; align-items: center; justify-content: center;
  font-family: ui-monospace, Menlo, monospace; font-size: 10px; letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.75); text-transform: uppercase;
}
/* Seeded gradient placeholders (house id % 8), as in the design mock. */
.ph-0 { background: linear-gradient(140deg, #9aab8d 0%, #5f7a63 100%); }
.ph-1 { background: linear-gradient(140deg, #c2a173 0%, #8d6f4a 100%); }
.ph-2 { background: linear-gradient(140deg, #8fa3ad 0%, #5c7078 100%); }
.ph-3 { background: linear-gradient(140deg, #b98d7e 0%, #8a5f52 100%); }
.ph-4 { background: linear-gradient(140deg, #a89b7a 0%, #6f6448 100%); }
.ph-5 { background: linear-gradient(140deg, #7f9686 0%, #4d6355 100%); }
.ph-6 { background: linear-gradient(140deg, #b3a68a 0%, #7d7157 100%); }
.ph-7 { background: linear-gradient(140deg, #93a89f 0%, #5d7268 100%); }

.card .photo { flex: none; width: 190px; min-height: 132px; }
.photo-img { object-fit: cover; }

.date-block {
  flex: none; width: 86px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 1px; border-right: 1px dashed var(--line); padding: 18px 0;
}
.date-mon {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.18em; color: var(--ink-faint);
  text-transform: uppercase;
}
.date-day { font-family: var(--serif); font-size: 34px; font-weight: 600; line-height: 1; color: var(--pine); }
.date-time { font-size: 12px; font-weight: 600; color: var(--ink-soft); margin-top: 3px; }

.card-body {
  flex: 1; min-width: 0; padding: 20px 48px 20px 24px;
  display: flex; flex-direction: column; justify-content: center; gap: 7px;
}
.card-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-title { font-family: var(--serif); font-size: 19px; font-weight: 600; color: var(--ink); }
.card-location { font-size: 13.5px; color: var(--ink-soft); }
.card-stats { display: flex; gap: 8px; align-items: baseline; margin-top: 2px; }
.price { font-family: var(--serif); font-weight: 700; color: var(--pine); font-size: 18px; }
.stat-dot { font-size: 13px; color: var(--ink-ghost); }
.surface { font-size: 13.5px; font-weight: 600; color: var(--ink-firm); }
.ppm2 { font-size: 12.5px; color: var(--ink-ghost); }

.chip {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 99px; white-space: nowrap;
}
.chip.offer { background: var(--pine); color: var(--cream); }
.chip.rejected { background: #eaddd6; color: var(--rust); }
.chip.visited { background: #e6dfcd; color: #6f6448; }
.chip.rdv { background: #dcead9; color: var(--green); }
.chip.contacted { background: #efe6d0; color: #8a713d; }
.chip.todo { background: #f0e9da; color: var(--ink-faint); }

.empty {
  border: 1.5px dashed var(--line-dash); border-radius: 16px; padding: 34px;
  text-align: center; color: var(--ink-faint); font-size: 14px; margin-bottom: 56px;
  background: rgba(251, 248, 240, 0.6);
}

/* ---------- Already visited rows ---------- */

.done-list { display: flex; flex-direction: column; gap: 10px; }

.done-row {
  display: flex; align-items: center; gap: 18px; width: 100%;
  background: rgba(251, 248, 240, 0.7); border: 1px solid var(--line-soft);
  border-radius: 14px; padding: 12px 48px 12px 12px; cursor: pointer;
  text-align: left; font: inherit; color: inherit;
  transition: background 0.12s, border-color 0.12s;
}
.done-row:hover { background: var(--card); border-color: #c3b391; }
.done-row .photo {
  flex: none; width: 72px; height: 56px; border-radius: 9px;
  filter: saturate(0.55) brightness(1.04); font-size: 0;
}
.done-body { flex: 1; min-width: 0; }
.done-title { font-family: var(--serif); font-size: 15.5px; font-weight: 600; color: var(--ink-mid); }
.done-meta { font-size: 12.5px; color: var(--ink-faint); margin-top: 2px; }
.done-price { flex: none; font-family: var(--serif); font-size: 13.5px; font-weight: 700; color: #7a6f5a; }

/* Delete control in the reserved right gutter of each row. */
.card-delete {
  position: absolute; top: 50%; right: 10px; transform: translateY(-50%);
  width: 32px; height: 32px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--card); border: 1px solid var(--line-soft);
  color: var(--ink-ghost); cursor: pointer; padding: 0;
  opacity: 0; transition: opacity 0.12s, color 0.12s, border-color 0.12s, background 0.12s;
}
.card-wrap:hover .card-delete, .card-delete:focus-visible { opacity: 1; }
.card-delete:hover { color: var(--rust); border-color: #d9bcae; background: #f6ebe4; }
.card-delete:disabled { opacity: 0.4; cursor: default; }

/* ---------- Buttons ---------- */

.btn-primary {
  background: var(--pine); color: var(--cream); border: none; border-radius: 99px;
  padding: 12px 26px; font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.btn-primary:hover { background: var(--pine-dark); }

.btn-secondary {
  background: none; border: 1.5px solid var(--line-dash); border-radius: 99px;
  padding: 10px 20px; font-size: 13px; font-weight: 700; color: var(--ink-firm);
  cursor: pointer; font-family: inherit;
}
.btn-secondary:hover { border-color: var(--green); color: var(--green); }

.btn-ghost {
  background: none; border: 1.5px solid var(--line-dash); border-radius: 99px;
  padding: 8px 15px; font-size: 12px; font-weight: 700; color: var(--ink-firm);
  cursor: pointer; font-family: inherit;
}
.btn-ghost:hover { border-color: var(--green); color: var(--green); }

.btn-link {
  background: none; border: none; color: var(--green); font-size: 13.5px;
  font-weight: 700; letter-spacing: 0.04em; cursor: pointer; padding: 0;
  margin-bottom: 24px; font-family: inherit;
}
.btn-link:hover { color: var(--pine-dark); }

.btn-danger {
  background: none; border: 1.5px solid #d9bcae; border-radius: 99px;
  padding: 11px 20px; font-size: 14px; font-weight: 700; color: var(--rust);
  cursor: pointer; font-family: inherit;
}
.btn-danger:hover { border-color: var(--rust); }

/* ---------- Detail view ---------- */

.photo-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 160px 160px;
  gap: 10px; margin-bottom: 30px; border-radius: 18px; overflow: hidden;
}
.photo-grid .photo:first-child { grid-row: 1 / 3; }
.photo-grid .photo-img { width: 100%; height: 100%; }

/* Gallery variant: show every stored photo, first one larger. */
.photo-grid.gallery {
  grid-template-columns: repeat(4, 1fr); grid-auto-rows: 140px; grid-template-rows: none;
}
.photo-grid.gallery .photo:first-child { grid-column: span 2; grid-row: span 2; }
.photo-grid.gallery.single { grid-template-columns: 1fr; grid-auto-rows: 360px; }
.photo-grid.gallery.single .photo:first-child { grid-column: auto; grid-row: auto; }

.detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.detail-location {
  font-size: 11px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-faint); margin-bottom: 8px;
}
.detail-header h1 {
  font-family: var(--serif); font-weight: 600; font-size: 34px; margin: 0;
  letter-spacing: -0.01em; color: var(--ink);
}

.detail-stats {
  display: flex; gap: 20px; align-items: baseline; margin: 18px 0 30px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 16px 0; flex-wrap: wrap;
}
.detail-stats .price { font-size: 24px; }
.detail-stats .surface { font-size: 14.5px; }
.detail-stats .ppm2 { font-size: 13px; color: var(--ink-faint); }
.detail-stats .chip { margin-left: auto; align-self: center; font-size: 11px; padding: 5px 12px; }

.detail-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 34px; align-items: start; }

.detail-grid h3 {
  font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 18px;
  margin: 0 0 12px; color: var(--pine);
}
.description { margin: 0; font-size: 15px; line-height: 1.75; color: var(--ink-mid); text-wrap: pretty; }

.visit-card {
  margin-top: 26px; background: var(--card); border-radius: 14px; padding: 16px 20px;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  box-shadow: 0 1px 2px rgba(36, 31, 25, 0.05);
}
.visit-date-block {
  flex: none; width: 44px; height: 44px; border-radius: 12px; background: #e7efe6;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.visit-mon {
  font-size: 8.5px; font-weight: 700; letter-spacing: 0.12em; color: var(--green);
  text-transform: uppercase;
}
.visit-day { font-family: var(--serif); font-size: 17px; font-weight: 700; line-height: 1; color: var(--pine); }
.visit-info { flex: 1; min-width: 120px; }
.visit-when { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.visit-at { font-size: 12.5px; color: var(--ink-soft); }

/* Dark contact card */
.contact-card { background: var(--pine); border-radius: 18px; padding: 24px; color: #e9e2cf; }
.contact-card h3 {
  font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 18px;
  margin: 0 0 16px; color: var(--cream);
}
.contact-rows { display: flex; flex-direction: column; gap: 13px; font-size: 13.5px; }
.contact-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.contact-row .label { color: var(--sage); }
.contact-row .value { font-weight: 700; color: var(--cream); }
.contact-row .value.yes { color: #bfe3b8; }
.contact-row .value.no { color: #e8c9b8; }
.contact-row.rule, .reply-block.rule { border-top: 1px solid rgba(246, 240, 226, 0.18); padding-top: 13px; }
.reply-block .label {
  color: var(--sage); margin-bottom: 6px; font-size: 12px; letter-spacing: 0.06em;
  text-transform: uppercase; font-weight: 700;
}
.reply-quote {
  font-family: var(--serif); font-style: italic; font-size: 14.5px; color: #e9e2cf;
  line-height: 1.6;
}
.contact-card .chip { background: var(--cream); color: var(--pine); }

.follow-up {
  margin-top: 16px; background: rgba(246, 240, 226, 0.1);
  border: 1px dashed rgba(246, 240, 226, 0.3); border-radius: 10px;
  padding: 11px 14px; font-size: 12.5px; color: #d8d2bd; line-height: 1.5;
}
.follow-up strong { color: var(--cream); }

/* ---------- Import from listing ---------- */

.import-card {
  background: var(--card); border-radius: 18px; padding: 20px 24px; max-width: 640px;
  margin-bottom: 18px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 1px 2px rgba(36, 31, 25, 0.06), 0 8px 24px rgba(36, 31, 25, 0.07);
}
.import-row { display: flex; gap: 10px; }
.import-input {
  flex: 1; border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 13px;
  font-size: 14.5px; background: #fff; color: var(--ink); min-width: 0;
}
.import-status { font-size: 13px; color: var(--green); }
.import-status.error { color: var(--rust); }

.import-toggle {
  background: none; border: none; padding: 0; text-align: left; cursor: pointer;
  font-family: inherit; font-size: 12.5px; color: var(--ink-faint); text-decoration: underline;
}
.import-toggle:hover { color: var(--green); }
.import-paste-area { display: flex; flex-direction: column; gap: 10px; }
.import-paste-area[hidden] { display: none; }
.import-help { font-size: 13px; color: var(--ink-mid); line-height: 1.5; }
.import-paste {
  border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-size: 12px; font-family: ui-monospace, Menlo, monospace; background: #fff;
  color: var(--ink); resize: vertical;
}
.import-paste-area .btn-secondary { align-self: flex-start; }

/* ---------- Form ---------- */

.form-title { font-family: var(--serif); font-weight: 600; font-size: 30px; margin: 0 0 26px; color: var(--ink); }

.form-card {
  background: var(--card); border-radius: 18px; padding: 30px;
  display: flex; flex-direction: column; gap: 18px; max-width: 640px;
  box-shadow: 0 1px 2px rgba(36, 31, 25, 0.06), 0 8px 24px rgba(36, 31, 25, 0.07);
}

.field {
  display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft);
}
.field input, .field select, .field textarea {
  border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 13px;
  font-size: 14.5px; background: #fff; color: var(--ink);
  letter-spacing: normal; text-transform: none; font-weight: 400;
}
.field textarea { resize: vertical; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field.narrow { max-width: 240px; }

.checkbox-field {
  display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600;
  color: var(--ink); cursor: pointer;
}
.checkbox-field input { width: 17px; height: 17px; accent-color: var(--green); }

.form-section { border-top: 1px solid var(--line-soft); padding-top: 20px; display: flex; flex-direction: column; gap: 18px; }
.form-section-title {
  font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 17px;
  color: var(--pine);
}

.form-actions { display: flex; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.form-actions .btn-cancel {
  background: none; border: 1.5px solid var(--line-dash); border-radius: 99px;
  padding: 12px 20px; font-size: 14px; font-weight: 700; color: var(--ink-firm);
  cursor: pointer; font-family: inherit;
}
.form-actions .btn-cancel:hover { border-color: var(--ink-soft); }
.form-actions .btn-danger { margin-left: auto; }

.form-error {
  background: #f6ebe4; border: 1px solid #d9bcae; border-radius: 10px;
  padding: 10px 12px; font-size: 13px; color: var(--rust);
}

.banner-error {
  background: #f6ebe4; border: 1px solid #d9bcae; border-radius: 10px;
  padding: 12px 14px; font-size: 13.5px; color: var(--rust); margin-bottom: 20px;
}

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  .hero { padding: 40px 20px 88px; }
  .hero h1 { font-size: 36px; }
  .hero-top { flex-wrap: wrap; align-items: flex-start; }
  .hero-stats { gap: 24px; }
  .list-content { padding: 0 20px 70px; }
  .page { padding: 28px 20px 70px; }

  .card .photo { width: 120px; min-height: 116px; }
  .date-block { width: 68px; }
  .date-day { font-size: 28px; }
  .card-body { padding: 16px 42px 16px 16px; }

  .detail-grid { grid-template-columns: 1fr; }
  .photo-grid:not(.gallery) { grid-template-columns: 1fr 1fr; grid-template-rows: 120px 120px; }
  .photo-grid:not(.gallery) .photo:nth-child(n+4) { display: none; }
  .photo-grid.gallery { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 120px; }
}
