/* Shanghai Travel - shared layout */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

:root {
  --maxw: 1220px;
  --fs-body: 15px;
  --lh: 1.65;
  --radius: 10px;
  --gap: 20px;
  --sec-pad: 68px;
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 22px;
}

section { padding: var(--sec-pad) 0; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--line);
}

.topbar-in {
  display: flex;
  align-items: center;
  gap: 16px;
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
}

.brand {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.navlinks {
  display: flex;
  gap: 4px;
  margin-left: auto;
  align-items: center;
}

.navlinks a {
  padding: 7px 12px;
  border-radius: 7px;
  font-size: var(--fs-nav);
  color: var(--text-2);
  font-weight: 600;
  transition: background 0.18s, color 0.18s;
}

.navlinks a:hover { background: var(--accent-soft); color: var(--accent); }

.langbtn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-nav);
  font-weight: 700;
  transition: all 0.18s;
}

.langbtn:hover { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; padding: 0; }

.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.hero-in {
  position: relative;
  z-index: 2;
  padding: 96px 0 76px;
}

.kicker {
  display: inline-block;
  font-size: var(--fs-kicker);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--hero-kicker);
  margin-bottom: 18px;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: var(--fs-h1);
  line-height: 1.08;
  margin: 0 0 20px;
  font-weight: 800;
  letter-spacing: -0.015em;
  white-space: pre-line;
  color: var(--hero-title);
}

.hero-lead {
  font-size: var(--fs-lead);
  max-width: 620px;
  color: var(--hero-lead);
  margin: 0 0 34px;
  line-height: 1.7;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.stat {
  background: var(--stat-bg);
  border: 1px solid var(--stat-line);
  border-radius: var(--radius);
  padding: 13px 20px;
  min-width: 108px;
}

.stat b {
  display: block;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.2;
  color: var(--stat-n);
}

.stat span { font-size: 12px; color: var(--text-2); font-weight: 600; }

/* ---------- alert ---------- */
.alert {
  display: flex;
  gap: 15px;
  align-items: flex-start;
  border-radius: var(--radius);
  padding: 18px 20px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-left: 5px solid var(--warn);
  margin-bottom: 30px;
}

.alert .ic { font-size: 22px; line-height: 1.2; }
.alert h3 { margin: 0 0 7px; font-size: 15px; font-weight: 800; color: var(--warn); }
.alert p { margin: 0 0 6px; font-size: 13.5px; color: var(--text-2); line-height: 1.68; }
.alert p:last-child { margin-bottom: 0; }

/* ---------- section head ---------- */
.sechead { margin-bottom: 30px; }

.sechead .num {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--accent);
  display: block;
  margin-bottom: 9px;
}

.sechead h2 {
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.sechead p {
  margin: 10px 0 0;
  color: var(--text-2);
  font-size: 14px;
  max-width: 640px;
}

/* ---------- notes ---------- */
.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: var(--gap);
}

.note {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}

.note-h {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 14px;
}

.note-h .ic {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  font-size: 18px;
  flex: 0 0 36px;
}

.note-h h3 { margin: 0; font-size: 15.5px; font-weight: 800; }

.note ul { margin: 0; padding-left: 18px; }
.note li { font-size: 13.2px; color: var(--text-2); margin-bottom: 8px; line-height: 1.66; }
.note li:last-child { margin-bottom: 0; }

/* ---------- warnings ---------- */
.warn-box {
  background: var(--surface);
  border: 1px solid var(--warn-line);
  border-radius: var(--radius);
  padding: 26px;
  margin-top: 26px;
}

.warn-box h3 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 800;
  color: var(--warn);
  display: flex;
  align-items: center;
  gap: 9px;
}

.warn-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
  gap: 11px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.warn-list li {
  position: relative;
  padding-left: 26px;
  font-size: 13.2px;
  color: var(--text-2);
  line-height: 1.62;
}

.warn-list li::before {
  content: '✕';
  position: absolute;
  left: 0;
  top: 1px;
  color: var(--warn);
  font-weight: 900;
  font-size: 12px;
}

/* ---------- attractions ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  margin-bottom: 22px;
}

/* chips live in their own row so phones can scroll them horizontally
   while the search box stays on a separate, full-width line */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  min-width: 0;
}

.chip {
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
  transition: all 0.16s;
}

.chip:hover { border-color: var(--accent); color: var(--accent); }

.chip.on {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}

.searchbox {
  margin-left: auto;
  position: relative;
}

.searchbox input {
  width: 240px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  outline: none;
}

.searchbox input:focus { border-color: var(--accent); }

.count {
  font-size: 12.5px;
  color: var(--text-2);
  margin-bottom: 18px;
  font-weight: 600;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: var(--gap);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--line-strong);
}

.card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--ph-bg);
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-ph {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: var(--ph-bg);
}

.card-ph span { font-size: 46px; opacity: .9; }

