/* =============================================================
   InfoSearchEngine — Stylesheet
   Aesthetic: refined editorial minimalism with warm neutrals.
   Display:   Fraunces (serif, opsz dynamic)
   UI / body: Geist (modern sans)
   ============================================================= */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, h4, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
button { font: inherit; cursor: pointer; }
input, button, textarea { font-family: inherit; color: inherit; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* ---------- Tokens ---------- */
:root {
  /* Warm off-white system with a single deep accent */
  --bg:        #faf9f6;
  --bg-card:   #ffffff;
  --bg-soft:   #f3f1ec;
  --ink:       #15161a;
  --ink-2:     #3a3b40;
  --ink-3:     #6b6c72;
  --line:      #e8e5dd;
  --line-2:    #d9d5cc;
  --accent:    #b14a2b;          /* warm terracotta */
  --accent-2:  #8a3520;
  --gold:      #c9a45a;
  --ok:        #2f7d4f;
  --warn:      #b9870b;
  --err:       #b3311a;

  --shadow-1: 0 1px 0 rgba(20,20,30,.04), 0 1px 2px rgba(20,20,30,.05);
  --shadow-2: 0 4px 14px rgba(20,20,30,.06), 0 1px 3px rgba(20,20,30,.04);
  --shadow-3: 0 18px 48px -18px rgba(20,20,30,.18), 0 4px 14px rgba(20,20,30,.05);

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 28px;

  --container: 1080px;

  --font-display: 'Fraunces', ui-serif, Georgia, serif;
  --font-ui:      'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;

  --ease: cubic-bezier(.2,.7,.2,1);
}

/* ---------- Base ---------- */
html, body { background: var(--bg); color: var(--ink); }
body {
  font-family: var(--font-ui);
  font-feature-settings: "ss01", "cv11";
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  display: flex; flex-direction: column;

  /* Subtle paper-grain background */
  background-image:
    radial-gradient(circle at 20% 0%, rgba(177,74,43,.05), transparent 55%),
    radial-gradient(circle at 90% 30%, rgba(201,164,90,.06), transparent 50%);
}

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 22px; }

/* ============================================================ HEADER */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 22px;
  max-width: var(--container); margin-inline: auto; width: 100%;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--ink); color: var(--bg);
  box-shadow: var(--shadow-1);
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 19px;
  letter-spacing: -.01em;
}
.site-nav { display: flex; gap: 8px; align-items: center; }
.link-btn {
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.link-btn:hover { background: var(--bg-soft); border-color: var(--ink); }

/* ============================================================ HERO */
.hero {
  padding: 56px 0 36px;
  text-align: center;
}
.eyebrow {
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 22px;
  font-weight: 500;
}
.headline {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(36px, 6vw, 64px);
  line-height: 1.04;
  letter-spacing: -.025em;
  color: var(--ink);
  max-width: 880px;
  margin: 0 auto;
  font-variation-settings: "opsz" 96, "SOFT" 50;
}
.headline em {
  font-style: italic;
  font-variation-settings: "opsz" 144, "SOFT" 100;
  color: var(--accent);
}
.headline-accent {
  display: inline-block;
  font-style: italic;
  background: linear-gradient(180deg, var(--ink) 60%, var(--accent) 60%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.subhead {
  margin: 22px auto 0;
  max-width: 600px;
  color: var(--ink-2);
  font-size: 17px;
}

/* ============================================================ SEARCH */
.search { margin-top: 36px; }
.search-box {
  position: relative;
  display: flex; align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  padding: 6px 6px 6px 22px;
  max-width: 680px;
  margin: 0 auto;
  box-shadow: var(--shadow-2);
  transition: box-shadow .25s var(--ease), border-color .25s var(--ease), transform .25s var(--ease);
}
.search-box:focus-within {
  border-color: var(--ink);
  box-shadow: var(--shadow-3);
  transform: translateY(-1px);
}
.search-icon { width: 20px; height: 20px; color: var(--ink-3); flex-shrink: 0; }
#q {
  flex: 1;
  border: 0; outline: 0;
  background: transparent;
  padding: 16px 12px;
  font-size: 17px;
  color: var(--ink);
  min-width: 0;
}
#q::placeholder { color: var(--ink-3); }
.clear-btn {
  border: 0; background: var(--bg-soft);
  width: 32px; height: 32px; border-radius: 999px;
  display: grid; place-items: center;
  color: var(--ink-3);
  transition: background .15s;
}
.clear-btn:hover { background: var(--line); color: var(--ink); }
.search-submit {
  border: 0;
  background: var(--ink);
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  margin-left: 8px;
  transition: background .2s var(--ease), transform .2s var(--ease);
}
.search-submit:hover { background: var(--accent-2); transform: translateY(-1px); }
.search-submit:active { transform: translateY(0); }
.search-submit:disabled { opacity: .6; cursor: not-allowed; transform: none; }

.search-hint {
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 16px;
}

/* Autocomplete dropdown */
.autocomplete {
  position: absolute;
  top: calc(100% + 8px); left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-3);
  z-index: 50;
  overflow: hidden;
  max-height: 360px; overflow-y: auto;
  animation: pop .18s var(--ease);
}
@keyframes pop {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.autocomplete li {
  padding: 12px 18px;
  display: flex; flex-direction: column; gap: 2px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  transition: background .12s;
}
.autocomplete li:last-child { border-bottom: 0; }
.autocomplete li:hover,
.autocomplete li[aria-selected="true"] { background: var(--bg-soft); }
.autocomplete .ac-main { font-weight: 500; color: var(--ink); }
.autocomplete .ac-sec  { font-size: 13px; color: var(--ink-3); }

/* ============================================================ MAIN */
.main-area { padding-bottom: 80px; flex: 1; }

/* Ad slots (placeholders) */
.ad-slot {
  margin: 22px auto;
  border: 1px dashed var(--line-2);
  background: repeating-linear-gradient(45deg, #fafaf7, #fafaf7 8px, #f3f1ec 8px, #f3f1ec 9px);
  color: var(--ink-3);
  border-radius: var(--r-md);
  display: grid; place-items: center;
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
}
.ad-banner { height: 100px; max-width: 760px; }
.ad-rect   { height: 260px; max-width: 320px; }

/* ============================================================ RESULT CARD */
.result-area:empty { display: none; }

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-2);
  margin: 12px auto 28px;
  animation: rise .35s var(--ease);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-photo {
  position: relative;
  height: 230px;
  background: linear-gradient(135deg, #2a2620, #15161a);
  overflow: hidden;
}
.result-photo img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .4s var(--ease);
}
.result-photo img.loaded { opacity: 1; }
.result-photo::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,.45));
}
.result-photo .status-badge {
  position: absolute; top: 16px; left: 16px;
  background: rgba(255,255,255,.92);
  padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
  letter-spacing: .04em;
  color: var(--ink);
  z-index: 2;
}
.result-photo .status-badge.ok { color: var(--ok); }
.result-photo .status-badge.closed { color: var(--err); }

