/* Canonical brand palette — mirrors styles.css. Single source of truth for
   tokens across welcome.html, app.html, patient.html, login/signup, admin. */
:root {
  --bg: #faf4ec;
  --srf: #ffffff;
  --srf2: #f7f2ea;
  --or: #c85a1e;
  --or-deep: #8f3d10;
  --or-soft: #f3d4bd;
  --or-softer: #faeadd;
  --t1: #0f0f0f;
  --t3: #5a5a58;
  --t4: #9a9a98;
  --bd: rgba(15, 15, 15, 0.08);
  --bd-soft: rgba(15, 15, 15, 0.05);
  --shadow-card: 0 1px 2px rgba(15, 15, 15, 0.03), 0 12px 40px rgba(15, 15, 15, 0.06);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--bg);
  color: var(--t1);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}

body {
  padding:
    calc(var(--safe-top) + 14px)
    20px
    calc(var(--safe-bottom) + 28px);
  max-width: 560px;
  margin: 0 auto;
  position: relative;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.logo {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 600;
  font-size: 30px;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--t1);
}

.logo-dot { color: var(--or); }

.nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--t1);
  text-decoration: none;
  cursor: pointer;
  padding: 8px 2px;
}

.nav a.muted { color: var(--t3); }

.try-free {
  background: var(--t1);
  color: #fff !important;
  padding: 10px 18px !important;
  border-radius: 999px;
  font-weight: 500;
  transition: transform 0.15s ease;
}

.try-free:active { transform: scale(0.96); }

/* Audience toggle */
.audience-row {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.audience-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--t4);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.audience-toggle {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--bd);
  border-radius: 999px;
  padding: 3px;
  position: relative;
}

.audience-toggle button {
  position: relative;
  z-index: 2;
  background: transparent;
  border: none;
  padding: 7px 18px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--t3);
  cursor: pointer;
  border-radius: 999px;
  transition: color 0.3s ease;
}

.audience-toggle button.active { color: #ffffff; }

.toggle-pill {
  position: absolute;
  top: 3px;
  left: 3px;
  height: calc(100% - 6px);
  background: var(--t1);
  border-radius: 999px;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1;
}

/* Hero — crossfade between panels without layout jump */
.hero {
  margin-top: 20px;
  position: relative;
  display: grid;
  grid-template-areas: "stack";
  grid-template-columns: minmax(0, 1fr);
}

.hero-panel {
  grid-area: stack;
  min-width: 0;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.28s ease, transform 0.28s ease;
  pointer-events: none;
  width: 100%;
}

.hero-panel.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.headline {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 500;
  font-size: 42px;
  line-height: 1.04;
  letter-spacing: -0.028em;
  color: var(--t1);
  text-align: center;
  text-wrap: balance;
}

.headline .accent {
  color: var(--or);
  font-style: italic;
  font-weight: 500;
}

.subcopy {
  margin: 14px auto 0;
  font-size: 16px;
  line-height: 1.45;
  color: var(--t3);
  max-width: 460px;
  text-align: center;
  text-wrap: pretty;
}

.credential-dek {
  margin: 16px 0 0;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--or);
  text-align: center;
}

.credential-dek + .input-card {
  margin-top: 32px;
}

/* Input card */
.input-card {
  margin-top: 22px;
  background: var(--srf);
  border-radius: 22px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--bd-soft);
  display: flex;
  flex-direction: column;
  min-height: 88px;
  transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.input-card.is-focused {
  border-color: var(--or);
  box-shadow:
    0 0 0 4px rgba(200, 90, 30, 0.12),
    0 1px 2px rgba(15, 15, 15, 0.03),
    0 16px 48px rgba(200, 90, 30, 0.10);
  transform: translateY(-1px);
}

.input-textarea-wrap {
  flex: 1;
  padding: 12px 20px 0;
  position: relative;
}

.input-textarea {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.45;
  color: var(--t1);
  resize: none;
  min-height: 24px;
  position: relative;
  z-index: 2;
}

.input-textarea::placeholder { color: transparent; }

