/*
 * Film set shell for the secondary account pages: Support (and the guest conversation),
 * Activity sharing, Legal and the 404. They speak the same dialect as the account home:
 * the blurred film set behind frosted glass, the same rail, header, type and controls.
 *
 * Loaded AFTER tokens.css and motion.css, and INSTEAD of styles.css: these pages never
 * show the sign-in card, so they skip its uppercase chamfered controls and dot grid.
 * Portal CSP is style-src 'self': no <style>, no style= (SVG included).
 *
 *   body.fs-page.fs-backdrop       the page (tokens.css paints the film set)
 *   .fs-shell > .fs-rail + .fs-main   signed-in pages: the account rail, then the page
 *   .fs-topbar + .fs-main--narrow     public pages (guest conversation, legal, 404)
 *   .fs-head .fs-crumb .fs-title .fs-lede   page header, as on the account home
 *   .fs-panel                      padding for a .fs-glass card
 *   .fs-switch                     an on/off switch built on a real checkbox
 *   .fs-notice                     a live status line that hides when empty
 *   [data-account-banner]          where account-status.js puts the grace banner
 * Motion lives in the no-preference block at the end; nothing waits at opacity 0.
 */

@font-face {
  font-family: "Space Grotesk";
  src: url("/assets/SpaceGrotesk.ttf") format("truetype");
  font-display: swap;
  font-style: normal;
  font-weight: 100 800;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: dark;
  background: var(--fs-ground);
}

body.fs-page {
  min-height: 100vh;
  margin: 0;
  color: var(--fs-ink);
  font: 400 16px/1.55 var(--fs-font);
  -webkit-font-smoothing: antialiased;
}

.fs-page a {
  color: var(--fs-link);
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.fs-page a:hover {
  color: var(--fs-ink);
}

.fs-page :is(h1, h2, h3, p) {
  overflow-wrap: anywhere;
}

.fs-page :is(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--fs-focus);
  outline-offset: 3px;
}

.fs-page .skip-link {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 60;
  padding: 12px 16px;
  color: var(--fs-ink);
  background: var(--fs-glass-solid);
  border: 1px solid var(--fs-focus);
  border-radius: var(--fs-radius-ctl);
  text-decoration: none;
  transform: translateY(-200%);
}

.fs-page .skip-link:focus {
  transform: none;
}

/* ---------- The account rail (the same one the account home shows) ---------- */
.fs-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.fs-rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 32px;
  height: 100vh;
  min-width: 0;
  padding: 28px 16px 24px;
  background: var(--fs-glass);
  -webkit-backdrop-filter: var(--fs-blur);
  backdrop-filter: var(--fs-blur);
  border-right: 1px solid var(--fs-line);
}

.fs-page .fs-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px;
  color: var(--fs-ink);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.01em;
  text-decoration: none;
}

.fs-page .fs-brand:hover {
  color: var(--fs-ink);
}

.fs-brand img {
  display: block;
  width: 40px;
  height: 40px;
  flex: none;
}

.fs-brand small {
  display: block;
  margin-top: 2px;
  color: var(--fs-ink-2);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}

.fs-rail-nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}

.fs-page .fs-rail-nav a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  color: #D9D4DD;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--fs-radius-ctl);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
}

.fs-page .fs-rail-nav a:hover {
  color: var(--fs-ink);
  background: rgba(255, 255, 255, .06);
}

.fs-page .fs-rail-nav a[aria-current="page"] {
  color: var(--fs-ink);
  background: rgba(255, 255, 255, .10);
  border-color: var(--fs-line);
  box-shadow: inset 3px 0 0 var(--fs-brand-red);
}

.fs-rail-help {
  margin-top: auto;
  padding: 18px 8px 0;
  border-top: 1px solid var(--fs-line);
  font-size: 14px;
}

.fs-rail-help strong {
  font-weight: 600;
}

.fs-rail-help p {
  margin: 6px 0 12px;
  color: var(--fs-ink-2);
  font-size: 13px;
  line-height: 1.55;
}

.fs-page .fs-rail-help a {
  color: var(--fs-ink);
  text-decoration: none;
}

.fs-page .fs-rail-help a:hover {
  color: var(--fs-link);
}

/* ---------- Public pages: a glass top bar instead of the rail ---------- */
.fs-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 20px;
  padding: 16px clamp(16px, 4vw, 56px);
  background: var(--fs-glass);
  -webkit-backdrop-filter: var(--fs-blur);
  backdrop-filter: var(--fs-blur);
  border-bottom: 1px solid var(--fs-line);
}

