/* Keepwell card pages. Colors and radii follow KeepTheme in the app. */

:root {
  color-scheme: light;
  --ink: #0E2923;
  --text-2: #4A5148;
  --text-3: #3F463D;
  --muted: #5C6359;
  --placeholder: #6B7166;
  --cream: #F7F2E7;
  --paper: #FEFCF7;
  --field: #FCFAF4;
  --line: #E3DCCB;
  --hair: rgba(199, 189, 166, 0.5);
  --forest: #133B34;
  --green: #296147;
  --mint: #D6E3D1;
  --mint-soft: #E4ECDF;
  --sage: #8FAA93;
  --gold: #B88033;
  --gold-soft: #F3E8D6;
  --gold-ink: #6E4A17;
  --red-soft: #F5DEDB;
  --red-ink: #872B23;
  --neutral-soft: #ECEADF;
  --error: #A0352C;

  --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;

  --radius-card: 26px;
  --radius-control: 18px;
  --shadow-card: 0 16px 36px rgba(14, 41, 35, 0.08), 0 2px 6px rgba(14, 41, 35, 0.03);
  --shadow-button: 0 10px 24px rgba(19, 59, 52, 0.22);
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background:
    radial-gradient(420px 360px at 100% -2%, rgba(214, 227, 209, 0.85), rgba(214, 227, 209, 0) 70%),
    radial-gradient(340px 340px at -8% 104%, rgba(127, 154, 132, 0.14), rgba(127, 154, 132, 0) 70%),
    var(--cream);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

a { color: var(--green); text-underline-offset: 2px; }
a:hover { color: var(--forest); }

:focus-visible {
  outline: 3px solid rgba(41, 97, 71, 0.4);
  outline-offset: 2px;
}
h1:focus, h1:focus-visible { outline: none; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.icon {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.9;
  stroke-linecap: round; stroke-linejoin: round;
}
.sprig { width: 22px; height: 22px; flex: none; color: var(--sage); }

/* MARK: Page */

.page {
  width: 100%;
  max-width: 460px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 20px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  animation: page-in 260ms ease-out;
}
.page-form { padding: 0; }

@keyframes page-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.spacer { flex: 1 1 24px; min-height: 24px; }
.spacer.small { flex: 0 0 48px; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 44px;
}
.wordmark {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--serif); font-weight: 600; font-size: 21px; letter-spacing: -0.2px;
}

.lang {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 12px;
  border-radius: 999px; border: 1px solid rgba(199, 189, 166, 0.6);
  background: rgba(254, 252, 247, 0.7);
  color: var(--ink); font-size: 14px; font-weight: 500;
}
.lang .icon { width: 16px; height: 16px; stroke-width: 1.8; }
.lang select {
  appearance: none; -webkit-appearance: none;
  border: 0; background: transparent; color: inherit;
  font: inherit; padding: 0; margin: 0; cursor: pointer;
}
.lang select:focus-visible { outline: none; }
.lang:focus-within { outline: 3px solid rgba(41, 97, 71, 0.4); outline-offset: 2px; }

/* MARK: Type */

.display {
  margin: 26px 0 0;
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(32px, 9.6vw, 40px); line-height: 1.07; letter-spacing: -0.6px;
  text-wrap: balance;
}
.display.medium { margin-top: 8px; font-size: 30px; line-height: 1.1; letter-spacing: -0.4px; }
.display.small { margin-top: 0; font-size: 31px; line-height: 1.1; letter-spacing: -0.4px; }

.lede { margin: 12px 0 0; font-size: 17px; line-height: 1.5; color: var(--text-2); text-wrap: pretty; }
.lede.small { margin-top: 8px; font-size: 15px; }

.meta { margin: 12px 0 0; font-size: 14px; color: var(--muted); }
.meta.small, .small { font-size: 13px; }
.center { text-align: center; }

.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.7px; text-transform: uppercase; color: var(--muted);
}
.eyebrow.green { margin: 26px 0 0; color: var(--green); letter-spacing: 0.8px; }

/* MARK: Buttons */

