/* Keyfob — hotel finder.
   Layout: search console up top, filter chips, then a single column of hotel cards.
   Motif: distances sit on brass key-fob tags, like a hotel room key. */
:root {
  --ink: #1d2433;
  --paper: #f5f6f8;
  --card: #ffffff;
  --line: #dce0e7;
  --muted: #5b6576;
  --brass: #a87a26;
  --brass-soft: #f4e8d0;
  --accent: #23466e;
  --accent-ink: #ffffff;
  --good: #2f7a4f;
  --danger: #a33a2c;
  --shadow: 0 1px 2px rgba(29, 36, 51, .06), 0 6px 18px rgba(29, 36, 51, .06);
  --display: "Young Serif", Georgia, "Times New Roman", serif;
  --body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e7eaf0; --paper: #11151d; --card: #191f2b; --line: #2b3343; --muted: #9aa3b4;
    --brass: #d9a74e; --brass-soft: #362b17; --accent: #8db4e3; --accent-ink: #0e1828;
    --good: #6cc495; --danger: #e8907f; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ink: #e7eaf0; --paper: #11151d; --card: #191f2b; --line: #2b3343; --muted: #9aa3b4;
  --brass: #d9a74e; --brass-soft: #362b17; --accent: #8db4e3; --accent-ink: #0e1828;
  --good: #6cc495; --danger: #e8907f; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 18px rgba(0,0,0,.25);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.55 var(--body);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; opacity: 0; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: 6px; z-index: 50; }
.skip:focus { left: 16px; }

/* top bar */
.top {
  max-width: 1240px; margin: 0 auto; padding-block: calc(14px + env(safe-area-inset-top, 0px)) 6px;
  display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-size: 20px; }
.logo { width: 26px; height: 26px; color: var(--brass); }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); cursor: pointer; color: var(--muted);
}
.icon-btn svg { width: 18px; height: 18px; }

.wrap { max-width: 1240px; margin: 0 auto; display: grid; gap: 16px; padding-block: 8px 28px; }

.hero h1 {
  font-family: var(--display); font-weight: 400; margin: 6px 0 0;
  font-size: clamp(28px, 4.6vw, 48px); line-height: 1.08; text-wrap: balance; max-width: 22ch;
}
.hero p { margin: 10px 0 0; color: var(--muted); max-width: 62ch; }

/* search console */
.search {
  display: flex; flex-wrap: wrap; gap: 12px 14px; align-items: end;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px; box-shadow: var(--shadow);
}
.field { display: grid; gap: 5px; min-width: 0; }
.field label, .field .label {
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  display: flex; justify-content: space-between; gap: 8px;
}
.field output { font-family: var(--mono); letter-spacing: 0; text-transform: none; color: var(--ink); }
input:not([type="range"]), select {
  background: var(--paper); border: 1px solid var(--line); border-radius: 7px;
  padding: 9px 11px; min-height: 44px; min-width: 0;
}
.zip-field input { width: 10em; font-family: var(--mono); font-size: 17px; letter-spacing: .05em; }
#country { max-width: 15em; }
.radius-field { flex: 1 1 160px; max-width: 240px; }
input[type="range"] { accent-color: var(--brass); width: 100%; min-height: 44px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; min-height: 44px; }
.seg button { border: 0; background: var(--paper); padding: 0 14px; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--brass-soft); color: var(--ink); font-weight: 600; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.primary {
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 7px;
  min-height: 44px; padding: 0 22px; font-weight: 600; cursor: pointer;
}
.primary:disabled, .ghost:disabled { opacity: .55; cursor: progress; }
.ghost {
  display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 1px solid var(--line);
  border-radius: 7px; min-height: 44px; padding: 0 14px; cursor: pointer;
}
.ghost svg { width: 16px; height: 16px; }

