/* Karma visual identity (ADR 0005): Rosé aften, the ripple sign, a living background, glass, motion.
   Every colour is a token; dark mode only redefines tokens. */
@font-face { font-family: "Fraunces"; src: url("/static/fonts/fraunces.woff2") format("woff2"); font-weight: 300 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/static/fonts/inter.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }

:root {
  --bg: #FBEDEA;            /* blush */
  --surface: #FFF8F6;
  --surface-2: #F7E4E0;
  --ink: #241622;           /* dyb blomme */
  --ink-2: #4A3343;
  --muted: #6E5463;
  --line: rgba(36, 22, 34, .11);
  --accent: #B5506A;        /* rosé: buttons, focus */
  --on-accent: #FFFFFF;     /* 5:1 on rosé */
  --accent-text: #963F57;   /* rosé for small text, AA on blush */
  --accent-soft: #F6D9DE;
  --accent-line: #EDB9C5;
  --peach: #F6B49A;
  --green: #2E7D50; --green-soft: #E3F2E8;
  --amber: #9A5A0E; --amber-soft: #FBEBD3;
  --red: #B42335; --red-soft: #FBE0E2;
  --ring-a: #B5506A; --ring-b: #E89878; --ring-lens: #E8A0B4;  /* the two sources of the sign: rosé and peach */
  --glass: rgba(255, 248, 246, .66); --glass-line: rgba(255, 255, 255, .75);
  --radius: 20px;
  --shadow: 0 1px 2px rgba(36, 22, 34, .05), 0 14px 32px -18px rgba(36, 22, 34, .28);
  --serif: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  color-scheme: light;
}
/* Karma is dark: the dark red of the "Kredsløbet" preview (ADR 0005). These tokens apply everywhere. */
:root {
  --bg: #1E0E19; --surface: #2A1424; --surface-2: #35192D;
  --ink: #F7E6EA; --ink-2: #E2C9D2; --muted: #C9AAB8; --line: rgba(247, 230, 234, .13);
  --accent: #E8A0B4; --on-accent: #241622; --accent-text: #F0B3C4; --accent-soft: #45213A; --accent-line: #6B3550;
  --green: #8FD4A9; --green-soft: #1E3326; --amber: #F2C27F; --amber-soft: #3A2A14; --red: #F59AA6; --red-soft: #45202A;
  --ring-a: #E8A0B4; --ring-b: #F6B49A; --ring-lens: #B5506A;
  --glass: rgba(42, 20, 36, .6); --glass-line: rgba(255, 255, 255, .10);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 36px -18px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans); color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; font-size: 16px; line-height: 1.5;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* the living background: a canvas drawn by static/karma.js (colour fields, motes, a faint ripple) */
.living-bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; display: block; }

