/* Settings, the second round: rows, the three-way and on/off controls, the people and access
 * editor and its preview, and the small pieces the new sections share. Additive: everything is
 * scoped to classes starting s2-, and it reads colour from tokens only (test/a11y-static.mjs and
 * test/contrast.mjs hold it to that). The page layout, the side nav and the cards themselves stay
 * where they were in app.css.
 */

/* ---- a row: what it is, a word under it, and what you can do ---- */

.s2-row {
  display: flex; align-items: center; gap: var(--space-16) var(--space-16); flex-wrap: wrap;
  padding: var(--space-16) 0; border-top: 1px solid var(--border);
}
.s2-row:first-of-type { border-top: none; }
.s2-row-text { flex: 1 1 220px; min-width: 0; }
.s2-row-title { font-weight: 700; font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; }
.s2-row-sub { font-size: 13.5px; color: var(--muted); line-height: 1.5; margin-top: var(--space-4); overflow-wrap: anywhere; }
.s2-row-control { display: flex; align-items: center; gap: var(--space-8); flex-wrap: wrap; flex: none; max-width: 100%; }
span.s2-row-sub { margin: 0; }

.s2-lead { margin: 0 0 var(--space-8); color: var(--muted); font-size: 14.5px; line-height: 1.55; }
.s2-note { margin: var(--space-16) 0 0; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.s2-note a { color: inherit; text-decoration: underline; }
.s2-note.bad { color: var(--error); font-weight: 600; }
.s2-note.warn { background: var(--warning-soft); color: var(--warning); padding: var(--space-16) var(--space-16); border-radius: var(--radius-card); font-weight: 600; }

/* ---- people: the circle of initials, and the line for one person ---- */

.s2-avatar {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; font-size: 13px; letter-spacing: .02em;
}
.s2-avatar.large { width: 60px; height: 60px; font-size: 19px; }
.s2-person { display: flex; align-items: center; gap: var(--space-16); flex-wrap: wrap; margin-bottom: var(--space-16); }
.s2-person-text { flex: 1 1 180px; min-width: 0; }
.s2-person-name { font-weight: 700; font-size: 18px; overflow-wrap: anywhere; }
.member-row .s2-avatar { margin-right: var(--space-4); }

.s2-tile {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; flex: none;
  background: var(--surface); color: var(--muted);
}
.s2-glyph { width: 22px; height: 22px; }

/* ---- the controls ---- */

.s2-seg { max-width: 100%; }
.s2-seg button { white-space: nowrap; }

.s2-toggle {
  position: relative; display: inline-flex; align-items: center; flex: none; width: 66px; height: 32px; padding: 0 var(--space-4);
  border: 1.5px solid var(--control); border-radius: var(--radius-pill); background: var(--surface); color: var(--text);
  font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; justify-content: flex-end;
}
.s2-toggle::after { content: ""; position: absolute; inset: -7px -3px; }
.s2-toggle-knob {
  position: absolute; left: 4px; top: 0; bottom: 0; width: 22px; height: 22px; margin: auto 0; border-radius: 50%;
  background: var(--control); transition: transform .18s ease, background .18s ease;
}
.s2-toggle-word { padding: 0 var(--space-8) 0 0; pointer-events: none; }
.s2-toggle[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); justify-content: flex-start; }
.s2-toggle[aria-checked="true"] .s2-toggle-knob { transform: translateX(34px); background: var(--accent-ink); }
.s2-toggle[aria-checked="true"] .s2-toggle-word { padding: 0 0 0 var(--space-8); }

.s2-chips { display: flex; align-items: center; gap: var(--space-8); flex-wrap: wrap; margin-bottom: var(--space-8); }
.s2-chips-label { font-size: 13px; font-weight: 700; color: var(--muted); margin-right: var(--space-4); }
.s2-chip {
  min-height: 40px; padding: 0 var(--space-16); border: 1.5px solid var(--control); border-radius: var(--radius-pill);
  background: transparent; color: var(--text); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.s2-chip:hover { background: var(--surface); }
.s2-chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; }

.s2-actions { display: flex; align-items: center; gap: var(--space-8); flex-wrap: wrap; margin-top: var(--space-24); }
.s2-actions.between { justify-content: space-between; }
.s2-inline { display: flex; align-items: center; gap: var(--space-8); flex-wrap: wrap; }
.s2-inline-label { font-size: 13px; font-weight: 700; color: var(--muted); }

.s2-open { margin: var(--space-4) 0 var(--space-16); padding: var(--space-24); border-radius: var(--radius-card); background: var(--surface); }
/* Full width like every other section (owner's feedback, 3 Dec 2026): the switch rows run edge to edge, and only the
   boxes you type or choose in keep a readable width. */
