/* ============================================================
   Sundowner Stays — Design System
   Coastal Australian premium · deep ocean / eucalyptus / terracotta
   ============================================================ */

:root {
  /* Color */
  --ocean-900: #0E2E36;
  --ocean-800: #123C46;
  --ocean-700: #174854;
  --ocean-600: #1F5563;
  --ocean-100: #DEE9EB;
  --eucalyptus-600: #3E5C4E;
  --eucalyptus-500: #4C6B5C;
  --eucalyptus-100: #E3EBE4;
  --terracotta-600: #B85C3A;
  --terracotta-500: #C96F4A;
  --terracotta-100: #F6E3D9;
  --sand-200: #F0E7D8;
  --sand-100: #F5EEE3;
  --paper: #FDFBF7;
  --white: #FFFFFF;
  --ink: #16282D;
  --ink-soft: #44575D;
  --ink-faint: #5E7076;
  --line: #DED5C6;
  --line-soft: #EAE3D6;
  --danger: #A83E2E;
  --danger-100: #F7E2DD;
  --gold: #C8913A;
  --ocean-ink-on-dark: #C9DADF;   /* muted text on ocean surfaces, AA */

  /* Type */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Schibsted Grotesk", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-base: 1rem;
  --text-md: 1.125rem;
  --text-lg: 1.375rem;
  --text-xl: 1.75rem;
  --text-2xl: 2.25rem;
  --text-3xl: clamp(2.5rem, 5vw, 3.5rem);
  --text-hero: clamp(2.75rem, 6vw, 4.5rem);

  /* Space (4px base) */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  --space-12: 48px; --space-16: 64px; --space-20: 80px; --space-24: 96px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  /* Shadow (warm-tinted) */
  --shadow-card: 0 1px 2px rgba(24, 42, 48, 0.06), 0 6px 20px -6px rgba(24, 42, 48, 0.10);
  --shadow-float: 0 4px 12px rgba(14, 46, 54, 0.12), 0 18px 44px -12px rgba(14, 46, 54, 0.22);

  /* Z-scale */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-backdrop: 300;
  --z-modal: 400;
  --z-toast: 500;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 220ms;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
img, svg, video { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }
a { color: var(--ocean-600); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
ul[class], ol[class] { list-style: none; padding: 0; }
:focus-visible { outline: 2px solid var(--terracotta-600); outline-offset: 2px; border-radius: 2px; }

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 550;
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: var(--ocean-800);
  text-wrap: balance;
}
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }
p { max-width: 68ch; }
.text-soft { color: var(--ink-soft); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.num { font-variant-numeric: tabular-nums; }
.serif { font-family: var(--font-display); }

/* ---------- Layout helpers ---------- */
.container { max-width: 1200px; margin-inline: auto; padding-inline: var(--space-6); }
.container-narrow { max-width: 860px; margin-inline: auto; padding-inline: var(--space-6); }
.flow > * + * { margin-top: var(--space-4); }
.cluster { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: 10px 22px;
  border-radius: var(--radius-pill);
  font-weight: 600; font-size: var(--text-sm);
  border: 1.5px solid transparent;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease),
              border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              transform var(--dur) var(--ease);
  text-decoration: none !important;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--terracotta-600); color: var(--white); }
