/* ===== City themes =====
   Each city only changes these variables; the rest of the CSS never
   hard-codes a city colour. script.js just sets <body data-city="..."> */

body[data-city="riyadh"] {
  --bg: #FFFCF7; --surface: #FFFFFF; --ink: #1F2328; --muted: #545B64; --line: #E8E1D6;
  --primary: #0F7C7A; --primary-dark: #0A5957; --on-primary: #FFFFFF;
  --accent: #F2B53B; --on-accent: #2A1E00; --soft: #FCEBC4; --tint: #E3F3F1;
  --cat: #B5452A; --overlay: rgba(25, 18, 12, 0.55);
  --display: "El Messiri", serif;
}
body[data-city="qassim"] {
  --bg: #FFFBF5; --surface: #FFFFFF; --ink: #1E2421; --muted: #55605A; --line: #ECE3D6;
  --primary: #9A4F1E; --primary-dark: #7A3D16; --on-primary: #FFFFFF;
  --accent: #E2A23B; --on-accent: #2A1A00; --soft: #F8E6C4; --tint: #FBEEDF;
  --cat: #2F6B4F; --overlay: rgba(40, 22, 10, 0.58);
  --display: "Reem Kufi", sans-serif;
}
body[data-city="khobar"] {
  --bg: #FAFCFD; --surface: #FFFFFF; --ink: #13232F; --muted: #4D5D69; --line: #E1E8EE;
  --primary: #1F5F78; --primary-dark: #174A5E; --on-primary: #FFFFFF;
  --accent: #E6B98A; --on-accent: #2A1C08; --soft: #FBEBD3; --tint: #E3EFF2;
  --cat: #B4532F; --overlay: rgba(10, 32, 42, 0.5);
  --display: "Rubik", sans-serif;
}
body[data-city="jeddah"] {
  --bg: #FFFBF7; --surface: #FFFFFF; --ink: #24201E; --muted: #5E5752; --line: #ECE4DA;
  --primary: #7B4B2A; --primary-dark: #5E3820; --on-primary: #FFFFFF;
  --accent: #2C7A8C; --on-accent: #FFFFFF; --soft: #DCEEF1; --tint: #F4ECE3;
  --cat: #2C6E7E; --overlay: rgba(28, 22, 18, 0.58);
  --display: "Amiri", serif;
}

/* ===== Base ===== */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans Arabic", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  transition: background-color 0.6s ease, color 0.6s ease;
}

h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.3; margin: 0; }
a { color: var(--primary); }
button { font: inherit; cursor: pointer; }

.container { width: min(1160px, 100% - 32px); margin-inline: auto; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ===== Header ===== */

.site-header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-row {
  min-height: 72px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.logo {
  font-family: var(--display); font-size: 1.7rem; font-weight: 700;
  color: var(--primary); text-decoration: none;
}
.city-switch {
  display: flex; gap: 4px; padding: 5px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  overflow-x: auto;
}
.city-switch button {
  min-height: 44px; padding: 0 20px; border: 0; border-radius: 999px;
  background: transparent; color: var(--ink); font-weight: 600; white-space: nowrap;
  transition: background-color 0.3s, color 0.3s;
}
.city-switch button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }

.lang-btn {
  min-height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--ink); font-weight: 600;
}
.lang-btn:hover { background: var(--tint); }
.header-actions { display: flex; align-items: center; gap: 16px; }
.city-switch button:hover:not([aria-pressed="true"]) { background: var(--tint); }

/* ===== Hero ===== */

.hero {
  position: relative; overflow: hidden;
  min-height: min(82vh, 760px);
  display: flex; align-items: center;
  background: var(--primary-dark); color: #FFFFFF;
}
.hero-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 40%;
  opacity: 0; transform: scale(1.06);
  transition: opacity 1s ease, transform 6s ease;
}
body[data-city="riyadh"] .hero-img[data-city="riyadh"],
body[data-city="qassim"] .hero-img[data-city="qassim"],
body[data-city="khobar"] .hero-img[data-city="khobar"],
body[data-city="jeddah"] .hero-img[data-city="jeddah"] { opacity: 1; transform: scale(1); }

.hero-overlay { position: absolute; inset: 0; background: var(--overlay); }

.hero-content { position: relative; padding: 96px 0 200px; }
.kicker {
  display: inline-flex; align-items: center; gap: 12px; margin: 0 0 18px;
  color: var(--accent); font-weight: 600; letter-spacing: 0.02em;
}
.kicker::before { content: ""; width: 40px; height: 2px; background: currentColor; }
body[data-city="jeddah"] .kicker { color: #9FD6E2; }

.hero h1 { font-size: clamp(2.4rem, 6vw, 4.6rem); max-width: 12ch; }
.tagline { font-size: clamp(1.05rem, 2vw, 1.3rem); margin: 16px 0 32px; max-width: 34ch; opacity: 0.92; }

.search input {
  width: min(560px, 100%); min-height: 58px; padding: 0 22px;
  border: 0; border-radius: 999px; background: #FFFFFF; color: #1F2328;
  font: inherit; font-size: 1.05rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.25);
}

