/* ============================================================
   שידוך — Design System (shared by index.html + chat.html)
   ============================================================
   Everything themeable lives in :root as CSS variables, so the
   look of the whole product can be adjusted from one place later
   (e.g. once a real brand kit / logo exists).
   ============================================================ */

:root {
  /* Color palette — taken from the logo (assets/logo-full.png): black
     ink on warm cream, nothing else. Hierarchy comes from ink weight
     and whitespace, not from color. --color-bg is the logo's exact
     background, so logo images sit on it seamlessly. */
  --color-bg: #FFF9F2;
  --color-bg-soft: #F6EEE4;
  --color-surface: #FFFFFF;
  --color-text: #151312;
  --color-text-soft: #5F5750;
  --color-text-faint: #958B82;

  --color-primary: #151312;       /* ink — buttons, user bubbles, progress */
  --color-primary-dark: #000000;
  --color-primary-light: #D6CCC1; /* hairline borders on outlined controls */
  --color-on-primary: #FFF9F2;    /* text on ink */
  --color-focus-ring: rgba(21, 19, 18, 0.12);

  --color-border: #ECE3D8;
  --color-user-bubble: #151312;
  --color-user-bubble-text: #FFF9F2;
  --color-bot-bubble: #FFFFFF;
  --color-bot-bubble-text: #151312;

  /* Elevation — soft and low, so the page stays as quiet as the logo */
  /* Hairlines do the work; shadows are kept to the bare minimum. */
  --shadow-soft: 0 1px 2px rgba(21, 19, 18, 0.04);
  --shadow-button: none;

  /* Radius */
  /* Small, consistent corners — matches the .btn style on the landing page. */
  --radius-lg: 14px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-pill: 6px;

  /* Typography — single, clean font family used everywhere.
     Kept as two variables (rather than one) so a different
     weight/family for headings can be reintroduced later without
     touching every rule that references --font-heading. */
  --font-heading: 'Frank Ruhl Libre', 'David Libre', serif;
  --font-body: 'Heebo', sans-serif;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --transition-fast: 0.2s var(--ease);
  --transition-mid: 0.4s var(--ease);
  --transition-slow: 0.8s var(--ease);

  /* Layout */
  --content-max: 560px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  max-width: 100%;
  display: block;
}