.btn-primary:hover { background: #A64F30; box-shadow: 0 6px 18px -6px rgba(184, 92, 58, 0.55); }
.btn-secondary { background: transparent; color: var(--ocean-800); border-color: var(--ocean-800); }
.btn-secondary:hover { background: var(--ocean-800); color: var(--paper); }
.btn-ghost { background: transparent; color: var(--ocean-800); }
.btn-ghost:hover { background: rgba(18, 60, 70, 0.08); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: var(--white); }
.btn-success { background: var(--eucalyptus-600); color: var(--white); }
.btn-success:hover { background: #33503F; }
.btn-lg { min-height: 52px; padding: 14px 30px; font-size: var(--text-base); }
.btn-sm { min-height: 36px; padding: 5px 14px; font-size: var(--text-xs); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn .spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* On-dark button variants */
.on-dark .btn-secondary { color: var(--paper); border-color: rgba(253, 251, 247, 0.6); }
.on-dark .btn-secondary:hover { background: var(--paper); color: var(--ocean-800); }
.on-dark .btn-ghost { color: var(--paper); }
.on-dark .btn-ghost:hover { background: rgba(253, 251, 247, 0.12); }

/* ---------- Cards ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}
.card-pad { padding: var(--space-6); }
a.card-link { color: inherit; display: block; }
a.card-link:hover { text-decoration: none; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 11px; border-radius: var(--radius-pill);
  font-size: var(--text-xs); font-weight: 600; line-height: 1.5;
  background: var(--sand-200); color: var(--ink-soft);
}
.badge svg { width: 13px; height: 13px; }
.badge-live, .badge-confirmed, .badge-verified { background: var(--eucalyptus-100); color: #2E4A3C; }
.badge-pending { background: var(--terracotta-100); color: #8C4526; }
.badge-paused { background: var(--ocean-100); color: var(--ocean-700); }
.badge-flagged, .badge-declined, .badge-suspended { background: var(--danger-100); color: var(--danger); }
.badge-instant { background: var(--ocean-800); color: var(--paper); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.field label { font-weight: 600; font-size: var(--text-sm); color: var(--ocean-800); }
.field .hint { font-size: var(--text-xs); color: var(--ink-faint); }
.input, .select, .textarea {
  width: 100%; min-height: 46px;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: #6B7C82; opacity: 1; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--ocean-600);
  box-shadow: 0 0 0 3px rgba(31, 85, 99, 0.14);
}
.input.invalid, .select.invalid { border-color: var(--danger); }
.field .error-msg { font-size: var(--text-xs); color: var(--danger); font-weight: 500; display: none; }
.field.has-error .error-msg { display: block; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2344575D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 38px;
}
.checkbox-row { display: flex; align-items: center; gap: var(--space-3); cursor: pointer; min-height: 44px; font-size: var(--text-sm); }
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--eucalyptus-600); cursor: pointer; }

/* Toggle switch */
.switch { position: relative; display: inline-flex; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; cursor: pointer; margin: 0; }
.switch .track {
  width: 100%; height: 100%; border-radius: var(--radius-pill);
  background: var(--line); transition: background-color var(--dur) var(--ease);
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--white); box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform var(--dur) var(--ease);
}
.switch input:checked + .track { background: var(--eucalyptus-600); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 2px solid var(--terracotta-600); outline-offset: 2px; }

/* ---------- Stars ---------- */
.stars { display: inline-flex; gap: 2px; color: var(--gold); }
.stars svg { width: 16px; height: 16px; }
.stars.lg svg { width: 22px; height: 22px; }
.star-input { display: inline-flex; gap: 4px; }
.star-input button { color: var(--line); transition: color 120ms var(--ease), transform 120ms var(--ease); padding: 2px; }
.star-input button svg { width: 30px; height: 30px; }
.star-input button.active, .star-input button.hovered { color: var(--gold); }
.star-input button:hover { transform: scale(1.12); }

/* ---------- Rating bars ---------- */
.score-row { display: grid; grid-template-columns: 110px 1fr 34px; align-items: center; gap: var(--space-3); font-size: var(--text-sm); }
.score-bar { height: 6px; border-radius: var(--radius-pill); background: var(--sand-200); overflow: hidden; }
.score-bar i { display: block; height: 100%; background: var(--ocean-800); border-radius: var(--radius-pill); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: var(--space-2); border-bottom: 1.5px solid var(--line-soft); overflow-x: auto; }
.tab {
  padding: 12px 18px; font-weight: 600; font-size: var(--text-sm);
  color: var(--ink-soft); border-bottom: 2.5px solid transparent;
  margin-bottom: -1.5px; white-space: nowrap;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.tab:hover { color: var(--ocean-800); }
.tab.active { color: var(--ocean-800); border-bottom-color: var(--terracotta-600); }
.tab .count { margin-left: 6px; font-size: var(--text-xs); background: var(--sand-200); padding: 1px 8px; border-radius: var(--radius-pill); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius-md); background: var(--white); }
.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th {
  text-align: left; font-weight: 600; color: var(--ink-soft); font-size: var(--text-xs);
  padding: 12px 16px; border-bottom: 1.5px solid var(--line-soft); background: var(--paper);
  white-space: nowrap;
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background-color 140ms var(--ease); }
.table tbody tr:hover { background: #FAF6EE; }

/* ---------- Avatar ---------- */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ocean-800); color: var(--paper);
  font-weight: 600; font-size: var(--text-sm); font-family: var(--font-display);
}
.avatar.lg { width: 56px; height: 56px; font-size: var(--text-md); }
.avatar.sm { width: 30px; height: 30px; font-size: var(--text-xs); }
.avatar.euc { background: var(--eucalyptus-600); }
.avatar.terra { background: var(--terracotta-600); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(14, 46, 54, 0.55);
  z-index: var(--z-backdrop);
  opacity: 0; pointer-events: none; transition: opacity var(--dur) var(--ease);
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  position: fixed; inset: 0; z-index: var(--z-modal);
  display: none; align-items: center; justify-content: center; padding: var(--space-5);
}
.modal.open { display: flex; }
.modal-panel {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto;
  padding: var(--space-8);
  animation: modalIn 260ms var(--ease);
}
.modal-panel.wide { max-width: 760px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
.modal-close {
  position: absolute; top: 0; right: 0; margin: var(--space-3);
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-soft); background: var(--paper);
  transition: background-color 140ms var(--ease);
}
.modal-close:hover { background: var(--sand-200); }
.modal-head { position: relative; padding-right: var(--space-10); margin-bottom: var(--space-5); }

/* ---------- Toast ---------- */
.toast-stack {
  position: fixed; bottom: var(--space-6); left: 50%; transform: translateX(-50%);
  z-index: var(--z-toast); display: flex; flex-direction: column; gap: var(--space-2);
  width: min(420px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: center; gap: var(--space-3);
  background: var(--ocean-900); color: var(--paper);
  padding: 13px 18px; border-radius: var(--radius-md);
  box-shadow: var(--shadow-float); font-size: var(--text-sm); font-weight: 500;
  animation: toastIn 300ms var(--ease);
}
.toast.leaving { opacity: 0; transform: translateY(8px); transition: opacity 250ms var(--ease), transform 250ms var(--ease); }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; color: #8FC3A9; }
.toast.error svg { color: #E8A08F; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

/* ---------- Empty state ---------- */
.empty-state {
  text-align: center; padding: var(--space-16) var(--space-6);
  border: 1.5px dashed var(--line); border-radius: var(--radius-md);
  color: var(--ink-soft);
}
.empty-state svg { width: 44px; height: 44px; margin: 0 auto var(--space-4); color: var(--ink-faint); }
.empty-state h3 { margin-bottom: var(--space-2); }

/* ---------- Calendar ---------- */
.cal { user-select: none; }
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-3); }
.cal-title { font-family: var(--font-display); font-weight: 600; font-size: var(--text-md); color: var(--ocean-800); }
.cal-nav { display: flex; gap: var(--space-1); }
.cal-nav button {
  width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  color: var(--ocean-800); transition: background-color 140ms var(--ease);
}
.cal-nav button:hover { background: var(--sand-200); }
.cal-nav button[disabled] { opacity: 0.3; cursor: default; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-dow { text-align: center; font-size: var(--text-xs); font-weight: 600; color: var(--ink-faint); padding: 6px 0; }
.cal-cell {
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); font-size: var(--text-sm); font-variant-numeric: tabular-nums;
  position: relative; gap: 1px;
}
.cal-cell.day { cursor: pointer; transition: background-color 120ms var(--ease), color 120ms var(--ease); }
.cal-cell.day:hover { background: var(--ocean-100); }
.cal-cell.other, .cal-cell.past { color: #A8B4B8; cursor: default; }
.cal-cell.past { text-decoration: line-through; text-decoration-color: rgba(168, 180, 184, 0.7); }
.cal-cell.booked { color: #A8B4B8; text-decoration: line-through; cursor: default; background: repeating-linear-gradient(-45deg, transparent, transparent 4px, rgba(222, 213, 198, 0.4) 4px, rgba(222, 213, 198, 0.4) 7px); }
.cal-cell.blocked { background: var(--sand-200); color: var(--ink-faint); }
.cal-cell.selected { background: var(--ocean-800); color: var(--paper); }
.cal-cell.in-range { background: var(--ocean-100); }
.cal-cell .price { font-size: 10px; color: var(--ink-faint); line-height: 1; }
.cal-cell.selected .price { color: var(--ocean-ink-on-dark); }
.cal-cell.custom-price .price { color: var(--terracotta-600); font-weight: 700; }

/* ---------- Leaflet price pins ---------- */
.price-pin {
  background: var(--white); color: var(--ocean-800);
  border: 1.5px solid var(--ocean-800);
  font-family: var(--font-body); font-weight: 700; font-size: 13px;
  padding: 4px 10px; border-radius: var(--radius-pill);
  box-shadow: var(--shadow-card); white-space: nowrap;
  transition: background-color 140ms var(--ease), color 140ms var(--ease), transform 140ms var(--ease);
  display: inline-block; transform-origin: center bottom;
}
.price-pin:hover, .price-pin.active {
  background: var(--ocean-800); color: var(--paper); transform: scale(1.08);
  z-index: 10; position: relative;
}
.leaflet-container { font-family: var(--font-body) !important; background: var(--sand-100) !important; }
.map-fallback-note { font-size: var(--text-xs); color: var(--ink-faint); text-align: center; padding: var(--space-2); }

/* ---------- Header / footer (injected) ---------- */
.site-header {
  position: sticky; top: 0; z-index: var(--z-sticky);
  background: var(--ocean-800); color: var(--paper);
}
.site-header .bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-6); min-height: 68px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--paper); text-decoration: none !important; }
.brand svg { width: 30px; height: 30px; }
.brand .word { font-family: var(--font-display); font-size: 1.28rem; font-weight: 600; letter-spacing: 0.01em; }
.main-nav { display: flex; align-items: center; gap: var(--space-1); }
.main-nav a {
  color: var(--ocean-ink-on-dark); font-size: var(--text-sm); font-weight: 500;
  padding: 9px 14px; border-radius: var(--radius-pill);
  transition: color 140ms var(--ease), background-color 140ms var(--ease);
  text-decoration: none !important;
}
.main-nav a:hover { color: var(--paper); background: rgba(253, 251, 247, 0.1); }
.main-nav a.active { color: var(--paper); background: rgba(253, 251, 247, 0.14); }
.nav-cta { display: flex; align-items: center; gap: var(--space-3); }
.menu-btn { display: none; width: 44px; height: 44px; border-radius: var(--radius-sm); color: var(--paper); align-items: center; justify-content: center; }
.menu-btn:hover { background: rgba(253,251,247,0.12); }
.mobile-nav { display: none; }
.mobile-nav.open { display: block; background: var(--ocean-900); padding: var(--space-4) var(--space-6) var(--space-6); }
.mobile-nav a { display: block; color: var(--paper); padding: 13px 6px; font-weight: 500; border-bottom: 1px solid rgba(253,251,247,0.08); text-decoration: none !important; }

