/* ============================================================================
   Porchlight — design system
   "Every story deserves a light left on."
   Warm, dignified, high-contrast, large-type. Built for elderly residents on
   older tablets AND for coordinators on a desktop dashboard. Plain CSS, served
   by Propshaft, linked from every layout.
   ========================================================================== */

:root {
  /* Palette — porch light at dusk: warm cream, honey glow, deep ink, sage */
  --cream:      #faf6ee;
  --cream-2:    #f3ecdd;
  --paper:      #ffffff;
  --ink:        #241f1a;
  --ink-soft:   #574e43;
  --ink-faint:  #8a7f70;
  --honey:      #e0922f;   /* primary accent — the light */
  --honey-deep: #b9701a;
  --honey-glow: #fbe6c4;
  --sage:       #5f7a5a;
  --sage-deep:  #46603f;
  --rose:       #b65c54;   /* gentle alert / love */
  --line:       #e6dcc9;
  --line-2:     #d8ccb4;
  --good:       #3f7d4f;
  --warn:       #b9701a;

  --shadow-sm: 0 1px 2px rgba(60,45,25,.06), 0 1px 3px rgba(60,45,25,.08);
  --shadow:    0 4px 14px rgba(60,45,25,.10), 0 2px 6px rgba(60,45,25,.06);
  --shadow-lg: 0 18px 50px rgba(60,45,25,.16);

  --radius:    14px;
  --radius-lg: 22px;
  --radius-sm: 9px;

  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-ui: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --maxw: 1140px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* Make the [hidden] attribute win over component display rules (.btn is inline-flex,
   audio preview is display:block) so JS-toggled elements stay hidden until shown. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--cream);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink); line-height: 1.15; margin: 0 0 .5em; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.3rem); }
