/* Compare resorts (compare.html, compare.js). The page frame comes from styles.css, the app bar from resort.css.
   The table is a grid: a label column and one column per resort on wide screens; on phones each label sits on its
   own line above the resorts' values, so up to four columns fit without scrolling sideways. */

.cmp-section { padding: 32px 0 56px; }   /* the page's own sky and snow show through (resort.css) */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Add a resort */
.cmp-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.cmp-add-label { font-weight: 700; color: var(--navy); }
.cmp-search { position: relative; flex: 1 1 280px; max-width: 520px; }
.cmp-search input {
  width: 100%; height: 44px; padding: 0 14px; border: 1px solid var(--stroke); border-radius: 12px; background: #fff;
  font: 16px/1.2 var(--font); color: var(--text);
}
.cmp-search input:focus { outline: 3px solid var(--focus-ring); outline-offset: 1px; }
.cmp-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 10; margin: 0; padding: 6px; list-style: none;
  max-height: 340px; overflow-y: auto; border-radius: 14px; background: var(--glass-solid); box-shadow: 0 12px 32px rgb(var(--navy-rgb) / .18);
}
.cmp-results li { padding: 8px 10px; border-radius: 10px; cursor: pointer; line-height: 1.3; }
.cmp-results li[aria-selected="true"], .cmp-results li:hover { background: var(--fill-hover); }
.cmp-results strong { display: block; font-size: 15px; }
.cmp-results small { display: block; font-size: 13px; color: var(--muted); }
.cmp-results .cmp-none { cursor: default; color: var(--muted); }
.cmp-results .cmp-none:hover { background: none; }
.cmp-status { min-height: 1.4em; margin: 8px 0 0; font-size: 14px; color: var(--caution-strong); }

/* The table */
.cmp-table { margin-top: 12px; border-radius: var(--radius-lg); background: #fff; box-shadow: 0 1px 0 var(--separator), 0 8px 24px rgb(var(--navy-rgb) / .06); overflow: clip; }
.cmp-row { display: grid; grid-template-columns: minmax(150px, 210px) repeat(var(--n), minmax(0, 1fr)); }
.cmp-row + .cmp-row { border-top: 1px solid var(--separator); }
.cmp-label, .cmp-cell { padding: 10px 14px; min-width: 0; }
.cmp-label { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.3; }
.cmp-label small { display: block; margin-top: 2px; font-size: 12px; font-weight: 400; color: var(--muted); }
.cmp-cell { font-size: 15px; font-variant-numeric: tabular-nums; line-height: 1.3; overflow-wrap: anywhere; }
.cmp-cell small { display: block; font-size: 12px; color: var(--muted); }
.cmp-muted { color: var(--muted); font-size: 14px; }
.cmp-cell.best .cmp-value { font-weight: 700; color: var(--navy); }
.cmp-cell.best .cmp-value::after, .cmp-best-key i {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: var(--live); vertical-align: 2px;
}
.cmp-mix { display: flex; gap: 1px; height: 6px; margin-top: 6px; border-radius: 3px; overflow: hidden; max-width: 160px; }
.cmp-mix i { min-width: 2px; }

/* The resorts' names: stay in view while scrolling down the rows */
.cmp-head { position: sticky; top: 64px; z-index: 5; background: var(--glass-thick); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--separator); }
.cmp-head .cmp-label { display: flex; align-items: flex-end; }
.cmp-count { font-size: 12px; font-weight: 600; color: var(--muted); }
.cmp-resort { position: relative; padding-right: 36px; }
.cmp-name { display: block; font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--navy); text-decoration: none; line-height: 1.25;
  overflow-wrap: break-word; -webkit-hyphens: auto; hyphens: auto; }
.cmp-name:hover { text-decoration: underline; }
.cmp-resort small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); line-height: 1.3; }
.cmp-remove {
  position: absolute; top: 8px; right: 6px; display: grid; place-items: center; width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: 50%; background: var(--fill); color: var(--muted); cursor: pointer;
}
.cmp-remove:hover { background: var(--fill-hover); color: var(--text); }
.cmp-remove svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.cmp-remove:focus-visible, .cmp-chip:focus-visible, .cmp-favs:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 1px; }

.cmp-group { padding: 14px 14px 6px; background: var(--fill); }
.cmp-group [role="rowheader"] { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* Below the table */
/* While the resort list loads: about a table's height when resorts are expected, the empty card's otherwise */
.cmp-loading { min-height: min(70vh, 640px); }
.cmp-loading-some { min-height: 180px; }
.cmp-hint, .cmp-empty p { margin: 14px 0 0; color: var(--muted); font-size: 15px; }
.cmp-empty { margin-top: 18px; padding: 22px; border-radius: var(--radius-lg); background: #fff; box-shadow: 0 1px 3px rgb(var(--navy-rgb) / .08), 0 6px 20px rgb(var(--navy-rgb) / .06); }
.cmp-empty p:first-child { margin-top: 0; color: var(--text); }
.cmp-favs {
  margin-top: 14px; height: 44px; padding: 0 18px; border: 0; border-radius: 12px; background: var(--accent); color: var(--on-accent);
  font: 600 15px/1 var(--font); cursor: pointer;
}
.cmp-favs:hover { background: var(--accent-hover); }
.cmp-suggest { margin-top: 18px; }
.cmp-suggest p { margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.cmp-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.cmp-chip {
  min-height: 36px; padding: 0 14px; border: 1px solid var(--stroke); border-radius: 999px; background: #fff;
  font: 600 14px/1.2 var(--font); color: var(--text); cursor: pointer;
}
.cmp-chip:hover { background: var(--fill-hover); }
.cmp-chip small { font-weight: 400; color: var(--muted); }
@media (pointer: coarse) { .cmp-chip { min-height: 44px; } }
.cmp-source { margin: 20px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.cmp-best-key { display: inline-block; margin-left: 4px; white-space: nowrap; }
.cmp-best-key i { margin: 0 4px 0 0; vertical-align: 0; }

/* Phones: each label on its own line above the values */
@media (max-width: 699px) {
  .cmp-section { padding-top: 20px; }
  .cmp-table { margin-left: -8px; margin-right: -8px; border-radius: var(--radius); }
  .cmp-row { grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
  .cmp-label { grid-column: 1 / -1; padding: 10px 10px 0; font-size: 13px; color: var(--muted); }
  .cmp-label small { display: inline; margin-left: 4px; }
  .cmp-cell { padding: 4px 8px 10px; font-size: 14px; }
  .cmp-head .cmp-label { display: none; }
  /* The × above the name, so the name has the column's whole width */
  .cmp-resort { display: flex; flex-direction: column; padding: 6px 8px 10px; }
  .cmp-name { font-size: 13px; }
  .cmp-resort small { display: none; }
  .cmp-remove { position: relative; top: 0; right: 0; order: -1; align-self: flex-end; width: 24px; height: 24px; margin: 6px 2px 8px 0; }
  .cmp-remove svg { width: 12px; height: 12px; }
  /* A 44 px target around the 24 px ×; the name sits 8 px under it and stays out of it */
  .cmp-remove::after { content: ""; position: absolute; inset: -12px -10px -8px; }
  /* Four resorts: a little tighter, so names like "Hintertuxer" fit their column */
  .cmp-table[data-n="4"] .cmp-cell { padding-left: 6px; padding-right: 6px; font-size: 13px; }
  .cmp-table[data-n="4"] .cmp-name { font-size: 12px; letter-spacing: -.01em; }
  .cmp-group { padding: 12px 10px 6px; }
}
