/* style.css - the Cancer Passport pages. Mobile first (390 px), up to a 680 px column on a
   desktop. System fonts only; nothing is loaded from another origin (CSP: style-src 'self'). */

:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --ink: #1c2626;
  --muted: #586866;
  --line: #e3ddd2;
  --brand: #0f6b5c;
  --brand-deep: #0a4d42;
  --brand-ink: #ffffff;
  --accent: #c8643b;
  --accent-soft: #f6e3d8;
  --warn: #9a3412;
  --focus: #1d4ed8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(28, 38, 38, 0.06), 0 6px 18px rgba(28, 38, 38, 0.06);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1615;
    --surface: #152120;
    --surface-2: #1a2928;
    --ink: #e7efed;
    --muted: #a3b4b1;
    --line: #27403c;
    --brand: #3fb39c;
    --brand-deep: #2a8c79;
    --brand-ink: #04211c;
    --accent: #e7a17a;
    --accent-soft: #3a2a21;
    --warn: #fdba74;
    --focus: #93c5fd;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0e1615;
  --surface: #152120;
  --surface-2: #1a2928;
  --ink: #e7efed;
  --muted: #a3b4b1;
  --line: #27403c;
  --brand: #3fb39c;
  --brand-deep: #2a8c79;
  --brand-ink: #04211c;
  --accent: #e7a17a;
  --accent-soft: #3a2a21;
  --warn: #fdba74;
  --focus: #93c5fd;
  --shadow: none;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  overflow-wrap: anywhere;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 680px;
  margin: 0 auto;
  padding: 14px 16px 6px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
}

.mark {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: radial-gradient(circle at 62% 50%, var(--accent) 0 22%, transparent 23%), var(--brand);
  flex: none;
}

.lang {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit;
  font-size: 14px;
  min-height: 36px;
  cursor: pointer;
}

main {
  max-width: 680px;
  margin: 0 auto;
  padding: 8px 16px 40px;
  display: grid;
  gap: 14px;
}

h1, h2 { line-height: 1.25; margin: 0; }
h1 { font-size: 24px; letter-spacing: -0.01em; }
h2 { font-size: 18px; display: flex; align-items: center; gap: 8px; }
h1:focus, h2:focus { outline: none; }
p { margin: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.lead { font-size: 17px; color: var(--muted); }
.hint { font-size: 14px; color: var(--muted); }
.msg { color: var(--warn); font-weight: 600; min-height: 0; }
.msg:empty { display: none; }
.loading { color: var(--muted); padding: 24px 0; text-align: center; }
.empty { color: var(--muted); }
.meta { font-size: 14px; color: var(--muted); }

/* The passport itself: the card a family sees first. */
.passport-card {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  padding: 22px 18px 18px;
  background: linear-gradient(140deg, var(--brand) 0%, var(--brand-deep) 100%);
  color: var(--brand-ink);
  display: grid;
  gap: 14px;
}

.passport-card::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 18px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.passport-card .eyebrow { color: var(--brand-ink); opacity: 0.85; }
.passport-card h1 { font-size: 26px; max-width: 26ch; }

.facts {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px 16px;
}

.fact dt { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.8; }
.fact dd { margin: 2px 0 0; font-size: 17px; font-weight: 600; }

.diagnosis {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 10px 12px;
  display: grid;
  gap: 2px;
}

.diagnosis .label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.85; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 12px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: var(--brand-ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
}

.btn.ghost { background: transparent; color: var(--brand); }
.btn.small { min-height: 40px; padding: 0 14px; font-size: 15px; width: auto; }
.btn:disabled { opacity: 0.6; cursor: progress; }

.link, .text-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--brand);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link:disabled { color: var(--muted); text-decoration: none; cursor: default; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.code-form { display: grid; gap: 10px; }
.code-form label { font-weight: 600; }

.code {
  font: inherit;
  font-size: 28px;
  letter-spacing: 0.3em;
  text-align: center;
  padding: 10px 12px;
  min-height: 56px;
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink);
}

.code:focus { border-color: var(--brand); outline: none; }

.wa-first {
  display: grid;
  gap: 10px;
  background: var(--accent-soft);
  border-radius: 12px;
  padding: 14px;
}

.wa-first h2 { font-size: 17px; }

.count {
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 9px;
  color: var(--muted);
}

.items { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }

.item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 10px;
  background: var(--surface-2);
}

.item-main { display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.item-text { min-width: 0; }
.item-name { font-weight: 600; }
.item-msg { font-size: 14px; color: var(--warn); }
.item-msg:empty { display: none; }

.kind {
  flex: none;
  min-width: 46px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border-radius: 8px;
  padding: 6px 6px;
  background: var(--accent-soft);
  color: var(--accent);
}

.kind.photo { background: var(--surface); color: var(--brand); border: 1px solid var(--line); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.foot { display: grid; gap: 8px; padding: 4px 2px; text-align: center; }

.notice h1 { font-size: 22px; }

/* Upload page */
.drop {
  border: 2px dashed var(--line);
  border-radius: 14px;
  padding: 22px 16px;
  text-align: center;
  display: grid;
  gap: 10px;
  background: var(--surface-2);
  position: relative;
}

.drop.over { border-color: var(--brand); }
.drop input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.files { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.file-row { display: flex; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.file-row .name { min-width: 0; font-weight: 600; }
.file-row .state { flex: none; font-size: 14px; color: var(--muted); }
.file-row .state.ok { color: var(--brand); font-weight: 600; }
.file-row .state.bad { color: var(--warn); font-weight: 600; }

@media (min-width: 720px) {
  main { padding-top: 16px; gap: 16px; }
  .card { padding: 22px 24px; }
  .passport-card { padding: 28px 28px 24px; }
  .passport-card h1 { font-size: 30px; }
  .btn { width: auto; }
  .card > .btn { justify-self: start; }
  .login .btn, .code-form .btn { width: 100%; }
  .item { grid-template-columns: 1fr auto; align-items: center; }
  .item-msg { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
