/* gratij — one stylesheet. Quiet and warm: it is somewhere to write a few
   lines at the end of the day, often on a phone, so the writing surface and
   the text are the design. */
:root {
  color-scheme: light dark;
  --bg: #fbf8f2;
  --panel: #ffffff;
  --panel-2: #f3eee3;
  --line: #e5dece;
  --ink: #2b2620;
  --muted: #6d655a;
  --accent: #2f6b4f;
  --accent-ink: #ffffff;
  --warm: #f0b34a;
  --bad: #b3412e;
  --good: #2f6b4f;
  --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171512; --panel: #201d19; --panel-2: #29251f; --line: #38322a;
    --ink: #efe9df; --muted: #a99f90; --accent: #8fd1a8; --accent-ink: #10251a; --warm: #f0b34a; --bad: #f08a75; --good: #8fd1a8;
  }
}

* { box-sizing: border-box; }
/* Components set display; `hidden` must still win. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 17px/1.6 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh; display: flex; flex-direction: column;
}
main { max-width: 760px; width: 100%; margin: 0 auto; padding: 32px 20px 64px; flex: 1; }
h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(32px, 5.5vw, 50px); line-height: 1.1; letter-spacing: -0.01em; margin: 0 0 14px; }
h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(23px, 3.4vw, 30px); line-height: 1.2; margin: 40px 0 10px; }
h3 { font-size: 18px; margin: 22px 0 6px; }
p { margin: 0 0 14px; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.lead { font-size: 20px; color: var(--muted); max-width: 36em; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; z-index: 50; }
:focus-visible { outline: 3px solid var(--warm); outline-offset: 2px; }

/* ── Header and footer ─────────────────────────────────────────── */
.site-header { display: flex; align-items: center; gap: 18px; padding: 12px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--serif); font-weight: 700; font-size: 22px; color: var(--ink); text-decoration: none; }
.site-header nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-header nav a { color: var(--muted); text-decoration: none; padding: 4px 0; }
.site-header nav a[aria-current="page"], .site-header nav a:hover { color: var(--ink); box-shadow: inset 0 -2px 0 var(--warm); }
.account { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.sync-dot[data-state="synced"] { background: var(--good); }
.sync-dot[data-state="syncing"], .sync-dot[data-state="claim-pending"] { background: var(--warm); }
.sync-dot[data-state="error"], .sync-dot[data-state="offline"] { background: var(--bad); }
.claim { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; padding: 10px 20px; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.site-footer { border-top: 1px solid var(--line); padding: 22px 20px; display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; color: var(--muted); font-size: 15px; }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: var(--muted); }

/* ── Controls ──────────────────────────────────────────────────── */
.btn { display: inline-block; font: inherit; font-weight: 650; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); border-radius: 10px; padding: 11px 20px; text-decoration: none; cursor: pointer; line-height: 1.2; }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.small { padding: 6px 12px; font-size: 15px; }
.btn.danger { background: transparent; color: var(--bad); border-color: var(--bad); }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
label { display: block; font-weight: 600; margin: 14px 0 6px; }
input[type=text], input[type=email], input[type=password], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
textarea { min-height: 120px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 6px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 14px; margin-top: 6px; }
.error { color: var(--bad); min-height: 1em; }
.ok { color: var(--good); }
.honeypot { position: absolute; left: -9999px; }

/* ── Surfaces ──────────────────────────────────────────────────── */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card + .card { margin-top: 16px; }
.notice { background: var(--panel-2); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 20px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stats { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); margin: 18px 0; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat .n { font-family: var(--serif); font-size: 32px; font-weight: 700; line-height: 1; }
.stat .k { color: var(--muted); font-size: 14px; margin-top: 6px; }

/* ── Writing ───────────────────────────────────────────────────── */
.prompt { font-family: var(--serif); font-size: clamp(24px, 4vw, 32px); line-height: 1.3; margin: 6px 0 12px; }
.editor textarea { font-family: var(--serif); font-size: 19px; line-height: 1.6; min-height: 180px; background: var(--panel); }
.entry { border-top: 1px solid var(--line); padding: 16px 0; }
.entry:first-child { border-top: 0; }
.prompt-list { list-style: none; padding: 0; margin: 12px 0; }
.prompt-list li { border-top: 1px solid var(--line); padding: 12px 0; display: flex; gap: 6px 16px; justify-content: space-between; align-items: baseline; flex-wrap: wrap; }
.prompt-list li:first-child { border-top: 0; }
.prompt-list li span { font-family: var(--serif); font-size: 19px; line-height: 1.4; }
.prompt-list li a { white-space: nowrap; }
.entry .q { color: var(--muted); font-style: italic; margin: 0 0 4px; }
.entry .t { font-family: var(--serif); font-size: 19px; white-space: pre-wrap; word-break: break-word; margin: 0 0 8px; }
.entry img { max-width: 100%; max-height: 360px; border-radius: 10px; display: block; margin: 6px 0 10px; }
.entry .actions { display: flex; gap: 14px; font-size: 15px; }
.day h2 { font-size: 21px; margin: 32px 0 4px; }
.conflict { background: var(--panel-2); border-left: 3px solid var(--warm); padding: 10px 14px; border-radius: 8px; margin: 8px 0; }

/* ── Calendar (look back) ──────────────────────────────────────── */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; max-width: 420px; margin: 12px 0 20px; }
.cal .h { font-size: 12px; color: var(--muted); text-align: center; }
.cal .d { aspect-ratio: 1; border-radius: 8px; background: var(--panel-2); display: grid; place-items: center; font-size: 13px; color: var(--muted); }
.cal .d.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.cal .d.blank { background: transparent; }

/* ── Marketing ─────────────────────────────────────────────────── */
.hero { padding: 28px 0 8px; }
.hero .cta { margin-top: 22px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.steps { counter-reset: s; list-style: none; padding: 0; display: grid; gap: 14px; }
.steps li { counter-increment: s; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 16px 58px; position: relative; }
.steps li::before { content: counter(s); position: absolute; left: 16px; top: 14px; width: 28px; height: 28px; border-radius: 50%; background: var(--warm); color: #2b2620; font-weight: 800; display: grid; place-items: center; }
.sample { font-family: var(--serif); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin: 26px 0 8px; }
.sample .q { color: var(--muted); font-style: italic; margin-bottom: 8px; }
.plans { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 18px; }
.plans ul { padding-left: 20px; margin: 10px 0 18px; }
