/* Shared application chrome for onboarding, sign-in and the profile. */
:root {
  --app-width: 560px;
  --app-wide: 720px;
  --app-gap: clamp(16px, 3vw, 24px);
  --app-card: var(--paper-0, #ffffff);
  --app-paper: var(--paper-page, #f6f1ea);
  --app-border: var(--border-default, rgba(28, 26, 31, 0.14));
  --app-muted: var(--ink-600, #5b5660);
  --app-danger: #8b3f3f;
  --app-danger-bg: #fbf1ef;
}

.site-header,
.site-footer {
  font-family: var(--font-sans, "Geist", sans-serif);
}

.site-header {
  min-height: 72px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-subtle, rgba(28, 26, 31, 0.08));
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-header nav a,
.site-header nav button {
  min-height: 40px;
  padding: 9px 16px;
  border: 1px solid var(--app-border);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-900, #1c1a1f);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.site-header nav a:hover,
.site-header nav button:hover {
  background: var(--paper-200, #ece6de);
}

.app-page,
.scaffold-page {
  width: min(var(--app-width), calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(40px, 8vw, 88px) 0 clamp(64px, 10vw, 112px);
}

.profile-page {
  width: min(var(--app-wide), calc(100% - 40px));
}

.app-card {
  padding: clamp(24px, 5vw, 40px);
  border: 1px solid var(--app-border);
  border-radius: 28px;
  background: var(--app-card);
  box-shadow: 0 18px 50px rgba(28, 26, 31, 0.08);
}

.app-page h1,
.app-page h2,
.app-page h3,
.scaffold-page h1,
.scaffold-page h2,
.scaffold-page h3,
.signin-panel h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.025em;
}

.app-page h1,
.scaffold-page h1,
.signin-panel h1 {
  font-size: clamp(44px, 9vw, 72px);
  line-height: 0.96;
}

.app-page h2,
.scaffold-page h2 {
  font-size: clamp(32px, 6vw, 48px);
  line-height: 1;
}

.app-page h3,
.scaffold-page h3 {
  font-size: clamp(26px, 5vw, 36px);
  line-height: 1.05;
}

.app-lede,
.lede {
  max-width: 42rem;
  margin: 18px 0 0;
  color: var(--app-muted);
  font-size: clamp(17px, 2.6vw, 20px);
  line-height: 1.5;
}

.app-progress {
  display: grid;
  gap: 9px;
  margin-bottom: 28px;
  color: var(--app-muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.app-progress-track {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--paper-200, #ece6de);
}

.app-progress-value {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ink-900, #1c1a1f);
}

.progress-1 { width: 14.28%; }
.progress-2 { width: 28.57%; }
.progress-3 { width: 42.85%; }
.progress-4 { width: 57.14%; }
.progress-5 { width: 71.42%; }
.progress-6 { width: 85.71%; }
.progress-7 { width: 100%; }

.app-form,
.app-form-stack {
  display: grid;
  gap: var(--app-gap);
  margin-top: 28px;
}

.app-form-stack {
  margin-top: 0;
}

.app-form label:not(.choice-card):not(.check-card),
.app-field-label {
  display: grid;
  gap: 8px;
  color: var(--ink-900, #1c1a1f);
  font-size: 15px;
  font-weight: 600;
}

.app-form input:not([type]),
.app-form input[type="text"],
.app-form input[type="email"],
.app-form input[type="password"],
.app-form input[type="time"],
.app-form input[type="hidden"],
.app-form select,
.scaffold-page input:not([type]),
.scaffold-page input[type="text"],
.scaffold-page input[type="email"],
.scaffold-page input[type="password"],
.scaffold-page input[type="time"],
.scaffold-page select,
.signin-form input[type="email"],
.signin-form input[type="password"],
.signin-form input[inputmode="numeric"] {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--app-border);
  border-radius: 12px;
  background: var(--app-paper);
  color: var(--ink-900, #1c1a1f);
  font: inherit;
  font-size: 16px;
}

.app-form input[type="hidden"] {
  display: none;
}

.app-form input:focus-visible,
.app-form select:focus-visible,
.signin-form input:focus-visible,
.scaffold-page input:focus-visible,
.scaffold-page select:focus-visible {
  outline: 3px solid var(--focus-ring, rgba(122, 74, 134, 0.55));
  outline-offset: 2px;
  border-color: var(--accent, #7a4a86);
}

.choice-grid {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.choice-grid fieldset,
fieldset.choice-grid {
  min-width: 0;
  padding: 0;
  border: 0;
}

fieldset.choice-grid legend {
  padding: 0;
}

.choice-grid--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-card {
  position: relative;
  display: flex;
  min-height: 72px;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--app-border);
  border-radius: 16px;
  background: var(--app-paper);
  color: var(--ink-900, #1c1a1f);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.choice-card:hover {
  border-color: var(--border-strong, rgba(28, 26, 31, 0.28));
  background: var(--paper-50, #fcfaf7);
}

.choice-card:has(input:checked) {
  border-color: var(--ink-900, #1c1a1f);
  background: var(--paper-0, #ffffff);
  box-shadow: inset 0 0 0 2px var(--ink-900, #1c1a1f);
}

.choice-card:focus-within {
  outline: 3px solid var(--focus-ring, rgba(122, 74, 134, 0.55));
  outline-offset: 3px;
}

.choice-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.choice-card-mark {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border: 1px solid var(--ink-600, #5b5660);
  border-radius: 50%;
  background: var(--paper-0, #ffffff);
}

.choice-card input:checked + .choice-card-mark {
  border: 6px solid var(--ink-900, #1c1a1f);
}

.choice-card-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.choice-card-title {
  font-size: 17px;
  font-weight: 600;
}

.choice-card-detail {
  color: var(--app-muted);
  font-size: 14px;
  line-height: 1.4;
}

.choice-card--muted {
  cursor: default;
  opacity: 0.72;
}

.choice-card--muted strong {
  font-weight: 600;
}

.check-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--app-muted);
  font-size: 15px;
  line-height: 1.45;
}

.check-card input {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  margin: 1px 0 0;
  accent-color: var(--ink-900, #1c1a1f);
}

.app-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}

.app-page button,
.app-page .button,
.app-page a.primary-action,
.scaffold-page button,
.scaffold-page .button,
.signin-form button,
.signin-form a.primary-action {
  min-height: 52px;
  padding: 13px 22px;
  border: 1px solid var(--ink-900, #1c1a1f);
  border-radius: 999px;
  background: var(--ink-900, #1c1a1f);
  color: var(--paper-50, #fcfaf7);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.app-page button:hover,
.app-page .button:hover,
.app-page a.primary-action:hover,
.scaffold-page button:hover,
.scaffold-page .button:hover,
.signin-form button:hover {
  background: var(--ink-700, #34303a);
  color: var(--paper-50, #fcfaf7);
}

.app-page button.secondary-action,
.app-page .secondary-action,
.scaffold-page button.secondary-action,
.signin-form button.secondary-action {
  background: transparent;
  color: var(--ink-900, #1c1a1f);
}

.app-page button.secondary-action:hover,
.app-page .secondary-action:hover,
.scaffold-page button.secondary-action:hover,
.signin-form button.secondary-action:hover {
  background: var(--paper-200, #ece6de);
  color: var(--ink-900, #1c1a1f);
}

.app-form .skip-action {
  border-color: var(--app-border);
  background: transparent;
  color: var(--ink-900, #1c1a1f);
}

.app-form .skip-action:hover {
  background: var(--paper-200, #ece6de);
  color: var(--ink-900, #1c1a1f);
}

.notice {
  margin: 20px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--app-border);
  border-left: 4px solid var(--accent, #7a4a86);
  border-radius: 12px;
  background: var(--paper-50, #fcfaf7);
  color: var(--ink-700, #34303a);
  font-size: 15px;
  line-height: 1.45;
}

.notice--error {
  border-left-color: var(--app-danger);
  background: var(--app-danger-bg);
}

.notice--success {
  border-left-color: #436b58;
  background: #f1f7f2;
}

.app-copy {
  color: var(--app-muted);
  font-size: 16px;
  line-height: 1.55;
}

.app-copy a,
.check-card a {
  color: var(--accent, #7a4a86);
}

.app-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink-700, #34303a);
  font-size: 16px;
  font-weight: 600;
}

.app-status--pending {
  color: var(--app-muted);
  font-weight: 400;
}

.app-page > .app-card + .app-card {
  margin-top: 16px;
}

.profile-page > h1 {
  margin-bottom: 12px;
}

.profile-page > .notice {
  margin-bottom: 18px;
}

.profile-card {
  display: grid;
  gap: 22px;
  padding: clamp(22px, 4vw, 32px);
  border: 1px solid var(--app-border);
  border-radius: 22px;
  background: var(--app-card);
  box-shadow: 0 12px 32px rgba(28, 26, 31, 0.06);
}

.profile-card h2 {
  margin: 0;
}

.profile-card p {
  margin: 0;
}

.profile-card .app-form,
.profile-card .choice-grid {
  margin-top: 0;
}

.profile-card .app-form + .app-form {
  padding-top: 22px;
  border-top: 1px solid var(--border-subtle, rgba(28, 26, 31, 0.08));
}

.profile-card .app-form .app-actions {
  margin-top: 0;
}

.profile-card--danger {
  border-color: rgba(139, 63, 63, 0.28);
}

.profile-card--danger h2 {
  color: var(--app-danger);
}

.danger-copy {
  color: var(--app-muted);
  font-size: 15px;
  line-height: 1.55;
}

.danger-action {
  border-color: var(--app-danger) !important;
  background: transparent !important;
  color: var(--app-danger) !important;
}

.danger-action:hover {
  background: var(--app-danger-bg) !important;
}

.profile-meta {
  display: grid;
  gap: 6px;
  color: var(--app-muted);
  font-size: 15px;
  line-height: 1.45;
}

.profile-meta strong {
  color: var(--ink-900, #1c1a1f);
  font-weight: 600;
}

.profile-link {
  color: var(--accent, #7a4a86);
  font-weight: 600;
}

.signin-panel {
  width: min(920px, calc(100% - 40px));
  margin: 0 auto;
  padding: clamp(40px, 8vw, 88px) 0 clamp(64px, 10vw, 112px);
}

.signin-form {
  width: min(var(--app-width), 100%);
  margin: 0 auto;
  padding: clamp(24px, 5vw, 40px);
  border: 1px solid var(--app-border);
  border-radius: 28px;
  background: var(--app-card);
  box-shadow: 0 18px 50px rgba(28, 26, 31, 0.08);
}

.signin-form form {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.signin-form .signin-or {
  margin: 24px 0;
  color: var(--app-muted);
  text-align: center;
}

.signin-form .legal-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--app-muted);
  font-size: 14px;
  line-height: 1.45;
}

.signin-form .legal-check input {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin: 1px 0 0;
  accent-color: var(--ink-900, #1c1a1f);
}

@media (max-width: 600px) {
  .site-header,
  .site-footer {
    width: calc(100% - 40px);
  }

  .site-header {
    min-height: 64px;
  }

  .app-page,
  .scaffold-page,
  .signin-panel {
    width: calc(100% - 32px);
  }

  .app-card,
  .profile-card,
  .signin-form {
    border-radius: 20px;
  }

  .choice-grid--two {
    grid-template-columns: 1fr;
  }

  .app-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .app-page button,
  .app-page .button,
  .app-page a.primary-action,
  .scaffold-page button,
  .scaffold-page .button,
  .signin-form button {
    width: 100%;
  }

  .app-form .app-actions button,
  .app-form .app-actions a {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .choice-card {
    transition: none;
  }
}

/* Demo persona picker: many short options, so a compact grid of letters instead of full-width cards. */
.choice-grid--compact {
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 8px;
}

.choice-grid--compact > legend {
  margin-bottom: 8px;
}

.choice-card--compact {
  justify-content: center;
  min-height: 48px;
  padding: 10px 0;
  text-align: center;
}

.choice-card--compact .choice-card-title {
  margin: 0;
}

/* The radio/checkbox inside a card is visually hidden, so keyboard focus is shown on the card itself. */
.choice-card:has(input:focus-visible),
.check-card:has(input:focus-visible) {
  outline: 3px solid var(--focus-ring, rgba(122, 74, 134, 0.55));
  outline-offset: 2px;
}

/* ---- UX pass (2026-10-11) ---- */

/* Smooth cross-fade between pages of the same site (View Transitions, CSS only; ignored by older browsers). */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 220ms;
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}

/* Profile: one status line first, settings after. */
.profile-status {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding: 20px 24px;
  border-radius: 22px;
  background: var(--ink-900, #1c1a1f);
  color: var(--paper-50, #fcfaf7);
}

.profile-status-line {
  margin: 0;
  font-family: var(--font-serif, "Instrument Serif", serif);
  font-style: italic;
  font-size: clamp(24px, 4vw, 30px);
  line-height: 1.15;
}

.profile-status-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.profile-status-chips li {
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  font-size: 14px;
}

.profile-status--paused {
  border: 1px solid rgba(139, 63, 63, 0.28);
  background: var(--app-danger-bg);
  color: var(--ink-900, #1c1a1f);
}

.profile-status--paused .profile-status-chips li {
  border-color: var(--app-border);
}

/* Delivery time as chips; "Other" reveals a time field. */
.choice-grid--chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-grid--chips > legend {
  width: 100%;
  margin-bottom: 8px;
}

.choice-chip {
  position: relative;
  cursor: pointer;
}

.choice-chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.choice-chip span {
  display: inline-flex;
  min-width: 72px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid var(--app-border);
  border-radius: 999px;
  background: var(--app-paper);
  color: var(--ink-900, #1c1a1f);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.choice-chip input:checked + span {
  border-color: var(--ink-900, #1c1a1f);
  background: var(--ink-900, #1c1a1f);
  color: var(--paper-50, #fcfaf7);
}

.choice-chip:has(input:focus-visible) span {
  outline: 3px solid var(--focus-ring, rgba(122, 74, 134, 0.55));
  outline-offset: 2px;
}

.other-time.is-hidden {
  display: none;
}

/* Danger zone folded away: present and easy to find, but not half the page. */
.profile-danger {
  display: block;
  padding: 0;
}

.profile-danger > summary {
  display: grid;
  gap: 4px;
  padding: clamp(22px, 4vw, 32px);
  padding-right: 64px;
  position: relative;
  cursor: pointer;
  list-style: none;
}

.profile-danger > summary::-webkit-details-marker {
  display: none;
}

.profile-danger > summary::after {
  content: "+";
  position: absolute;
  top: 50%;
  right: clamp(22px, 4vw, 32px);
  transform: translateY(-50%);
  font-size: 26px;
  line-height: 1;
  color: var(--app-muted);
}

.profile-danger[open] > summary::after {
  content: "−";
}

.profile-danger > summary:focus-visible {
  outline: 3px solid var(--focus-ring, rgba(122, 74, 134, 0.55));
  outline-offset: -3px;
  border-radius: 22px;
}

.profile-danger-title {
  font-family: var(--font-serif, "Instrument Serif", serif);
  font-style: italic;
  font-size: 28px;
  line-height: 1.1;
  color: var(--ink-900, #1c1a1f);
}

.profile-danger-hint {
  color: var(--app-muted);
  font-size: 15px;
}

.profile-danger-block {
  display: grid;
  gap: 18px;
  padding: 0 clamp(22px, 4vw, 32px) clamp(22px, 4vw, 32px);
}

.profile-danger-block + .profile-danger-block {
  padding-top: 22px;
  border-top: 1px solid var(--border-subtle, rgba(28, 26, 31, 0.08));
}

.profile-danger-block h2 {
  color: var(--app-danger);
}

/* Telegram step: show what tomorrow brings. */
.sample-brief {
  display: grid;
  justify-items: center;
  gap: 14px;
  margin: 28px 0 0;
}

.sample-brief img {
  width: 220px;
  height: auto;
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(28, 26, 31, 0.14);
}

.sample-brief figcaption {
  max-width: 400px;
  color: var(--app-muted);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

/* After a click the button says so and further clicks are ignored (see site.js). */
form[aria-busy="true"] button[type="submit"],
form[aria-busy="true"] button:not([type]) {
  opacity: 0.6;
  cursor: progress;
}

.app-actions.is-hidden {
  display: none;
}

/* QR for people on a computer; hidden on phones, where "Open Telegram" opens the app directly. */
.qr-block {
  display: none;
}

@media (min-width: 768px) and (hover: hover) {
  .qr-block {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 22px;
    padding: 16px;
    border: 1px solid var(--app-border);
    border-radius: 16px;
    background: var(--app-paper);
  }

  .qr-block p {
    margin: 0;
    color: var(--app-muted);
    font-size: 14px;
    line-height: 1.5;
  }
}

.qr-code {
  flex: 0 0 112px;
  width: 112px;
  height: 112px;
  padding: 6px;
  border-radius: 10px;
  background: #ffffff;
}

.qr-code path {
  fill: var(--ink-900, #1c1a1f);
}

.qr-block + .app-status,
.app-actions + .app-status {
  margin-top: 18px;
}
