/* You (S5a, #171): the sections pattern. Wide screens: the list of sections
   beside the chosen one, the list staying in view while the section scrolls
   with the page. Phones: the list first, a section pushed over it (panes.js),
   the bottom bar out of the way while it's open. The cards themselves keep
   account.css. Uses only existing tokens. */

.you-frame {
  --you-list-width: 17.5rem;
  display: grid;
  grid-template-columns: var(--you-list-width) minmax(0, 1fr);
  align-items: start;
  gap: 1.5rem;
  width: 100%;
  max-width: 78rem;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}

@media (min-width: 48rem) {
  .app-frame.has-nav > .you-frame { grid-column: 2; min-width: 0; }
}

/* ---- The list pane ---- */

.you-list {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  padding: 0 0 0.5rem;
}

.you-list.hidden { display: none; }

.you-person {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0.75rem 0.5rem;
  min-width: 0;
}

.you-person .mini-avatar { flex: none; width: 3rem; height: 3rem; font-size: 0.9rem; }
.you-person-text { display: grid; gap: 0.1rem; min-width: 0; }
/* One line of fixed height (not min-height: its text box can differ by a sub-pixel), there from the start: the date arrives after the list is shown, and a line
   appearing (or wrapping to two) moved every row under the pointer, so a click could
   start on one row and end on the next and do nothing. Guests have no such line. */
.you-member-since { height: 1lh; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; overflow-wrap: normal; }
body[data-audience="guest"] .you-member-since { display: none; }
.you-name { margin: 0; font-weight: 700; overflow-wrap: anywhere; }

.you-guest-card { margin: 0 0.75rem 0.5rem; }

.you-sections { display: grid; gap: 0.15rem; margin: 0; padding: 0 0.5rem; list-style: none; }
.you-sections > li[hidden] { display: none; }

.you-section-link {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius-field);
  color: var(--text);
  font-size: var(--type-body);
  font-weight: 600;
  text-decoration: none;
}

.you-section-link:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }

/* "Report an accessibility problem" (#219): at the foot of the list, quieter than a section. */
.you-feedback { margin: 0.5rem 0 0; padding: 0 0.5rem; }
.you-feedback[hidden] { display: none; }
.you-feedback a { display: inline-block; padding: 0.7rem 0.75rem; color: var(--text-muted); font-size: 0.875rem; font-weight: 600; line-height: 1.35; text-underline-offset: 0.2em; }
.you-feedback a:hover { color: var(--text); }

/* The selected section, as the selected room (L3): lit fill, one bar (panes.css), bold. */
.you-section-link[aria-current="page"],
.you-section-link[aria-current="page"]:hover {
  position: relative;
  border-color: transparent;
  background: var(--selected);
  box-shadow: var(--elev-1);
  font-weight: 700;
}

/* Stewarding keeps its Dusk, as on the rail. */
.you-steward-link { color: var(--steward); }

.you-session { margin: 0.75rem 0.75rem 0; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.you-session .secondary-button { width: 100%; justify-content: center; }

/* ---- The main pane ---- */

.you-main.account-shell { width: auto; max-width: 52rem; margin: 0; padding: 0; }

.you-main-header { display: flex; align-items: center; gap: 0.5rem; margin: 0.35rem 0 1.25rem; }
.you-frame .drawer-toggle, .you-frame .drawer-backdrop { display: none; }

.you-section-title {
  margin: 0;
  font-family: var(--display-font);
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 400;
  letter-spacing: var(--display-tracking);
  line-height: 1.1;
}

.you-section-title:focus { outline: none; }
.you-section-title:focus-visible { outline: 2px solid var(--signature-text); outline-offset: 4px; border-radius: 0.4rem; }

.you-section[hidden] { display: none; }

/* Card headings moved down a level under the section title; they keep their look. */
.you-section .account-card h3:not(.push-sounds h3) { margin: 0; font-size: 1.35rem; letter-spacing: -0.025em; }
.you-section .account-card h4 { margin: 0; font-size: 1rem; }

/* Profile: the name and when you joined. */
.you-facts { display: grid; gap: 0.6rem; margin: 0; }
.you-facts > div { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.you-facts dt { min-width: 8rem; color: var(--text-muted); }
.you-facts dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }

.you-notice:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  margin: 0;
  padding: 0.75rem 1rem;
  border: 1px solid color-mix(in srgb, var(--presence-text) 45%, var(--line));
  border-radius: 0.85rem;
  background: var(--presence-wash);
}

/* S5b: settings copy is one line; the rest waits behind "Learn more". */
.you-more summary { width: fit-content; color: var(--signature-text); font-weight: 600; cursor: pointer; }
.you-more p { margin: 0.5rem 0 0; color: var(--text-muted); line-height: 1.55; }

/* Accessibility: "Announce new messages", three choices. */
.announce-fieldset { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; min-width: 0; margin: 0; padding: 0; border: 0; }
.announce-fieldset legend { margin-bottom: 0.6rem; padding: 0; font-weight: 600; }
.announce-option { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; }
.announce-option input { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--signature); }
/* The hint describes "Only messages to me" and closes the group. */
.announce-help { flex-basis: 100%; margin: 0; }

.scheme-note { color: var(--text-muted); font-weight: 400; }

/* ---- Tablets: a narrower list, still beside the section ---- */

@media (min-width: 48rem) and (max-width: 63.99rem) {
  .you-frame { --you-list-width: 14.5rem; gap: 1rem; }
}

/* ---- Phones: the stack ---- */

