/* The Settings screen (/shared/settings-screen.js, the settings template in app.html): a bar with ‹, the title and 🔊,
   then the settings in groups of rows on cards, as a phone's own Settings has them. Each rule is scoped to the screen
   (:where([data-styles~="settings"]), as every screen's stylesheet is - see the one-page notes in /shared/slide.js).
   Its colors are theme.css's, so dark mode is the same rules. */

/* Home's glow (the screen comes from home's ⚙️, and home's music carries on here) */
:where([data-styles~="settings"]).settings {
  --glow-a: rgba(255, 95, 168, 0.34);
  --glow-b: rgba(255, 170, 90, 0.24);
  --glow-c: rgba(120, 119, 198, 0.34);
  --toast-top: 72px;
}

/* The bar: stays at the top as the list scrolls under it, which it then blurs */
:where([data-styles~="settings"]) .settings-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 10px max(12px, env(safe-area-inset-left, 0px));
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
:where([data-styles~="settings"]) .settings-bar.is-scrolled {
  background: rgba(35, 37, 38, 0.95);
  box-shadow: 0 1px 0 var(--glass-line);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}
/* The backdrop's own color, light or dark, where the browser can mix colors (on its own: see .page-body::before in
   theme.css) */
@supports (color: color-mix(in srgb, red, red)) {
  :where([data-styles~="settings"]) .settings-bar.is-scrolled { background: color-mix(in srgb, var(--bg-1) 94%, transparent); }
}
:where([data-styles~="settings"]) .settings-bar h1 {
  margin: 0;
  text-align: center;
  font-weight: 800;
  font-size: 19px;
  line-height: 1.2;
  color: var(--on-dark);
}
:where([data-styles~="settings"]) .settings-round {
  appearance: none;
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--glass-line);
  border-radius: 50%;
  background: var(--glass);
  color: var(--on-dark);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: background-color 0.15s ease;
}
@media (hover: hover) {
  :where([data-styles~="settings"]) .settings-round:hover { background: rgba(255, 255, 255, 0.2); }
}
:where([data-styles~="settings"]) .settings-round:is(:active, .is-pressed) { scale: 0.92; }
:where([data-styles~="settings"]) .settings-back svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  translate: -1px 0;
}

/* The groups, as wide as a phone at most (a computer's window: down the middle) */
:where([data-styles~="settings"]) .settings-list {
  max-width: 520px;
  margin: 0 auto;
  padding: 6px max(16px, env(safe-area-inset-right, 0px)) calc(36px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  gap: 22px;
}
:where([data-styles~="settings"]) .settings-group {
  display: grid;
  gap: 8px;
}
:where([data-styles~="settings"]) .settings-label {
  margin: 0 6px;
  font-weight: 600;
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--on-dark-muted);
}
:where([data-styles~="settings"]) .settings-card {
  overflow: hidden;
  border-radius: var(--radius-card);
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 14px 30px -14px rgba(0, 0, 0, 0.45);
}

/* A row: its emoji, what it is (and a line under that), then its switch, its choice or its › */
:where([data-styles~="settings"]) .settings-row {
  position: relative;
  width: 100%;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  /* Pressed, a row lights up rather than shrinking inside its card */
  scale: none;
  transition: background-color 0.15s ease;
}
:where([data-styles~="settings"]) :is(button, a).settings-row:is(:active, .is-pressed) {
  scale: none;
  background: var(--row-hover);
  transition-duration: 0s;
}
@media (hover: hover) {
  :where([data-styles~="settings"]) :is(button, a).settings-row:hover { background: var(--row-hover); }
}
:where([data-styles~="settings"]) .settings-row:focus-visible { outline-offset: -3px; }
/* A hairline between rows, from under the words to the card's edge */
:where([data-styles~="settings"]) .settings-row:not(:first-child)::before,
:where([data-styles~="settings"]) .settings-sub > .settings-row:first-child::before {
  content: "";
  position: absolute;
  top: 0;
  left: 56px;
  right: 0;
  height: 1px;
  background: var(--field-line);
}
:where([data-styles~="settings"]) .settings-icon {
  width: 28px;
  flex: none;
  text-align: center;
  font-size: 20px;
  line-height: 1;
}
:where([data-styles~="settings"]) .settings-text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}
:where([data-styles~="settings"]) .settings-text b {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.25;
}
:where([data-styles~="settings"]) .settings-text small {
  font-size: 13px;
  line-height: 1.3;
  color: var(--ink-muted);
}
:where([data-styles~="settings"]) .settings-chev {
  flex: none;
  font-size: 24px;
  line-height: 1;
  color: var(--ink-muted);
  opacity: 0.7;
}
/* Can't be used just now (signed out, or busy asking the server): faded, and the switch says so */
:where([data-styles~="settings"]) .settings-row.is-off { cursor: default; }
:where([data-styles~="settings"]) .settings-row.is-off .settings-text b { color: var(--ink-muted); }

/* You, at the top: the Account card's way in */
:where([data-styles~="settings"]) .settings-me {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  scale: none;
  transition: background-color 0.15s ease;
}
:where([data-styles~="settings"]) .settings-me:is(:active, .is-pressed) { scale: none; background: var(--row-hover); }
:where([data-styles~="settings"]) .settings-me-photo {
  width: 52px;
  height: 52px;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--field);
  font-style: normal;
  font-size: 24px;
  line-height: 1;
}
:where([data-styles~="settings"]) .settings-me-photo > * {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  font-size: 22px;
}
:where([data-styles~="settings"]) .settings-me-photo > img { object-fit: cover; }
:where([data-styles~="settings"]) .settings-me .settings-text b {
  font-weight: 800;
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Appearance: its line, then Light | Dark | Auto sliding (/shared/tabs.js), then what the one picked means */
:where([data-styles~="settings"]) .settings-look {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding-top: 12px;
  padding-bottom: 12px;
  cursor: default;
}
:where([data-styles~="settings"]) .settings-line {
  display: flex;
  align-items: center;
  gap: 12px;
}
:where([data-styles~="settings"]) .settings-looks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  --tabs-gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--field);
  -webkit-user-select: none;
  user-select: none;
}
:where([data-styles~="settings"]) .settings-looks button {
  appearance: none;
  height: 36px;
  padding: 0 6px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-muted);
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  cursor: pointer;
}
@media (hover: hover) {
  :where([data-styles~="settings"]) .settings-looks button:hover { color: var(--ink); }
}
:where([data-styles~="settings"]) .settings-look-stage { min-height: 18px; }
:where([data-styles~="settings"]) .settings-look-page {
  margin: 0;
  text-align: center;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-muted);
}

/* Reminder time: the phone's own picker, looking like the rest */
:where([data-styles~="settings"]) .settings-select {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  max-width: 45%;
  height: 36px;
  padding: 0 30px 0 12px;
  border: 0;
  border-radius: 10px;
  background-color: var(--field);
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-muted) 50%), linear-gradient(135deg, var(--ink-muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}
:where([data-styles~="settings"]) .settings-select:disabled { opacity: 0.5; cursor: default; }

:where([data-styles~="settings"]) .settings-foot {
  margin: 0;
  text-align: center;
  font-size: 13px;
  line-height: 1.4;
  color: var(--on-dark-muted);
  font-variant-numeric: tabular-nums;
}