button,
input,
textarea {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

a {
  color: inherit;
  text-decoration: none;
}

h1, h2, h3, p {
  margin: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   LANDING PAGE — editorial layout: serif display type, hairline
   rules, generous whitespace, one ink-black band. Section order:
   topbar → hero → statement → steps → privacy band → FAQ → final
   CTA → footer.
   ============================================================ */

html {
  scroll-behavior: smooth;
}

.page-landing {
  min-height: 100%;
}

.page-landing main > section {
  scroll-margin-top: 80px;
}

/* --- Shared building blocks --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 30px;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: background var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast);
}

.btn svg {
  width: 18px;
  height: 18px;
  transition: transform var(--transition-fast);
}

.btn:hover svg {
  transform: translateX(-3px);
}

.btn-ink {
  background: var(--color-primary);
  color: var(--color-on-primary);
}

.btn-ink:hover {
  background: #2B2724;
}

.btn-small {
  padding: 9px 18px;
  font-size: 0.88rem;
}

.btn-link {
  color: var(--color-text);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  transition: text-underline-offset var(--transition-fast);
}

.btn-link:hover {
  text-underline-offset: 8px;
}

.btn-link-light {
  color: var(--color-on-primary);
}

.eyebrow,
.section-kicker {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--color-text-soft);
}

.section-kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

/* A short hairline before each section label. */
.section-kicker::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
}

.section-kicker-light {
  color: rgba(255, 249, 242, 0.65);
}

.section-title {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: clamp(1.9rem, 4.2vw, 2.9rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

/* Sections fade in as they scroll into view (script.js). */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* --- Top bar --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: calc(14px + var(--safe-top)) clamp(20px, 5vw, 64px) 14px;
  background: rgba(255, 249, 242, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition-mid);
}

.topbar.is-scrolled {
  border-bottom-color: var(--color-border);
}

.topbar-logo img {
  height: 34px;
  width: auto;
}

.topbar-nav {
  display: none;
  gap: 28px;
  margin-inline-start: auto;
}

.topbar-nav a {
  font-size: 0.92rem;
  color: var(--color-text-soft);
  transition: color var(--transition-fast);
}

.topbar-nav a:hover {
  color: var(--color-text);
}

.topbar .btn-small {
  margin-inline-start: auto;
}

/* --- Hero --- */
.hero {
  display: grid;
  gap: 48px;
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 20px 72px;
}

.js .hero-text > * {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}

.js .page-landing.is-loaded .hero-text > * {
  opacity: 1;
  transform: none;
}

.page-landing.is-loaded .hero-text > :nth-child(2) { transition-delay: 0.08s; }
.page-landing.is-loaded .hero-text > :nth-child(3) { transition-delay: 0.18s; }
.page-landing.is-loaded .hero-text > :nth-child(4) { transition-delay: 0.28s; }
.page-landing.is-loaded .hero-text > :nth-child(5) { transition-delay: 0.36s; }

.hero-title {
  margin: 18px 0 22px;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: clamp(2.4rem, 7vw, 4.6rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

.hero-lead {
  max-width: 480px;
  font-size: 1.08rem;
  font-weight: 300;
  line-height: 1.75;
  color: var(--color-text-soft);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 28px;
  margin-top: 34px;
}

.hero-note {
  margin-top: 22px;
  font-size: 0.82rem;
  color: var(--color-text-faint);
}

/* Product preview: a mock of the real conversation. */
.hero-art {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 24px 0;
}

.js .hero-art {
  opacity: 0;
  transition: opacity 1.2s var(--ease) 0.3s;
}

.js .page-landing.is-loaded .hero-art {
  opacity: 1;
}

.preview-card {
  position: relative;
  width: min(360px, 100%);
  padding: 18px 18px 20px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 30px 60px -30px rgba(21, 19, 18, 0.25);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.75rem;
  color: var(--color-text-faint);
}

.preview-head img {
  height: 20px;
  width: auto;
}

.preview-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.preview-bot {
  align-self: flex-start;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-end-start-radius: 2px;
}

.preview-user {
  align-self: flex-end;
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-end-end-radius: 2px;
}

.preview-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
}

.preview-typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-text-faint);
  animation: typing-bounce 1.2s infinite ease-in-out;
}

.preview-typing span:nth-child(2) { animation-delay: 0.15s; }
.preview-typing span:nth-child(3) { animation-delay: 0.3s; }

/* --- Statement / steps / FAQ share the same column --- */
.statement,
.steps,
.faq {
  max-width: 1180px;
  margin: 0 auto;
  padding: 72px 20px;
  border-top: 1px solid var(--color-border);
}

.statement-grid {
  display: grid;
  gap: 28px;
}

.statement-title {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.statement-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 1.02rem;
  font-weight: 300;
  line-height: 1.8;
  color: var(--color-text-soft);
}

/* --- Steps --- */
.section-head {
  margin-bottom: 44px;
}

.steps-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.step {
  padding: 28px 0;
  border-top: 1px solid var(--color-border);
}

.step-num {
  display: block;
  margin-bottom: 14px;
  font-family: var(--font-heading);
  font-size: 2.6rem;
  line-height: 1;
  color: var(--color-text-faint);
}

.step h3 {
  margin: 0 0 8px;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 1.45rem;
}

.step p {
  max-width: 340px;
  font-size: 0.98rem;
  line-height: 1.7;
  color: var(--color-text-soft);
}

/* --- Privacy band (the one ink-black section) --- */
.privacy-band {
  background: var(--color-primary);
  color: var(--color-on-primary);
  padding: 80px 20px;
}

.privacy-inner {
  max-width: 1140px;
  margin: 0 auto;
  display: grid;
  gap: 40px;
}

.privacy-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 28px;
}

.privacy-list li {
  padding-top: 20px;
  border-top: 1px solid rgba(255, 249, 242, 0.18);
}

.privacy-list h3 {
  margin: 0 0 6px;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 1.25rem;
}

.privacy-list p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: rgba(255, 249, 242, 0.7);
}

/* --- FAQ --- */
.faq-list {
  max-width: 760px;
}

.faq-list details {
  border-top: 1px solid var(--color-border);
}

.faq-list details:last-child {
  border-bottom: 1px solid var(--color-border);
}

.faq-list summary {
  position: relative;
  list-style: none;
  cursor: pointer;
  padding: 22px 0 22px 40px;
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 500;
}

.faq-list summary::-webkit-details-marker {
  display: none;
}

/* Plus that turns into a minus. */
.faq-list summary::before,
.faq-list summary::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 50%;
  width: 14px;
  height: 1.5px;
  background: var(--color-text);
  transition: transform var(--transition-fast);
}

.faq-list summary::after {
  transform: rotate(90deg);
}

.faq-list details[open] summary::after {
  transform: rotate(0deg);
}

.faq-list summary:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 4px;
}

.faq-list details p {
  padding: 0 0 24px;
  max-width: 620px;
  font-size: 0.98rem;
  line-height: 1.75;
  color: var(--color-text-soft);
}

/* --- Final CTA --- */
.final-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  padding: 96px 20px 104px;
  background: var(--color-bg-soft);
}

.final-heart {
  width: 64px;
  height: auto;
  margin-bottom: 8px;
}

.final-title {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.1;
}

.final-cta p {
  margin-bottom: 18px;
  color: var(--color-text-soft);
}

/* --- Footer --- */
.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 48px 20px calc(36px + var(--safe-bottom));
  text-align: center;
}