/* ---------- Main column and page header ---------- */
.fs-main {
  display: block;
  width: 100%;
  max-width: 1240px;
  min-width: 0;
  margin: 0 auto;
  padding: clamp(28px, 4vw, 56px);
}

.fs-main--narrow {
  max-width: 880px;
}

.fs-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px 24px;
  margin: 0 0 28px;
}

.fs-head > div {
  min-width: 0;
}

.fs-crumb {
  margin: 0 0 14px;
  color: var(--fs-ink-2);
  font: 600 11px/1.3 var(--fs-font);
  letter-spacing: .14em;
  text-transform: uppercase;
}

.fs-page .fs-crumb a {
  color: inherit;
  text-decoration: none;
}

.fs-page .fs-crumb a:hover {
  color: var(--fs-ink);
  text-decoration: underline;
}

.fs-title {
  margin: 0 0 10px;
  color: var(--fs-ink);
  font: 700 clamp(32px, 3.4vw, 48px)/1.05 var(--fs-font);
  letter-spacing: -.02em;
}

.fs-title:focus {
  outline: none;
}

.fs-lede {
  max-width: 64ch;
  margin: 0;
  color: var(--fs-ink-2);
  font-size: 15px;
  line-height: 1.6;
}

.fs-head-side {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  flex: none;
}

.fs-panel {
  min-width: 0;
  padding: 28px 30px;
}

.fs-panel > h2,
.fs-panel-title {
  margin: 0 0 8px;
  color: var(--fs-ink);
  font: 700 22px/1.25 var(--fs-font);
  letter-spacing: -.01em;
}

.fs-panel p {
  color: var(--fs-ink-2);
  line-height: 1.6;
}

.fs-fineprint {
  margin: 0;
  color: var(--fs-ink-2);
  font-size: 13px;
  line-height: 1.6;
}

/* ---------- Controls: quiet glass buttons, one red primary, calm fields ---------- */
.fs-page button,
.fs-page .fs-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  max-width: 100%;
  padding: 10px 18px;
  color: var(--fs-ink);
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--fs-line-strong);
  border-radius: var(--fs-radius-ctl);
  font: 600 14px/1.25 var(--fs-font);
  letter-spacing: 0;
  text-align: center;
  text-decoration: none;
  text-transform: none;
  white-space: normal;
  cursor: pointer;
}

.fs-page button:hover:not(:disabled),
.fs-page .fs-button:hover {
  color: var(--fs-ink);
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .30);
}

.fs-page .fs-button--primary,
.fs-page button.fs-button--primary:hover:not(:disabled),
.fs-page a.fs-button--primary:hover {
  color: #FFFFFF;
}

.fs-page .fs-button--primary {
  background: var(--fs-action);
  border-color: var(--fs-action);
}

.fs-page button.fs-button--primary:hover:not(:disabled),
.fs-page a.fs-button--primary:hover {
  background: var(--fs-action-hover);
  border-color: var(--fs-action-hover);
}

.fs-page button:disabled {
  cursor: wait;
  opacity: .55;
}

.fs-page .fs-link-button {
  min-height: 44px;
  padding: 10px 2px;
  color: var(--fs-link);
  background: transparent;
  border-color: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.fs-page .fs-link-button:hover:not(:disabled) {
  color: var(--fs-ink);
  background: transparent;
  border-color: transparent;
}

.fs-page label {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: var(--fs-ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
}

/* Field outlines are ≥ 3:1 against the glass (WCAG 1.4.11); 16 px text keeps iOS from zooming. */
.fs-page :is(input:not([type="checkbox"]):not([type="file"]), select, textarea) {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 11px 14px;
  color: var(--fs-ink);
  background: rgba(0, 0, 0, .34);
  border: 1px solid rgba(255, 255, 255, .42);
  border-radius: var(--fs-radius-ctl);
  font: 400 16px/1.5 var(--fs-font);
}

.fs-page select {
  cursor: pointer;
}

.fs-page select option {
  color: var(--fs-ink);
  background: var(--fs-glass-solid);
}

.fs-page textarea {
  min-height: 140px;
  resize: vertical;
}

.fs-page :is(input, select, textarea)::placeholder {
  color: var(--fs-ink-3);
  opacity: 1;
}

.fs-page :is(input:not([type="checkbox"]):not([type="file"]), select, textarea):hover {
  border-color: rgba(255, 255, 255, .58);
}

.fs-page :is(input:not([type="checkbox"]):not([type="file"]), select, textarea):focus {
  border-color: var(--fs-focus);
}

/* ---------- Switch: a real checkbox (role=switch) over a painted track ---------- */
.fs-switch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  cursor: pointer;
}

.fs-page label.fs-switch {
  display: flex;
  font-size: 16px;
}

.fs-switch input {
  position: absolute;
  top: 50%;
  left: 0;
  width: 56px;
  height: 32px;
  margin: -16px 0 0;
  opacity: .001;
  cursor: pointer;
}

.fs-switch-track {
  position: relative;
  display: block;
  width: 56px;
  height: 32px;
  flex: none;
  background: rgba(255, 255, 255, .10);
  border: 1px solid rgba(255, 255, 255, .46);
  border-radius: var(--fs-radius-pill);
}

.fs-switch-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  content: "";
  background: var(--fs-ink);
  border-radius: 50%;
}

