:root {
  --black: #000000;
  --white: #FFFFFF;
  --field: #EEEEEE;
  --tile: #F3F3F3;
  --rule: #E2E2E2;
  --mute: #545454;
  --font: "Century Gothic", CenturyGothic, AppleGothic, sans-serif;
  --wrap: 1120px;
}
@media (min-width: 1440px) {
  :root { --wrap: 1360px; }
}

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--white);
  color: var(--black);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--black); outline-offset: 3px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }

main {
  padding-top: 64px;
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  min-height: 100vh;
  box-sizing: border-box;
}

/* header */
.top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--black);
  color: var(--white);
}
.top .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.top img { height: 60px; width: auto; }
.top span { font-size: 15px; font-weight: 500; letter-spacing: .01em; }

/* intro scrolls away; tabs + search stick under header */
.intro {
  padding: 36px 0 36px;
  background: var(--white);
}
.controls-sticky {
  position: sticky;
  top: 64px;
  z-index: 50;
  background: var(--white);
}
.intro h1 {
  font-size: clamp(30px, 3.4vw, 40px);
  line-height: 1.06;
  font-weight: 700;
  letter-spacing: -.022em;
  margin: 0;
  white-space: nowrap;
}
.intro-points {
  margin: 14px 0 0;
  padding: 0;
  font-size: 17px;
  color: #000 !important;
  max-width: 60ch;
}

/* controls */
.controls {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 18px 0;
  border-top: 1px solid var(--black);
  border-bottom: 1px solid var(--rule);
  background: var(--white);
}
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0;
  padding: 2px;
  list-style: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  border: 0;
  border-radius: 999px;
  padding: 8px 8px 8px 14px;
  background: var(--field);
  color: var(--black);
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  gap: 8px;
  align-items: center;
}
.tab small {
  font-size: 12px;
  color: var(--mute);
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 50%;
  background: #DFDFDF;
  line-height: 1;
}
.tab[aria-selected="true"] { background: var(--black); color: var(--white); }
.tab[aria-selected="true"] small {
  color: var(--white);
  background: #333;
}
.search { position: relative; flex: 0 1 280px; }
.search input {
  width: 100%;
  font: inherit;
  font-size: 15px;
  border: 0;
  border-radius: 8px;
  background: var(--field);
  padding: 11px 14px 11px 40px;
}
.search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  height: 14px;
  width: 14px;
  margin-left: 6px;
  cursor: pointer;
  background: center / 14px 14px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E");
}
.search svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

/* city grid */
.grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 26px 18px;
  padding: 28px 0 8px;
  margin: 0;
  list-style: none;
}
.city {
  display: block;
  cursor: pointer;
  width: 100%;
  text-decoration: none;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  text-align: left;
  transition: transform .15s ease;
}
.city:hover { transform: translateY(-2px); }
.city:focus-visible {
  outline: 3px solid var(--black);
  outline-offset: 4px;
  border-radius: 4px;
}
.ph {
  aspect-ratio: 3 / 2;
  border-radius: 6px;
  overflow: hidden;
  background: transparent;
  position: relative;
  padding: 1px;
  box-sizing: border-box;
  transition: background .15s ease;
}
.ph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 5px;
  display: block;
  background: var(--tile);
}
.ph .pin {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #B8B8B8;
}
.city:hover .ph {
  background: #000;
}
.city[aria-pressed="true"] .ph { box-shadow: 0 0 0 3px var(--black); }
.name {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.25;
  transition: color .15s ease, font-weight .15s ease;
}
.city:hover .name { font-weight: 700; }
.city[aria-pressed="true"] .name::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--black);
  flex: none;
}
.country {
  font-size: 14px;
  color: var(--mute);
  margin-top: 2px;
  transition: color .15s ease;
}
.city:hover .country { color: var(--black); }
.empty { padding: 40px 0; color: var(--mute); font-size: 17px; }

/* location panel */
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--black);
  padding-bottom: 16px;
}
.panel h2 {
  margin: 0;
  font-size: clamp(26px, 3.4vw, 36px);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -.02em;
}
.panel h2 span {
  display: block;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--mute);
  margin-top: 6px;
}
.change {
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  background: none;
  border: 0;
  padding: 4px 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.hint { margin: 16px 0 0; font-size: 15px; color: var(--mute); }
.group { margin-top: 28px; }
.group h3 { margin: 0 0 4px; font-size: 15px; font-weight: 500; color: var(--mute); }
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 4px;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
}
.row:hover { background: #FAFAFA; }
.row b { font-size: 18px; font-weight: 500; display: block; line-height: 1.3; }
.row .lbl { display: flex; align-items: center; gap: 14px; }
.ic {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--tile);
  color: var(--black);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.ic svg {
  display: block;
  flex-shrink: 0;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 16px 0 4px;
  font-size: 14px;
  color: var(--mute);
}
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend .ic { width: 28px; height: 28px; }
.legend .ic svg { width: 15px; height: 15px; }
.row em {
  font-style: normal;
  font-size: 14px;
  color: var(--mute);
  display: block;
  margin-top: 2px;
}
.row .go {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--black);
  color: var(--white);
  display: grid;
  place-items: center;
  transition: transform .15s ease;
}
.row:hover .go { transform: translateX(2px); background: #333; }

/* ideas */
.intro-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 48px;
  align-items: center;
}
.ideas {
  border-left: 4px solid var(--black);
  padding: 4px 0 4px 20px;
}
.ideas h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.ideas p { margin: 4px 0 10px; font-size: 15px; color: var(--mute); }
.ideas ul { margin: 0; padding: 0; list-style: none; font-size: 16px; }
.ideas li {
  padding: 8px 0;
  border-top: 1px solid var(--rule);
  white-space: nowrap;
}
.ideas li:first-child { border-top: 0; padding-top: 2px; }
.ideas li:last-child { padding-bottom: 2px; }