@media (max-width: 47.99rem) {
  .you-frame { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0 0 2rem; }
  .you-list { position: static; max-height: none; padding: 0.25rem 0 1rem; }
  .you-frame[data-stack="list"] > .you-main { display: none; }
  .you-frame[data-stack="conversation"] > .you-list { display: none; }
  .app-frame.has-nav:has(> .you-frame[data-stack="conversation"]) { --bar-space: 0px; }
  .app-frame.has-nav:has(> .you-frame[data-stack="conversation"]) > .app-nav { display: none; }
  body:has(.you-frame[data-stack="list"]) .skip-link { display: none; }

  .you-main.account-shell { padding: 0 0.5rem; }
  .you-main-header { position: sticky; top: 0; z-index: 4; margin: 0 -0.5rem 0.75rem; padding: 0.5rem 0.5rem 0.5rem 0.25rem; background: var(--ground); border-bottom: 1px solid var(--line); }
  .you-frame .drawer-toggle { display: inline-flex; }
  .you-section-title { font-size: clamp(1.2rem, 8vw, 1.5rem); overflow-wrap: break-word; }
  .you-section-link { min-height: 3rem; font-size: 1rem; }
}

@media (any-pointer: coarse) {
  .you-section-link { min-height: 3rem; }
}

@media (forced-colors: active) {
  .you-section-link[aria-current="page"] { border: 2px solid Highlight; }
}

/* ---- Lantern Next L7 (#397): settings as quiet sections on the scales ---- */

/* A section's title is Display M: a page header, not a poster. */
.you-section-title { font-weight: 700; letter-spacing: var(--title-tracking); line-height: var(--leading-tight); }
/* (Phones keep their own, smaller size above.) */
@media (min-width: 48rem) {
  .you-section-title { font-size: var(--type-display-m); }
}
/* Cards sit at the resting elevation with the sheet corner and a soft edge; their headings
   are Title type. */
#account-shell .account-card {
  gap: var(--space-4);
  padding: clamp(1.1rem, 3vw, 1.5rem);
  border-color: var(--line-soft);
  border-radius: var(--radius-sheet);
  box-shadow: var(--elev-1);
}
#account-shell .account-card + .account-card { margin-top: var(--space-4); }
#account-shell .account-card h2 { font-family: var(--display-font); font-size: var(--type-title); font-weight: 700; letter-spacing: var(--title-tracking); line-height: var(--leading-tight); }
#account-shell .account-details { border-color: var(--line-soft); border-radius: var(--radius-field); }

/* The colour scheme is a set of named radios, each a chip: its swatch, then its name. The
   chosen one is told by more than colour: a full ring in ink, its name in bold, and a tick
   on its swatch. */
#account-shell .scheme-picker { gap: var(--space-2); }
#account-shell .scheme-option {
  min-height: var(--target-min);
  max-width: 100%;
  padding: 0.3rem 0.85rem 0.3rem 0.5rem;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-pill);
  overflow-wrap: anywhere;
}
#account-shell .scheme-option:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
#account-shell .scheme-option:has(input:checked) { border-color: var(--text); background: var(--surface); box-shadow: inset 0 0 0 1px var(--text); }
#account-shell .scheme-option:has(input:checked) .scheme-swatch { outline: none; }
#account-shell .scheme-option:has(input:focus-visible) { outline: 2px solid var(--signature-text); outline-offset: 2px; }
#account-shell .scheme-option:has(input:focus-visible) .scheme-swatch { outline: none; }
#account-shell .scheme-swatch { position: relative; }
#account-shell .scheme-option:has(input:checked) .scheme-swatch::before,
#account-shell .scheme-option:has(input:checked) .scheme-swatch::after {
  position: absolute;
  inset-block-end: -0.35rem;
  inset-inline-end: -0.4rem;
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  content: "";
}
#account-shell .scheme-option:has(input:checked) .scheme-swatch::before { background: var(--text); box-shadow: 0 0 0 1.5px var(--surface); }
#account-shell .scheme-option:has(input:checked) .scheme-swatch::after {
  background: var(--surface);
  -webkit-mask: url("/assets/icons/check.svg") center / 0.7rem no-repeat;
  mask: url("/assets/icons/check.svg") center / 0.7rem no-repeat;
}
@media (forced-colors: active) {
  #account-shell .scheme-option { border-color: ButtonText; }
  #account-shell .scheme-option:has(input:checked) { border: 2px solid Highlight; }
  #account-shell .scheme-option:has(input:checked) .scheme-swatch::before { forced-color-adjust: none; background: Highlight; box-shadow: none; }
  #account-shell .scheme-option:has(input:checked) .scheme-swatch::after { forced-color-adjust: none; background: HighlightText; }
}

/* ChitChat for Android (#417): at the foot of the list, above the feedback line. Members only:
   the app has no guest entry. The address is the one the app's "Server address" field takes. */
.you-android-app {
  display: grid;
  justify-items: start;
  gap: 0.4rem;
  margin: 1rem 0.5rem 0;
  padding: 0.75rem 0.75rem 0;
  border-top: 1px solid var(--line-soft);
}
.you-android-app[hidden],
body[data-audience="guest"] .you-android-app { display: none; }
.android-app-title { margin: 0; font-size: var(--type-body); font-weight: 700; }
.android-app-server { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; }
.android-app-address { margin: 0; font-size: var(--type-label); overflow-wrap: anywhere; }
.android-app-host { font-weight: 600; user-select: all; }
.android-app-copy { min-width: 3rem; min-height: 3rem; padding-block: 0.4rem; }
.android-app-status { flex-basis: 100%; margin: 0; color: var(--text-muted); font-size: var(--type-label); }