.typed-placeholder {
  position: absolute;
  top: 12px;
  left: 20px;
  right: 20px;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.45;
  color: var(--t4);
  pointer-events: none;
  z-index: 1;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.typed-placeholder.hidden { opacity: 0; }

.typed-cursor {
  display: inline-block;
  width: 1.5px;
  height: 1em;
  background: var(--t4);
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: cursor-blink 1.1s ease-in-out infinite;
  transform: translateY(2px);
}

@keyframes cursor-blink {
  0%, 45% { opacity: 1; }
  55%, 100% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .typed-cursor { animation: none; opacity: 1; }
}

.input-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px 10px;
}

.attach-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--bd);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--t3);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.attach-btn:active {
  background: rgba(15, 15, 15, 0.04);
  border-color: rgba(15, 15, 15, 0.15);
}

.send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--or-softer);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s ease, background 0.25s ease, box-shadow 0.25s ease;
  position: relative;
}

.send-btn svg {
  color: var(--or);
  opacity: 0.55;
  transition: opacity 0.25s ease, transform 0.2s ease;
}

.send-btn.is-ready {
  background: var(--or);
  box-shadow: 0 4px 14px rgba(200, 90, 30, 0.35);
}

.send-btn.is-ready svg {
  color: #ffffff;
  opacity: 1;
  transform: translateY(-1px);
}

.send-btn:active {
  transform: scale(0.94);
}

/* Example questions — horizontal scroll */
.examples-wrap {
  margin-top: 22px;
  position: relative;
  margin-left: -20px;
  margin-right: -20px;
}

.examples-wrap::after,
.examples-wrap::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 28px;
  pointer-events: none;
  z-index: 2;
}
.examples-wrap::before {
  left: 0;
  background: linear-gradient(to right, var(--bg), transparent);
}
.examples-wrap::after {
  right: 0;
  background: linear-gradient(to left, var(--bg), transparent);
}

.examples {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 2px 20px;
  scroll-padding-left: 20px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

.examples::-webkit-scrollbar { display: none; }

.example {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.7);
  color: var(--t3);
  border: 1px solid var(--bd-soft);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  flex-shrink: 0;
  scroll-snap-align: start;
}

.example:active {
  transform: scale(0.97);
  background: #ffffff;
}

.example .chip-arrow {
  color: var(--or);
  font-weight: 500;
  opacity: 0.65;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

@media (hover: hover) {
  .example:hover {
    background: #ffffff;
    border-color: rgba(15, 15, 15, 0.12);
    color: var(--t1);
  }
  .example:hover .chip-arrow {
    transform: translateX(2px);
    opacity: 1;
  }
}

/* Fade chips once the user starts typing (progressive-disclosure behavior) */
.examples-wrap {
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.hero-panel.is-typing .examples-wrap {
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
}

/* Desktop — keep the previous wider column so the page isn't narrow on large screens */
@media (min-width: 720px) {
  body {
    max-width: 680px;
    padding-top: calc(var(--safe-top) + 22px);
    padding-bottom: calc(var(--safe-bottom) + 48px);
  }

  .audience-row { margin-top: 36px; }
  .hero { margin-top: 28px; }

  .headline { font-size: 52px; }
  .subcopy { font-size: 17px; margin-top: 16px; }

  .input-card { margin-top: 28px; min-height: 92px; }
  .input-textarea { min-height: 26px; font-size: 17px; }
  .typed-placeholder { font-size: 17px; }

  .trust-row { margin-top: 36px; font-size: 12.5px; }
}

/* Narrow phones */
@media (max-width: 420px) {
  .logo { font-size: 26px; }
  .headline { font-size: 34px; line-height: 1.06; }
  .subcopy { font-size: 15px; }
  .trust-row { gap: 8px; font-size: 11px; }
  .input-card { min-height: 80px; }
  .input-textarea { min-height: 22px; }
  .audience-toggle button { padding: 6px 16px; font-size: 12.5px; }
  .try-free { padding: 8px 14px !important; font-size: 13px; }
  .example { font-size: 13.5px; padding: 8px 14px; }
}

@media (max-width: 360px) {
  .logo { font-size: 24px; }
  .headline { font-size: 29px; }
  .audience-toggle button { padding: 6px 13px; font-size: 12px; }
}
