/* Settings (settings.js): the panel, as a dialog on the map and on the Settings page (settings.html). Grouped rows
   like the iOS Settings app. The switch and buttons come from friends.css; colours from design/tokens.css. */

.set-group { margin: 0 0 var(--space-4); }
.set-group-title {
  margin: 0 0 6px 4px;
  font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.set-card { border-radius: var(--radius); background: #fff; box-shadow: 0 0 0 1px var(--separator); overflow: hidden; }
.set-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; cursor: pointer;
}
.set-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.set-text strong { font-size: 15px; font-weight: 600; }
.set-text small { font-size: 13px; line-height: 1.35; color: var(--muted); }
.set-icon {
  flex: none; width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center;
}
.set-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.set-icon { color: #fff; }
.set-icon.sos { background: var(--sos); }
.set-icon.share { background: var(--live); }
.set-icon.friends { background: #7b3fe4; }   /* the first friend colour in friends.js */
.set-icon.arrows { background: var(--piste-blue); }
.set-icon.junction { background: var(--poi-junction); }
.set-icon.units { background: var(--piste-unknown); }
.set-icon.restaurant { background: var(--poi-food); }
.set-icon.parking { background: var(--poi-parking); }
.set-icon.warning { background: var(--wx-avalanche); }
.set-icon.legend { background: var(--navy); }
.set-icon.report { background: var(--caution); color: var(--caution-ink); }   /* skiers' report pins (piste-reports.js) */
.set-icon.offpiste { background: var(--poi-offpiste); color: var(--poi-offpiste-ink); }
.set-icon.awake { background: var(--caution); color: var(--caution-ink); }
.set-icon.piste { background: var(--piste-red); }
.set-icon.park { background: var(--poi-park); }
.set-icon.bell { background: var(--badge); }
.set-icon.record { background: var(--sos); }   /* recorded ski days (tracking.js) */
.set-icon.language { background: var(--piste-blue); }   /* the app's language (i18n.js) */
.set-icon.keyboard { background: var(--navy); }   /* the "/" search shortcut (feature-search.js) */
.set-icon.motion { background: var(--wx-snow); }   /* Animations on Home (dashboard.js) */
.set-icon.quality { background: var(--accent); }   /* Graphics quality (perf.js) */
.set-icon.snow { background: var(--wx-snow); }   /* Snow alerts for favourites (snow-alerts.js) */
.set-row + .set-row, .set-confirm + .set-row { box-shadow: inset 0 1px 0 var(--separator); }   /* hairlines between rows */
div.set-row { cursor: default; }
.set-row input[role="switch"]:disabled { opacity: .5; cursor: default; }
.set-row input[role="switch"][aria-disabled="true"] { opacity: .5; cursor: progress; }
/* Metric / Imperial */
.set-segment { flex: none; display: inline-flex; padding: 2px; border-radius: 9px; background: var(--fill-hover); }
.set-segment button {
  min-width: 72px; padding: 5px 10px; border: 0; border-radius: 7px; background: transparent;
  font: 600 13px/1.2 var(--font); color: var(--text); cursor: pointer;
}
.set-segment button[aria-pressed="true"] { background: #fff; box-shadow: 0 1px 3px rgb(var(--navy-rgb) / .18); }
@media (max-width: 420px) { .set-segment button { min-width: 0; padding: 5px 8px; } }
.set-segment button:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
/* Fingers get 44 px without a taller control: the tap area reaches above and below (Settings' units, My skiing's period) */
@media (pointer: coarse) and (max-width: 420px) { .set-segment button { min-width: 44px; } }   /* and 44 wide: Graphics quality's "Low" was 41 px at 402 px wide */
@media (pointer: coarse) {
  .set-segment button { position: relative; }
  .set-segment button::after { content: ""; position: absolute; inset: calc(50% - 22px) 0; }   /* -9 px gave 43.6 (iOS Safari 2026-11-08) */
}

/* The language list (i18n.js) */
.set-select {
  flex: none; max-width: 46%; padding: 6px 28px 6px 10px; border: 0; border-radius: 9px;
  background: var(--fill-hover) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23555' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 14px;
  font: 600 13px/1.2 var(--font); color: var(--text); appearance: none; -webkit-appearance: none; cursor: pointer;
}
.set-select:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
/* On phones the list goes under its text, the full width of the row, so neither is squeezed or cut */
@media (max-width: 520px) {
  .set-row.wide { flex-wrap: wrap; }
  .set-row.wide .set-text { flex-basis: calc(100% - 42px); }
  .set-row.wide .set-select { flex: 0 0 calc(100% - 42px); max-width: none; min-height: 44px; margin-left: 42px; font-size: 15px; }
}

.set-note { margin: 6px 4px 0; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.set-foot { margin: var(--space-4) 4px 0; font-size: 12px; color: var(--muted); }

/* Asked before off-piste routes are switched on */
.set-confirm {
  margin: 0 14px 14px; padding: 12px;
  border-radius: var(--radius-sm);
  background: rgb(238 125 26 / .1); box-shadow: inset 0 0 0 1px rgb(238 125 26 / .35);
  font-size: 13.5px; line-height: 1.45;
}
.set-confirm-title { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-weight: 700; color: var(--poi-offpiste-text); }
.set-sign {   /* the diamond sign from the map, with an upright "!" */
  position: relative; isolation: isolate; flex: none; width: 20px; height: 20px;
  display: grid; place-items: center;
  font: 800 12px/1 var(--font); color: var(--poi-offpiste-ink);
}
.set-sign::before {
  content: ""; position: absolute; inset: 3px; z-index: -1;
  transform: rotate(45deg); border-radius: 2px;
  background: var(--poi-offpiste); box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.2px rgb(22 32 44 / .35);
}
/* Turning off SOS: red; sharing for the first time: blue */
.set-confirm.danger { background: rgb(var(--sos-rgb) / .08); box-shadow: inset 0 0 0 1px rgb(var(--sos-rgb) / .3); }
.set-confirm.danger .set-confirm-title { color: var(--sos-dark); }
.set-confirm.danger .set-sign { color: #fff; }
.set-confirm.danger .set-sign::before { background: var(--sos); border-radius: 50%; transform: none; }
.set-confirm.info { background: rgb(var(--accent-rgb) / .07); box-shadow: inset 0 0 0 1px rgb(var(--accent-rgb) / .3); }
.set-confirm.info .set-confirm-title { color: var(--text); }
.set-confirm.info .set-sign { display: none; }
.set-confirm-link { margin: 8px 0 0; }
.set-actions .btn.primary.danger { background: var(--sos); color: #fff; }
.set-actions .btn.primary.danger:hover { background: var(--sos-dark); }
.set-confirm ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
.set-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* As a dialog on the map */
.settings-dialog { width: min(460px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 0; overflow: hidden; }
.settings-dialog[open] { display: flex; flex-direction: column; }
.settings-head {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 14px 10px 22px;
}
.settings-head h2 { flex: 1; margin: 0; font-size: var(--text-title); letter-spacing: var(--tracking-title); }
.settings-body { padding: 4px 18px 20px; overflow-y: auto; }
.settings-body .set-card { background: rgba(255, 255, 255, .85); }

/* The Settings page */
body.settings-doc {
  margin: 0;
  font-family: var(--font); font-size: var(--text-base); line-height: 1.5;
  color: var(--text); background: var(--page);
  -webkit-font-smoothing: antialiased;
}
body.settings-doc * { box-sizing: border-box; }
.settings-page { max-width: 640px; margin: 0 auto; padding: var(--space-6) var(--gutter) 48px; font-family: var(--font); color: var(--text); }
.settings-page h1 { margin: 0 0 4px; font-family: var(--font-display); font-size: 28px; letter-spacing: var(--tracking-title); }
.settings-page > p { margin: 0 0 var(--space-5); color: var(--muted); }
