/* The earlier look, kept for news and groceries (the rest of the family uses theme.css).
   An app links this file and sets its own colour on <html>:
     <html style="--accent: #F0997B">
   and keeps only what is particular to it in its own styles. */

:root {
  --bg: #0b0b0b;           /* same as the icon tile */
  --surface: #161616;
  --surface-2: #1f1f1f;
  --line: #232323;
  --text: #f4f1ee;
  --muted: #8d8a86;
  --faint: #6a6764;
  --accent: #AFA9EC;       /* each app overrides this */
  --on-accent: #0b0b0b;
  --danger: #F09595;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 16px/1.45 var(--font); overscroll-behavior-y: contain; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* Header: the app's name in lowercase, actions on the right */
.app-head {
  position: sticky; top: 0; z-index: 2;
  background: rgba(11, 11, 11, .88);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  padding: max(10px, calc(env(safe-area-inset-top) + 12px)) 16px 0;   /* clear of iOS's fade under the status bar */
}
.app-title { display: flex; align-items: center; gap: 4px; min-height: 44px; }
.app-title h1 { flex: 1; margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.app-title h1::after { content: "."; color: var(--accent); }

.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); flex: none; }
.icon-btn:active { background: var(--surface); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 999px; background: var(--surface); color: var(--text); font-weight: 600; font-size: 15px; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.danger { background: transparent; color: var(--danger); }

/* Chips: filters and toggles in a sideways-scrolling row */
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 0 10px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; padding: 6px 12px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 14px; white-space: nowrap; }
.chips button[aria-pressed="true"] { background: var(--text); color: var(--bg); font-weight: 600; }

/* Fields */
.field { width: 100%; padding: 11px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); font-size: 16px; }
.field::placeholder { color: var(--muted); }

/* Full-screen sheets (reader, settings), closed with the back gesture */
/* The bar sits flush at the very top (it carries the phone's status-bar space itself), so
   nothing scrolls by above it. */
.sheet {
  position: fixed; inset: 0; z-index: 5; background: var(--bg); overflow-y: auto;
  padding: 0 0 calc(32px + env(safe-area-inset-bottom));
  overscroll-behavior: contain;               /* scrolling it never moves the page underneath */
  scrollbar-width: none;
}
.sheet::-webkit-scrollbar { display: none; }
/* While a sheet is open the page underneath stays put, so only the sheet scrolls and the page's
   scrollbar doesn't show through it. */
html:has(.sheet:not([hidden])), html:has(.sheet:not([hidden])) body { overflow: hidden; }
.sheet-bar { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: max(6px, calc(env(safe-area-inset-top) + 12px)) 8px 4px; background: var(--bg); }
.sheet-inner { max-width: 680px; margin: 0 auto; padding: 0 20px; }
.sheet h2 { font-size: 22px; margin: 6px 0 4px; }

/* Lists with hairline rows */
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { border-bottom: 1px solid var(--line); }

.note { color: var(--muted); text-align: center; padding: 48px 24px; }
.meta { font-size: 12px; color: var(--muted); }
.meta b { color: var(--accent); font-weight: 600; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 10;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; max-width: calc(100% - 32px);
}

@keyframes spin { to { transform: rotate(360deg); } }
.spin svg { animation: spin .9s linear infinite; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