.site-footer { background: var(--ocean-900); color: var(--ocean-ink-on-dark); margin-top: var(--space-24); }
.site-footer a { color: var(--ocean-ink-on-dark); text-decoration: none; }
.site-footer a:hover { color: var(--paper); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: var(--space-10); padding: var(--space-16) 0 var(--space-10); }
.footer-grid h4 { color: var(--paper); font-size: var(--text-sm); font-family: var(--font-body); font-weight: 700; margin-bottom: var(--space-4); }
.footer-grid li { margin-bottom: var(--space-2); font-size: var(--text-sm); }
.footer-base { border-top: 1px solid rgba(253,251,247,0.12); padding: var(--space-5) 0; display: flex; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; font-size: var(--text-xs); }

/* ---------- Reveal animation (enhance-only; content visible by default) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal { animation: rise 640ms var(--ease) backwards; }
  .reveal-1 { animation-delay: 80ms; } .reveal-2 { animation-delay: 160ms; }
  .reveal-3 { animation-delay: 240ms; } .reveal-4 { animation-delay: 320ms; }
  @keyframes rise { from { opacity: 0; transform: translateY(18px); } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Photo helpers ---------- */
.ph { background: linear-gradient(160deg, var(--ocean-100), var(--sand-200)); }
.ph img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .main-nav { display: none; }
  .menu-btn { display: flex; }
  .nav-cta .btn-secondary { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; padding-top: var(--space-12); }
}
@media (max-width: 640px) {
  .container, .container-narrow { padding-inline: var(--space-4); }
  .footer-grid { grid-template-columns: 1fr; gap: var(--space-8); }
  .modal-panel { padding: var(--space-6); }
}
