/* Matches melissagardner.co.za: cream paper, forest green, honey accents, Fraunces + Mulish. */

@font-face { font-family: "Fraunces"; font-style: normal; font-weight: 400 600; font-display: swap; src: url(fonts/fraunces-normal.woff2) format("woff2"); }
@font-face { font-family: "Fraunces"; font-style: italic; font-weight: 400; font-display: swap; src: url(fonts/fraunces-italic.woff2) format("woff2"); }
@font-face { font-family: "Mulish"; font-style: normal; font-weight: 400 700; font-display: swap; src: url(fonts/mulish-normal.woff2) format("woff2"); }

:root {
  --cream: #F7F1E5;
  --cream-2: #F0E8D6;
  --paper: #FCF9F2;
  --forest: #33503F;
  --forest-deep: #26402F;
  --sage: #7E9A74;
  --sage-soft: #B8C8A6;
  --honey: #E0A33E;
  --honey-deep: #C9852A;
  --ink: #222B24;
  --muted: #5C6A5C;
  --line: rgba(51, 80, 63, .14);
  --line-strong: rgba(51, 80, 63, .24);

  --danger: #A8473B;
  --danger-soft: #F6E4DE;
  --warn: #9A6716;
  --warn-soft: #FBF0D9;
  --ok: #3F6B4C;
  --ok-soft: #E4EDDD;
  --info-soft: #EAF0E4;

  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 18px 50px -22px rgba(38, 64, 47, .45);
  --shadow-soft: 0 10px 30px -18px rgba(38, 64, 47, .35);
  --serif: "Fraunces", Georgia, serif;
  --sans: "Mulish", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--cream);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
main { max-width: 820px; margin: 0 auto; padding: 8px 20px 24px; }

/* ---- type ---- */
h1, h2, h3 { font-family: var(--serif); font-weight: 500; color: var(--forest-deep); letter-spacing: -0.01em; }
h1 { font-size: 2rem; line-height: 1.15; margin: 10px 0 6px; }
h2 { font-size: 1.3rem; margin: 32px 0 12px; }
h3 { font-size: 1.1rem; margin: 18px 0 8px; }
p { margin: 6px 0; }
a { color: var(--forest); }
em { font-family: var(--serif); font-style: italic; }
.eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--honey-deep); margin: 18px 0 2px; }
.muted { color: var(--muted); font-size: .94rem; }
.small { font-size: .85rem; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; }
.stack > * + * { margin-top: 12px; }
.hidden { display: none !important; }

