/* ============================================================
   Life OS — Today page (editorial)
   Cream paper, Fraunces serif headlines, Inter sans body.
   Mobile-first; widens on tablets/desktop.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,400;1,9..144,500&family=Inter:wght@400;500;600;700&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --paper: #f6f1e7;
  --paper-2: #efe8d8;
  --ink: #1a1814;
  --ink-2: #3a342b;
  --mute: #7a7167;
  --rule: #d8cfb9;
  --rust: #a04a25;
  --sage: #6f7d5e;
  --plum: #6b3a4a;
  --ochre: #b8862c;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16140f;
    --paper-2: #1f1c14;
    --ink: #f4ecd8;
    --ink-2: #d8cfb9;
    --mute: #968b78;
    --rule: #2e2a22;
    --rust: #d77a4d;
    --sage: #95a986;
    --plum: #b27486;
    --ochre: #d4a657;
  }
}

html, body {
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: calc(20px + var(--safe-top)) 20px calc(var(--tabbar-h) + var(--safe-bottom) + 24px);
}

.loading {
  text-align: center;
  color: var(--mute);
  padding: 80px 0;
  font-style: italic;
  font-family: 'Fraunces', Georgia, serif;
}

.error {
  background: rgba(160, 74, 37, 0.08);
  border: 1px solid var(--rust);
  color: var(--rust);
  padding: 14px 16px;
  border-radius: 4px;
  margin-top: 24px;
}

/* ----------- Masthead ------------ */

.masthead { padding: 8px 0 28px; border-bottom: 2px solid var(--ink); margin-bottom: 28px; }
.dateline {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--rust);
  margin-bottom: 14px;
}
.masthead h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  font-size: clamp(40px, 9vw, 64px);
  line-height: 0.95;
  letter-spacing: -0.035em;
  margin-bottom: 14px;
}
.lede {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  color: var(--mute);
  font-size: 18px;
  line-height: 1.45;
  max-width: 36ch;
}

/* ----------- Sections ------------ */

section {
  padding: 28px 0 24px;
  border-bottom: 1px solid var(--rule);
}
section:last-of-type { border-bottom: 0; }

section h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  font-size: 32px;
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.section-label {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--rust);
  margin-bottom: 6px;
}
.section-deck {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  color: var(--mute);
  font-size: 15px;
  margin-bottom: 18px;
}

/* ----------- Empty states ------------ */

.empty {
  font-family: 'Fraunces', Georgia, serif;
  font-style: italic;
  color: var(--mute);
  padding: 12px 0;
  font-size: 15px;
}

/* ----------- Goals ------------ */

.goal {
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
}
.goal:last-child { border-bottom: 0; }
.goal-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-bottom: 8px;
}
.goal-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 22px;
  font-weight: 500;
}
.goal-pct {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.goal-meta {
  display: flex; gap: 12px;
  font-size: 13px;
  color: var(--mute);
  font-style: italic;
  font-family: 'Fraunces', Georgia, serif;
  margin-bottom: 8px;
}
.bar {
  height: 2px;
  background: var(--rule);
  position: relative;
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  background: var(--ink);
  transition: width .4s ease;
}

/* ----------- Tasks ------------ */

.task-list {
  list-style: none;
  display: flex; flex-direction: column;
}
.task {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  user-select: none;
}
.task:last-child { border-bottom: 0; }
.task .check {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  margin-top: 2px;
  display: grid; place-items: center;
  transition: all .15s ease;
}
.task.done .check {
  background: var(--ink);
  color: var(--paper);
}
.task.done .check::after {
  content: '✓';
  font-size: 13px;
  line-height: 1;
}
.task .body { flex: 1; }
.task .name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.3;
}
.task.done .name {
  color: var(--mute);
  text-decoration: line-through;
}
.task .meta {
  font-size: 12px;
  color: var(--mute);
  font-style: italic;
  font-family: 'Fraunces', Georgia, serif;
  margin-top: 2px;
}
.task.overdue .meta { color: var(--rust); font-style: normal; font-weight: 500; }

/* ----------- Saved items grid ------------ */

.saved-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 540px) {
  .saved-grid { grid-template-columns: 1fr 1fr; gap: 18px; }
}
.saved {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  padding: 14px;
  display: flex; flex-direction: column; gap: 6px;
  text-decoration: none;
  color: inherit;
}
.saved:hover, .saved:focus { border-color: var(--ink); }
.saved-type {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--rust);
}
.saved-content {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 17px;
  line-height: 1.35;
  font-weight: 500;
  word-wrap: break-word;
  /* clamp to 3 lines */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.saved-meta {
  font-size: 12px;
  color: var(--mute);
  font-style: italic;
  font-family: 'Fraunces', Georgia, serif;
  margin-top: auto;
  padding-top: 6px;
}

/* ----------- Projects ------------ */

.project {
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}
.project:last-child { border-bottom: 0; }
.project-name {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.2;
}
.project-meta {
  font-size: 13px;
  color: var(--mute);
  font-style: italic;
  font-family: 'Fraunces', Georgia, serif;
  margin-top: 2px;
}

/* ----------- Footer ------------ */

.colophon {
  text-align: center;
  padding: 30px 0 0;
  color: var(--mute);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
}