.skylines { position: absolute; inset-inline: 0; bottom: -1px; height: 170px; pointer-events: none; }
.skyline {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; transition: opacity 0.8s ease;
}
body[data-city="riyadh"] .skyline[data-city="riyadh"],
body[data-city="qassim"] .skyline[data-city="qassim"],
body[data-city="khobar"] .skyline[data-city="khobar"],
body[data-city="jeddah"] .skyline[data-city="jeddah"] { opacity: 1; }
.sk-fill { fill: var(--bg); }
.sk-win { fill: var(--primary); }

/* ===== Section heads & tabs ===== */

.places { padding: 48px 0 24px; }
.section-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 20px;
}
.section-head h2 { font-size: clamp(1.8rem, 3.5vw, 2.4rem); }
.section-sub { margin: 4px 0 0; color: var(--muted); font-size: 0.95rem; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tabs button {
  min-height: 44px; padding: 0 20px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: all 0.25s;
}
.tabs button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.family-toggle {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
  color: var(--muted); cursor: pointer;
}
.family-toggle input { width: 20px; height: 20px; accent-color: var(--primary); }
.results-count { color: var(--muted); font-size: 0.9rem; margin: 4px 0 16px; }

/* ===== Cards ===== */

.cards {
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
}
.card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 24px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--line);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: rise 0.5s ease both;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(0, 0, 0, 0.08); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