.result-body { padding: 28px 28px 24px; }
.result-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.result-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(26px, 3.4vw, 36px);
  line-height: 1.1;
  letter-spacing: -.02em;
  color: var(--ink);
  font-variation-settings: "opsz" 96;
}
.result-category {
  font-size: 13px;
  color: var(--ink-3);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.result-rating {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 10px;
  font-size: 14px; color: var(--ink-2);
}
.stars { color: var(--gold); letter-spacing: 2px; }

.result-summary { color: var(--ink-2); margin: 16px 0 4px; font-size: 15.5px; }

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.info-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  background: var(--bg-soft);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
}
.info-item .ic { color: var(--accent); width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }
.info-item .lbl {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 2px;
}
.info-item .val { color: var(--ink); word-break: break-word; font-size: 14.5px; }
.info-item a.val { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.info-item a.val:hover { color: var(--accent); }

.result-actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-top: 22px;
}
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line-2);
  background: var(--bg-card);
  color: var(--ink);
  padding: 10px 16px; border-radius: 999px;
  font-size: 14px; font-weight: 500;
  transition: background .2s var(--ease), border-color .2s var(--ease), transform .15s;
}
.btn:hover { background: var(--bg-soft); border-color: var(--ink); }
.btn.primary {
  background: var(--ink); color: #fff; border-color: var(--ink);
}
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }

/* Hours collapsible */
.hours-block { margin-top: 18px; }
.hours-block details {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px 16px;
}
.hours-block summary {
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  list-style: none;
  display: flex; justify-content: space-between; align-items: center;
}
.hours-block summary::-webkit-details-marker { display: none; }
.hours-block summary::after {
  content: "+"; font-size: 18px; color: var(--ink-3); transition: transform .2s;
}
.hours-block details[open] summary::after { content: "−"; }
.hours-block ul { margin-top: 10px; }
.hours-block li {
  display: flex; justify-content: space-between;
  padding: 4px 0;
  font-size: 14px; color: var(--ink-2);
  border-bottom: 1px dashed var(--line);
}
.hours-block li:last-child { border-bottom: 0; }

/* ============================================================ CHAT */
.chat-area {
  margin: 28px auto 0;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-2);
  animation: rise .35s var(--ease);
}
.chat-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; margin-bottom: 18px;
}
.chat-header h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 24px;
  letter-spacing: -.015em;
  color: var(--ink);
}
.chat-header .muted { color: var(--ink-3); font-size: 13.5px; margin-top: 2px; }
.muted { color: var(--ink-3); }

.ai-quota {
  font-size: 13px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 999px;
  white-space: nowrap;
}
.ai-quota #aiRemaining { font-weight: 600; color: var(--accent-2); }

.suggested-questions {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 18px;
}
.chip {
  border: 1px solid var(--line-2);
  background: var(--bg-card);
  padding: 7px 14px; border-radius: 999px;
  font-size: 13.5px; color: var(--ink-2);
  transition: background .2s, border-color .2s, color .2s;
}
.chip:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