.recent { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.recent button {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 3px 10px; cursor: pointer;
  font-family: var(--mono); font-size: 12px;
}
.status { min-height: 1.5em; color: var(--muted); }
.status.err { color: var(--danger); }
.status strong { color: var(--ink); }
.status .note { display: block; font-size: 13px; margin-top: 2px; }

/* summary */
.summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.summary div { background: var(--card); padding: 12px 14px; min-width: 0; }
.summary dt { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.summary dd { margin: 2px 0 0; font-family: var(--display); font-size: 22px; overflow-wrap: anywhere; }
.summary dd small { font-family: var(--body); font-size: 13px; color: var(--muted); }
@media (max-width: 720px) { .summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* filters */
.controls { display: grid; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 5px 12px; cursor: pointer; font-size: 13px; color: var(--muted);
}
.chip-btn[aria-pressed="true"] { background: var(--brass-soft); border-color: var(--brass); color: var(--ink); font-weight: 600; }
.chip-btn .c { font-family: var(--mono); font-size: 11px; opacity: .75; margin-left: 4px; }
.control-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
#filter { flex: 1 1 220px; max-width: 360px; }
.inline { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }

/* layout: one readable column of results */
.layout { display: block; max-width: 880px; }
.tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.tabs [role="tab"] {
  border: 0; background: none; padding: 10px 6px; margin-bottom: -1px; cursor: pointer; color: var(--muted);
  border-bottom: 2px solid transparent; font-weight: 600;
}
.tabs [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--brass); }
.n { font-family: var(--mono); font-size: 12px; background: var(--line); border-radius: 999px; padding: 1px 7px; margin-left: 4px; }
.spacer { flex: 1; }
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 6px 4px; font-weight: 500; font-size: 14px; }

/* results */
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; outline: none; }
.hotel {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.hotel:hover { border-color: var(--brass); }
.hotel.active { border-color: var(--brass); box-shadow: 0 0 0 1px var(--brass), var(--shadow); }
.fob {
  position: relative; width: 78px; padding: 15px 4px 9px; text-align: center;
  background: var(--brass-soft); border: 1px solid var(--brass); border-radius: 8px 8px 24px 24px;
}
.fob::before {
  content: ""; position: absolute; top: 5px; left: 50%; width: 8px; height: 8px; margin-left: -4px;
  border-radius: 50%; border: 1.5px solid var(--brass); background: var(--card);
}
.fob b { display: block; font-family: var(--mono); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; }
.fob span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.fob .rank { position: absolute; top: -8px; left: -8px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px;
  background: var(--accent); color: var(--accent-ink); font: 600 11px/22px var(--mono); }
.hotel h3 { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 5px; margin: 5px 0 6px; }
.tag {
  font-size: 11px; letter-spacing: .04em; padding: 1px 8px; border: 1px solid var(--line);
  border-radius: 999px; color: var(--muted); white-space: nowrap;
}
.tag.type { text-transform: uppercase; letter-spacing: .07em; }
.tag.stars { color: var(--brass); border-color: var(--brass); }
.dist-line { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dist-line strong { color: var(--ink); font-weight: 600; }
.dist-line .pending { opacity: .6; }
.addr { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; margin-top: 2px; }
.links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 14px; }
.links a { text-decoration: none; font-weight: 500; }
.links a:hover { text-decoration: underline; }
.save {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--card);
  display: grid; place-items: center; cursor: pointer; color: var(--muted);
}
.save svg { width: 17px; height: 17px; }
.save { grid-column: 3; grid-row: 1; }
.save[aria-pressed="true"] { color: var(--brass); border-color: var(--brass); background: var(--brass-soft); }
@media (max-width: 480px) {
  .hotel { grid-template-columns: auto minmax(0, 1fr); }
  .save { grid-column: 1; grid-row: 2; justify-self: center; }
  .fob { width: 68px; }
}
.empty {
  border: 1px dashed var(--line); border-radius: var(--r); padding: 30px 20px; text-align: center; color: var(--muted);
}
.empty strong { display: block; color: var(--ink); font-family: var(--display); font-weight: 400; font-size: 19px; margin-bottom: 4px; }
.skeleton { height: 108px; border-radius: var(--r); border: 1px solid var(--line);
  background: linear-gradient(90deg, var(--card) 0%, var(--paper) 50%, var(--card) 100%); background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }
.more { width: 100%; justify-content: center; margin-top: 10px; }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 8px; z-index: 1000;
  max-width: calc(100vw - 32px); box-shadow: var(--shadow); font-size: 14px;
}

.foot { max-width: 1240px; margin: 0 auto; padding-block: 18px 30px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.foot p { margin: 4px 0; max-width: 90ch; }
.foot a { color: inherit; }

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

/* copy address */
.addr-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 4px; }
.addr-row .addr { margin: 0; min-width: 0; }
.copy-btn {
  display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--paper);
  color: var(--ink); border-radius: 6px; padding: 3px 9px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.copy-btn svg { width: 14px; height: 14px; }
.copy-btn:hover { border-color: var(--brass); }
.copy-btn.copied { background: var(--brass-soft); border-color: var(--brass); color: var(--good); font-weight: 600; }

