/* Palette: Alaska Golden Hills — alpine navy dusk, warm gold, sand, cream */
:root {
  --ink: #241c14;
  --forest: #1e2f3f;
  --paper: #faf5ea;
  --moss: #d8c39c;
  --moss-light: #f0e6d1;
  --marigold: #c98a2e;
  --airbnb: #e0565b;
  --vrbo: #2f66c4;
  --line: #e2d5bd;
  --radius: 10px;
  font-size: 16px;
}

* { box-sizing: border-box; margin: 0; }

body {
  font-family: 'Karla', system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
}

h1, h2, h3, .display {
  font-family: 'Bricolage Grotesque', 'Karla', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

header.site {
  background: var(--forest);
  color: var(--paper);
  padding: 2.5rem 1.25rem 2rem;
}
header.site .wrap { max-width: 960px; margin: 0 auto; }
header.site h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); }
header.site p { color: var(--moss); max-width: 46ch; margin-top: .5rem; }
header.site a { color: var(--marigold); text-decoration: none; font-size: .85rem; }

main { max-width: 960px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }

.banner {
  border-radius: var(--radius);
  padding: .75rem 1rem;
  margin-bottom: 1.25rem;
  font-weight: 700;
}
.banner.ok { background: var(--moss-light); color: var(--forest); }
.banner.err { background: #f6e2e2; color: #7a2626; }

/* ---------- Listing grid (homepage) ---------- */
.listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.75rem 1.5rem;
}
.listing-card {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  text-align: left;
  font: inherit;
  color: inherit;
}
.listing-card .photo {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  background: var(--moss-light);
  margin-bottom: .6rem;
}
.listing-card .photo img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .25s ease;
}
.listing-card:hover .photo img { transform: scale(1.04); }
.listing-card:focus-visible { outline: 3px solid var(--marigold); outline-offset: 3px; border-radius: 14px; }
.listing-card .photo-empty {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: #a08f76; font-size: .8rem; text-align: center; padding: 1rem;
}
.listing-card .carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 1.9rem; height: 1.9rem; border-radius: 50%; border: none;
  background: rgba(255,255,255,.9); color: var(--ink); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: .9rem;
  opacity: 0; transition: opacity .15s ease;
}
.listing-card .photo:hover .carousel-btn { opacity: 1; }
.listing-card .carousel-btn.prev { left: .5rem; }
.listing-card .carousel-btn.next { right: .5rem; }
.listing-card .dots {
  position: absolute; bottom: .5rem; left: 0; right: 0;
  display: flex; justify-content: center; gap: .3rem;
}
.listing-card .dots i {
  width: .35rem; height: .35rem; border-radius: 50%; background: rgba(255,255,255,.6); display: block;
}
.listing-card .dots i.on { background: #fff; }
.listing-card h2 { font-size: 1rem; font-weight: 700; }
.listing-card .meta { color: #75695a; font-size: .85rem; margin: .15rem 0 .3rem; }
.listing-card .rate { font-weight: 700; font-size: .95rem; }
.listing-card .rate span { color: #75695a; font-weight: 400; font-size: .85rem; }

/* ---------- Listing detail ---------- */
.back-link {
  display: inline-block; margin-bottom: 1.25rem; color: var(--forest);
  text-decoration: none; font-weight: 700; font-size: .9rem;
}
.gallery {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  grid-template-rows: repeat(2, 9rem);
  gap: .5rem;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery img:first-child { grid-row: span 2; }
.gallery.n1 { grid-template-columns: 1fr; grid-template-rows: 20rem; }
.gallery.n1 img:first-child { grid-row: span 1; }
.gallery .photo-empty {
  grid-column: 1 / -1; grid-row: span 2; display: flex; align-items: center; justify-content: center;
  background: var(--moss-light); color: #a08f76; height: 14rem; border-radius: 14px;
}
@media (max-width: 640px) {
  .gallery { grid-template-columns: 1fr; grid-template-rows: 14rem; }
  .gallery img:not(:first-child) { display: none; }
  .gallery img:first-child { grid-row: span 1; }
}

.property {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.75rem;
}
.property h2 { font-size: 1.4rem; }
.property .meta { color: #75695a; font-size: .9rem; margin: .25rem 0 .75rem; }
.property .rate { font-weight: 700; }
.property .rate span { color: #75695a; font-weight: 400; font-size: .85rem; }

/* Signature: the synced calendar IS the hero of each card */
.cal { margin-top: 1rem; }
.cal .cal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .4rem;
}
.cal .cal-head button {
  background: none; border: 1px solid var(--line); border-radius: 6px;
  width: 2rem; height: 2rem; cursor: pointer; font-size: 1rem; color: var(--ink);
}
.cal .month-label { font-weight: 700; font-size: .95rem; }
.grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px;
}
.grid .dow { font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; color: #a08f76; text-align: center; padding: .2rem 0; }
.day {
  aspect-ratio: 1; border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-size: .8rem; background: var(--moss-light); cursor: pointer; border: 2px solid transparent;
  user-select: none;
}
.day.empty { background: transparent; cursor: default; }
.day.past { background: #f2ebda; color: #b3a68e; cursor: default; }
.day.blocked-airbnb { background: var(--airbnb); color: #fff; cursor: not-allowed; }
.day.blocked-vrbo { background: var(--vrbo); color: #fff; cursor: not-allowed; }
.day.blocked-direct, .day.blocked-manual { background: var(--marigold); color: #fff; cursor: not-allowed; }
.day.sel { border-color: var(--forest); background: var(--forest); color: #fff; }
.day.in-range { border-color: var(--forest); }

.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .75rem; margin-top: .5rem; color: #75695a; }
.legend i { display: inline-block; width: .75rem; height: .75rem; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }
.legend .l-air i { background: var(--airbnb); }
.legend .l-vrbo i { background: var(--vrbo); }
.legend .l-direct i { background: var(--marigold); }
.legend .l-open i { background: var(--moss-light); }

.book-form { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.book-form .dates { font-size: .9rem; margin-bottom: .5rem; }
.book-form .quote { font-weight: 700; margin: .5rem 0; }
.book-form input {
  width: 100%; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 6px;
  font: inherit; margin-bottom: .5rem; background: #fff;
}
button.primary {
  background: var(--forest); color: var(--paper); border: none; border-radius: 6px;
  padding: .7rem 1.2rem; font: inherit; font-weight: 700; cursor: pointer; width: 100%;
}
button.primary:disabled { background: #b8a98d; cursor: not-allowed; }
button.primary:focus-visible, .day:focus-visible { outline: 3px solid var(--marigold); outline-offset: 2px; }

/* Admin */
table { width: 100%; border-collapse: collapse; font-size: .85rem; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--line); }
th { background: var(--moss-light); font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; }
.tag { display: inline-block; padding: .1rem .5rem; border-radius: 99px; font-size: .7rem; font-weight: 700; color: #fff; }
.tag.airbnb { background: var(--airbnb); }
.tag.vrbo { background: var(--vrbo); }
.tag.direct, .tag.manual { background: var(--marigold); }
.tag.pending { background: #a08f76; }
.tag.cancelled { background: #d6c9b3; color: #555; }
.admin-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1.25rem; }
.admin-card label { display: block; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin: .6rem 0 .2rem; color: #75695a; }
.admin-card input { width: 100%; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.admin-card .export { font-family: monospace; font-size: .75rem; background: var(--moss-light); padding: .5rem; border-radius: 6px; word-break: break-all; margin-top: .5rem; }
.sync-status { font-size: .8rem; color: #75695a; margin-top: .5rem; }

/* Admin photo manager */
.photo-manager { margin-top: .3rem; }
.thumb-strip { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: .6rem; }
.thumb {
  position: relative; width: 5.5rem; height: 5.5rem; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line); cursor: grab; background: var(--moss-light);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.dragging { opacity: .4; }
.thumb .cover-badge {
  position: absolute; top: 0; left: 0; background: var(--marigold); color: #fff;
  font-size: .6rem; font-weight: 700; padding: .1rem .35rem; border-bottom-right-radius: 6px;
}
.thumb .del-btn {
  position: absolute; top: .2rem; right: .2rem; width: 1.2rem; height: 1.2rem; border-radius: 50%;
  border: none; background: rgba(0,0,0,.6); color: #fff; font-size: .7rem; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.upload-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.upload-row input[type=file] { flex: 1; min-width: 12rem; font-size: .8rem; }
.row-actions { display: flex; gap: .5rem; margin-top: .75rem; }
.row-actions button { flex: 1; }
button.ghost { background: none; border: 1px solid var(--forest); color: var(--forest); border-radius: 6px; padding: .6rem 1rem; font: inherit; font-weight: 700; cursor: pointer; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media (max-width: 560px) { .property { padding: 1rem; } }