.app { max-width: 560px; margin: 0 auto; min-height: 100%; position: relative; z-index: 1; }
.view { padding: 20px 18px calc(110px + env(safe-area-inset-bottom)); min-height: 100vh; animation: view-in .35s var(--ease); }
.view.no-tabs { padding-bottom: 32px; }
.view.with-demo { padding-top: 48px; }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* typography */
h1, h2, h3 { font-family: var(--serif); font-weight: 450; text-wrap: balance; }
h1 { font-size: 1.95rem; line-height: 1.12; margin: 0 0 6px; letter-spacing: -.015em; font-variation-settings: "opsz" 72; }
h2 { font-size: 1.3rem; margin: 28px 0 10px; letter-spacing: -.01em; }
h2:first-child { margin-top: 0; }
h3 { font-size: 1.08rem; margin: 0 0 4px; font-weight: 500; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.sign { display: block; }
.sign-header { width: 52px; height: 52px; }
.sign-hero { width: calc(100% + 36px); height: 230px; margin: 0 -18px; }
.tagline { font-family: var(--serif); font-style: italic; font-weight: 350; color: var(--muted); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 12px 22px; font-weight: 600; cursor: pointer;
  background: var(--accent); color: var(--on-accent); min-height: 46px;
  transition: transform .12s var(--ease), box-shadow .2s ease, background .2s ease;
  box-shadow: 0 8px 20px -12px var(--accent);
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1.5px solid var(--line); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--accent-text); padding: 8px 12px; min-height: 0; box-shadow: none; }
.btn.danger { background: var(--surface); color: var(--red); border: 1.5px solid var(--red-soft); box-shadow: none; }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 15px; min-height: 36px; font-size: .9rem; }
.btn.icon { width: 46px; padding: 0; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.spacer { flex: 1; }

/* cards */
.card { background: color-mix(in srgb, var(--surface) 80%, transparent); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
  border: 1px solid var(--glass-line); backdrop-filter: blur(14px) saturate(1.15); -webkit-backdrop-filter: blur(14px) saturate(1.15); }
.card + .card { margin-top: 12px; }
.card.tap { cursor: pointer; transition: transform .15s var(--ease); }
.card.tap:active { transform: scale(.99); }
.card.accent { background: var(--accent-soft); border-color: var(--accent-line); }
.card.success { background: var(--green-soft); border-color: transparent; }
.card.warn { background: var(--amber-soft); border-color: transparent; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 10px;
  font-size: .78rem; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.pill.rose { background: var(--accent-soft); color: var(--accent-text); }
.pill.green { background: var(--green-soft); color: var(--green); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.red { background: var(--red-soft); color: var(--red); }
.pill.ink { background: var(--ink); color: var(--bg); }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; color: #fff; flex: none; font-size: .95rem; letter-spacing: .02em;
}
.avatar.lg { width: 64px; height: 64px; font-size: 1.4rem; }
.avatar.sm { width: 28px; height: 28px; font-size: .72rem; }
.avatars { display: flex; }
.avatars .avatar { margin-left: -8px; border: 2px solid var(--surface); }
.avatars .avatar:first-child { margin-left: 0; }

.activity-icon {
  width: 46px; height: 46px; border-radius: 14px; background: var(--accent-soft); display: inline-flex;
  align-items: center; justify-content: center; font-size: 1.5rem; flex: none;
}
.suggestion .head { display: flex; gap: 12px; align-items: flex-start; }
.suggestion .title { font-weight: 600; font-size: 1.05rem; line-height: 1.25; }
.suggestion .meta { color: var(--muted); font-size: .875rem; margin-top: 2px; }
.suggestion .reason { margin: 12px 0; padding: 10px 12px; background: var(--surface-2); border-radius: 12px; font-size: .92rem; color: var(--ink-2); }
.suggestion .foot { display: flex; align-items: center; gap: 10px; }
.price { font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.price small { font-weight: 500; color: var(--muted); font-size: .8rem; }

/* home: the curated invitation, one at a time */
.invite {
  background: var(--glass); border: 1px solid var(--glass-line); border-radius: 28px; padding: 20px;
  backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 22px 48px -28px rgba(36, 22, 34, .45); display: flex; flex-direction: column; gap: 10px;
  animation: invite-in .6s var(--ease);
}
@keyframes invite-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.invite .who { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.invite h2 { margin: 4px 0 0; font-size: 1.6rem; line-height: 1.15; }
.invite .facts { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.invite blockquote { margin: 4px 0; font-family: var(--serif); font-style: italic; font-size: 1.08rem; line-height: 1.4; color: var(--ink); }
.invite .note { font-size: .82rem; color: var(--muted); }
.invite .summary { white-space: pre-line; font-size: .92rem; color: var(--ink-2); }
.minis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.mini {
  background: var(--glass); border: 1px solid var(--glass-line); border-radius: 18px; padding: 12px; min-width: 0;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); display: flex; flex-direction: column; gap: 6px; cursor: pointer;
  transition: transform .15s var(--ease);
}
.mini:active { transform: scale(.98); }
.mini b { font-weight: 600; font-size: .9rem; line-height: 1.25; }
.mini .tiny { color: var(--muted); }

.list-item { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: .85rem; font-weight: 600; color: var(--ink-2); }
input[type=text], input[type=number], textarea, select {
  width: 100%; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--surface); outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
input[type=range] { accent-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; cursor: pointer; font-size: .9rem; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* navigation: a floating glass pill over the living background */
.tabs {
  position: fixed; left: 16px; right: 16px; bottom: calc(14px + env(safe-area-inset-bottom)); margin: 0 auto; max-width: 420px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 7px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--glass-line);
  backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: 0 18px 40px -20px rgba(36, 22, 34, .5); z-index: 30;
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .7rem; color: var(--muted);
  font-weight: 600; padding: 6px 0; border-radius: 999px; transition: background .3s ease, color .3s ease;
}
.tabs .tab-icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--ink); background: var(--accent-soft); box-shadow: 0 0 18px -4px var(--ring-lens); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 14px; font-size: .9rem; z-index: 50;
  box-shadow: var(--shadow); max-width: 90vw; animation: view-in .25s var(--ease);
}
.toast.err { background: var(--red); color: #fff; }

/* header */
.topbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.topbar .back { width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }
.topbar h1 { font-size: 1.45rem; margin: 0; }

/* interview */
.chat { display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; }
.bubble { max-width: 86%; padding: 12px 15px; border-radius: 20px; line-height: 1.45; white-space: pre-wrap; animation: view-in .3s var(--ease); }
.bubble.ai { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; align-self: flex-start; box-shadow: var(--shadow); }
.bubble.me { background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 6px; align-self: flex-end; }
.bubble.typing { color: var(--muted); font-style: italic; }
.composer {
  position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); display: flex; gap: 8px; align-items: flex-end;
  padding: 8px; border-radius: 28px; background: var(--glass); border: 1px solid var(--glass-line);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.composer textarea { flex: 1; resize: none; min-height: 46px; max-height: 120px; border-radius: 22px; padding: 11px 16px; }
.mic { width: 46px; height: 46px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); font-size: 1.15rem; cursor: pointer; flex: none; }
.mic.rec { background: var(--red); color: #fff; border-color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(180, 35, 53, .45); } 100% { box-shadow: 0 0 0 12px rgba(180, 35, 53, 0); } }
.voice-toggle { font-size: .8rem; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }

/* progress dots */
.steps { display: flex; gap: 8px; margin: 14px 0 18px; }
.steps .step { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.steps .step.done { background: var(--accent); }
.steps .step.now { background: var(--accent-text); }

/* map */
#map { height: 60vh; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.leaflet-container { font: inherit; }

/* chat inside proposal */
.thread { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow: auto; padding: 4px 0; }
.thread .msg { display: flex; gap: 8px; align-items: flex-end; }
.thread .msg.me { flex-direction: row-reverse; }
.thread .msg .bubble { font-size: .95rem; padding: 9px 12px; }

.timeline { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0 4px; }
.timeline .t { text-align: center; font-size: .72rem; color: var(--muted); }
.timeline .t .dot { width: 100%; height: 6px; border-radius: 3px; background: var(--line); margin-bottom: 4px; }
.timeline .t.done .dot { background: var(--green); }
.timeline .t.now .dot { background: var(--accent); }

.voucher { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.35rem; letter-spacing: .08em; font-weight: 700; text-align: center; padding: 14px; background: var(--surface); border: 2px dashed var(--accent); border-radius: 14px; color: var(--accent-text); }

.demo-bar { position: fixed; top: 0; left: 0; right: 0; margin: 0 auto; max-width: 560px; z-index: 40; display: flex; justify-content: center; }
.demo-bar select { border-radius: 0 0 12px 12px; border: 0; padding: 7px 14px; font-size: .8rem; background: var(--ink); color: var(--bg); width: auto; max-width: 92vw; }

/* start */
.hero { padding: 36px 0 18px; display: flex; flex-direction: column; gap: 14px; }
.hero .tagline { font-size: 1.3rem; margin: 0; }
.hero h1 { font-size: 2.2rem; margin-top: 10px; }
.hero p { font-size: 1.05rem; color: var(--ink-2); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.stat b { display: block; font-size: 1.4rem; font-family: var(--serif); font-weight: 500; }
.rate { display: flex; gap: 6px; }
.rate button { width: 40px; height: 40px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); font-size: 1.2rem; cursor: pointer; }
.rate button.on { background: var(--accent-soft); border-color: var(--accent); }

.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.spin { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Maya's style picker (ADR 0004) */
.style-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.style-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; width: 100%;
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 16px; padding: 10px 14px; cursor: pointer;
  transition: border-color .2s ease, box-shadow .2s ease; }
.style-opt[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset, 0 0 22px -8px var(--ring-lens); }
.style-panel { margin: -4px 0 12px; }
.style-panel .style-opts { margin-top: 0; }

/* the mutual yes: two sources glide in, their waves meet, "karma" flares, a soft pling */
.yes-moment {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 24px; text-align: center; background: color-mix(in srgb, #140910 78%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); opacity: 0; transition: opacity .4s ease; color: #FFF1EA;
}
.yes-moment.show { opacity: 1; }
.yes-moment canvas { width: min(560px, 100%); height: 300px; display: block; }
.yes-moment h2, .yes-moment p, .yes-moment .btn { opacity: 0; transform: translateY(10px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.yes-moment.met h2 { opacity: 1; transform: none; }
.yes-moment.met p { opacity: 1; transform: none; transition-delay: .15s; }
.yes-moment.met .btn { opacity: 1; transform: none; transition-delay: .3s; }
.yes-moment h2 { margin: 0; font-size: 1.9rem; color: #FFF1EA; }
.yes-moment p { color: #E9C9D3; max-width: 32ch; }

/* motion across the app */
.view > * { animation: rise .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 55ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.invite { transform-style: preserve-3d; transition: transform .5s var(--ease), box-shadow .5s var(--ease); will-change: transform; }
.invite::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, .35), transparent 45%); opacity: .8; }
.invite { position: relative; }
.tabs { position: fixed; }
.tabs .tab-ind { position: absolute; top: 7px; bottom: 7px; left: 0; width: 0; border-radius: 999px; background: var(--accent-soft);
  box-shadow: 0 0 22px -6px var(--ring-lens); transition: transform .45s var(--ease), width .45s var(--ease); z-index: 0; }
.tabs a { position: relative; z-index: 1; }
.tabs a.on { background: transparent; box-shadow: none; }
.btn:not(.secondary):not(.ghost):not(.danger) { position: relative; overflow: hidden; }
.btn:not(.secondary):not(.ghost):not(.danger)::after { content: ""; position: absolute; inset: 0; transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%); transition: transform .8s var(--ease); }
.btn:not(.secondary):not(.ghost):not(.danger):hover::after, .btn:not(.secondary):not(.ghost):not(.danger):focus-visible::after { transform: translateX(120%); }
@media (hover: none) { .invite .btn::after { animation: sheen 4.5s ease-in-out 1.2s infinite; } }
@keyframes sheen { 0%, 70% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }

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