.s2-form { display: flex; flex-direction: column; gap: var(--space-field); }
.s2-form > .field { max-width: 560px; }
.s2-form .field { margin-bottom: 0; }
.s2-form select, .s2-form input[type="email"], .s2-form input[type="date"] { max-width: 100%; }
.s2-switcher { max-width: 360px; margin-top: var(--space-16); }

.s2-block { padding: var(--space-8) 0 var(--space-16); }
.s2-block-title { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: var(--space-8); }
.s2-sample { margin: var(--space-16) 0 0; font-size: 18px; line-height: 1.55; max-width: 520px; }

.s2-details { margin-top: var(--space-24); }
.s2-details summary { cursor: pointer; font-size: 14px; font-weight: 700; color: var(--accent-dark); padding: var(--space-8) 0; border-radius: 6px; }
.s2-table { width: 100%; border-collapse: collapse; margin-top: var(--space-8); font-size: 14px; }
.s2-table th { text-align: left; font-size: 13px; font-weight: 700; color: var(--muted); padding: 0 var(--space-16) var(--space-8) 0; }
.s2-table td { padding: var(--space-16) var(--space-16) var(--space-16) 0; border-top: 1px solid var(--border); vertical-align: top; }
@media (max-width: 640px) {
  .s2-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .s2-table, .s2-table tbody, .s2-table tr, .s2-table td { display: block; width: 100%; }
  .s2-table tr { padding: var(--space-16) 0; border-top: 1px solid var(--border); }
  .s2-table td { border: none; padding: var(--space-4) 0; }
  .s2-table td::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 700; color: var(--muted); }
}

.s2-consequences { margin: 0 0 var(--space-16); padding-left: var(--space-24); line-height: 1.6; }

/* ---- choosing what someone can see ---- */

.s2-matrix-heading { font-size: 13px; font-weight: 700; color: var(--muted); padding: var(--space-16) 0 var(--space-4); }
.s2-matrix-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-8) var(--space-16); flex-wrap: wrap;
  padding: var(--space-8) 0; border-top: 1px solid var(--border);
}
.s2-matrix-row .s2-row-text { flex: 1 1 140px; }
.s2-matrix-row .seg { flex: none; }
.s2-matrix-row .seg button { padding: 0 var(--space-16); }
.s2-fixed { font-size: 13.5px; font-weight: 600; color: var(--muted); padding-right: var(--space-8); }
/* The buttons at the foot of a dialog wrap and their words wrap with them, so a long label at the
   largest text size on a phone stays on the screen. */
.s2-foot { flex-wrap: wrap; }
.s2-foot .btn { white-space: normal; text-align: center; line-height: 1.25; height: auto; padding-block: var(--space-8); }
.s2-peek { margin: var(--space-16) 0 var(--space-8); }
.s2-peek .btn { gap: var(--space-8); }
.invite-custom { margin-top: var(--space-16); padding: var(--space-8) var(--space-24) var(--space-16); border-radius: var(--radius-card); background: var(--surface); }

.s2-preview { border: 1px solid var(--border-strong); border-radius: 22px; overflow: hidden; background: var(--bg); margin: var(--space-8) 0 var(--space-16); }
.s2-preview-bar { display: flex; align-items: center; gap: var(--space-8); padding: var(--space-8) var(--space-16); background: var(--surface); font-size: 13.5px; font-weight: 700; color: var(--muted); }
.s2-preview-bar .s2-glyph { width: 18px; height: 18px; }
.s2-preview-chrome { padding: var(--space-16) var(--space-16) var(--space-8); }
.s2-preview-title { font-family: var(--font-display); font-size: 20px; font-weight: 500; margin-bottom: var(--space-8); }
.s2-preview-tabs { list-style: none; margin: 0; padding: 0 0 var(--space-8); display: flex; flex-wrap: wrap; gap: var(--space-8); border-bottom: 1px solid var(--border); }
.s2-preview-tab { display: inline-flex; align-items: center; gap: var(--space-8); padding: var(--space-4) var(--space-16); border-radius: var(--radius-pill); background: var(--surface); font-size: 13.5px; font-weight: 600; }
.s2-preview-tag { font-size: 12px; font-weight: 700; color: var(--muted); }
.s2-preview-body { padding: var(--space-8) var(--space-16) var(--space-16); }
.s2-preview-list { list-style: none; margin: 0; padding: 0; }
.s2-preview-list li { display: flex; align-items: center; gap: var(--space-16); padding: var(--space-8) 0; border-top: 1px solid var(--border); }
.s2-preview-list li:first-child { border-top: none; }
.s2-preview-name { flex: 1; font-weight: 700; }
.s2-preview-empty { margin: var(--space-8) 0; color: var(--muted); font-size: 14px; }
.s2-preview-note { display: flex; gap: var(--space-16); align-items: flex-start; padding: var(--space-16) var(--space-16); background: var(--surface); font-size: 14px; line-height: 1.5; }
.s2-preview-note .s2-glyph { flex: none; margin-top: var(--space-4); }

