/* Casita · warm minimal theme
   One shared file: keep an identical copy in every app folder (like casita-auth.js).
   Colors switch to the evening palette automatically when the phone is in dark mode. */

:root {
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --bg: #f5eee4;          /* linen */
  --card: #fbf7f1;        /* warm white */
  --sunk: #ebdfd1;        /* pressed-in surfaces: segmented controls */
  --tile: #f0e3d5;        /* icon tiles */
  --ink: #3b2b23;
  --muted: #76614f;
  --line: #e7d9c8;

  --accent: #a9542f;      /* clay */
  --accent-ink: #fff8f1;
  --accent-soft: #f3dfd1;
  --accent-text: #934423;

  --warn: #8f4c17;  --warn-soft: #f4e2c9;
  --bad: #a3301f;   --bad-soft: #f5d9d1;

  --fridge: #6b8789; --freezer: #8089a3; --pantry: #b07a3c;

  --arch: #9c4828; --arch-ink: #fbf2e6; --arch-line: #f3d9b1;
  --toast-act: #f0a983;
  --shadow: 0 1px 2px rgba(80, 50, 30, .06), 0 6px 18px rgba(80, 50, 30, .05);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .3 0 0 0 0 .2 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #231a15;  --card: #2e231d;  --sunk: #30251f;  --tile: #3d2b22;
    --ink: #f0e5d8; --muted: #bba894; --line: #3a2d25;
    --accent: #da8761; --accent-ink: #231a15; --accent-soft: #4a3024; --accent-text: #f0a983;
    --warn: #e9b36f; --warn-soft: #45331c;
    --bad: #f2998a;  --bad-soft: #4a2620;
    --fridge: #9db7b8; --freezer: #a9b0c8; --pantry: #d6a266;
    --arch: #7e3a20; --arch-ink: #fbf2e6; --arch-line: #e9c79a;
    --toast-act: #934423;
    --shadow: none;
    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .3 0 0 0 0 .2 0 0 0 .055 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  }
}

html { background: var(--bg); color-scheme: light dark; }
body {
  background: transparent;
  font-family: var(--sans);
  font-size: 15.5px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Faint paper grain, behind everything. Sticky bars reuse it with the .paper class
   (or background: var(--paper)) so they blend into the page. */
:root { --paper: var(--grain) 0 0 / 240px fixed, var(--bg); }
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--grain) 0 0 / 240px;
}
.paper { background: var(--paper); }

/* Buttons */
.btn {
  border: 0; border-radius: 999px; padding: 11px 20px; min-height: 44px;
  background: var(--accent); color: var(--accent-ink);
  font-family: var(--sans); font-weight: 600; cursor: pointer;
  transition: transform .12s, filter .12s;
}
.btn:active { transform: scale(.97); }
.btn:hover:not(:disabled) { filter: brightness(1.04); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--bad); border: 1px solid var(--line); }
.iconbtn {
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 999px;
  display: inline-grid; place-items: center;
  background: var(--sunk); color: var(--ink); cursor: pointer; font-size: 20px; line-height: 1;
}
.iconbtn:hover { background: var(--line); color: var(--ink); }
.iconbtn svg { width: 20px; height: 20px; }

/* Form fields */
.field { font-size: 13px; color: var(--muted); gap: 6px; }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); border-radius: 14px; padding: 11px 14px;
  background: var(--bg); color: var(--ink); font-size: 16px; font-family: var(--sans);
}
.field input:focus, .field select:focus, .field textarea:focus,
.search:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Dialogs */
dialog {
  border: 0; border-radius: 26px; background: var(--card); color: var(--ink);
  box-shadow: 0 24px 60px rgba(40, 24, 14, .28);
}
dialog input, dialog select, dialog textarea { min-width: 0; max-width: 100%; }
dialog::backdrop { background: rgba(35, 26, 21, .42); }
dialog h3 { font-family: var(--serif); font-weight: 400; font-size: 23px; letter-spacing: -.005em; }

/* Sign-in screen */
#loginView { background: var(--paper); }
#loginView .card {
  background: var(--card); border: 0; border-radius: 30px; box-shadow: var(--shadow);
  padding: 30px 24px 26px; gap: 16px;
}
#loginView h2 { font-family: var(--serif); font-weight: 400; font-size: 30px; letter-spacing: -.01em; color: var(--ink); }
#loginView img { width: 72px; height: 72px; border-radius: 20px; }
#loginMsg { border-radius: 14px; }

/* Toast */
#toast { border-radius: 999px; padding: 12px 18px; font-family: var(--sans); box-shadow: 0 10px 30px rgba(40, 24, 14, .25); }
#toast button { color: var(--toast-act); }