.card-top { display: flex; align-items: center; justify-content: space-between; }
.rank {
  font-family: var(--display); font-size: 2.2rem; line-height: 1;
  color: var(--accent);
}
body[data-city="khobar"] .rank { color: #C08A50; }
.chip {
  display: inline-block; padding: 3px 12px; border-radius: 999px;
  background: var(--tint); font-size: 0.85rem; font-weight: 600;
}
.chip.cat { color: var(--cat); }

.card .name { font-size: 1.45rem; }
.name-alt { margin: -8px 0 0; color: var(--muted); font-size: 0.85rem; }
/* The other-language name has its own dir, so align it to the page side explicitly */
[dir="rtl"] .name-alt, [dir="rtl"] .place-name-alt { text-align: right; }
[dir="ltr"] .name-alt, [dir="ltr"] .place-name-alt { text-align: left; }

.rating { display: flex; align-items: center; gap: 6px; margin: 0; }
.star { width: 18px; height: 18px; fill: var(--accent); }
body[data-city="khobar"] .star { fill: #C08A50; }
.score { font-size: 1.1rem; }
.reviews { color: var(--muted); font-size: 0.9rem; }

.meta { display: flex; justify-content: space-between; gap: 12px; margin: 0; color: var(--muted); font-size: 0.92rem; }
.price { letter-spacing: 2px; color: var(--primary); }
.price .off { opacity: 0.25; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tags li { padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 0.82rem; color: var(--muted); }

.btn {
  margin-top: auto; min-height: 46px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px; background: var(--primary); color: var(--on-primary);
  font-weight: 600; text-decoration: none;
  transition: background-color 0.25s;
}
.btn:hover { background: var(--primary-dark); }
button.btn { border: 0; width: 100%; }

.card .name a { color: inherit; text-decoration: none; }
.card .name a:hover { color: var(--primary); }
.actions { margin-top: auto; display: grid; grid-template-columns: 2fr 1fr; gap: 8px; }
.actions .btn { margin-top: 0; }
.btn.ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn.ghost:hover { background: var(--tint); }

.empty { padding: 40px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 20px; }

/* ===== Day plan ===== */

.plan-wrap { margin-top: 48px; padding: 56px 0; background: var(--tint); transition: background-color 0.6s; }
.plan {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
}
.plan li {
  padding: 20px; border-radius: 18px; background: var(--surface);
  display: flex; flex-direction: column; gap: 4px;
}
.plan .when { color: var(--cat); font-weight: 600; font-size: 0.9rem; }
.plan .what { font-family: var(--display); font-size: 1.25rem; }
.plan a { color: var(--ink); font-weight: 600; text-decoration: none; }
.plan a:hover { color: var(--primary); text-decoration: underline; }
.plan .sub { color: var(--muted); font-size: 0.85rem; }

/* ===== Place page ===== */

.back-link { color: var(--ink); font-weight: 600; text-decoration: none; }
.back-link::before { content: "→ "; }
[dir="ltr"] .back-link::before { content: "← "; }

.place-hero {
  position: relative; overflow: hidden; min-height: 340px;
  display: flex; align-items: flex-end;
  background: var(--primary-dark); color: #FFFFFF;
}
.place-hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 40%; }
.place-hero-content { position: relative; padding: 64px 0 40px; }
.place-hero h1 { font-size: clamp(2.2rem, 5.5vw, 4rem); }
.place-name-alt { margin: 4px 0 0; opacity: 0.85; }
.breadcrumb { display: flex; gap: 8px; margin-bottom: 12px; font-size: 0.95rem; }
.breadcrumb a { color: #FFFFFF; }

.place-main { padding: 40px 0 24px; }
.place-grid {
  display: grid; gap: 32px; align-items: start;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
}
.place-info { display: flex; flex-direction: column; gap: 20px; }

.score-boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.score-box { padding: 18px; border-radius: 18px; display: flex; flex-direction: column; gap: 2px; }
.score-box.google { background: var(--primary); color: var(--on-primary); }
.score-box.visitors { background: var(--soft); color: var(--ink); }
.score-box .label { font-size: 0.88rem; opacity: 0.85; }
.score-box .big { font-size: 2rem; font-family: var(--display); }
.score-box .small { font-size: 0.85rem; opacity: 0.85; }

.facts {
  margin: 0; display: grid; grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line); border-radius: 18px; background: var(--surface); overflow: hidden;
}
.facts div { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.facts div:nth-child(odd) { border-inline-end: 1px solid var(--line); }
.facts div:nth-last-child(-n+2) { border-bottom: 0; }
.facts dt { color: var(--muted); font-size: 0.85rem; }
.facts dd { margin: 0; font-weight: 600; }
.big-tags li { font-size: 0.9rem; padding: 4px 14px; }
.source-note { margin: 0; color: var(--muted); font-size: 0.85rem; }

.review-form-wrap { padding: 28px; border-radius: 22px; background: var(--tint); }
.review-form-wrap h2 { font-size: 1.7rem; margin-bottom: 16px; }
#review-form { display: flex; flex-direction: column; gap: 10px; }
#review-form label, .stars-input legend { font-weight: 600; }
#review-form input, #review-form textarea {
  font: inherit; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
#review-form input { min-height: 48px; }
.stars-input { border: 0; padding: 0; margin: 0; }
/* Stars sit in a visible white box; empty stars are clearly grey */
.stars-row {
  display: inline-flex; gap: 2px; padding: 6px 10px; margin-top: 6px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px;
}
.star-btn {
  width: 48px; height: 48px; border: 0; background: transparent;
  font-size: 2.1rem; line-height: 1; color: #9A958C;
  transition: color 0.15s, transform 0.15s;
}
.star-btn:hover { transform: scale(1.12); }
.star-btn.on, .star-btn.preview { color: var(--accent); }
body[data-city="khobar"] .star-btn.on, body[data-city="khobar"] .star-btn.preview { color: #C08A50; }
.star-label { margin: 0; color: var(--muted); font-size: 0.9rem; }
.form-error { margin: 0; color: #B3261E; font-weight: 600; min-height: 1.2em; }

.reviews-wrap, .similar-wrap { margin-top: 48px; }
.reviews-wrap h2, .similar-wrap h2 { font-size: 1.8rem; margin-bottom: 16px; }
.reviews-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.review { padding: 18px 20px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); }
.review-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.9rem; }
.review-head strong { color: var(--ink); }
.review-stars { color: var(--accent); letter-spacing: 2px; }
.review p { margin: 6px 0 0; }

.similar { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.mini-card {
  display: flex; flex-direction: column; gap: 4px; padding: 18px 20px;
  border-radius: 16px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); text-decoration: none; transition: transform 0.25s, box-shadow 0.25s;
}
.mini-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(0, 0, 0, 0.07); }
.mini-card strong { font-family: var(--display); font-size: 1.2rem; }
.mini-card span { color: var(--muted); font-size: 0.9rem; }

/* ===== Footer ===== */

.site-footer { padding: 32px 0 48px; color: var(--muted); font-size: 0.9rem; border-top: 1px solid var(--line); }
.site-footer p { margin: 4px 0; }

/* ===== Small screens ===== */

@media (max-width: 640px) {
  /* Compact header: logo + cities on one row, and it scrolls away */
  .site-header { position: static; }
  .header-row { min-height: 64px; gap: 8px; flex-wrap: wrap; padding: 8px 0; }
  .site-header .city-switch { order: 3; width: 100%; }
  .lang-btn { min-height: 40px; padding: 0 12px; font-size: 0.9rem; }
  .logo { font-size: 1.25rem; white-space: nowrap; }
  .city-switch { padding: 3px; }
  .city-switch button { min-height: 40px; padding: 0 10px; font-size: 0.9rem; }
  .hero-content { padding: 64px 0 150px; }
  .skylines { height: 110px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
