/**
 * Rogla Booking Widget — styles.
 *
 * Namespaced under `.rbw` (Rogla Booking Widget) so it can't leak into or
 * clash with the host page. Every colour/font/spacing token is read from the
 * host page's CSS custom properties FIRST, with a literal fallback matching
 * design/MERGE-SPEC.md's "Mountain Fairytale" system — so the widget looks
 * right both standalone (this folder's index.html demo) and once dropped
 * into design/concepts/00-merged/index.html, which already defines --paper,
 * --ink, --ember, --display, --serif, --sans, --mono, etc. on :root.
 *
 * Fonts: Fraunces (display), Newsreader (body/serif), Manrope (UI/sans),
 * JetBrains Mono (micro-labels). If the host page doesn't already load them,
 * see guest-widget/README.md for the Google Fonts <link>.
 */

.rbw {
  --rbw-paper: var(--paper, #f4eee3);
  --rbw-card: var(--card, #fcf8f0);
  --rbw-ink: var(--ink, #1e1f1c);
  --rbw-ink-soft: var(--ink-soft, #55574f);
  --rbw-ink-70: var(--ink-70, rgba(30, 31, 28, 0.78));
  --rbw-ink-55: var(--ink-55, rgba(30, 31, 28, 0.68));
  --rbw-ink-40: var(--ink-40, rgba(30, 31, 28, 0.4));
  --rbw-fir: var(--fir, #2e4a3a);
  --rbw-ember: var(--ember, #c8632b);
  --rbw-ember-ink: var(--ember-ink, #a44e20);
  --rbw-ember-hi: var(--ember-hi, #d9793d);
  --rbw-gold: var(--gold, #b8893b);
  --rbw-line: var(--line, rgba(30, 31, 28, 0.14));
  --rbw-line-soft: var(--line-soft, rgba(30, 31, 28, 0.08));
  --rbw-snow: var(--snow, #e8eef2);
  --rbw-red: #b5432c;

  --rbw-display: var(--display, "Fraunces", Georgia, "Times New Roman", serif);
  --rbw-serif: var(--serif, "Newsreader", Georgia, "Times New Roman", serif);
  --rbw-sans: var(--sans, "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif);
  --rbw-mono: var(--mono, "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace);

  --rbw-radius: var(--radius, 3px);
  --rbw-ease: var(--ease, cubic-bezier(0.22, 0.61, 0.36, 1));

  all: initial;
  display: block;
  box-sizing: border-box;
  max-width: 640px;
  width: 100%;
  margin-inline: auto;
  background: var(--rbw-card);
  border: 1px solid var(--rbw-line);
  color: var(--rbw-ink);
  font-family: var(--rbw-serif);
  font-size: 1rem;
  line-height: 1.55;
}
.rbw *, .rbw *::before, .rbw *::after { box-sizing: border-box; }
.rbw a { color: var(--rbw-ember-ink); }
.rbw :focus-visible {
  outline: 2px solid var(--rbw-ember-ink);
  outline-offset: 2px;
  border-radius: 2px;
}
.rbw button { font: inherit; color: inherit; }
.rbw [hidden] { display: none !important; }

/* ── layout shell ─────────────────────────────────────────────── */
.rbw__pad { padding: 1.5rem; }
@media (min-width: 560px) { .rbw__pad { padding: 2rem; } }

.rbw__head { padding: 1.5rem 1.5rem 0; }
@media (min-width: 560px) { .rbw__head { padding: 2rem 2rem 0; } }
.rbw__eyebrow {
  font-family: var(--rbw-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--rbw-ember-ink);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.6rem;
}
.rbw__eyebrow::before { content: ""; width: 20px; height: 1px; background: var(--rbw-ember); flex: none; }
.rbw__title {
  font-family: var(--rbw-display);
  font-optical-sizing: auto;
  font-variation-settings: "opsz" 30, "wght" 480, "SOFT" 14, "WONK" 0;
  font-size: clamp(1.4rem, 1.1rem + 1.4vw, 1.9rem);
  line-height: 1.15;
  margin: 0 0 0.4rem;
  color: var(--rbw-ink);
}
.rbw__subtitle { font-size: 0.9375rem; color: var(--rbw-ink-70); margin: 0; max-width: 44ch; }

.rbw__section { padding: 1.25rem 1.5rem; border-top: 1px solid var(--rbw-line); }
@media (min-width: 560px) { .rbw__section { padding: 1.5rem 2rem; } }
.rbw__section-title {
  font-family: var(--rbw-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--rbw-ink-55);
  margin: 0 0 1rem;
}

/* ── status / error banner ────────────────────────────────────── */
.rbw__status {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--rbw-line);
  border-radius: var(--rbw-radius);
  font-family: var(--rbw-sans);
  font-size: 0.8125rem;
  line-height: 1.5;
  margin: 0 0 1rem;
}
.rbw__status--error { border-color: color-mix(in srgb, var(--rbw-red) 45%, var(--rbw-line)); background: color-mix(in srgb, var(--rbw-red) 8%, var(--rbw-card)); color: var(--rbw-red); }
.rbw__status--info { border-color: var(--rbw-line); background: var(--rbw-paper); color: var(--rbw-ink-70); }
.rbw__status button.rbw__retry {
  font-family: var(--rbw-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: underline;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: inherit;
  flex: none;
}

/* ── calendar ──────────────────────────────────────────────────── */
.rbw__calhead { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; }
.rbw__navbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--rbw-line);
  background: var(--rbw-card);
  color: var(--rbw-ink);
  border-radius: var(--rbw-radius);
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}
.rbw__navbtn:hover:not(:disabled) { border-color: var(--rbw-ember-ink); color: var(--rbw-ember-ink); }
.rbw__navbtn:disabled { opacity: 0.35; cursor: not-allowed; }
.rbw__navbtn svg { width: 16px; height: 16px; }

.rbw__hint {
  font-family: var(--rbw-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rbw-ink-55);
  text-align: center;
}

.rbw__months {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 560px) { .rbw__months { grid-template-columns: 1fr 1fr; } }

.rbw__month-name {
  font-family: var(--rbw-display);
  font-size: 1.0625rem;
  font-variation-settings: "opsz" 20, "wght" 520;
  text-align: center;
  margin: 0 0 0.6rem;
}
.rbw__weekdays, .rbw__days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.rbw__weekdays div {
  font-family: var(--rbw-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rbw-ink-40);
  text-align: center;
  padding-bottom: 0.35rem;
}
.rbw__day {
  aspect-ratio: 1 / 1;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--rbw-sans);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 2px;
  color: var(--rbw-ink);
  cursor: pointer;
  position: relative;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.rbw__day:hover:not(:disabled) { background: var(--rbw-paper); border-color: var(--rbw-line); }
.rbw__day--empty { visibility: hidden; cursor: default; }
.rbw__day--blocked { color: var(--rbw-ink-40); text-decoration: line-through; cursor: not-allowed; }
.rbw__day--blocked:hover { background: transparent; border-color: transparent; }
.rbw__day--past { color: var(--rbw-ink-40); cursor: not-allowed; opacity: 0.5; }
.rbw__day--today { font-weight: 700; }
.rbw__day--today::after {
  content: "";
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--rbw-ember);
}
.rbw__day--in-range { background: color-mix(in srgb, var(--rbw-ember) 14%, transparent); border-radius: 0; }
.rbw__day--checkin, .rbw__day--checkout {
  background: var(--rbw-ember-ink);
  color: #fff;
  font-weight: 600;
}
.rbw__day--checkin { border-radius: 50% 0 0 50%; }
.rbw__day--checkout { border-radius: 0 50% 50% 0; }
.rbw__day--checkin.rbw__day--checkout { border-radius: 50%; }

.rbw__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
  font-family: var(--rbw-mono);
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rbw-ink-55);
}
.rbw__legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.rbw__swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.rbw__swatch--avail { background: var(--rbw-card); border: 1px solid var(--rbw-line); }
.rbw__swatch--unavail { background: var(--rbw-ink-40); }
.rbw__swatch--selected { background: var(--rbw-ember-ink); }

.rbw__daterow { display: flex; gap: 1rem; margin-top: 1.25rem; }
.rbw__datefield {
  flex: 1;
  border: 1px solid var(--rbw-line);
  border-radius: var(--rbw-radius);
  padding: 0.6rem 0.75rem;
  background: var(--rbw-paper);
}
.rbw__datefield dt {
  font-family: var(--rbw-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rbw-ink-55);
  margin: 0 0 0.2rem;
}
.rbw__datefield dd { margin: 0; font-family: var(--rbw-sans); font-size: 0.9375rem; font-weight: 500; }
.rbw__clear {
  font-family: var(--rbw-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: none;
  border: none;
  color: var(--rbw-ink-55);
  text-decoration: underline;
  cursor: pointer;
  margin-top: 0.6rem;
  padding: 0.4rem 0;
}
.rbw__clear:hover { color: var(--rbw-ember-ink); }
.rbw__minnights {
  font-family: var(--rbw-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
  color: var(--rbw-ink-55);
  margin-top: 0.75rem;
}

/* ── guests steppers ──────────────────────────────────────────── */
.rbw__guests { display: grid; gap: 0.9rem; }
.rbw__guestrow { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.rbw__guestlabel { display: flex; flex-direction: column; }
.rbw__guestlabel b { font-family: var(--rbw-sans); font-size: 0.9375rem; font-weight: 600; }
.rbw__guestlabel small { font-family: var(--rbw-sans); font-size: 0.75rem; color: var(--rbw-ink-55); }
.rbw__stepper { display: flex; align-items: center; gap: 0.75rem; }
.rbw__stepbtn {
  width: 32px;
  height: 32px;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rbw-line);
  background: var(--rbw-card);
  border-radius: 50%;
  cursor: pointer;
  font-family: var(--rbw-sans);
  font-size: 1.1rem;
  line-height: 1;
  color: var(--rbw-ink);
  transition: border-color 0.18s, color 0.18s;
}
.rbw__stepbtn:hover:not(:disabled) { border-color: var(--rbw-ember-ink); color: var(--rbw-ember-ink); }
.rbw__stepbtn:disabled { opacity: 0.3; cursor: not-allowed; }
.rbw__stepval { min-width: 1.4rem; text-align: center; font-variant-numeric: tabular-nums; font-family: var(--rbw-sans); font-weight: 600; }

/* ── quote ─────────────────────────────────────────────────────── */
.rbw__quote-placeholder { color: var(--rbw-ink-55); font-size: 0.875rem; }
.rbw__quote-line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.4rem;
  font-family: var(--rbw-sans);
  font-size: 0.875rem;
  border-bottom: 1px dotted var(--rbw-line);
}
.rbw__quote-line span:first-child { color: var(--rbw-ink-70); }
.rbw__quote-line b { font-variant-numeric: tabular-nums; font-weight: 600; }
.rbw__quote-total {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.75rem;
  margin-top: 0.4rem;
  font-family: var(--rbw-display);
  font-size: 1.2rem;
  font-variation-settings: "opsz" 18, "wght" 520;
}
.rbw__quote-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 1rem;
}
.rbw__quote-chip {
  border: 1px solid var(--rbw-line);
  border-radius: var(--rbw-radius);
  padding: 0.6rem 0.75rem;
  background: var(--rbw-paper);
}
.rbw__quote-chip dt {
  font-family: var(--rbw-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rbw-ink-55);
  margin: 0 0 0.25rem;
}
.rbw__quote-chip dd { margin: 0; font-family: var(--rbw-sans); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── form ──────────────────────────────────────────────────────── */
.rbw__form-row { display: grid; gap: 1rem; grid-template-columns: 1fr; margin-bottom: 1rem; }
@media (min-width: 460px) { .rbw__form-row { grid-template-columns: 1fr 1fr; } }
.rbw__field { display: flex; flex-direction: column; gap: 0.35rem; }
.rbw__field label {
  font-family: var(--rbw-mono);
  font-size: 0.5625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--rbw-ink-55);
}
.rbw__field input, .rbw__field textarea {
  border: 1px solid var(--rbw-line);
  background: var(--rbw-card);
  padding: 0.65rem 0.7rem;
  font-family: var(--rbw-sans);
  font-size: 0.875rem;
  border-radius: 2px;
  width: 100%;
  min-height: 44px;
  color: var(--rbw-ink);
  transition: border-color 0.18s, background-color 0.18s;
}
.rbw__field textarea { min-height: 72px; resize: vertical; }
.rbw__field input:hover, .rbw__field textarea:hover { border-color: var(--rbw-ink-55); }
.rbw__field input:focus, .rbw__field textarea:focus { outline: none; background: var(--rbw-paper); border-color: var(--rbw-ember-ink); }
.rbw__field--invalid input, .rbw__field--invalid textarea { border-color: var(--rbw-red); }
.rbw__required { color: var(--rbw-ink-40); font-family: var(--rbw-mono); font-size: 0.625rem; letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 1rem; }

/* ── buttons ───────────────────────────────────────────────────── */
.rbw__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  cursor: pointer;
  border: 1px solid transparent;
  padding: 0.85rem 1.25rem;
  font-family: var(--rbw-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: var(--rbw-radius);
  transition: background 0.18s, transform 0.18s, border-color 0.18s, opacity 0.18s;
  background: var(--rbw-ember-ink);
  color: #fff;
  min-height: 48px;
}
.rbw__btn:hover:not(:disabled) { background: var(--rbw-ember); transform: translateY(-1px); }
.rbw__btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.rbw__btn--ghost {
  background: transparent;
  border-color: var(--rbw-line);
  color: var(--rbw-ink);
}
.rbw__btn--ghost:hover:not(:disabled) { border-color: var(--rbw-ink); background: transparent; transform: none; }

.rbw__spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: rbw-spin 0.7s linear infinite;
  flex: none;
}
@media (prefers-reduced-motion: reduce) { .rbw__spinner { animation-duration: 1.6s; } }
@keyframes rbw-spin { to { transform: rotate(360deg); } }

.rbw__note {
  font-family: var(--rbw-mono);
  font-size: 0.625rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rbw-ink-55);
  text-align: center;
  margin: 0.9rem 0 0;
  line-height: 1.7;
}

/* ── success panel ─────────────────────────────────────────────── */
.rbw__success { text-align: center; padding: 2.5rem 1.5rem; }
@media (min-width: 560px) { .rbw__success { padding: 3rem 2rem; } }
.rbw__success-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--rbw-fir);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rbw__success-icon svg { width: 24px; height: 24px; }
.rbw__success h3 {
  font-family: var(--rbw-display);
  font-variation-settings: "opsz" 26, "wght" 480;
  font-size: 1.5rem;
  margin: 0 0 0.5rem;
}
.rbw__success p { margin: 0 0 0.5rem; color: var(--rbw-ink-70); font-size: 0.9375rem; }
.rbw__success-ref {
  display: inline-block;
  font-family: var(--rbw-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  background: var(--rbw-paper);
  border: 1px solid var(--rbw-line);
  padding: 0.4rem 0.8rem;
  border-radius: var(--rbw-radius);
  margin: 0.5rem 0 1rem;
}
.rbw__success .rbw__btn { width: auto; margin-inline: auto; }

/* ── loading skeleton for calendar ────────────────────────────── */
.rbw__skel { animation: rbw-pulse 1.4s ease-in-out infinite; background: var(--rbw-line-soft); border-radius: 2px; }
@keyframes rbw-pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .rbw * { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; }
}
