/* ============================================
   Damson Restaurant — theme tokens & components
   Dark = default (Flavoro-inspired gold-on-black)
   Light = cream + gold accents
   ============================================ */

:root,
html[data-theme="dark"] {
  --bg:           #0a0a0a;
  --bg-2:         #111111;
  --surface:      #161616;
  --surface-2:    #1f1f1f;
  --border:       rgba(212, 162, 76, 0.18);
  --fg:           #f5efe4;
  --fg-muted:     #b9b1a1;
  --gold:         #d4a24c;
  --gold-2:       #e6c478;
  --gold-3:       #b88838;
  --shadow:       0 20px 50px -20px rgba(0,0,0,.7);
  --hero-overlay: linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,.85));
}

html[data-theme="light"] {
  --bg:           #fbf7f1;
  --bg-2:         #f3ecdf;
  --surface:      #ffffff;
  --surface-2:    #faf5ea;
  --border:       rgba(184, 136, 56, 0.22);
  --fg:           #1f1812;
  --fg-muted:     #6d6357;
  --gold:         #b88838;
  --gold-2:       #d4a24c;
  --gold-3:       #8c6628;
  --shadow:       0 20px 40px -25px rgba(76, 55, 20, .25);
  --hero-overlay: linear-gradient(180deg, rgba(20,12,4,.45), rgba(20,12,4,.7));
}

html, body { background: var(--bg); color: var(--fg); }

::selection { background: var(--gold); color: #1a1306; }

a { color: inherit; }
a:hover { color: var(--gold); }

/* ---------- Brand logo ---------- */
.brand-logo {
  display: inline-flex;
  align-items: center;
  height: 56px;
  flex-shrink: 0;
}
.brand-logo img {
  height: 100%;
  width: auto;
  max-width: 280px;
  object-fit: contain;
  display: block;
}
.brand-logo--footer { height: 64px; }
.brand-logo--footer img { max-width: 320px; }

/* Light mode: invert/darken slightly so the gold reads against cream */
html[data-theme="light"] .brand-logo img {
  filter: drop-shadow(0 1px 0 rgba(76,55,20,.15));
}

@media (max-width: 640px) {
  .brand-logo { height: 44px; }
}

/* ---------- Brand mark (kept for older refs / install page) ---------- */
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  color: var(--gold);
  flex-shrink: 0;
}
.brand-mark svg { width: 20px; height: 20px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-link {
  position: relative;
  color: var(--fg);
  transition: color .2s ease;
}
.nav-link:hover, .nav-link.active { color: var(--gold); }
.nav-link.active::after {
  content:'';
  position: absolute;
  left: 0; right: 0; bottom: -8px;
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
}

/* ---------- Buttons ---------- */
.btn-gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .65rem 1.4rem;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-2) 50%, var(--gold) 100%);
  color: #1a1306;
  border-radius: 4px;
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
  box-shadow: 0 8px 24px -10px rgba(212,162,76,.6);
}
.btn-gold:hover { color: #1a1306; transform: translateY(-1px); filter: brightness(1.05); }
.btn-gold:active { transform: translateY(0); }
.btn-gold--book { white-space: nowrap; padding: .7rem 1.6rem; }

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .6rem 1.3rem;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  border: 1px solid var(--gold);
  color: var(--gold);
  border-radius: 4px;
  background: transparent;
  transition: background .2s ease, color .2s ease;
}
.btn-outline:hover { background: var(--gold); color: #1a1306; }

/* Smaller pill buttons for the header (sign-out, dashboard) */
.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .4rem .85rem;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  border-radius: 999px;
  transition: background .2s ease, color .2s ease, border-color .2s ease, transform .15s ease;
  white-space: nowrap;
}
.btn-pill:hover { transform: translateY(-1px); }
.btn-pill--gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #1a1306;
  border: 1px solid var(--gold);
}
.btn-pill--gold:hover { color: #1a1306; filter: brightness(1.05); }
.btn-pill--outline {
  border: 1px solid var(--border);
  color: var(--fg);
  background: transparent;
}
.btn-pill--outline:hover { border-color: var(--gold); color: var(--gold); background: rgba(212,162,76,.06); }

/* ---------- Inputs ---------- */
.input, .textarea, .select {
  width: 100%;
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .7rem 1rem;
  font-size: .9rem;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--fg-muted); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,162,76,.18);
}
.label {
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: .35rem;
  display: block;
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  transition: background .2s ease, transform .2s ease;
}
.theme-toggle:hover { background: rgba(212,162,76,.1); transform: rotate(15deg); }
.theme-toggle svg { width: 20px; height: 20px; }
html[data-theme="dark"]  .theme-toggle .icon-sun  { display: block; }
html[data-theme="dark"]  .theme-toggle .icon-moon { display: none; }
html[data-theme="light"] .theme-toggle .icon-sun  { display: none; }
html[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* ---------- Cart badge ---------- */
.cart-badge {
  position: absolute;
  top: -2px; right: -2px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  background: var(--gold);
  color: #1a1306;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Section utilities ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-size: .72rem;
  letter-spacing: .35em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}
.eyebrow::before, .eyebrow::after {
  content:'';
  width: 36px;
  height: 1px;
  background: var(--gold);
  opacity: .55;
}

.section-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -.01em;
}