.badge-cat {
  position: absolute;
  left: 12px;
  top: 12px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  background: var(--badge-bg);
  color: var(--badge-fg);
  backdrop-filter: blur(6px);
}

.stars {
  position: absolute;
  right: 12px;
  top: 12px;
  font-size: 11.5px;
  color: #ffc93c;
  letter-spacing: 1px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .6);
}

.fav {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .4);
  background: rgba(0, 0, 0, .38);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  backdrop-filter: blur(6px);
  transition: all .16s;
}

.fav:hover { background: rgba(0, 0, 0, .62); transform: scale(1.08); }
.fav.on { background: var(--accent); color: var(--accent-contrast); border-color: transparent; }

.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.card-body h3 { margin: 0; font-size: 16px; font-weight: 800; font-family: var(--font-display); }
.card-sub { font-size: 12.5px; color: var(--accent); font-weight: 700; }
.card-desc { font-size: 13px; color: var(--text-2); margin: 0; line-height: 1.65; }

.meta { display: grid; gap: 6px; margin-top: 2px; }

.meta-row {
  display: flex;
  gap: 9px;
  font-size: 12.6px;
  line-height: 1.55;
}

.meta-row .k {
  flex: 0 0 var(--meta-k-w);
  color: var(--text-3);
  font-weight: 700;
}

.meta-row .v { color: var(--text); font-weight: 600; }

.closed-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid var(--warn-line);
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  margin-top: 3px;
  align-self: flex-start;
}

.card-more {
  margin-top: auto;
  padding-top: 10px;
  font-size: 12.5px;
  font-weight: 800;
  color: var(--accent);
  border-top: 1px dashed var(--line);
}

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.on { display: flex; }

.modal-bg {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 14, .74);
  backdrop-filter: blur(4px);
}

.modal-box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  max-width: 640px;
  width: 100%;
  max-height: 86vh;
  overflow: auto;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}

.modal-media { aspect-ratio: 16 / 9; overflow: hidden; background: var(--ph-bg); }
.modal-media img { width: 100%; height: 100%; object-fit: cover; }
.modal-media .card-ph { aspect-ratio: 16/9; }

.modal-in { padding: 24px 26px 28px; }
.modal-in h3 { margin: 0 0 6px; font-size: 21px; font-weight: 800; font-family: var(--font-display); }
.modal-sub { color: var(--accent); font-weight: 700; font-size: 13px; margin: 0 0 14px; }
.modal-in > p { color: var(--text-2); font-size: 14px; line-height: 1.72; margin: 0 0 18px; }

.modal-table { display: grid; gap: 8px; margin-bottom: 20px; }

.modal-close {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, .5);
  color: #fff;
  font-size: 17px;
  display: grid;
  place-items: center;
}

.tips-list h4 {
  margin: 0 0 11px;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: .04em;
}

.tips-list ul { margin: 0; padding-left: 19px; }
.tips-list li { font-size: 13.2px; color: var(--text-2); margin-bottom: 8px; line-height: 1.62; }

/* ---------- itineraries ---------- */
.itins { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(310px, 100%), 1fr)); gap: var(--gap); }

.itin {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.itin h3 { margin: 0 0 4px; font-size: 18px; font-weight: 800; font-family: var(--font-display); }
.itin .tag { font-size: 12px; color: var(--accent); font-weight: 700; margin-bottom: 16px; }
.itin ol { margin: 0 0 15px; padding-left: 19px; flex: 1; }
.itin li { font-size: 13.2px; color: var(--text-2); margin-bottom: 10px; line-height: 1.62; }
.itin .note {
  font-size: 12.5px;
  background: var(--accent-soft);
  border-radius: 7px;
  padding: 10px 12px;
  color: var(--text);
  font-weight: 600;
  line-height: 1.6;
}

/* ---------- food ---------- */
.food-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 14px;
}

.food-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px 19px;
}

.food-item h4 { margin: 0 0 6px; font-size: 14.5px; font-weight: 800; }
.food-item p { margin: 0; font-size: 12.8px; color: var(--text-2); line-height: 1.62; }

/* ---------- essentials ---------- */
.ess-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: var(--gap); }

.ess {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}

.ess h3 { margin: 0 0 14px; font-size: 15.5px; font-weight: 800; }
.ess dl { margin: 0; display: grid; gap: 9px; }

.ess .row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 8px;
}

.ess .row:last-child { border-bottom: none; padding-bottom: 0; }
.ess dt { font-size: 13px; color: var(--text-2); font-weight: 600; }
.ess dd { margin: 0; font-size: 13.5px; font-weight: 800; font-family: var(--font-display); }

.ess ul { margin: 0; padding-left: 18px; }
.ess li { font-size: 13px; color: var(--text-2); margin-bottom: 8px; line-height: 1.62; }
.ess li:last-child { margin-bottom: 0; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }

.pill {
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 700;
}

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--line);
  padding: 34px 0 46px;
  color: var(--text-3);
  font-size: 12.5px;
}