/* photo, opened by clicking a hotel */
.hotel { cursor: pointer; }
.hotel.open { border-color: var(--brass); }
.link-like { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-weight: 500; cursor: pointer; }
.link-like:hover { text-decoration: underline; }
.photo { grid-column: 1 / -1; margin: 4px 0 0; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--paper); cursor: default; }
.photo img { display: block; width: 100%; max-height: 420px; object-fit: cover; background: var(--line); }
.photo figcaption, .photo .none { padding: 8px 12px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: space-between; }
.photo .rating { color: var(--ink); font-weight: 600; }
.photo .rating b { color: var(--brass); }
.photo.loading { height: 220px; background: linear-gradient(90deg, var(--card) 0%, var(--paper) 50%, var(--card) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
.photo .none { padding: 18px 14px; justify-content: flex-start; }

/* hotel card dialog */
.card-dialog {
  border: 0; padding: 0; background: transparent; color: var(--ink);
  width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto;
}
.card-dialog::backdrop { background: rgba(10, 14, 22, .55); }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.card-actions .ghost { background: var(--card); }
.hcard {
  background: var(--card); border-radius: 16px; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,.3);
  border: 1px solid var(--line);
}
.hcard-top {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--accent); color: var(--accent-ink); padding: 12px 20px;
}
.hcard-brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--display); font-size: 18px; }
.hcard-brand svg { width: 20px; height: 20px; color: var(--brass); }
.hcard-kind { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
.hcard-main { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 20px; padding: 20px; }
.hcard-info h2 { font-family: var(--display); font-weight: 400; font-size: 26px; line-height: 1.15; margin: 8px 0 10px; text-wrap: balance; overflow-wrap: anywhere; }
.hcard-addr { margin: 0; font-size: 16px; line-height: 1.45; overflow-wrap: anywhere; }
.hcard-phone { margin: 6px 0 0; color: var(--muted); font-variant-numeric: tabular-nums; }
.hcard-facts { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 16px 0 0; }
.hcard-facts dt { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.hcard-facts dd { margin: 2px 0 0; font-family: var(--mono); font-size: 15px; font-variant-numeric: tabular-nums; }
.hcard-qr { margin: 0; text-align: center; align-self: start; }
.hcard-qr .qr { width: 132px; height: 132px; display: block; border-radius: 8px; border: 1px solid var(--line); }
.hcard-qr figcaption { font-size: 12px; color: var(--muted); margin-top: 6px; }
.hcard-foot { border-top: 1px solid var(--line); padding: 10px 20px; font-size: 12px; color: var(--muted); background: var(--paper); }
@media (max-width: 520px) {
  .hcard-main { grid-template-columns: 1fr; }
  .hcard-qr { justify-self: start; display: flex; align-items: center; gap: 12px; text-align: left; }
  .hcard-qr .qr { width: 104px; height: 104px; }
  .card-actions { justify-content: stretch; }
  .card-actions button { flex: 1 1 auto; }
}

/* Printed hotel insert, inspired by the guest card reference. */
.hotel-card-scene { padding: 28px; background: repeating-linear-gradient(3deg, #79411f 0px, #854a25 5px, #92532d 8px, #854a25 14px); border-radius: 12px; }
.hotel-insert { width: min(100%, 360px); margin: auto; padding: 30px 24px 18px; box-sizing: border-box; text-align: center; color: #102d50; background: linear-gradient(115deg, #fff, #e6edf1 48%, #f8fafb); box-shadow: 2px 8px 20px #29130688; transform: rotate(-1deg); }
.hotel-identity { margin-bottom: 22px; }
.hotel-logo { max-width: 100%; max-height: 110px; object-fit: contain; margin: 0 auto 12px; }
.hotel-emblem { font: 42px Georgia, serif; letter-spacing: .08em; margin: 0 auto 12px; }
.hotel-wordmark { font: 28px Georgia, serif; overflow-wrap: anywhere; }
.hotel-gold-rule { height: 2px; background: #bb881f; margin: 18px 0; }
.hotel-insert h2 { font: 700 25px/1.2 Arial, sans-serif; margin: 0 0 16px; overflow-wrap: anywhere; }
.hotel-card-address { font: 21px/1.4 Arial, sans-serif; margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.hotel-card-phone { font: 16px Arial, sans-serif; margin: 14px 0; }
.hotel-card-message { font: 700 21px/1.25 Arial, sans-serif; margin: 14px 0; }
.hotel-card-qr { margin: 16px auto; }
.hotel-card-qr svg { width: 144px; height: 144px; display: block; margin: auto; }
.hotel-card-qr figcaption { font: 12px Arial, sans-serif; margin-top: 7px; }
.hotel-card-credit { font: 10px/1.5 Arial, sans-serif; color: #526174; margin-top: 20px; }
@media(max-width: 420px) { .hotel-card-scene { padding: 18px; } .hotel-insert { padding: 24px 18px 16px; } }

/* Full three-piece tabletop scene; one image is shared by preview and download. */
.card-dialog { width: min(820px, calc(100vw - 24px)); }
.hotel-scene-preview { background: #793e1d; border-radius: 12px; overflow: hidden; min-height: 160px; }
.hotel-scene-preview > img { display: block; width: 100%; height: auto; }
.hotel-scene-preview > p { padding: 32px; color: white; text-align: center; }