h3 { font-size: 1.35rem; }
p  { margin: 0 0 1rem; }
a  { color: var(--honey-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }
small { color: var(--ink-faint); }

.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: 22px; }
.wrap-narrow { max-width: 720px; margin-inline: auto; padding-inline: 22px; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.center { text-align: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .78rem; font-weight: 700; color: var(--honey-deep); }
.stack > * + * { margin-top: 1rem; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  font-family: var(--font-ui); font-weight: 600; font-size: 1rem;
  padding: .72em 1.4em; border-radius: 999px; border: 1.5px solid transparent;
  cursor: pointer; transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
  text-decoration: none; line-height: 1;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--honey); color: #fff; box-shadow: 0 6px 18px rgba(224,146,47,.32); }
.btn-primary:hover { background: var(--honey-deep); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--cream-2); }
.btn-sage { background: var(--sage); color: #fff; }
.btn-sage:hover { background: var(--sage-deep); }
.btn-lg { font-size: 1.15rem; padding: .9em 1.8em; }
.btn-block { display: flex; width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

/* ---- Cards / panels ---- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px; }
.card-pad { padding: 26px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }

/* ---- Forms ---- */
label { display: block; font-weight: 600; margin-bottom: .35em; color: var(--ink-soft); font-size: .95rem; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; padding: .7em .85em; font-size: 1rem; font-family: var(--font-ui);
  border: 1.5px solid var(--line-2); border-radius: var(--radius-sm); background: var(--paper); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--honey); box-shadow: 0 0 0 3px var(--honey-glow); }
.field + .field { margin-top: 1.1rem; }
.check { display: flex; align-items: center; gap: .6em; font-weight: 500; }
.check input { width: auto; }

/* ---- Flash ---- */
.flash { padding: .85em 1.1em; border-radius: var(--radius-sm); margin-bottom: 1.2rem; font-weight: 500; border: 1px solid; }
.flash-notice { background: #eef6ee; border-color: #cfe4cf; color: #2f5b39; }
.flash-alert  { background: #fbeeea; border-color: #f0d2cb; color: #8f3b32; }

/* ---- Badges / pills ---- */
.pill { display: inline-flex; align-items: center; gap: .4em; padding: .25em .7em; border-radius: 999px; font-size: .78rem; font-weight: 700; background: var(--cream-2); color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; }
.pill-honey { background: var(--honey-glow); color: var(--honey-deep); }
.pill-sage  { background: #e3ecdf; color: var(--sage-deep); }
.pill-rose  { background: #f6e2df; color: var(--rose); }

/* ---- Marketing layout ---- */
.site-header { position: sticky; top: 0; z-index: 30; background: rgba(250,246,238,.86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 70px; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: .55em; font-family: var(--font-display); font-weight: 600; font-size: 1.4rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand .lamp { width: 26px; height: 26px; flex: 0 0 auto; }
.nav { display: flex; align-items: center; gap: 22px; }
.nav a { color: var(--ink-soft); font-weight: 500; }
.nav a:hover { color: var(--ink); text-decoration: none; }
.nav-cta { display: flex; align-items: center; gap: 12px; }

.site-footer { background: var(--ink); color: #d9cfbf; margin-top: 80px; padding: 56px 0 40px; }
.site-footer a { color: #f0e6d5; }
.site-footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 36px; }
.site-footer h4 { color: #fff; font-size: 1rem; margin-bottom: .8em; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: .5em; }

.hero { padding: 80px 0 60px; position: relative; overflow: hidden; }
.hero-glow { position: absolute; top: -160px; right: -120px; width: 520px; height: 520px; background: radial-gradient(circle, rgba(251,230,196,.9), rgba(250,246,238,0) 68%); pointer-events: none; z-index: 0; }
.hero .wrap { position: relative; z-index: 1; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 50px; align-items: center; }
.hero h1 { margin-bottom: .35em; }
.hero .lede { font-size: 1.28rem; color: var(--ink-soft); max-width: 34ch; }
.hero-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 30px; }

.section { padding: 64px 0; }
.section-tint { background: var(--cream-2); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 26px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 30px; }
.feature { text-align: left; }
.feature .ic { width: 46px; height: 46px; border-radius: 12px; background: var(--honey-glow); color: var(--honey-deep); display: grid; place-items: center; margin-bottom: 14px; font-size: 1.4rem; }

.price-card { text-align: center; padding: 40px 30px; }
.price-amt { font-family: var(--font-display); font-size: 3.4rem; color: var(--ink); line-height: 1; }
.price-amt span { font-size: 1.1rem; color: var(--ink-faint); font-family: var(--font-ui); }

.cta-band { background: linear-gradient(135deg, var(--honey), var(--honey-deep)); color: #fff; border-radius: var(--radius-lg); padding: 50px; text-align: center; }
.cta-band h2 { color: #fff; }
.cta-band .btn-primary { background: #fff; color: var(--honey-deep); }

/* prose for legal/marketing copy */
.prose { max-width: 70ch; }
.prose h2 { margin-top: 1.6em; }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: .4em; }

/* ============================================================================
   COORDINATOR DASHBOARD
   ========================================================================== */
.dash { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; background: var(--cream); }
.dash-side { background: var(--ink); color: #d9cfbf; padding: 24px 18px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.dash-side .brand { color: #fff; font-size: 1.25rem; margin-bottom: 28px; }
.dash-nav { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.dash-nav a { display: flex; align-items: center; gap: 10px; padding: .65em .8em; border-radius: 10px; color: #cdc0ab; font-weight: 500; }
.dash-nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.dash-nav a.is-active { background: var(--honey); color: #fff; }
.dash-side-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1); font-size: .85rem; }
.dash-side-foot a { color: #e8dcc8; }
.dash-main { padding: 34px 40px; min-width: 0; }
.dash-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 26px; flex-wrap: wrap; }
.dash-head h1 { font-size: 2rem; margin: 0; }

.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 26px; }
.stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.stat .n { font-family: var(--font-display); font-size: 2.1rem; line-height: 1; color: var(--ink); }
.stat .l { font-size: .82rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; margin-top: 6px; }

.dash-cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; align-items: start; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title h2 { font-size: 1.3rem; margin: 0; }

.story-feature { background: linear-gradient(135deg, #fff, var(--honey-glow)); border: 1px solid var(--line-2); border-radius: var(--radius-lg); padding: 28px; box-shadow: var(--shadow); }
.story-feature .pill { margin-bottom: 12px; }
.story-feature blockquote { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.35; color: var(--ink); margin: 0 0 14px; }

.list-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--sage); color: #fff; display: grid; place-items: center; font-weight: 700; flex: 0 0 auto; font-family: var(--font-display); }
.list-row .meta { min-width: 0; flex: 1; }
.list-row .meta .nm { font-weight: 600; }
.list-row .meta .sb { font-size: .87rem; color: var(--ink-faint); }

.data-table { width: 100%; border-collapse: collapse; background: var(--paper); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.data-table th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-faint); padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--cream); }
.data-table td { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: var(--cream); }

.progress-bar { height: 8px; background: var(--cream-2); border-radius: 999px; overflow: hidden; }
.progress-bar > i { display: block; height: 100%; background: var(--honey); border-radius: 999px; }

.highlight-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.highlight-card blockquote { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.4; margin: 10px 0 14px; color: var(--ink); }
.audio-player { width: 100%; margin-top: 8px; }

.empty { text-align: center; padding: 40px 20px; color: var(--ink-faint); }
.empty .ic { font-size: 2.4rem; margin-bottom: 8px; }

/* ============================================================================
   RESIDENT ONE-BUTTON APP  (huge type, max contrast, thumb-friendly)
   ========================================================================== */
.res { --res-fg:#2a2118; --res-bg:#fbf4e6; }
body.res-body { background: var(--res-bg); font-size: 20px; }
.res-shell { min-height: 100dvh; display: flex; flex-direction: column; max-width: 760px; margin-inline: auto; padding: 24px; }
.res-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.res-greeting { font-family: var(--font-display); font-size: 1.5rem; color: var(--res-fg); }
.res-progress { font-size: 1rem; color: var(--ink-faint); }
.res-main { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; gap: 28px; min-height: 0; padding: 16px 0; }
.res-question {
  font-family: var(--font-display); font-size: clamp(2rem, 6.5vw, 3.2rem); line-height: 1.22;
  color: var(--res-fg); text-align: center;
}
.res-chapter { text-align: center; font-size: 1.05rem; text-transform: uppercase; letter-spacing: .12em; color: var(--honey-deep); font-weight: 700; margin-bottom: 4px; }

/* the one big button */
.big-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  width: 100%; min-height: 168px; border-radius: 30px; border: none; cursor: pointer;
  font-family: var(--font-ui); font-size: 1.9rem; font-weight: 700; color: #fff;
  background: var(--honey); box-shadow: 0 12px 30px rgba(224,146,47,.4);
  transition: transform .1s ease, background .15s ease;
}
.big-btn:active { transform: scale(.98); }
.big-btn .big-ic { font-size: 3rem; line-height: 1; }
.big-btn.is-recording { background: var(--rose); box-shadow: 0 12px 30px rgba(182,92,84,.45); animation: pulse 1.4s ease-in-out infinite; }
.big-btn.is-busy { background: var(--ink-faint); }
@keyframes pulse { 0%,100% { box-shadow: 0 12px 30px rgba(182,92,84,.4); } 50% { box-shadow: 0 12px 46px rgba(182,92,84,.7); } }

.res-actions { display: flex; gap: 14px; }
.res-actions .btn { flex: 1; font-size: 1.15rem; padding: 1em; min-height: 64px; }
.btn-soft { background: #fff; border: 2px solid var(--line-2); color: var(--res-fg); border-radius: 18px; }
.res-foot { text-align: center; padding-top: 16px; }

.res-tile {
  display: flex; align-items: center; gap: 18px; width: 100%; text-align: left;
  background: #fff; border: 2px solid var(--line-2); border-radius: 24px; padding: 22px 24px;
  font-size: 1.5rem; font-weight: 600; color: var(--res-fg); cursor: pointer;
}
.res-tile .ic { font-size: 2.4rem; }
.res-tile .badge-n { margin-left: auto; background: var(--rose); color: #fff; border-radius: 999px; padding: .1em .6em; font-size: 1.2rem; }

.toggle-audio { display: inline-flex; align-items: center; gap: 8px; font-size: 1.05rem; color: var(--ink-soft); background: #fff; border: 2px solid var(--line-2); border-radius: 999px; padding: .5em 1em; cursor: pointer; font-weight: 600; }

.msg-card { background: #fff; border: 2px solid var(--line-2); border-radius: 22px; padding: 22px; margin-bottom: 16px; }
.msg-card .from { font-family: var(--font-display); font-size: 1.4rem; color: var(--res-fg); margin-bottom: 10px; }
.msg-card audio { width: 100%; }

/* ============================================================================
   FAMILY RELAY
   ========================================================================== */
.fam { background: var(--cream); }
.fam-header { background: var(--ink); color: #f3ead9; padding: 22px 0; }
.fam-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.fam-header .brand { color: #fff; }
.fam-hero { padding: 40px 0 10px; }
.fam-hero h1 { margin-bottom: .2em; }
.fam-recordings { padding: 24px 0 60px; }
.story-item { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.story-item .q { font-family: var(--font-display); font-size: 1.3rem; color: var(--ink); margin-bottom: 6px; }
.story-item .when { font-size: .85rem; color: var(--ink-faint); margin-bottom: 12px; }
.story-item .transcript { color: var(--ink-soft); border-left: 3px solid var(--honey-glow); padding-left: 14px; margin: 12px 0; }

.recorder-box { background: linear-gradient(135deg, #fff, var(--honey-glow)); border: 1px solid var(--line-2); border-radius: var(--radius-lg); padding: 28px; text-align: center; box-shadow: var(--shadow); }
.rec-btn { display: inline-flex; flex-direction: column; align-items: center; gap: 10px; background: var(--rose); color: #fff; border: none; border-radius: 24px; padding: 22px 40px; font-size: 1.25rem; font-weight: 700; cursor: pointer; box-shadow: 0 10px 26px rgba(182,92,84,.35); }
.rec-btn.is-recording { animation: pulse 1.4s ease-in-out infinite; }
.rec-btn .big-ic { font-size: 2.4rem; }

.lock-screen { min-height: 70vh; display: grid; place-items: center; }
.lock-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 40px; max-width: 420px; text-align: center; }
.lock-card .ic { font-size: 2.6rem; }

/* ---- Auth (login/signup) split screen ---- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-art { background: linear-gradient(160deg, var(--honey-deep), var(--ink)); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art h2 { color: #fff; font-size: 2rem; }
.auth-art .lede { color: rgba(255,255,255,.86); font-size: 1.15rem; max-width: 34ch; }
.auth-form { display: grid; place-items: center; padding: 40px; }
.auth-form .inner { width: 100%; max-width: 400px; }

/* ---- QR print card ---- */
.qr-card { width: 4in; margin: 0 auto; padding: .35in; border: 2px dashed #999; border-radius: 16px; text-align: center; }
.qr-card svg { width: 2.4in; height: 2.4in; }

/* ============================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
  .hero-grid, .grid-3, .grid-2, .dash-cols, .site-footer .cols, .auth { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .dash { grid-template-columns: 1fr; }
  .dash-side { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 12px; }
  .dash-nav { flex-direction: row; flex-wrap: wrap; }
  .dash-side-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .dash-side .brand { margin-bottom: 0; }
  .dash-main { padding: 24px 18px; }
  .auth-art { display: none; }
  .nav { display: none; }
}
@media (max-width: 520px) {
  .stat-row { grid-template-columns: 1fr 1fr; }
}

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
}

/* ===== Articles / Resources (merged from the standalone marketing site) ===== */
.read{ max-width: 720px; margin: 0 auto; padding: 0 24px; }
.article-head{ background: linear-gradient(160deg,#2b2620,#3a3228); color: var(--cream); padding: 70px 0 56px; }
.article-head .kicker{ color: var(--honey); text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; font-weight: 700; }
.article-head h1{ color: var(--cream); margin: .3em 0 0; font-family: var(--font-display); font-size: 2.3rem; line-height: 1.15; }
.article-head .sub{ color: #d8cfc0; font-size: 1.18rem; max-width: 60ch; margin-top: .6em; }
.article-body{ padding: 50px 0 30px; font-size: 1.06rem; line-height: 1.7; color: var(--ink); }
.article-body h2{ font-family: var(--font-display); border-top: 1px solid var(--line); padding-top: 1.1em; margin-top: 1.8em; }
.article-body p{ margin: 1em 0; }
.pull{ font-family: var(--font-display); font-size: 1.45rem; line-height: 1.35; color: var(--honey-deep); margin: 1.4em 0; font-weight: 500; border:0; }
.callout{ background: rgba(95,122,90,.08); border: 1px solid rgba(95,122,90,.30); border-radius: 12px; padding: 20px 24px; margin: 1.8em 0; }
.callout h3{ margin-top: 0; color: var(--sage-deep); }
ul.clean{ list-style: none; padding-left: 0; }
ul.clean li, .article-body ol li{ margin-bottom: .55em; }
.refs{ font-size: .9rem; color: var(--ink-soft); border-top: 1px solid var(--line); margin-top: 2.4em; padding-top: 1.4em; }
.refs h3{ font-size: 1rem; color: var(--ink-soft); }
.refs ol{ padding-left: 1.2em; }
.note{ font-size: .86rem; color: var(--ink-faint); font-style: italic; }
.next-reads{ margin: 40px auto; max-width: 720px; padding: 0 24px; }
.next-reads .cards, .article-cards{ display: grid; grid-template-columns: repeat(auto-fit,minmax(240px,1fr)); gap: 18px; margin-top: 18px; }
.article-cards .card, .next-reads .card{ display: block; text-decoration: none; color: inherit; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .15s; }
.article-cards .card:hover, .next-reads .card:hover{ box-shadow: var(--shadow); transform: translateY(-2px); }
.card .tag{ display: inline-block; color: var(--honey-deep); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; }
.card .more{ color: var(--honey-deep); font-weight: 600; }