.fs-switch input:checked + .fs-switch-track {
  background: var(--fs-good);
  border-color: var(--fs-good);
}

.fs-switch input:checked + .fs-switch-track::after {
  background: #FFFFFF;
  transform: translateX(24px);
}

.fs-switch input:focus-visible + .fs-switch-track {
  outline: 2px solid var(--fs-focus);
  outline-offset: 3px;
}

.fs-switch input:disabled,
.fs-switch input:disabled + .fs-switch-track {
  cursor: wait;
}

.fs-switch input:disabled + .fs-switch-track {
  opacity: .55;
}

/* ---------- Status line: glass, and gone when there is nothing to say ---------- */
.fs-notice {
  margin: 0 0 20px;
  padding: 12px 16px;
  color: var(--fs-ink);
  background: var(--fs-glass);
  -webkit-backdrop-filter: var(--fs-blur);
  backdrop-filter: var(--fs-blur);
  border: 1px solid var(--fs-line-strong);
  border-radius: var(--fs-radius-ctl);
  font-size: 14px;
  line-height: 1.6;
}

.fs-notice:empty {
  display: none;
}

/* ---------- Activity sharing (/privacy/activity/) ---------- */
.activity-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.activity-summary {
  display: grid;
  gap: 12px;
  margin: 18px 0 22px;
  padding: 0;
  list-style: none;
}

.activity-summary li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  color: var(--fs-ink-2);
  font-size: 15px;
  line-height: 1.55;
}

.activity-summary strong {
  color: var(--fs-ink);
  font-weight: 600;
}

.activity-summary svg {
  display: block;
  width: 28px;
  height: 28px;
}

.activity-summary .mark-line {
  fill: none;
  stroke: var(--fs-ink-2);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.activity-summary .mark-good {
  stroke: var(--fs-good);
}

.activity-summary .mark-plate {
  fill: var(--fs-brand-red);
}

.activity-choice {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  background: var(--fs-glass-strong);
  border: 1px solid var(--fs-line);
  border-radius: var(--fs-radius-ctl);
}

.activity-choice form {
  margin: 0;
}

.fs-panel .activity-effect {
  margin: 0;
  color: var(--fs-ink);
  font-size: 14px;
  line-height: 1.6;
}

.activity-effect strong {
  font-weight: 700;
}

.fs-panel .activity-status {
  margin: 0;
  color: var(--fs-ink-2);
  font-size: 13px;
}

.activity-status:empty {
  display: none;
}

.fs-page .activity-choice .fs-link-button {
  justify-self: start;
  min-height: 36px;
  padding-block: 4px;
  color: var(--fs-ink-2);
  font-size: 13px;
  font-weight: 500;
}

.fs-page .activity-choice .fs-link-button:hover:not(:disabled) {
  color: var(--fs-ink);
}

.activity-details {
  margin-top: 18px;
  border-top: 1px solid var(--fs-line);
}

.activity-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 14px 2px;
  color: var(--fs-ink);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.activity-details > summary::-webkit-details-marker {
  display: none;
}

.activity-details > summary::after {
  width: 9px;
  height: 9px;
  flex: none;
  content: "";
  border-right: 2px solid var(--fs-ink-2);
  border-bottom: 2px solid var(--fs-ink-2);
  transform: rotate(45deg) translate(-2px, -2px);
}

.activity-details[open] > summary::after {
  transform: rotate(-135deg) translate(-2px, -2px);
}

.activity-details h3 {
  margin: 18px 0 8px;
  color: var(--fs-ink);
  font-size: 15px;
  font-weight: 600;
}

.activity-notice {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0 0 0 18px;
  color: var(--fs-ink-2);
  font-size: 14px;
  line-height: 1.6;
}

.activity-notice li::marker {
  color: var(--fs-ink-3);
}

.fs-panel .activity-version {
  margin: 12px 0 0;
  color: var(--fs-ink-2);
  font-size: 12px;
}

.activity-download {
  display: grid;
  gap: 14px;
}

.activity-download .fs-panel-title {
  margin: 0;
}

.activity-download p {
  margin: 0;
  font-size: 15px;
}

.activity-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* A page of the export, sealed by the red plate once it is ready. */
.activity-seal {
  position: relative;
  width: 132px;
  height: 104px;
  margin: 4px 0 2px;
}

.activity-seal .seal-doc {
  display: block;
  width: 84px;
  height: 104px;
  overflow: visible;
}

.activity-seal .seal-sheet {
  fill: rgba(255, 255, 255, .05);
  stroke: rgba(255, 255, 255, .42);
  stroke-width: 2;
  stroke-linejoin: round;
}

.activity-seal .seal-fold {
  fill: none;
  stroke: rgba(255, 255, 255, .42);
  stroke-width: 2;
  stroke-linejoin: round;
}

.activity-seal .seal-lines {
  fill: none;
  stroke: rgba(255, 255, 255, .26);
  stroke-width: 3;
  stroke-linecap: round;
}

.activity-seal .fs-art {
  position: absolute;
  right: 0;
  bottom: 6px;
}

.activity-seal .fs-plate {
  width: 96px;
}

/* ---------- Legal notices (/legal/) ---------- */
.legal-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.fs-page .legal-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 12px 16px;
  color: var(--fs-ink);
  background: var(--fs-glass-strong);
  border: 1px solid var(--fs-line);
  border-radius: var(--fs-radius-ctl);
  text-decoration: none;
}