footer .wrap { display: flex; flex-wrap: wrap; gap: 14px; justify-content: space-between; align-items: center; }

.disclaimer { max-width: 720px; line-height: 1.7; }

/* link back to the open-source repo - inherits the theme accent in both editions */
footer .repo-link {
  color: var(--text-3);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  transition: color .2s ease, text-decoration-color .2s ease;
}

footer .repo-link:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

@media (hover: none) {
  footer .repo-link:hover {
    color: var(--text-3);
    text-decoration-color: var(--line-strong);
  }
}

/* ---------- back to top ---------- */
.totop {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  display: grid;
  place-items: center;
  font-size: 17px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}

.totop.on { opacity: 1; pointer-events: auto; }
.totop:hover { transform: translateY(-3px); border-color: var(--accent); color: var(--accent); }

.empty {
  grid-column: 1 / -1;
  padding: 34px 0;
  color: var(--text-2);
  font-size: 14px;
}

.updated {
  margin-top: 18px;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.7;
}

/* ---------- favourites strip ---------- */
.fav-strip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  margin-bottom: 22px;
}

.fav-head {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 12px;
}

.fav-head h3 { margin: 0; font-size: 15px; font-weight: 800; font-family: var(--font-display); }
.fav-head span { font-size: 12px; color: var(--text-3); font-weight: 700; }

.fav-pills { display: flex; flex-wrap: wrap; gap: 8px; }

.fav-pill {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 700;
  transition: all .16s;
}

.fav-pill:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  :root { --sec-pad: 50px; }

  /* top bar becomes two rows: brand + lang switch on top,
     nav links below as a horizontally scrollable tab strip */
  .topbar-in {
    flex-wrap: wrap;
    height: auto;
    padding-top: calc(env(safe-area-inset-top) + 8px);
    padding-bottom: 6px;
    gap: 0 14px;
    row-gap: 2px;
  }
  .brand { order: 1; }
  .langbtn { order: 2; margin-left: auto; }
  .navlinks {
    order: 3;
    display: flex;
    width: 100%;
    margin-left: 0;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 2px 6px;
  }
  .navlinks::-webkit-scrollbar { display: none; }
  .navlinks a { white-space: nowrap; flex: 0 0 auto; padding: 6px 9px; font-size: 13px; }

  .searchbox { margin-left: 0; width: 100%; }
  .searchbox input { width: 100%; }
  .hero-in { padding: 72px 0 56px; }
}

@media (max-width: 600px) {
  :root { --sec-pad: 44px; --gap: 16px; }

  .wrap { padding: 0 18px; }

  .hero-in { padding: 52px 0 42px; }
  .kicker { margin-bottom: 14px; }
  .hero-lead { margin-bottom: 26px; }
  .hero-stats { gap: 8px; }
  .stat { padding: 10px 12px; min-width: 0; flex: 1 1 calc(50% - 4px); }
  .stat b { font-size: 20px; }
  .stat span { font-size: 11px; }

  .alert { padding: 15px 16px; }
  .sechead { margin-bottom: 22px; }
  .sechead h2 { font-size: 26px; }

  /* filters: chips scroll sideways, search takes its own full line */
  .filters { flex-wrap: wrap; margin-bottom: 16px; }
  .chip-row {
    flex: 0 0 auto;
    max-width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
    padding-bottom: 2px;
    margin-right: -18px;
    padding-right: 18px;
  }
  .chip-row::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; padding: 8px 15px; font-size: 12.5px; }
  .searchbox { order: 99; flex-basis: 100%; margin-top: 10px; }

  /* larger touch targets */
  .fav { width: 40px; height: 40px; font-size: 17px; }
  .totop {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
  }

  /* modal becomes a full-screen sheet on phones */
  .modal { padding: 0; }
  .modal-box {
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
  }
  .modal-in { padding: 18px 18px calc(34px + env(safe-area-inset-bottom)); }
  .modal-close { right: 14px; top: calc(12px + env(safe-area-inset-top)); }

  /* single-column grids at phone width */
  .notes-grid,
  .warn-list,
  .cards,
  .itins,
  .food-grid,
  .ess-grid { grid-template-columns: 1fr; }
  .card-body { padding: 14px 15px 16px; }
  .note { padding: 20px 18px; }
  .warn-box { padding: 20px 18px; }
  .itin { padding: 20px 18px; }
  .food-item { padding: 15px 16px; }
  .ess { padding: 20px 18px; }
  footer { padding: 26px 0 40px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .card:hover { transform: none; }
}

/* touch devices: drop hover states that would otherwise stick */
@media (hover: none) {
  .card:hover { transform: none; box-shadow: none; }
  .chip:hover, .fav-pill:hover, .langbtn:hover {
    border-color: var(--line-strong);
    color: var(--text-2);
  }
  .fav:hover { transform: none; }
  .totop:hover { transform: none; border-color: var(--line-strong); color: var(--text); }
}