.footer-logo {
  width: 150px;
  height: auto;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  font-size: 0.85rem;
  color: var(--color-text-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-links a:hover {
  color: var(--color-text);
}

.footer-fine {
  font-size: 0.78rem;
  color: var(--color-text-faint);
}

/* --- Wider screens: two-column hero, three-column steps --- */
@media (min-width: 860px) {
  .topbar-nav {
    display: flex;
  }

  .topbar .btn-small {
    margin-inline-start: 0;
  }

  .hero {
    grid-template-columns: 1.15fr 0.85fr;
    gap: 64px;
    min-height: calc(100svh - 72px);
    padding-top: 24px;
    padding-bottom: 80px;
  }

  .statement,
  .steps,
  .faq {
    padding-top: 110px;
    padding-bottom: 110px;
  }

  .statement-grid {
    grid-template-columns: 1.2fr 1fr;
    gap: 72px;
  }

  .steps-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
  }

  .privacy-band {
    padding: 110px 20px;
  }

  .privacy-inner {
    grid-template-columns: 1fr 1.4fr;
    gap: 72px;
  }

  .privacy-inner > .btn-link {
    grid-column: 2;
  }

  .site-footer {
    flex-direction: row;
    justify-content: space-between;
    max-width: 1180px;
    margin: 0 auto;
    border-top: 1px solid var(--color-border);
  }
}

/* ============================================================
   CHAT PAGE
   ============================================================ */

.chat-page {
  overflow: hidden; /* The document must not scroll behind the chat. */
}

.page-chat {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: var(--content-max);
  margin: 0 auto;
  background: var(--color-bg);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + var(--safe-top)) 18px 14px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.back-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--color-text-soft);
  transition: background var(--transition-fast), color var(--transition-fast);
  flex-shrink: 0;
}

.back-link:hover {
  background: var(--color-bg-soft);
  color: var(--color-text);
}

.back-link svg {
  width: 18px;
  height: 18px;
}

.chat-header-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.chat-logo {
  height: 30px;
  width: auto;
}

.chat-status {
  font-size: 0.72rem;
  color: var(--color-text-faint);
  margin-top: 2px;
}

/* Test-mode only (chat.html?test=1) — see addQuickFillButton(). */
.quickfill-btn {
  flex-shrink: 0;
  padding: 6px 10px;
  border: 1px dashed var(--color-text-soft);
  border-radius: var(--radius-pill);
  color: var(--color-text-soft);
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
}

.quickfill-btn:hover {
  color: var(--color-text);
  border-color: var(--color-text);
}

.header-spacer {
  width: 36px;
  flex-shrink: 0;
}

/* --- Questionnaire progress meter: a thin line along the bottom edge
   of the (sticky) header, filling left → right as questions are
   answered. Kept intentionally quiet — no numbers, no heavy styling. --- */
.progress-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--color-border);
  overflow: hidden;
  direction: ltr; /* fill always grows left → right, independent of page RTL */
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--color-primary);
  transition: width 0.45s var(--ease);
}

.chat-messages {
  flex: 1;
  min-height: 0; /* Allow this flex child to scroll without enlarging the page. */
  overscroll-behavior-y: contain;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.message-row {
  flex-shrink: 0;
  display: flex;
  animation: message-in 0.35s var(--ease);
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-row.from-bot {
  justify-content: flex-start;
}

.message-row.from-user {
  justify-content: flex-end;
}

.bubble {
  max-width: 78%;
  padding: 12px 16px;
  font-size: 0.96rem;
  line-height: 1.55;
  word-wrap: break-word;
}

.message-row.from-bot .bubble {
  background: var(--color-bot-bubble);
  color: var(--color-bot-bubble-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md) var(--radius-md) var(--radius-md) 4px;
  box-shadow: var(--shadow-soft);
}

.message-row.from-user .bubble {
  background: var(--color-user-bubble);
  color: var(--color-user-bubble-text);
  border-radius: var(--radius-md) var(--radius-md) 4px var(--radius-md);
}

.typing-row .bubble {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 16px;
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-text-faint);
  animation: typing-bounce 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* --- Question flow: tappable option buttons + dummy photo button --- */
.options-row {
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}

.options-row.removing {
  opacity: 0;
  transform: translateY(-4px);
}

.options-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 84%;
}

.option-btn {
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--color-primary-light);
  background: var(--color-surface);
  color: var(--color-primary-dark);
  font-size: 0.92rem;
  font-weight: 500;
  box-shadow: var(--shadow-soft);
  transition: background var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast), box-shadow var(--transition-fast),
    opacity var(--transition-fast);
}

.option-btn:hover:not(:disabled) {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-on-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-button);
}

.option-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.97);
}

.option-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Final-details panel's real photo picker: a grid of up to 3
   preview thumbnails plus an "add photo" tile, all the same size. */
.final-photos-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.final-photo-thumb,
.final-photo-add {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  flex: 0 0 auto;
}

.final-photo-thumb {
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-soft);
}

.final-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.final-photo-remove {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(43, 35, 32, 0.65);
  color: var(--color-on-primary);
  font-size: 0.7rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast);
}

.final-photo-remove:hover:not(:disabled) {
  background: rgba(43, 35, 32, 0.9);
}

.final-photo-remove:disabled {
  opacity: 0.5;
}

.final-photo-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1.5px dashed var(--color-primary-light);
  background: var(--color-bg);
  color: var(--color-primary-dark);
  font-size: 0.62rem;
  font-weight: 500;
  text-align: center;
  padding: 4px;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.final-photo-add-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.final-photo-add:hover:not(:disabled) {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}