.ornament {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  color: var(--gold);
  opacity: .8;
}
.ornament::before, .ornament::after {
  content:'';
  width: 50px;
  height: 1px;
  background: currentColor;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  align-items: center;
  background: var(--bg-2);
  overflow: hidden;
}
.hero__media {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero__media img,
.hero__media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.hero__overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--hero-overlay);
}
.hero__content {
  position: relative;
  z-index: 2;
  color: #fff;
}
.hero__script {
  font-family: 'Dancing Script', cursive;
  color: var(--gold-2);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 600;
  line-height: 1;
}
.hero__title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: clamp(3rem, 9vw, 7rem);
  line-height: .95;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: #fff;
}
.hero__divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--gold);
}
.hero__divider::before, .hero__divider::after {
  content:'';
  width: 60px;
  height: 1px;
  background: var(--gold);
}
.hero__subtitle {
  max-width: 32rem;
  color: #e8e3da;
  font-size: 1rem;
  line-height: 1.7;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--gold);
  box-shadow: var(--shadow);
}

.dish-card .dish-card__img {
  aspect-ratio: 4/3;
  width: 100%;
  object-fit: cover;
  background: var(--bg-2);
}
.dish-card .dish-card__body { padding: 1.25rem; text-align: center; }
.dish-card .dish-card__name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  font-weight: 600;
}
.dish-card .dish-card__price {
  color: var(--gold);
  font-weight: 600;
  margin: .35rem 0 .9rem;
}

