:root {
  --bg: #fbf7f2;
  --surface: #ffffff;
  --text: #2b1d14;
  --muted: #7a6a5e;
  --primary: #8b4513;
  --primary-2: #c8793a;
  --accent: #2f855a;
  --danger: #c53030;
  --border: #ecdfd3;
  --shadow: 0 10px 30px rgba(60, 30, 10, 0.08);
  --radius: 16px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { line-height: 1.25; }
.container { width: min(1140px, 92%); margin-inline: auto; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel { padding: 1.5rem; }
.muted { color: var(--muted); }
.status { color: var(--muted); }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251, 247, 242, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { font-weight: 800; font-size: 1.2rem; color: var(--primary); }
.nav-links { display: flex; gap: 1.5rem; }
.nav-links a { font-weight: 500; color: var(--muted); }
.nav-links a:hover, .nav-links a.active { color: var(--primary); }
.nav-toggle { display: none; background: none; border: 0; font-size: 1.5rem; cursor: pointer; color: var(--text); }
@media (max-width: 640px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; gap: 0; background: var(--surface);
    border-bottom: 1px solid var(--border);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 1rem 4%; border-top: 1px solid var(--border); }
}

/* Hero */
.hero {
  background: linear-gradient(135deg, #3b1f0e 0%, #8b4513 55%, #d9925a 100%);
  color: #fff; text-align: center; padding: 4rem 0 5.5rem;
}
.hero.small { padding: 2.5rem 0 3rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin: 0 0.5rem; }
.hero p { opacity: .9; margin: 0 auto 2rem; max-width: 560px; }
.search-bar {
  display: flex; gap: .5rem; max-width: 640px; margin: 0 auto;
  background: #fff; padding: .4rem; border-radius: 999px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, .25);
}
.search-bar input {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent;
  padding: .8rem 1.2rem; font: inherit; font-size: 1rem; color: var(--text);
}
.search-error { max-width: 640px; margin: .75rem auto 0; color: #ffd6d6; font-size: .9rem; min-height: 1.2em; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 0; border-radius: 999px; padding: .75rem 1.25rem; cursor: pointer;
  font-family: inherit; font-weight: 600; font-size: .95rem;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff;
  box-shadow: 0 6px 16px rgba(139, 69, 19, .3);
}
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { background: #fff; }

/* Forms */
select, input, textarea {
  font-family: inherit; font-size: 1rem; width: 100%;
  padding: .7rem .9rem; border: 1px solid var(--border); border-radius: 10px;
  background: #fff; color: var(--text);
}
select:focus, input:focus, textarea:focus { outline: 2px solid var(--primary-2); border-color: transparent; }
select:disabled { opacity: .55; }
input.invalid, textarea.invalid { border-color: var(--danger); background: #fff5f5; }
form { display: grid; gap: 1rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row { display: flex; flex-direction: column; gap: .35rem; }
.form-row > label, .form-row > span { font-weight: 600; font-size: .9rem; }
.field-error { color: var(--danger); font-size: .82rem; min-height: 1.1em; }
textarea { resize: vertical; }

/* Star rating input */
.star-input { position: relative; display: flex; flex-direction: row-reverse; justify-content: flex-end; gap: .2rem; width: max-content; }
.star-input input { position: absolute; opacity: 0; pointer-events: none; }
.star-input label { font-size: 2rem; line-height: 1; color: #d9cbbd; cursor: pointer; }
.star-input label:hover,
.star-input label:hover ~ label,
.star-input input:checked ~ label { color: #f5a623; }

/* Filters */
.filters {
  display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 1rem; align-items: end;
  padding: 1.25rem; margin-top: -2.5rem; position: relative;
}
.filter-group { display: flex; flex-direction: column; gap: .35rem; }
.filter-group label { font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.filter-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Cafe cards */
.cafe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.25rem; margin: 1.5rem 0 4rem; }
.cafe-card { overflow: hidden; display: flex; flex-direction: column; transition: transform .2s, box-shadow .2s; }
.cafe-card:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(60, 30, 10, .15); }
.cafe-img { aspect-ratio: 4 / 3; background: linear-gradient(135deg, #f3d5b5, #c8793a); overflow: hidden; }
.cafe-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.cafe-card:hover .cafe-img img { transform: scale(1.05); }
.img-fallback img { display: none; }
.cafe-body { padding: 1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .35rem; }
.cafe-title { display: flex; justify-content: space-between; align-items: flex-start; gap: .5rem; }
.cafe-title h3 { margin: 0; font-size: 1.1rem; }
.cafe-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin-top: .4rem; font-size: .9rem; }
.stars { color: #f5a623; letter-spacing: 1px; }
.tag { align-self: flex-start; font-size: .75rem; font-weight: 600; background: #fdf0e4; color: var(--primary); padding: .2rem .6rem; border-radius: 999px; }
.badge { font-size: .72rem; font-weight: 700; padding: .2rem .55rem; border-radius: 999px; white-space: nowrap; }
.badge.open { background: #e6f6ec; color: var(--accent); }
.badge.closed { background: #f0f0f0; color: #666; }
.skeleton { height: 320px; background: linear-gradient(90deg, #f3ece4, #fbf7f2, #f3ece4); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); }
@keyframes shimmer { to { background-position: -200% 0; }}
.empty { grid-column: 1 / -1; padding: 3rem 1.5rem; text-align: center; }

/* Detail page */
.detail { display: grid; grid-template-columns: 1.3fr 1fr; gap: 1.5rem; padding: 2rem 0 4rem; align-items: start; }
.detail-main, .detail-side { display: flex; flex-direction: column; gap: 1.5rem; }
.back-link { color: var(--primary); font-weight: 600; }
.detail-hero { aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: linear-gradient(135deg, #f3d5b5, #c8793a); }
.detail-hero img { width: 100%; height: 100%; object-fit: cover; }
.detail h1 { margin: .5rem 0; font-size: clamp(1.6rem, 4vw, 2.2rem); }
.hours { width: 100%; border-collapse: collapse; }
.hours td { padding: .45rem 0; border-bottom: 1px dashed var(--border); }
.hours td:last-child { text-align: right; }
.hours tr.today td { font-weight: 700; color: var(--primary); }
.review { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.review:last-child { border-bottom: 0; }
.review header { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.review p { margin: .4rem 0 0; }
.review-form { padding: 1.5rem; }
.review-form h2 { margin-top: 0; }

/* Contact page */
.contact-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 1.5rem; padding: 2.5rem 0 4rem; align-items: start; }
.info-card p { margin: .5rem 0; }
.info-card h3 { margin-top: 1.25rem; }

/* Footer and toast */
.site-footer { border-top: 1px solid var(--border); padding: 2rem 0; text-align: center; color: var(--muted); background: #fff; }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 150%);
  background: var(--text); color: #fff; padding: .8rem 1.2rem; border-radius: 12px;
  transition: transform .3s; z-index: 100; max-width: 90%; text-align: center;
}
.toast.show { transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

/* Responsive */
@media (max-width: 1000px) {
  .filters { grid-template-columns: 1fr 1fr; margin-top: -2rem; }
  .filter-actions { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .detail, .contact-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .hero { padding: 3rem 0 4.5rem; }
  .search-bar { flex-direction: column; border-radius: 20px; }
  .search-bar input { padding: .7rem 1rem; }
  .search-bar .btn { width: 100%; }
  .filters { grid-template-columns: 1fr; margin-top: -1.5rem; }
  .form-grid { grid-template-columns: 1fr; }
  .cafe-grid { grid-template-columns: 1fr; }
  .panel { padding: 1.1rem; }
}