.fs-page .legal-list a::after {
  flex: none;
  color: var(--fs-ink-2);
  content: "→";
}

.fs-page .legal-list a:hover {
  border-color: var(--fs-line-strong);
  background: rgba(255, 255, 255, .08);
}

.legal-list .fs-pill {
  margin-left: auto;
}

.legal-section + .legal-section {
  margin-top: 28px;
}

.legal-section > h2 {
  margin: 0;
  color: var(--fs-ink);
  font: 700 18px/1.3 var(--fs-font);
}

.legal-section > p {
  margin: 6px 0 0;
  color: var(--fs-ink-2);
  font-size: 14px;
}

.legal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.legal-controller {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--fs-line);
}

/* ---------- 404 ---------- */
.lost {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 96px);
  padding: 32px 16px;
}

.lost-card {
  display: grid;
  justify-items: start;
  gap: 14px;
  width: min(100%, 560px);
  padding: 36px 36px 32px;
}

.lost-card .fs-art {
  width: min(100%, 240px);
  color: var(--fs-ink-3);
}

.lost-card .fs-title {
  margin: 0;
}

.lost-card .fs-lede {
  margin: 0;
}

.lost-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

/* ---------- Footer ---------- */
.fs-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 56px) 32px;
  color: var(--fs-ink-2);
  font-size: 13px;
}

/* ---------- The grace banner and other state banners inside the main column ---------- */
.fs-main > [data-account-banner] {
  display: block;
}

/* ---------- Narrower screens ---------- */
@media (max-width: 1050px) {
  .fs-main {
    padding: 32px 24px;
  }

  .activity-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .fs-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  /* The rail becomes a header; every link stays visible (wrapped, never sideways-scrolling). */
  .fs-rail {
    position: static;
    width: 100%;
    height: auto;
    gap: 14px;
    padding: 16px 16px 14px;
    border-right: 0;
    border-bottom: 1px solid var(--fs-line);
  }

  .fs-page .fs-brand {
    font-size: 18px;
  }

  .fs-rail .fs-brand small {
    display: none;
  }

  .fs-rail-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .fs-page .fs-rail-nav a {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 14px;
  }

  .fs-page .fs-rail-nav a[aria-current="page"] {
    box-shadow: inset 0 -2px 0 var(--fs-brand-red);
  }

  .fs-rail-help {
    display: none;
  }

  .fs-main {
    padding: 24px 16px 32px;
  }

  .fs-head {
    flex-direction: column;
    gap: 14px;
    margin-bottom: 22px;
  }

  .fs-head-side {
    justify-content: flex-start;
  }

  .fs-panel {
    padding: 22px 18px;
  }

  .lost-card {
    padding: 28px 20px 24px;
  }
}

/* ---------- Motion: calm arrivals only; reduced motion shows the final state ----------
   Arrival order (motion.css .fs-arrive): the page header, then the cards, six steps at most. */
.activity-share,
.legal-document,
.lost-card {
  --fs-i: 1;
}

.activity-download {
  --fs-i: 2;
}


@media (prefers-reduced-motion: no-preference) {
  .fs-switch-track,
  .fs-switch-track::after {
    transition: background-color var(--fs-state) linear, border-color var(--fs-state) linear, transform var(--fs-state) linear;
  }

  .activity-details > summary::after {
    transition: transform var(--fs-state) linear;
  }
}