/* ---- header ---- */
.topbar {
  position: sticky; top: 0; z-index: 15;
  background: rgba(247, 241, 229, .88); backdrop-filter: saturate(1.2) blur(10px); -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 820px; margin: 0 auto; padding: calc(10px + env(safe-area-inset-top)) 20px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar img { height: 34px; width: auto; display: block; }
.topbar .who { font-size: .82rem; color: var(--muted); }

/* ---- cards & lists ---- */
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-soft);
}
.card + .card { margin-top: 14px; }
.card > h3:first-child { margin-top: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list a.item { display: flex; gap: 12px; align-items: center; padding: 14px 2px; color: inherit; text-decoration: none; }
.list a.item:hover .title { color: var(--forest); }
.item .title { font-weight: 600; color: var(--ink); }

/* ---- buttons ---- */
button, .btn {
  font: 600 .95rem var(--sans); border: 1.5px solid var(--sage); background: transparent; color: var(--forest-deep);
  border-radius: 999px; padding: 10px 20px; min-height: 46px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: background .15s, box-shadow .15s, transform .05s;
}
button:hover, .btn:hover { background: rgba(126, 154, 116, .1); }
button:active, .btn:active { transform: translateY(1px); }
button.primary, .btn.primary { background: var(--forest); border-color: var(--forest); color: #fff; box-shadow: var(--shadow-soft); }
button.primary:hover, .btn.primary:hover { background: var(--forest-deep); }
.btn.honey { background: var(--honey); border-color: var(--honey); color: var(--forest-deep); }
.btn.honey:hover { background: #D99A31; }
button.danger { color: var(--danger); border-color: rgba(168, 71, 59, .5); }
button.danger:hover { background: var(--danger-soft); }
.block { width: 100%; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* ---- forms ---- */
label { display: block; font-size: .8rem; font-weight: 700; color: var(--muted); margin: 14px 0 6px; letter-spacing: .02em; }
input, select, textarea {
  width: 100%; font: 1rem var(--sans); color: var(--ink); background: #fff;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 11px 14px; min-height: 46px;
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 150px; resize: vertical; line-height: 1.6; }
textarea.tall { min-height: 340px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 4px rgba(126, 154, 116, .2); }
input::placeholder, textarea::placeholder { color: #9AA39A; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 500; color: var(--ink); font-size: .98rem; letter-spacing: 0; }
.check input { width: 20px; min-height: 20px; height: 20px; accent-color: var(--forest); }

/* ---- status chips & notices ---- */
.chip { display: inline-block; font-size: .74rem; font-weight: 700; padding: 3px 12px; border-radius: 999px; background: var(--cream-2); color: var(--muted); white-space: nowrap; }
.chip.busy { background: var(--info-soft); color: var(--forest); }
.chip.action { background: #FBEBCB; color: #8A5A12; }
.chip.done { background: var(--ok-soft); color: var(--ok); }
.chip.error { background: var(--danger-soft); color: var(--danger); }

.notice { border-radius: var(--radius-sm); padding: 12px 16px; font-size: .93rem; margin: 10px 0; border: 1px solid transparent; }
.notice.error { background: var(--danger-soft); color: var(--danger); border-color: rgba(168, 71, 59, .2); }
.notice.warn { background: var(--warn-soft); color: var(--warn); border-color: rgba(201, 133, 42, .25); }
.notice.info { background: var(--info-soft); color: var(--forest); border-color: var(--line); }
.notice.ok { background: var(--ok-soft); color: var(--ok); border-color: var(--line); }
.notice ul { margin: 6px 0 0; padding-left: 18px; }

/* ---- bottom navigation ---- */
nav.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  background: rgba(252, 249, 242, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  display: flex; justify-content: center; gap: 4px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}
nav.tabs a { flex: 0 1 140px; text-align: center; color: var(--muted); text-decoration: none; font-size: .74rem; font-weight: 600; padding: 4px; border-radius: 12px; }
nav.tabs a.active { color: var(--forest-deep); }
nav.tabs a.active svg { color: var(--honey-deep); }
nav.tabs svg { display: block; margin: 0 auto 2px; width: 24px; height: 24px; }

/* ---- home ---- */
.hero-cta {
  display: flex; align-items: center; gap: 16px; text-decoration: none; color: inherit;
  background: var(--forest); color: #fff; border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow);
}
.hero-cta:hover { background: var(--forest-deep); }
.hero-cta .dot { width: 52px; height: 52px; border-radius: 50%; background: var(--honey); display: grid; place-items: center; flex: none; }
.hero-cta .dot svg { width: 24px; height: 24px; color: var(--forest-deep); }
.hero-cta strong { font-family: var(--serif); font-weight: 500; font-size: 1.3rem; display: block; }
.hero-cta span { opacity: .8; font-size: .9rem; }

/* ---- recorder ---- */
.big-record { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 28px 0 12px; }
.rec-btn {
  width: 132px; height: 132px; border-radius: 50%; border: 0; padding: 0;
  background: radial-gradient(circle at 35% 30%, #EBB65A, var(--honey) 55%, var(--honey-deep));
  color: var(--forest-deep); font: 600 1rem var(--sans); box-shadow: 0 0 0 10px rgba(224, 163, 62, .16), var(--shadow);
}
.rec-btn:hover { background: radial-gradient(circle at 35% 30%, #EBB65A, var(--honey) 55%, var(--honey-deep)); }
.rec-btn.recording { animation: breathe 2.4s ease-in-out infinite; }
.rec-btn.paused { background: var(--sage-soft); box-shadow: 0 0 0 10px rgba(126, 154, 116, .15), var(--shadow); }
@keyframes breathe { 0%, 100% { box-shadow: 0 0 0 10px rgba(224, 163, 62, .16), var(--shadow); } 50% { box-shadow: 0 0 0 22px rgba(224, 163, 62, .1), var(--shadow); } }
.timer { font-family: var(--serif); font-size: 2.4rem; font-variant-numeric: tabular-nums; color: var(--forest-deep); }

/* ---- steps ---- */
.steps { display: flex; gap: 6px; margin: 14px 0 6px; }
.steps span { flex: 1; height: 5px; border-radius: 4px; background: var(--cream-2); }
.steps span.on { background: var(--sage); }
.steplabels { display: flex; justify-content: space-between; font-size: .72rem; font-weight: 600; color: var(--muted); margin-bottom: 18px; }

.spinner { width: 30px; height: 30px; border: 3px solid var(--cream-2); border-top-color: var(--honey); border-radius: 50%; animation: spin 1s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- note view ---- */
.note-view h3 { margin-top: 22px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.note-view .body { white-space: pre-wrap; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; font-size: .95rem; margin: 0; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .76rem; word-break: break-all; }
details summary { cursor: pointer; font-weight: 700; color: var(--forest-deep); padding: 4px 0; }
details.card summary { font-family: var(--serif); font-weight: 500; font-size: 1.05rem; }

.genogram svg { width: 100%; height: auto; display: block; }
.genogram text { fill: var(--ink); font: 12px var(--sans); }
.genogram .shape { fill: #fff; stroke: var(--forest); stroke-width: 1.6; }
.genogram .client { fill: #FBEBCB; stroke: var(--honey-deep); stroke-width: 2.4; }
.genogram line { stroke: var(--sage); stroke-width: 1.4; }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom)); max-width: 520px; margin: 0 auto; z-index: 20;
  background: var(--forest-deep); color: #fff; padding: 12px 18px; border-radius: var(--radius-sm); box-shadow: var(--shadow);
}

/* ---- login ---- */
.login { max-width: 400px; margin: 9vh auto 0; text-align: center; }
.login img { width: 190px; height: auto; margin: 0 auto 10px; display: block; }
.login .card { text-align: left; margin-top: 20px; }

.sticky-actions {
  position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 5;
  background: linear-gradient(to bottom, rgba(247, 241, 229, 0), var(--cream) 30%);
  padding: 18px 0 8px; display: flex; gap: 10px; flex-wrap: wrap;
}

@media (max-width: 440px) {
  main { padding: 6px 16px 20px; }
  h1 { font-size: 1.7rem; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .kv { grid-template-columns: 112px 1fr; }
  .card { padding: 16px; }
}

@media (max-width: 440px) {
  .sticky-actions { flex-wrap: nowrap; }
  .sticky-actions button { padding: 10px 14px; font-size: .9rem; }
}