/* ---- a section you can look at but not change ----
   The same hiding body.read-only does for a viewer (app.css), for one tab at a time. */
.tab-panel.read-only .btn.add,
.tab-panel.read-only .inline-add,
.tab-panel.read-only .btn.danger { display: none; }

/* ---- phones ---- */

@media (max-width: 640px) {
  .s2-row-control { width: 100%; }
  .s2-row-control .seg { max-width: 100%; }
  .s2-row-control .seg button { padding: 0 var(--space-16); }
  .s2-person-text { flex-basis: 140px; }
  .s2-actions.between { align-items: flex-start; }
  .s2-open { padding: var(--space-16); }
  .s2-matrix-row .seg { width: 100%; }
  .s2-matrix-row .seg button { flex: 1; padding: 0 var(--space-8); }
  .s2-fixed { width: 100%; }
}
/* A switch or a toggle keeps its place on the right even on a phone: it is not a wide control. */
@media (max-width: 640px) {
  .s2-row:has(> .s2-row-control > .s2-toggle) .s2-row-control { width: auto; }
  .s2-row:has(> .s2-row-control > .s2-toggle) { flex-wrap: nowrap; }
}

/* 44px to press, on a phone or any touch screen, as the rest of the app does it. */
@media (max-width: 640px), (pointer: coarse) {
  .s2-chip, .s2-toggle, .s2-details summary { min-height: 44px; }
  .s2-toggle { height: 44px; border-radius: var(--radius-pill); }
  .s2-toggle-knob { height: 24px; width: 24px; }
  .s2-toggle::after { inset: 0; }
}

/* The Change email card (js/ui/change-email.js) sits among the account rows: its own card chrome
   goes, and its row reads like the others. */
.s2-embed .card.change-email { border-top: 0; padding: 0; }
.s2-embed .change-email .row { padding: var(--space-16) 0; border-top: 1px solid var(--border); }
.s2-embed .change-email .row b { font-size: 15px; line-height: 1.4; }
.s2-embed .change-email .row span { font-size: 13.5px; line-height: 1.5; }
.s2-embed .change-email-form { margin: var(--space-4) 0 var(--space-16); padding: var(--space-24); }
.s2-embed .change-email-note { margin: var(--space-4) 0 var(--space-16); }
@media (max-width: 640px) { .s2-embed .change-email-form { padding: var(--space-16); } }

/* A person's row in "People and invites": the name and address take the room they need and the
   badge and buttons drop to their own line on a phone, rather than squeezing the address into a
   column one letter wide. */
.member-row { flex-wrap: wrap; }
.member-row .member-who { flex: 1 1 180px; }
@media (max-width: 640px) {
  .member-row .member-who + * { margin-left: var(--space-48); }
}

/* Settings, Plan and payment (js/settings/plan.js). */
.plan-pill { margin-left: auto; font-size: 13px; font-weight: 700; padding: var(--space-4) var(--space-16); border-radius: var(--radius-pill); background: var(--surface); }
.plan-pill.trial { background: var(--accent-soft); color: var(--accent-dark); }
.plan-actions { display: flex; flex-wrap: wrap; gap: var(--space-8); margin-top: var(--space-16); }
.plan-fine { margin: var(--space-16) 0 0; font-size: 13px; color: var(--muted); }
.plan-row-included { padding: var(--space-16) 0; border-top: 1px solid var(--border); }
.plan-included-title { margin: 0 0 var(--space-8); font-weight: 700; }
.plan-included { margin: 0; padding-left: 1.2em; columns: 2 16em; column-gap: var(--space-24); color: var(--muted); }
.plan-included li { break-inside: avoid; margin: var(--space-4) 0; }
.plan-fine a { color: var(--muted); }
@media (max-width: 640px) { .plan-actions .btn { flex: 1 1 100%; } }

