/*
VOICE: warm, unhurried, built for grandparents: large type, one thing per screen.
IDEA: a family album; each memory is a mounted print with its story written beneath.
PICTURE: the photo itself, or a large round record button while speaking.
COLOUR and TYPE: evergreen band, warm white paper, a red record dot, marigold highlight. Newsreader titles + Atkinson Hyperlegible body.
LAYOUT: single calm column up to 980px, big tap targets, stacked on phones.
*/
:root {
  color-scheme: light dark;
  --bg: light-dark(#fbfaf7, #131816);
  --paper: light-dark(#ffffff, #1b2220);
  --ink: light-dark(#1d2220, #eef0ec);
  --soft: light-dark(#5b6460, #a9b3ae);
  --line: light-dark(#e3e1da, #2c3532);
  --green: #1f4a40;
  --green-ink: #f3f7f2;
  --gold: #e3a92b;
  --red: #c63d2f;
  --focus: #2d6cdf;
  --radius: 14px;
}
* { box-sizing: border-box; min-width: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 19px/1.55 "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow-x: clip;
}
h1, h2, h3 { font-family: "Newsreader", Georgia, serif; font-weight: 600; line-height: 1.1; text-wrap: balance; margin: 0 0 .4em; }
h1 { font-size: clamp(34px, 6vw, 50px); }
h2 { font-size: clamp(26px, 4vw, 34px); }
h3 { font-size: 24px; }
p { margin: 0 0 1em; }
a { color: inherit; }
.lead { font-size: 22px; color: var(--soft); max-width: 36em; }
.muted { color: var(--soft); }
.small { font-size: 16px; }
.hidden { display: none !important; }

/* top bar */
.top {
  background: var(--green); color: var(--green-ink);
  padding: 10px max(4vw, 14px); padding-top: max(10px, env(safe-area-inset-top));
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.brand { font-family: "Newsreader", Georgia, serif; font-size: 26px; font-weight: 600; text-decoration: none; margin-right: auto; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav a { text-decoration: none; padding: 10px 14px; border-radius: 999px; font-size: 17px; min-height: 44px; display: inline-flex; align-items: center; }
.nav a[aria-current="page"] { background: rgba(255,255,255,.16); }

main { max-width: 980px; margin: 0 auto; padding: clamp(22px, 4vw, 48px) max(4vw, 16px) 80px; }
.band.narrow { max-width: 640px; margin: 10vh auto; padding: 0 20px; }

/* buttons */
button, .btn {
  font: inherit; font-size: 19px; border: 2px solid var(--green); background: var(--paper); color: var(--ink);
  border-radius: 999px; padding: 10px 22px; min-height: 52px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none;
}
button.primary, .btn.primary { background: var(--green); color: var(--green-ink); }
button.danger { border-color: var(--red); color: var(--red); }
button.link { border: 0; background: none; padding: 6px 4px; min-height: 44px; text-decoration: underline; color: var(--soft); font-size: 17px; }
button:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* welcome choices */
.choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 28px 0; }
.choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px; text-align: left;
  background: var(--paper); border: 2px solid var(--line); border-radius: 20px; padding: 24px;
  min-height: 210px; cursor: pointer; font: inherit; color: inherit; border-radius: 20px;
}
.choice:hover { border-color: var(--green); }
.choice svg { width: 56px; height: 56px; flex: none; }
.choice strong { font-family: "Newsreader", Georgia, serif; font-size: 28px; line-height: 1.1; }
.choice span { color: var(--soft); font-size: 17px; }

/* forms */
label.field { display: block; margin: 18px 0; font-weight: 700; }
label.field span { display: block; font-weight: 400; color: var(--soft); font-size: 16px; }
input[type=text], textarea {
  font: inherit; font-size: 19px; width: 100%; padding: 12px 14px; margin-top: 6px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink);
}
textarea { min-height: 220px; line-height: 1.6; resize: vertical; }
input:focus, textarea:focus { border-color: var(--green); outline: none; }

.drop {
  display: grid; place-items: center; text-align: center; gap: 8px;
  border: 3px dashed var(--line); border-radius: 20px; padding: 44px 20px; background: var(--paper); cursor: pointer;
}
.drop.over { border-color: var(--green); }
.drop strong { font-size: 24px; }
.preview { max-height: 60vh; width: 100%; object-fit: contain; border-radius: 12px; background: #0001; }
.progress { height: 12px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 16px 0; }
.progress i { display: block; height: 100%; width: 0; background: var(--green); transition: width .2s; }

/* recorder */
.recorder { text-align: center; padding: 10px 0; }
.recbtn {
  width: 168px; height: 168px; border-radius: 50%; border: 0; background: var(--red); color: #fff;
  font-size: 22px; font-weight: 700; margin: 18px auto; box-shadow: 0 10px 30px #c63d2f55; flex-direction: column; gap: 4px;
}
.recbtn.on { background: var(--green); box-shadow: 0 0 0 var(--ring, 0px) #c63d2f33, 0 10px 30px #0003; }
.recbtn svg { width: 48px; height: 48px; }
.timer { font-size: 44px; font-variant-numeric: tabular-nums; font-family: "Newsreader", Georgia, serif; }
.live {
  text-align: left; background: var(--paper); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; min-height: 120px; margin-top: 18px; white-space: pre-wrap;
}
.live em { color: var(--soft); font-style: normal; }

/* library */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 22px; }
.tabs button { min-height: 46px; padding: 8px 18px; font-size: 17px; border-color: var(--line); }
.tabs button[aria-pressed="true"] { background: var(--green); color: var(--green-ink); border-color: var(--green); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; display: flex; flex-direction: column; }
.card img, .card .ph { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: #0001; }
.card .ph { display: grid; place-items: center; color: var(--soft); }
.card .ph svg { width: 54px; height: 54px; }
.card div { padding: 12px 14px 16px; }
.card b { display: block; font-size: 19px; line-height: 1.3; }
.card small { color: var(--soft); font-size: 15px; }
.list { display: grid; gap: 12px; }
.item { display: flex; gap: 16px; align-items: center; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; flex-wrap: wrap; }
.item img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; flex: none; }
.item .t { flex: 1 1 220px; }
.item audio { flex: 1 1 260px; }
.empty { padding: 40px 20px; text-align: center; border: 2px dashed var(--line); border-radius: 20px; color: var(--soft); }

/* memory page */
.print { background: var(--paper); padding: 14px; border-radius: 6px; box-shadow: 0 12px 32px #0002; margin: 0 0 28px; }
.print img, .print video { width: 100%; max-height: 72vh; object-fit: contain; display: block; background: #000; border-radius: 2px; }
.titlebar { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.titlebar h1 { flex: 1 1 300px; margin: 0; }
.byline { color: var(--soft); margin: 8px 0 26px; }
.part { border-top: 1px solid var(--line); padding: 26px 0; }
.part header { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.part h2 { flex: 1 1 240px; margin: 0; font-size: 28px; }
.part .meta { color: var(--soft); font-size: 16px; margin: 4px 0 12px; }
.part audio { width: 100%; margin: 6px 0 14px; }
.words { white-space: pre-wrap; font-size: 20px; line-height: 1.7; max-width: 40em; }
.note { background: light-dark(#fff6df, #2d2717); border-radius: 10px; padding: 10px 14px; font-size: 17px; margin: 8px 0; }
.addmore { background: var(--paper); border: 2px solid var(--line); border-radius: 20px; padding: 22px; margin-top: 20px; }
.addmore h3 { margin-bottom: .6em; }
.tools { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 30px; border-top: 1px solid var(--line); padding-top: 18px; }

/* people */
.person { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px solid var(--line); }
.person b { flex: 1 1 200px; }
.linkbox { word-break: break-all; background: var(--paper); border: 2px solid var(--gold); border-radius: 12px; padding: 14px; margin: 12px 0; font-size: 16px; }

/* dialogs & toast */
dialog { border: 0; border-radius: 20px; padding: 26px; max-width: min(560px, 92vw); background: var(--paper); color: var(--ink); }
dialog::backdrop { background: #0008; }
dialog.sheet { width: min(760px, 96vw); max-width: 96vw; max-height: 94vh; }
.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 14px 22px; border-radius: 999px; font-size: 18px; z-index: 99; max-width: 92vw; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } .progress i { transition: none; } }

@media (max-width: 700px) {
  .choices { grid-template-columns: minmax(0, 1fr); }
  .choice { min-height: 0; flex-direction: row; align-items: center; padding: 18px; }
  .choice strong { font-size: 24px; }
  .recbtn { width: 140px; height: 140px; }
  .brand { font-size: 22px; }
  .nav a { padding: 8px 10px; font-size: 16px; }
}