/* inner pages */
#view { padding-top: 28px; padding-bottom: 8px; min-height: 60vh; }
.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-size: 14px;
  color: var(--mute);
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}
.lnk {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--black);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.crumbs li + li::before {
  content: "/";
  margin-right: 6px;
  color: #B0B0B0;
}
.banner {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 24 / 5;
  min-height: 150px;
  background: var(--tile);
}
.banner img { width: 100%; height: 100%; object-fit: cover; }
.banner::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0, 0, 0, .72) 0%, rgba(0, 0, 0, .15) 55%, rgba(0, 0, 0, 0) 100%);
}
.banner .cap {
  position: absolute;
  left: 24px;
  bottom: 18px;
  z-index: 1;
  color: var(--white);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.banner .cap h1 {
  margin: 0;
  font-size: clamp(30px, 4.6vw, 48px);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -.025em;
}
.banner .cap span { font-size: 15px; color: #E6E6E6; }
.pagehead {
  margin: 0;
  font-size: clamp(30px, 4.6vw, 48px);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -.025em;
}
.step {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin: 28px 0 0;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--black);
}
.step h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.01em;
}
.step small { font-size: 14px; color: var(--mute); }
.bgrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}
.bcard {
  width: 100%;
  background: var(--white);
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  text-decoration: none;
  transition: transform .15s ease, border-color .15s ease;
}
.bcard:hover { transform: translateY(-2px); border-color: var(--black); }
.bcard .go {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.bcard .go svg { display: block; }
.bcard b { display: block; font-size: 19px; font-weight: 500; }
.bcard em {
  display: block;
  font-style: normal;
  font-size: 14px;
  color: var(--mute);
  margin-top: 2px;
}
.back {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-top: 32px;
  font-size: 15px;
  font-weight: 500;
  text-underline-offset: 3px;
}

footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  margin-top: 0;
  background: var(--black);
  color: #E6E6E6;
  padding: 18px 0 calc(18px + env(safe-area-inset-bottom, 0px));
  font-size: 14px;
}

/* Real desktop only (not mobile “Desktop site”): only city list scrolls.
   Phones requesting desktop width still use normal page scroll so the last cities stay reachable. */
@media (min-width: 901px) and (hover: hover) and (pointer: fine) {
  html,
  body {
    height: 100%;
    overflow: hidden;
  }
  main {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
  #home:not([hidden]) {
    height: calc(100vh - 64px - 72px);
    height: calc(100dvh - 64px - 72px - env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  #home[hidden] {
    display: none;
  }
  .intro {
    flex: 0 0 auto;
    width: 100%;
  }
  .controls-sticky,
  .cities-panel {
    flex: 0 0 auto;
    width: 100%;
    max-width: var(--wrap);
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
  }
  .cities-panel {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .cities-panel::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }
  .cities-panel .grid {
    padding-bottom: 24px;
  }
  #view:not([hidden]) {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 64px - 72px);
    height: calc(100dvh - 64px - 72px - env(safe-area-inset-bottom, 0px));
    overflow: hidden;
  }
  #view .view-top,
  #view .view-bottom {
    flex: 0 0 auto;
  }
  #view .view-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  #view .view-scroll::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }
  .banner .cap h1 { font-size: 30px; }
}

/* Wide layout on touch / mobile desktop-view: keep page scrollable */
@media (min-width: 901px) and (hover: none),
  (min-width: 901px) and (pointer: coarse) {
  #home[hidden] {
    display: none;
  }
  .banner .cap h1 { font-size: 30px; }
  .grid {
    padding-bottom: 28px;
  }
}

@media (min-width: 1440px) {
  .grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 901px) and (max-width: 1080px) {
  .intro h1 {
    font-size: calc(clamp(30px, 3.4vw, 40px) - 2px);
  }
}
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .intro-grid { grid-template-columns: 1fr; gap: 20px; }
  .intro h1,
  .ideas li { white-space: normal; }
  .intro-points {
    font-size: 16px;
    color: inherit;
    max-width: none;
    border: 0;
    padding: 0;
  }
  .bgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .banner .cap h1 { font-size: 26px; }
}
@media (max-width: 620px) {
  /* main {
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  } */
  .wrap { padding: 0 18px; }
  .intro { padding: 20px 0 20px; }
  .intro h1 { font-size: 26px; }
  .intro-points {
    font-size: 14px;
  }
  .tab { font-size: 14px; padding: 6px 6px 6px 12px; }
  .ideas { padding: 4px 0 4px 16px; }
  .ideas ul { font-size: 14px; }
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 14px;
    padding-top: 20px;
  }
  .name { font-size: 14px; }
  .country { font-size: 12px; }
  .search { flex: 1 1 100%; }
  .bgrid { grid-template-columns: 1fr; margin: 20px 0 0; }
  .bcard { padding: 16px; }
  .bcard b { font-size: 16px; }
  .bcard em { font-size: 12px; }
  .banner { aspect-ratio: 16 / 9; }
  .banner .cap { left: 16px; bottom: 14px; gap: 2px; }
  .banner .cap h1 { font-size: 20px; }
  #view { padding-top: 20px; }
  .step { margin: 20px 0 0; }
  .step h2 { font-size: 18px; }
  .row b { font-size: 16px; }
  .back { margin-top: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