.final-photo-add:disabled {
  opacity: 0.5;
  cursor: default;
}

/* --- Final-details panel: photo + phone + email + submit, shown once
   as its own bot bubble after the questionnaire ends. Deliberately
   reads as a clean technical form, not another chat question. --- */
.message-row.from-bot .bubble.final-details-bubble {
  max-width: 92%; /* a bit roomier than a normal message bubble */
}

.final-details-bubble {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 260px;
  max-width: 100%;
}

.final-details-back-row {
  display: flex;
  margin-bottom: -2px; /* pulls the first real field back up close, same gap: 14px rhythm */
}

.final-details-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 2px;
  color: var(--color-text-soft);
  font-size: 0.8rem;
  font-weight: 500;
  transition: color var(--transition-fast), opacity var(--transition-fast);
}

.final-details-back-btn:hover:not(:disabled) {
  color: var(--color-text);
}

.final-details-back-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.final-details-back-btn svg {
  width: 15px;
  height: 15px;
}

.final-details-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.final-details-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-soft);
}

.final-details-input {
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  font-size: 0.94rem;
  text-align: left;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.final-details-input:focus {
  outline: none;
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.final-details-input:disabled {
  opacity: 0.65;
  background: var(--color-bg-soft);
}

.final-details-error {
  min-height: 14px;
  font-size: 0.76rem;
  color: #B3382C;
}

.final-details-submit {
  margin-top: 2px;
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-size: 0.94rem;
  font-weight: 600;
  box-shadow: var(--shadow-button);
  transition: background var(--transition-fast), transform var(--transition-fast), opacity var(--transition-fast);
}

.final-details-submit:hover:not(:disabled) {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
}

.final-details-submit:disabled {
  opacity: 0.75;
  cursor: default;
  transform: none;
}

.chat-input-area {
  display: flex;
  flex-wrap: wrap; /* lets the "previous question" button sit on its own line */
  align-items: flex-end;
  gap: 10px;
  padding: 12px 14px calc(14px + var(--safe-bottom));
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

/* Once the get-to-know-you questionnaire ends, the chat is over for
   good — no more typing, no more sending. See hideChatInputArea() in
   chat.js. */
.chat-input-area.is-hidden {
  display: none;
}

/* "Back to previous question" — a quiet text button on its own line
   above the input, shown only while a question is waiting for an
   answer (see updatePrevButton() in chat.js). */
.prev-question-btn {
  flex: 0 0 100%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: -2px 0 -4px;
  padding: 2px 2px;
  color: var(--color-text-soft);
  font-size: 0.8rem;
  font-weight: 500;
  transition: color var(--transition-fast);
}

.prev-question-btn[hidden] {
  display: none;
}

.prev-question-btn:hover {
  color: var(--color-primary-dark);
}

.prev-question-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 6px;
}

.prev-question-btn svg {
  width: 15px;
  height: 15px;
  transform: scaleX(-1); /* point the "undo" arrow the RTL way */
}

a.option-btn {
  display: inline-block;
}

/* Secondary action in the chat (e.g. "start over" after resuming). */
.option-btn-quiet {
  border-style: dashed;
  color: var(--color-text-soft);
}

.chat-input {
  flex: 1;
  resize: none;
  overflow-y: hidden; /* autoResizeInput() switches to auto past max-height */
  max-height: 120px;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-bg);
  font-size: 0.96rem;
  line-height: 1.4;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.chat-input:focus {
  outline: none;
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.chat-input::placeholder {
  color: var(--color-text-faint);
}

.chat-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--color-bg-soft);
}

.send-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--color-primary);
  color: var(--color-on-primary);
  flex-shrink: 0;
  box-shadow: var(--shadow-button);
  transition: transform var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

.send-button:hover {
  background: var(--color-primary-dark);
  transform: translateY(-1px);
}

.send-button:active {
  transform: translateY(0) scale(0.96);
}

.send-button:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
  box-shadow: none;
}

.send-button svg {
  width: 19px;
  height: 19px;
  /* icon points toward reading direction; flipped for RTL in markup */
}

@media (min-width: 768px) {
  .page-chat {
    height: 92vh;
    margin-top: 4vh;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    border: 1px solid var(--color-border);
  }

  body:has(.page-chat) {
    background: var(--color-bg-soft);
  }
}

/* Wide screens: the conversation stays centered, just a bit wider
   than on tablets so it doesn't read as a phone-sized card. */
@media (min-width: 1040px) {
  .page-chat {
    max-width: 640px;
  }
}

/* ============================================================
   PRIVACY POLICY PAGE (privacy.html) — a simple content page,
   reusing the chat header's back-link pattern so it feels like part
   of the same site rather than a bolted-on legal page.
   ============================================================ */

.page-legal {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  max-width: var(--content-max);
  margin: 0 auto;
  background: var(--color-bg);
}

.legal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + var(--safe-top)) 18px 14px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
}

.legal-header-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1rem;
  color: var(--color-text);
  flex: 1;
  text-align: center;
}

.legal-content {
  flex: 1;
  padding: 24px 20px calc(32px + var(--safe-bottom));
}