.btn-primary, .btn-secondary {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; border-radius: 999px;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}
.btn-primary {
  margin-top: 26px; min-height: 58px; padding: 0 22px;
  border: 0; background: var(--forest); color: var(--paper);
  font-size: 17px; box-shadow: var(--shadow-button);
}
.btn-primary:hover { background: #0F302A; color: var(--paper); }
.btn-primary:active { transform: scale(0.985); box-shadow: 0 6px 14px rgba(19, 59, 52, 0.2); }
.btn-secondary {
  margin-top: 12px; min-height: 52px; padding: 0 20px;
  border: 1px solid rgba(19, 59, 52, 0.25); background: transparent; color: var(--forest);
  font-size: 16px;
}
.btn-secondary:hover { background: rgba(19, 59, 52, 0.05); color: var(--forest); }
.btn-secondary:active { transform: scale(0.985); }

.icon-btn {
  width: 44px; height: 44px; margin-left: -10px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--ink); border-radius: 50%; cursor: pointer;
}
.icon-btn .icon { width: 22px; height: 22px; stroke-width: 2; }

.chip-btn {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px;
  background: var(--neutral-soft); color: var(--forest);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.chip-btn .icon { width: 15px; height: 15px; stroke-width: 2; }

/* MARK: Welcome illustration */

.hero-cards { position: relative; height: 262px; margin-top: 22px; }
.hero-back {
  position: absolute; left: 13%; top: 18px; width: 72%; height: 222px;
  border-radius: var(--radius-card); background: var(--mint); transform: rotate(5deg);
}
.hero-card {
  position: absolute; left: 8%; top: 10px; width: 78%; height: 232px;
  border-radius: var(--radius-card); background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 40px rgba(14, 41, 35, 0.10), 0 2px 6px rgba(14, 41, 35, 0.04);
  transform: rotate(-2.5deg);
  padding: 20px 22px; display: flex; flex-direction: column; gap: 16px;
}
.hero-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hero-names { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hero-title {
  font-family: var(--serif); font-size: 20px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hero-lines { display: flex; flex-direction: column; gap: 12px; }
.hero-line { display: flex; align-items: baseline; gap: 10px; }
.hero-line span { flex: none; min-width: 72px; font-size: 13px; font-weight: 600; color: var(--green); }
.hero-line i { flex: 1; height: 10px; border-bottom: 1.5px dashed #D9D1BE; }
.hero-badge {
  position: absolute; right: 5%; top: 0; width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--gold); color: var(--paper);
  box-shadow: 0 8px 18px rgba(184, 128, 51, 0.30); transform: rotate(8deg);
}
.hero-badge .icon { width: 22px; height: 22px; }

.avatar {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--mint); color: var(--forest);
  font-family: var(--serif); font-size: 20px; font-weight: 600;
}
.avatar.large {
  width: 58px; height: 58px; font-size: 25px;
  border: 3px solid #FFFFFF; box-shadow: 0 4px 10px rgba(14, 41, 35, 0.08);
}

.note-card {
  margin-top: 26px; padding: 16px 18px;
  display: flex; gap: 14px; align-items: flex-start;
  border-radius: 22px; background: rgba(254, 252, 247, 0.72); border: 1px solid rgba(255, 255, 255, 0.85);
}
.note-title { margin: 0; font-size: 15px; font-weight: 600; }
.note-body { margin: 3px 0 0; font-size: 14px; line-height: 1.45; color: var(--text-2); }

.icon-circle {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-circle .icon { width: 19px; height: 19px; stroke-width: 1.8; }
.icon-circle.green { background: var(--mint-soft); color: var(--green); }
.icon-circle.gold { background: var(--gold-soft); color: #8E6224; }
.icon-circle.red { background: var(--red-soft); color: var(--error); }
.icon-circle.neutral { background: var(--neutral-soft); color: var(--text-3); }

.footer {
  border-top: 1px solid var(--hair); padding-top: 18px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center; color: var(--muted);
}
.footer p { margin: 0; }
.footer p:first-child { font-size: 15px; color: var(--text-2); }
.footer p.small:first-child { font-size: 13px; color: var(--muted); }
.footer a { font-weight: 600; }

/* MARK: Form */

.formbar {
  position: sticky; top: 0; z-index: 2;
  padding: calc(10px + env(safe-area-inset-top)) 20px 14px;
  background: rgba(247, 242, 231, 0.92);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid rgba(199, 189, 166, 0.45);
}
.formbar.plain { border-bottom-color: transparent; background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; position: static; }
.formbar-row { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; }
.formbar-title {
  text-align: center; font-size: 16px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.formbar-progress { text-align: right; font-size: 13px; font-weight: 600; color: var(--green); font-variant-numeric: tabular-nums; }
.progress { margin-top: 10px; height: 4px; border-radius: 2px; background: rgba(199, 189, 166, 0.4); overflow: hidden; }
.progress-fill { height: 100%; width: 0; border-radius: 2px; background: var(--green); transition: width 240ms ease; }

.form-body { flex: 1; padding: 24px 20px 8px; display: flex; flex-direction: column; }

.section-label {
  margin: 30px 0 10px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.7px; text-transform: uppercase; color: var(--muted);
}

.field { display: flex; flex-direction: column; gap: 8px; margin: 0 0 16px; padding: 0; border: 0; min-width: 0; }
.field > label, .field > legend {
  display: inline-flex; align-items: center; gap: 7px; padding: 0;
  font-size: 14px; font-weight: 600; color: var(--text-3);
}
.field > legend { margin-bottom: 8px; }
.field > label .icon, .field > legend .icon { width: 17px; height: 17px; stroke-width: 1.8; }
.hint { font-weight: 400; color: var(--muted); }

input, textarea, select { font: inherit; color: var(--ink); }

.field input, .field textarea, .select-wrap select {
  width: 100%; border-radius: var(--radius-control);
  border: 1px solid var(--line); background: var(--field);
  font-size: 17px; line-height: 1.4;
  box-shadow: 0 4px 12px rgba(14, 41, 35, 0.03);
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}
.field input { min-height: 52px; padding: 0 16px; }
.field textarea { padding: 14px 16px; resize: none; overflow: hidden; min-height: 52px; display: block; }
.field input::placeholder, .field textarea::placeholder { color: var(--placeholder); }
.field input:focus, .field textarea:focus, .select-wrap select:focus {
  outline: none; border-color: var(--green); background: var(--paper);
  box-shadow: 0 0 0 4px rgba(41, 97, 71, 0.12);
}
.field input[aria-invalid="true"] { border-color: var(--error); }

.birthday-row { display: grid; grid-template-columns: 3fr 2fr; gap: 10px; }
.select-wrap { position: relative; display: block; }
.select-wrap select {
  appearance: none; -webkit-appearance: none;
  min-height: 52px; padding: 0 40px 0 16px; cursor: pointer;
}
.select-wrap .chevron {
  position: absolute; right: 14px; top: 50%; width: 18px; height: 18px;
  margin-top: -9px; pointer-events: none; color: var(--muted); stroke-width: 2;
}

.field-foot { display: flex; justify-content: space-between; gap: 12px; margin: 0; font-size: 13px; color: var(--muted); }
.field-foot:empty { display: none; }
.counter { font-variant-numeric: tabular-nums; margin-left: auto; }

.error { margin: 0; font-size: 14px; font-weight: 500; color: var(--error); }
.form-error { margin-top: 4px; padding: 12px 14px; border-radius: 14px; background: var(--red-soft); }

.bar {
  position: sticky; bottom: 0; z-index: 2;
  padding: 16px 20px calc(18px + env(safe-area-inset-bottom));
  background: rgba(247, 242, 231, 0.94);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid rgba(199, 189, 166, 0.45);
}
.bar .btn-primary { margin-top: 0; }
.bar .meta { margin-top: 10px; }
.status { margin: 10px 0 0; min-height: 1px; text-align: center; font-size: 14px; font-weight: 600; color: var(--green); }
.status:empty { display: none; }
.link-fallback {
  margin: 10px 0 0; padding: 12px 14px; border-radius: 14px; background: var(--paper);
  font-size: 13px; color: var(--text-2); word-break: break-all; user-select: all; -webkit-user-select: all;
}

/* MARK: Review card */

.card {
  margin-top: 22px; overflow: hidden;
  border-radius: var(--radius-card); background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.9); box-shadow: var(--shadow-card);
}
.card.tilted { margin-top: 30px; transform: rotate(-1.5deg); padding-bottom: 18px; }
.card-head { display: flex; align-items: center; gap: 14px; padding: 20px 18px 16px; }
.card-names { flex: 1; min-width: 0; }
.card-name {
  margin: 0; font-family: var(--serif); font-size: 26px; font-weight: 500; line-height: 1.1;
  overflow-wrap: anywhere;
}
.card-meta { margin: 3px 0 0; font-size: 14px; color: var(--muted); }

.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; gap: 14px; align-items: flex-start; padding: 14px 18px; border-top: 1px solid rgba(199, 189, 166, 0.35); }
.row:last-child { padding-bottom: 18px; }
.row .icon-circle { width: 42px; height: 42px; }
.row-label { margin: 0; font-size: 13px; color: var(--muted); }
.row-value { margin: 2px 0 0; font-size: 16px; line-height: 1.4; font-weight: 500; white-space: pre-line; overflow-wrap: anywhere; }

.chips { list-style: none; margin: 0; padding: 0 18px; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.chip.gold { background: var(--gold-soft); color: var(--gold-ink); }
.chip.green { background: var(--mint-soft); color: #1F4A36; }
.chip.neutral { background: var(--neutral-soft); color: var(--text-3); }
.chip.red { background: var(--red-soft); color: var(--red-ink); }

.tip { margin: 0; padding: 14px 16px; border-radius: 18px; background: rgba(254, 252, 247, 0.7); font-size: 13px; line-height: 1.5; color: var(--text-2); }

/* MARK: Sent */

.check-badge {
  margin-top: 26px; width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--green); color: var(--paper);
  box-shadow: 0 0 0 10px rgba(41, 97, 71, 0.10);
  animation: pop 420ms cubic-bezier(0.2, 1.4, 0.4, 1) both 80ms;
}
.check-badge .icon { width: 30px; height: 30px; stroke-width: 2.4; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }

.divider { margin-top: 30px; display: flex; align-items: center; gap: 12px; }
.divider i { flex: 1; height: 1px; background: rgba(199, 189, 166, 0.6); }
.divider .sprig { width: 18px; height: 18px; }

.notif { position: relative; margin-top: 22px; padding-bottom: 14px; }
.notif-back {
  position: absolute; left: 14px; right: 14px; bottom: 0; height: 60px;
  border-radius: 22px; background: rgba(254, 252, 247, 0.55);
}
.notif-card {
  position: relative; display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: 22px;
  background: rgba(254, 252, 247, 0.95); border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 30px rgba(14, 41, 35, 0.10);
}
.notif-icon {
  flex: none; width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: #F2EEE3; border: 1px solid var(--line);
}
.notif-icon .sprig { width: 24px; height: 24px; color: #7F9A84; }
.notif-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.notif-top b { font-weight: 600; letter-spacing: 0.4px; }
.notif-title { font-size: 15px; font-weight: 600; }
.notif-body { font-size: 14px; line-height: 1.4; color: var(--text-3); }

.offer {
  margin-top: 22px; padding: 14px 16px; border-radius: 18px;
  display: flex; gap: 12px; align-items: center; background: #F6EBD8;
}
.offer .icon-circle { width: 36px; height: 36px; background: var(--gold); color: var(--paper); }
.offer .icon-circle .icon { width: 18px; height: 18px; }
.offer p { margin: 0; font-size: 15px; line-height: 1.4; font-weight: 600; color: #4A3412; }

.noscript { max-width: 420px; margin: 40px auto; padding: 0 20px; font-size: 16px; color: var(--text-2); }

/* MARK: Simple pages (index, 404) */

.simple { justify-content: center; text-align: left; }
.simple .display { margin-top: 18px; }
.app-icon { width: 72px; height: 72px; border-radius: 17px; box-shadow: 0 8px 20px rgba(14, 41, 35, 0.12); }

@media (min-width: 600px) {
  .page { padding-top: 40px; }
  .page-form { padding-top: 0; }
  .formbar { padding-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