/* ---------- Reservation strip ---------- */
.reservation {
  background:
    linear-gradient(90deg, rgba(0,0,0,.75) 0%, rgba(0,0,0,.55) 100%),
    var(--bg-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  color: var(--fg);
}
.footer-h {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  margin-bottom: 1rem;
  color: var(--gold);
}
.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--fg);
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.social-icon svg { width: 16px; height: 16px; }
.social-icon:hover { background: var(--gold); color: #1a1306; border-color: var(--gold); }

/* ---------- Flash messages ---------- */
.flash {
  border-radius: 4px;
  padding: .9rem 1.1rem;
  font-size: .9rem;
  border: 1px solid;
}
.flash-success { background: rgba(46, 160, 67, .08); color: #6cd28a; border-color: rgba(46,160,67,.4); }
.flash-error   { background: rgba(220, 53,  69, .08); color: #f1808a; border-color: rgba(220, 53, 69, .4); }

/* ---------- Live chat widget (customer) ---------- */
#damson-chat { position: fixed; bottom: 22px; right: 22px; z-index: 80; font-family: inherit; }
/* HARD HIDE — beats any [hidden] vs display:flex conflict */
#damson-chat .dchat-hide { display: none !important; }
#damson-chat [hidden]    { display: none !important; }
#dchat-fab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .85rem 1.2rem;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #1a1306;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: .75rem;
  border: 0;
  border-radius: 999px;
  box-shadow: 0 14px 30px -10px rgba(212,162,76,.6);
  transition: transform .2s ease, filter .2s ease;
  cursor: pointer;
}
#dchat-fab:hover { transform: translateY(-2px); filter: brightness(1.05); }
#dchat-fab.is-open { transform: scale(.94); filter: brightness(.95); }
.dchat-fab-label { display: inline-block; }
#dchat-fab-dot {
  position: absolute; top: -2px; right: -2px;
  width: 12px; height: 12px;
  background: #e53935;
  border-radius: 50%;
  border: 2px solid var(--bg);
  animation: dchat-pulse 1.4s infinite;
}
@keyframes dchat-pulse {
  0%   { transform: scale(1);   box-shadow: 0 0 0 0 rgba(229,57,53,.6); }
  70%  { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(229,57,53,0); }
  100% { transform: scale(1);   box-shadow: 0 0 0 0 rgba(229,57,53,0); }
}

#dchat-panel {
  position: absolute;
  bottom: 64px;
  right: 0;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 120px));
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 30px 80px -25px rgba(0,0,0,.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: dchat-in .2s ease;
}
@keyframes dchat-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }

.dchat-head {
  background: linear-gradient(135deg, var(--gold), var(--gold-3));
  color: #1a1306;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.dchat-head-title { font-family: 'Cormorant Garamond', serif; font-weight: 700; font-size: 1.15rem; line-height: 1.1; }
.dchat-head-sub   { font-size: .75rem; opacity: .85; display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.dchat-live       { width: 8px; height: 8px; border-radius: 50%; background: #1ea34c; box-shadow: 0 0 0 4px rgba(30,163,76,.25); animation: dchat-pulse-live 1.6s infinite; display: inline-block; }
@keyframes dchat-pulse-live { 0%,100% { box-shadow: 0 0 0 4px rgba(30,163,76,.25); } 50% { box-shadow: 0 0 0 6px rgba(30,163,76,.05); } }
.dchat-head-actions { display: flex; align-items: center; gap: 6px; }
.dchat-head-actions button { background: transparent; border: 0; color: #1a1306; cursor: pointer; padding: 8px; border-radius: 8px; line-height: 0; opacity: .8; transition: background .15s ease, opacity .15s ease; min-width: 32px; min-height: 32px; display: inline-flex; align-items: center; justify-content: center; }
.dchat-head-actions button:hover  { opacity: 1; background: rgba(0,0,0,.15); }
.dchat-head-actions button:active { transform: scale(.95); }
.dchat-head-actions button.dchat-muted { opacity: .35; }
#dchat-close { font-size: 1.5rem; font-weight: 800; line-height: 1; padding: 4px 12px 6px; background: rgba(0,0,0,.08); }
#dchat-close:hover { background: rgba(0,0,0,.22); }

.dchat-empty { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--fg-muted); opacity: .65; text-align: center; padding: 32px 18px; }
.dchat-empty svg { color: var(--gold); }
.dchat-empty p { font-size: .85rem; margin: 0; }

.dchat-gate { padding: 18px; overflow-y: auto; }
.dchat-gate-intro { font-size: .85rem; color: var(--fg-muted); margin: 0 0 14px; line-height: 1.5; }
.dchat-input, #dchat-input {
  width: 100%;
  background: var(--surface-2);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: .9rem;
  margin-bottom: 9px;
}
.dchat-input:focus, #dchat-input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,162,76,.18); }
.dchat-start {
  width: 100%;
  padding: 10px;
  margin-top: 4px;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #1a1306;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: .8rem;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.dchat-err { background: rgba(229,57,53,.15); color: #f1808a; padding: 8px 10px; border-radius: 6px; font-size: .8rem; margin-top: 8px; }

.dchat-room { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.dchat-msgs { flex: 1; overflow-y: auto; padding: 14px 14px 6px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.dchat-msg { display: flex; flex-direction: column; max-width: 80%; }
.dchat-msg--me    { align-self: flex-end;   align-items: flex-end; }
.dchat-msg--admin { align-self: flex-start; align-items: flex-start; }
.dchat-bubble {
  padding: 9px 13px;
  border-radius: 14px;
  font-size: .9rem;
  line-height: 1.4;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.dchat-msg--me    .dchat-bubble { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #1a1306; border-bottom-right-radius: 4px; }
.dchat-msg--admin .dchat-bubble { background: var(--surface-2); color: var(--fg); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.dchat-time { font-size: .65rem; opacity: .55; margin-top: 2px; padding: 0 4px; }
.dchat-msg--pending .dchat-bubble { opacity: .7; }
.dchat-msg--failed  .dchat-bubble { background: rgba(229,57,53,.15); color: #f1808a; }

.dchat-compose {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  gap: 8px;
  align-items: center;
}
.dchat-compose #dchat-input { margin: 0; flex: 1; }
.dchat-compose button {
  width: 40px; height: 40px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #1a1306;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 480px) {
  .dchat-fab-label { display: none; }
  #dchat-fab { width: 56px; height: 56px; padding: 0; justify-content: center; }
  #dchat-panel { bottom: 70px; height: min(70vh, 500px); }
}

/* ---------- Auth forms ---------- */
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2.5rem;
  box-shadow: var(--shadow);
}

/* ---------- Menu filter chips ---------- */
.chip {
  padding: .5rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: .8rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--fg);
  background: transparent;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.chip:hover { border-color: var(--gold); color: var(--gold); }
.chip.active { background: var(--gold); color: #1a1306; border-color: var(--gold); }

/* ---------- Quantity stepper ---------- */
.qty {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.qty button {
  width: 32px; height: 32px;
  background: var(--surface-2);
  color: var(--fg);
  font-size: 1.1rem;
  transition: background .2s ease;
}
.qty button:hover { background: var(--gold); color: #1a1306; }
.qty span { padding: 0 .85rem; min-width: 32px; text-align: center; font-weight: 600; }

/* ---------- Image placeholder for menu items without an upload ---------- */
.dish-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background:
    radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--gold) 30%, var(--surface)) 0%, var(--surface-2) 60%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  font-family: 'Cormorant Garamond', serif;
  font-size: 2rem;
  font-weight: 600;
}

/* ---------- Download menu panel (home hero) ---------- */
.download-menu-panel {
  margin-top: 1.25rem;
  background: rgba(20, 12, 4, .82);
  backdrop-filter: blur(10px);
  border: 1px solid var(--gold);
  border-radius: 6px;
  padding: 1.25rem;
  max-width: 26rem;
  box-shadow: 0 18px 40px -20px rgba(0,0,0,.7);
  animation: dl-panel-in .25s ease;
}
@keyframes dl-panel-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.dl-row {
  display: flex;
  align-items: center;
  gap: .9rem;
  padding: .7rem .85rem;
  margin-bottom: .35rem;
  background: rgba(212, 162, 76, .06);
  border: 1px solid transparent;
  border-radius: 4px;
  color: #f3ecdf;
  text-decoration: none;
  transition: background .2s ease, border-color .2s ease, transform .15s ease;
}
.dl-row:hover {
  background: rgba(212, 162, 76, .18);
  border-color: var(--gold);
  color: #fff;
  transform: translateX(2px);
}
.dl-icon {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--gold);
  color: #1a1306;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.dl-text { display: flex; flex-direction: column; line-height: 1.25; }
.dl-text strong { font-size: .9rem; font-weight: 600; }
.dl-text small  { font-size: .72rem; opacity: .75; margin-top: 2px; }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .7s ease, transform .7s ease; }
.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- Small screens tweaks ---------- */
@media (max-width: 640px) {
  .hero { min-height: 80vh; }
  .auth-card { padding: 1.75rem; }
}