.legal-body {
  color: var(--color-text-soft);
  font-size: 0.94rem;
  line-height: 1.7;
}

.legal-placeholder-note,
.legal-updated {
  color: var(--color-text-faint);
  font-size: 0.82rem;
}

.legal-body h2 {
  margin: 26px 0 8px;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-text);
}

.legal-body p + p {
  margin-top: 10px;
}

.legal-body ul {
  margin: 8px 0 10px;
  padding-inline-start: 20px;
}

.legal-body li + li {
  margin-top: 4px;
}

.legal-body a {
  color: var(--color-primary-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-body strong {
  color: var(--color-text);
  font-weight: 600;
}

.final-details-submit-error {
  min-height: 0;
  margin-top: -6px;
}

@media (min-width: 768px) {
  .page-legal {
    min-height: 92vh;
    margin-top: 4vh;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    border: 1px solid var(--color-border);
  }

  body:has(.page-legal) {
    background: var(--color-bg-soft);
  }
}

/* ============================================================
   Final-details panel: consent checkboxes ("קוביות") shown right
   above the submit button. A real, keyboard-accessible <input
   type="checkbox"> underneath (visually hidden but functional),
   styled as a rounded "cube" matching the rest of the design system
   — not a native browser checkbox.
   ============================================================ */

.final-consent-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.final-consent-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

/* Wraps ONLY the checkbox input + decorative box — never the text/link,
   so a click on the cube can only ever toggle the checkbox. */
.final-consent-hit {
  display: inline-flex;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.final-consent-native-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.final-consent-box {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border-radius: 6px;
  border: 1.5px solid var(--color-primary-light);
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.final-consent-box svg {
  width: 13px;
  height: 13px;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.final-consent-option.is-checked .final-consent-box {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.final-consent-option.is-checked .final-consent-box svg {
  opacity: 1;
  transform: scale(1);
}

.final-consent-hit:focus-visible .final-consent-box {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.final-consent-text {
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--color-text-soft);
  cursor: pointer;
}

.final-consent-optional {
  color: var(--color-text-faint);
  white-space: nowrap;
}

.final-consent-text a {
  color: var(--color-primary-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ============================================================
   PROFILE BUILDER — final step of the chat (chat.js →
   renderFinalDetailsPanel). Replaces the chat body: live preview
   card, editable details, dating status, private contact details,
   consents, "approve and send for review".
   ============================================================ */

.page-chat.is-building .chat-messages,
.page-chat.is-building .chat-input-area {
  display: none;
}

.profile-builder {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
}

.pb-topbar {
  padding: 10px 18px;
  border-bottom: 1px solid var(--color-border);
}

.pb-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 22px 18px calc(32px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.pb-title {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 1.7rem;
  line-height: 1.2;
  margin-bottom: 8px;
}

.pb-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 22px;
  border-top: 1px solid var(--color-border);
}

.pb-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.pb-hint {
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--color-text-soft);
}

.pb-hint-small {
  font-size: 0.78rem;
  color: var(--color-text-faint);
}

.pb-input {
  text-align: right;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}

/* --- Preview card --- */
.profile-card {
  position: relative;
  max-width: 360px;
  width: 100%;
  align-self: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 24px 50px -32px rgba(21, 19, 18, 0.35);
  transition: opacity var(--transition-mid);
}

.profile-card.is-hidden-card {
  opacity: 0.6;
}

.profile-card-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--color-bg-soft);
}

.profile-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-card-count {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(21, 19, 18, 0.6);
  color: #fff;
  font-size: 0.72rem;
}

.profile-card-placeholder {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--color-text-faint);
}

.profile-card-placeholder img {
  width: 56px;
  height: auto;
  opacity: 0.55;
}

.profile-card-body {
  padding: 16px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profile-card-name {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 1.2;
}

.profile-card-status {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.74rem;
  color: var(--color-text-soft);
  white-space: nowrap;
}

.profile-card-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-text-faint);
}

.profile-card-status.status-available::before { background: #3E8E5A; }
.profile-card-status.status-dating::before { background: #C9922E; }
.profile-card-status.status-paused::before { background: #9A9089; }
.profile-card-status.status-taken::before { background: #B3382C; }

.profile-card-sub {
  font-size: 0.9rem;
  color: var(--color-text-soft);
}

.profile-card-facts {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.profile-card-facts li {
  padding: 4px 10px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.76rem;
  color: var(--color-text-soft);
}

.profile-card-block {
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
}

.profile-card-block h5 {
  margin: 0 0 3px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-text-faint);
}

.profile-card-block p {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--color-text);
}

.profile-card-notice {
  margin: 0;
  padding: 10px 18px;
  background: var(--color-bg-soft);
  border-top: 1px solid var(--color-border);
  font-size: 0.8rem;
  color: var(--color-text-soft);
}

/* --- Dating status --- */
.pb-status-group {
  display: grid;
  gap: 8px;
}

.pb-status-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px 14px;
  text-align: right;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.pb-status-option:hover:not(:disabled) {
  border-color: var(--color-primary-light);
}

.pb-status-option.is-selected {
  border-color: var(--color-primary);
  box-shadow: inset 0 0 0 1px var(--color-primary);
}

.pb-status-label {
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--color-text);
}

.pb-status-desc {
  font-size: 0.8rem;
  color: var(--color-text-soft);
}

.pb-status-option:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* --- Social network --- */
.pb-social-row {
  display: flex;
  gap: 8px;
}

.pb-social-select {
  flex: 0 0 auto;
  width: 112px;
  text-align: right;
}

.pb-social-row input {
  flex: 1;
  min-width: 0;
}

/* --- What stays private --- */
.pb-private-box {
  padding: 16px 18px;
  background: var(--color-bg-soft);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pb-private-list {
  margin: 4px 0 0;
  padding-inline-start: 18px;
  font-size: 0.86rem;
  line-height: 1.7;
  color: var(--color-text-soft);
}

.final-consent-option.is-disabled {
  opacity: 0.5;
}

.pb-submit-note {
  margin-top: -14px;
  text-align: center;
}

@media (min-width: 768px) {
  .pb-scroll {
    padding: 28px 32px 40px;
  }
}

/* Photo visibility choice ("מי יוכל לראות את התמונה שלך?"). */
.pb-subtitle {
  margin: 10px 0 0;
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--color-text);
}

.pb-how {
  padding: 12px 14px;
  background: var(--color-bg-soft);
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--color-text-soft);
}

.pb-how strong {
  display: block;
  margin-bottom: 2px;
  color: var(--color-text);
  font-weight: 600;
}

.pb-how[hidden] {
  display: none;
}

/* ============================================================
   PERSONAL AREA — account.html / account.js
   Same ink-on-cream language as the rest of the site: hairlines,
   small radii, no color except for status.
   ============================================================ */
.page-account {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 680px;
  margin: 0 auto;
}

.ac-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(12px + var(--safe-top)) 16px 12px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.ac-logo img {
  height: 30px;
  width: auto;
  display: block;
}

.ac-header-title {
  flex: 1;
  font-size: 0.88rem;
  color: var(--color-text-soft);
}

.ac-logout {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.ac-logout[hidden] {
  display: none;
}

.ac-main {
  flex: 1;
  padding: 28px 16px calc(40px + var(--safe-bottom));
  transition: opacity var(--transition-fast);
}

.ac-main.is-busy {
  opacity: 0.6;
  pointer-events: none;
}

.ac-loading {
  color: var(--color-text-faint);
  font-size: 0.9rem;
}

.ac-demo-note {
  margin: 12px 16px 0;
  padding: 8px 12px;
  border: 1px dashed var(--color-primary-light);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--color-text-soft);
}

.ac-title {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 1.9rem;
  line-height: 1.2;
  margin-bottom: 10px;
}

.ac-lead {
  color: var(--color-text-soft);
  font-size: 0.96rem;
  margin-bottom: 22px;
}

.ac-notice {
  margin-bottom: 18px;
  padding: 10px 14px;
  background: var(--color-bg-soft);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

/* --- Auth --- */
.ac-auth {
  max-width: 400px;
  margin: 0 auto;
  padding-top: 12px;
}

.ac-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ac-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ac-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--color-text);
}

.ac-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font: inherit;
  font-size: 0.95rem;
  color: var(--color-text);
  text-align: right;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

textarea.ac-input {
  resize: vertical;
  line-height: 1.5;
}

.ac-input:focus {
  outline: none;
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 3px var(--color-focus-ring);
}

.ac-input-ltr {
  text-align: left;
}

.ac-input-narrow {
  width: auto;
  flex: 0 0 auto;
}

.ac-row {
  display: flex;
  gap: 8px;
}

.ac-hint {
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--color-text-faint);
}

.ac-hint a {
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.ac-error {
  font-size: 0.8rem;
  color: #B3382C;
}

.ac-error:empty {
  display: none;
}

.ac-static {
  font-size: 0.95rem;
  direction: ltr;
  text-align: right;
}

.ac-submit {
  align-self: flex-start;
  margin-top: 4px;
}

.ac-auth .ac-submit {
  align-self: stretch;
}

.ac-auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 20px;
}

.ac-link {
  font-size: 0.88rem;
}

.ac-auth-foot {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
}

/* --- Banners --- */
.ac-banner {
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-inline-start: 3px solid var(--color-text);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

.ac-banner-warn {
  border-inline-start-color: #C9922E;
}

.ac-banner-title {
  font-weight: 600;
  font-size: 0.94rem;
}

.ac-banner-text {
  margin-top: 2px;
  font-size: 0.86rem;
  color: var(--color-text-soft);
}

.ac-banner-actions {
  margin-top: 8px;
}

/* --- Tabs --- */
.ac-tabs {
  position: sticky;
  top: calc(55px + var(--safe-top));
  z-index: 4;
  margin: 22px -16px 0;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.ac-tabs-inner {
  display: flex;
  gap: 0;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.ac-tabs-inner::-webkit-scrollbar {
  display: none;
}

.ac-tab {
  position: relative;
  flex: 0 0 auto;
  padding: 12px 8px;
  font-size: 0.88rem;
  color: var(--color-text-soft);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}

.ac-tab:hover {
  color: var(--color-text);
}

.ac-tab.is-active {
  color: var(--color-text);
  font-weight: 600;
  border-bottom-color: var(--color-text);
}

.ac-tab:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

.ac-tab-dot {
  position: absolute;
  top: 10px;
  left: 2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #C9922E;
}

.ac-panel {
  padding-top: 8px;
}

.ac-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 26px 0;
  border-bottom: 1px solid var(--color-border);
}

.ac-section:last-child {
  border-bottom: 0;
}

.ac-section-title {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 1.3rem;
}

.ac-section-hint {
  margin-top: -6px;
  font-size: 0.86rem;
  color: var(--color-text-soft);
}

.ac-section .profile-card {
  margin-top: 6px;
}

.ac-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 6px;
}

.ac-segment {
  display: inline-flex;
  align-self: center;
  padding: 3px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

.ac-segment-btn {
  padding: 7px 14px;
  font-size: 0.84rem;
  border-radius: 5px;
  color: var(--color-text-soft);
}

.ac-segment-btn.is-active {
  background: var(--color-text);
  color: var(--color-on-primary);
}

.ac-field.is-pending .ac-input {
  border-color: #E4C58F;
  background: #FFFBF3;
}

.ac-pending-tag {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 1px 7px;
  border-radius: 999px;
  background: #F6E6C8;
  color: #7A5612;
}

/* --- Photos --- */
.ac-photos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.ac-photo,
.ac-photo-add {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.ac-photo {
  margin: 0;
  border: 1px solid var(--color-border);
}

.ac-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ac-photo.is-pending img {
  opacity: 0.75;
}

.ac-photo-tag {
  position: absolute;
  bottom: 6px;
  right: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #F6E6C8;
  color: #7A5612;
  font-size: 0.7rem;
  font-weight: 500;
}

.ac-photo-remove {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(21, 19, 18, 0.7);
  color: var(--color-on-primary);
  font-size: 0.72rem;
}

.ac-photo-remove:hover {
  background: rgba(21, 19, 18, 0.9);
}

.ac-photo-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1.5px dashed var(--color-primary-light);
  font-size: 0.8rem;
  color: var(--color-text-soft);
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.ac-photo-add:hover,
.ac-photo-add:focus-within {
  background: var(--color-bg-soft);
  border-color: var(--color-primary);
}

.ac-photo-add-icon {
  font-size: 1.4rem;
  line-height: 1;
  color: var(--color-text);
}

/* --- Matches --- */
.ac-matches {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ac-match {
  display: flex;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.ac-match-media {
  flex: 0 0 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ac-match-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ac-match-initial {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--color-text-soft);
}

.ac-match-body {
  flex: 1;
  min-width: 0;
}

.ac-match-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.ac-match-name {
  font-size: 1rem;
  font-weight: 600;
}

.ac-match-status {
  font-size: 0.75rem;
  padding: 2px 9px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-text-soft);
}

.ac-match-sub,
.ac-match-note {
  font-size: 0.86rem;
  color: var(--color-text-soft);
}

.ac-empty {
  padding: 28px 16px;
  text-align: center;
  border: 1px dashed var(--color-primary-light);
  border-radius: var(--radius-md);
}

.ac-empty-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.ac-danger {
  background: transparent;
  color: #B3382C;
  border: 1px solid #E3B4AE;
}

.ac-danger:hover {
  background: #FBEDEB;
}

/* --- Toast --- */
.ac-toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + var(--safe-bottom));
  z-index: 20;
  max-width: calc(100% - 32px);
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  background: var(--color-text);
  color: var(--color-on-primary);
  font-size: 0.9rem;
  box-shadow: 0 12px 30px -12px rgba(21, 19, 18, 0.5);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.ac-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.ac-toast.is-error {
  background: #8E2B21;
}

.ac-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  padding: 18px 16px calc(18px + var(--safe-bottom));
  border-top: 1px solid var(--color-border);
  font-size: 0.8rem;
  color: var(--color-text-faint);
}

.ac-footer a:hover {
  color: var(--color-text);
}

@media (min-width: 768px) {
  .ac-main {
    padding: 40px 32px 56px;
  }

  .ac-tabs {
    margin: 26px -32px 0;
  }

  .ac-tabs-inner {
    padding: 0 32px;
  }
}

/* ============================================================
   BROWSING — browse.html / browse.js (design demonstration)
   One card at a time, "הבא" / "מעניין אותי", filters, rules.
   Reuses the personal area's header, toast, empty state and
   match rows (.ac-*).
   ============================================================ */
.page-browse {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 560px;
  margin: 0 auto;
}

.bw-main {
  flex: 1;
  padding: 22px 16px calc(40px + var(--safe-bottom));
}

.bw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.bw-head .ac-title {
  margin-bottom: 0;
}

.bw-tools {
  display: flex;
  gap: 8px;
}

.bw-tool {
  padding: 7px 13px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: 0.84rem;
  color: var(--color-text);
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.bw-tool:hover,
.bw-tool.is-active {
  border-color: var(--color-text);
}

.bw-tool:focus-visible,
.bw-chip:focus-visible,
.bw-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* --- Filters --- */
.bw-filters {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.bw-filter-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bw-filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-soft);
}

.bw-age {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bw-age .ac-input {
  padding: 8px 12px;
}

.bw-age-sep {
  font-size: 0.86rem;
  color: var(--color-text-soft);
}

.bw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.bw-chip {
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-bg);
  font-size: 0.84rem;
  color: var(--color-text-soft);
  transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.bw-chip:hover {
  border-color: var(--color-primary-light);
  color: var(--color-text);
}

.bw-chip.is-selected {
  background: var(--color-text);
  border-color: var(--color-text);
  color: var(--color-on-primary);
}

.bw-clear {
  align-self: flex-start;
}

/* --- Deck --- */
.bw-deck {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.bw-count {
  align-self: stretch;
  margin-bottom: 10px;
  font-size: 0.8rem;
  color: var(--color-text-faint);
  text-align: center;
}

.bw-stage {
  position: relative;
  width: 100%;
  max-width: 380px;
}

/* A sliver of the next card, so the stack reads as a deck. */
.bw-peek {
  position: absolute;
  inset: 10px 14px -10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.bw-card {
  position: relative;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.26s var(--ease), opacity 0.26s var(--ease);
}

.bw-card.is-dragging {
  transition: none;
  cursor: grabbing;
}

.bw-card .profile-card {
  max-width: none;
}

.bw-card img {
  -webkit-user-drag: none;
  pointer-events: none;
}

.bw-card.is-flying-like {
  transform: translateX(130%) rotate(14deg);
  opacity: 0;
}

.bw-card.is-flying-pass {
  transform: translateX(-130%) rotate(-14deg);
  opacity: 0;
}

.bw-stamp {
  position: absolute;
  top: 22px;
  padding: 6px 14px;
  border: 2px solid currentColor;
  border-radius: var(--radius-sm);
  background: rgba(255, 249, 242, 0.92);
  font-weight: 700;
  font-size: 1rem;
  opacity: 0;
  transition: opacity var(--transition-fast);
  pointer-events: none;
}

.bw-stamp-like {
  left: 18px;
  color: #3E8E5A;
  transform: rotate(-8deg);
}

.bw-stamp-pass {
  right: 18px;
  color: var(--color-text-soft);
  transform: rotate(8deg);
}

.bw-card.show-like .bw-stamp-like,
.bw-card.show-pass .bw-stamp-pass {
  opacity: 1;
}

.bw-actions {
  /* Stays reachable while scrolling through a long card. */
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  width: calc(100% + 32px);
  max-width: 412px;
  margin: 18px -16px 0;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: linear-gradient(to top, var(--color-bg) 70%, rgba(255, 249, 242, 0));
}

.bw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 18px;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 500;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.bw-btn:active {
  transform: scale(0.98);
}

.bw-btn-pass {
  border: 1px solid var(--color-primary-light);
  background: var(--color-surface);
  color: var(--color-text);
}

.bw-btn-pass:hover {
  border-color: var(--color-text);
}

.bw-btn-like {
  background: var(--color-primary);
  color: var(--color-on-primary);
}

.bw-btn-like:hover {
  background: #2B2724;
}

.bw-icon {
  display: inline-flex;
}

.bw-icon svg {
  width: 19px;
  height: 19px;
}

.bw-hint {
  max-width: 380px;
  margin-top: 12px;
  text-align: center;
}

.bw-empty {
  width: 100%;
}

.bw-empty .ac-actions {
  margin-top: 14px;
  flex-wrap: wrap;
}

/* --- Interests list --- */
.bw-interests {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bw-interests .ac-match-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.bw-interests .ac-match-head {
  align-self: stretch;
}

.ac-match-status.is-mutual {
  border-color: #3E8E5A;
  color: #2F6E45;
  background: #EEF6F0;
}

/* --- Mutual interest dialog --- */
.bw-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(21, 19, 18, 0.45);
  animation: bw-fade 0.2s var(--ease);
}

.bw-modal-box {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 28px 24px 24px;
  border-radius: var(--radius-lg);
  background: var(--color-bg);
  text-align: center;
  font-size: 0.94rem;
  color: var(--color-text-soft);
}

.bw-modal-box .bw-icon svg {
  width: 40px;
  height: 40px;
  color: #B3382C;
}

.bw-modal-title {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: 1.5rem;
  color: var(--color-text);
}

@keyframes bw-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --- Rules --- */
.bw-rules {
  margin-top: 34px;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.bw-rules summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
}

.bw-rules-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 14px 0 2px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.bw-rules-steps li {
  position: relative;
  padding-inline-start: 34px;
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--color-text-soft);
}

.bw-rules-steps li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  inset-inline-start: 0;
  top: 1px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--color-text);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.bw-rules-steps strong {
  display: block;
  color: var(--color-text);
}

@media (prefers-reduced-motion: reduce) {
  .bw-card,
  .bw-modal {
    transition: none;
    animation: none;
  }
}

@media (min-width: 768px) {
  .bw-main {
    padding: 34px 32px 56px;
  }
}