.chat-log {
  display: flex; flex-direction: column; gap: 12px;
  max-height: 520px; overflow-y: auto;
  padding: 4px;
  margin-bottom: 16px;
}
.chat-log:empty { display: none; }
.msg { max-width: 84%; padding: 12px 16px; border-radius: 16px; line-height: 1.55; font-size: 15px; }
.msg.user {
  align-self: flex-end;
  background: var(--ink); color: #fff;
  border-bottom-right-radius: 6px;
}
.msg.ai {
  align-self: flex-start;
  background: var(--bg-soft); color: var(--ink);
  border: 1px solid var(--line);
  border-bottom-left-radius: 6px;
}
.msg.ai .ai-tag {
  display: inline-block;
  font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 6px; font-weight: 600;
}
.msg.err { background: #fbe9e4; border-color: #f1c4b9; color: var(--err); }

.typing {
  display: inline-flex; gap: 4px; padding: 14px 16px;
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 16px;
  align-self: flex-start;
}
.typing span {
  width: 6px; height: 6px; border-radius: 999px; background: var(--ink-3);
  animation: dot 1s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: .12s; }
.typing span:nth-child(3) { animation-delay: .24s; }
@keyframes dot {
  0%,80%,100% { opacity: .25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.chat-input {
  display: flex; gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  padding: 6px 6px 6px 18px;
  transition: border-color .2s, box-shadow .2s;
}
.chat-input:focus-within {
  border-color: var(--ink);
  box-shadow: var(--shadow-2);
}
.chat-input input {
  flex: 1; border: 0; outline: 0; background: transparent;
  padding: 12px 0; font-size: 15px; min-width: 0;
}
#chatSend {
  border: 0; background: var(--ink); color: #fff;
  padding: 10px 18px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 500;
  transition: background .2s, transform .15s;
}
#chatSend:hover { background: var(--accent-2); }
#chatSend:disabled { opacity: .55; cursor: not-allowed; }

/* ============================================================ MODAL */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(20,20,25,.55);
  backdrop-filter: blur(6px);
  animation: fade .2s var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal-panel {
  position: relative;
  width: 100%; max-width: 480px;
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 36px 30px 28px;
  box-shadow: var(--shadow-3);
  animation: rise .25s var(--ease);
}
.modal h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -.02em;
  margin-top: 4px;
}
.modal .bullets { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.modal .bullets li {
  padding-left: 22px; position: relative;
  color: var(--ink-2);
}
.modal .bullets li::before {
  content: "";
  position: absolute; left: 0; top: 9px;
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 999px;
}
.modal .cta {
  margin-top: 22px;
  width: 100%;
  background: var(--ink); color: #fff;
  border: 0; padding: 14px;
  border-radius: 999px;
  font-size: 15px; font-weight: 500;
  transition: background .2s;
}
.modal .cta:hover { background: var(--accent-2); }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  background: var(--bg-soft); border: 0;
  width: 32px; height: 32px; border-radius: 999px;
  display: grid; place-items: center;
  color: var(--ink-2);
}
.modal-close:hover { background: var(--line); color: var(--ink); }
.small { font-size: 12.5px; }

/* ============================================================ FOOTER */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 0;
  background: rgba(255,255,255,.4);
}
.footer-inner {
  display: flex; flex-direction: column; gap: 4px;
  align-items: center; text-align: center;
  font-size: 13.5px; color: var(--ink-2);
}

/* ============================================================ TOAST */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: 999px;
  font-size: 14px;
  box-shadow: var(--shadow-3);
  z-index: 200;
  animation: rise .25s var(--ease);
}
.toast[hidden] { display: none; }
.toast.err { background: var(--err); }
.toast.ok  { background: var(--ok); }

/* ============================================================ SKELETON */
.skeleton {
  background: linear-gradient(90deg, #f1eee6 0%, #faf7ef 50%, #f1eee6 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--r-md);
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
.sk-card { padding: 24px; background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--r-lg); }
.sk-card .skeleton + .skeleton { margin-top: 12px; }
.sk-line { height: 14px; }
.sk-line.lg { height: 24px; width: 60%; }
.sk-line.md { width: 80%; }
.sk-line.sm { width: 40%; }

/* ============================================================ RESPONSIVE */
@media (max-width: 640px) {
  .hero { padding: 32px 0 24px; }
  .headline { font-size: 36px; }
  .subhead { font-size: 16px; }
  .search-box { padding: 4px 4px 4px 16px; border-radius: 24px; }
  #q { padding: 14px 8px; font-size: 16px; }
  .search-submit { padding: 10px 16px; font-size: 14px; }
  .result-body { padding: 22px 18px 18px; }
  .result-photo { height: 180px; }
  .chat-area { padding: 18px; border-radius: 18px; }
  .chat-header { flex-direction: column; align-items: flex-start; }
  .ad-banner { height: 80px; }
  .site-header { padding: 16px 18px; }
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ============================================================ A11Y */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