/* What the chosen access preset means (js/settings/access-editor.js). */
.s2-preset-explain { margin: var(--space-4) 0 var(--space-16); font-size: 14.5px; color: var(--text); max-width: 60ch; }
/* Paid: a warm thank-you at the top of Plan and payment (owner's feedback, 18 Nov). */
.plan-thanks { display: flex; align-items: center; gap: var(--space-16); margin: var(--space-4) 0 var(--space-16); padding: var(--space-16) var(--space-24); border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-dark); }
.plan-thanks .brand-mark, .plan-thanks svg { flex: none; width: 40px; height: 40px; }
.plan-thanks-text { min-width: 0; }
.plan-thanks-title { margin: 0 0 var(--space-4); font-family: var(--font-display); font-size: 21px; font-weight: 500; line-height: 1.2; color: var(--text); }
.plan-thanks-sub { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--text); }
/* The sync line ends the Settings title row; when it needs attention it is the full box, on a line of its own. */
.settings-head { flex-wrap: wrap; }
.settings-head > .sync-status:not(.quiet) { flex: 1 1 100%; margin: var(--space-8) 0 0; }
@media (max-width: 480px) { .plan-thanks { align-items: flex-start; padding: var(--space-16); } .plan-thanks .brand-mark, .plan-thanks svg { width: 32px; height: 32px; } }
.plan-thanks-facts { margin: var(--space-8) 0 0; font-size: 14px; color: var(--text); }
.plan-thanks-facts strong { font-weight: 700; }
.s2-replyby-row { display: flex; flex-wrap: wrap; gap: var(--space-16); align-items: center; }
.s2-replyby-row > * { flex: 1 1 220px; min-width: 0; }

/* The Basics: the wedding image as guests see it, small (owner's request, 20 Nov 2026). Two frames side by side,
   one under the other on a phone. Drawn from tokens, so both themes follow; the email frame stays light, as emails are. */
.image-previews { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-16); margin-top: var(--space-16); }
.image-preview { margin: 0; display: grid; gap: var(--space-8); }
.image-preview figcaption { font-size: 12.5px; color: var(--muted); }
.image-preview-email, .image-preview-page { border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; background: var(--card); }
.image-preview-email { padding: var(--space-8); background: var(--surface); }
.image-preview-email .image-preview-pic { border-radius: 10px 10px 0 0; height: 84px; }
.image-preview-email .image-preview-body { background: var(--card); border-radius: 0 0 10px 10px; }
.image-preview-pic { height: 96px; overflow: hidden; background: var(--accent-soft); }
.image-preview-pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.image-preview-body { display: grid; gap: var(--space-4); padding: var(--space-8) var(--space-16) var(--space-16); }
.image-preview-body b { font-family: var(--font-display); font-weight: 500; font-size: 17px; line-height: 1.2; }
.image-preview-body span { font-size: 12px; color: var(--muted); }
.image-preview-body .image-preview-eyebrow { color: var(--accent-dark); font-weight: 700; }
.image-preview-page .image-preview-body { text-align: center; }

/* The day → Guest page (js/tabs/website.js, 1 Dec 2026): the settings above, the page as guests see it below. */
.site-settings { display: grid; gap: var(--space-16); min-width: 0; }
.site-head a.btn { text-decoration: none; }
/* Editing: the settings in one numbered column, the page beside them and kept in view while you scroll (owner's feedback,
   2 Dec 2026). Below 1180px the page comes after the settings. */
.site-edit { display: grid; gap: var(--space-24); }
@media (min-width: 1180px) {
  .site-edit { grid-template-columns: minmax(0, 1fr) minmax(360px, 440px); align-items: start; }
  .site-aside { position: sticky; top: 136px; }
  .site-aside .site-frame { height: calc(100vh - 190px); min-height: 480px; }
}
.site-preview { display: grid; gap: var(--space-8); }
.site-preview-label { margin: 0; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.site-frame { display: block; width: 100%; height: 80vh; min-height: 560px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--bg); }
@media (max-width: 640px) { .site-frame { height: 75vh; min-height: 480px; } }

/* Two-step sign-in (round three): the backup codes, and the authenticator app's code to scan. The code sits on white in
   both modes, as a printed QR code does, so every phone camera reads it. */
.backup-codes { list-style: none; margin: 0 0 var(--space-16); padding: var(--space-16); display: grid; grid-template-columns: repeat(auto-fill, minmax(12ch, 1fr)); gap: var(--space-8) var(--space-16); background: var(--surface); border-radius: var(--radius-sm); font-family: var(--mono); font-size: 16px; }
.totp-steps { margin: 0 0 var(--space-16); padding-left: var(--space-24); line-height: 1.6; }
.totp-steps li { margin-bottom: var(--space-8); }
.totp-qr { display: block; width: 184px; max-width: 100%; margin: var(--space-8) 0; padding: var(--space-8); background: var(--qr-light); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.totp-qr svg { display: block; width: 100%; height: auto; }
.totp-secret { display: inline-block; margin-top: var(--space-4); font-family: var(--mono); font-size: 15px; word-spacing: 0.3em; overflow-wrap: anywhere; }
