/* ==========================================================================
   Home hub — homeBuddy's front door
   Vanilla CSS, no build step, no remote assets. Pantry's sibling: the SAME
   warm light-first ground and time-axis colors (red past / amber due / green
   fine — nothing else may wear them), so the two family pages read as one
   household's software. Its own accent: a slate house-blue, because green
   already means "the pantry's action" one tap away.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */

:root {
  --bg:        #fbfaf7;
  --surface:   #ffffff;
  --surface-2: #f1efe9;
  --surface-3: #e8e5dd;
  --line:      #e6e3db;
  --line-strong: #cfcabe;

  --text:   #1d1d1f;
  --text-2: #4d4d52;
  --muted:  #79797f;

  /* the time axis (page.css's badges and pills draw with these) */
  --good:      #2f7d33;
  --good-bg:   #e4f2e2;
  --warn:      #a35208;
  --warn-bg:   #fbecd9;
  --danger:    #a02020;
  --danger-bg: #f9e4e2;

  --accent:    #33628f;   /* the house blue — this page's action color */

  /* What shared/ui.css draws with. */
  --on-accent: #fff;
  --shadow:    rgba(0, 0, 0, .22);
  --dock-bottom: calc(var(--safe-b) + 14px);

  --focus: #1f6feb;

  --radius:    14px;
  --radius-sm: 10px;
  --tap:       44px;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui,
          "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #141613;
    --surface:   #1d201c;
    --surface-2: #252923;
    --surface-3: #2e332c;
    --line:      #2c302a;
    --line-strong: #434a40;

    --text:   #f0f1ee;
    --text-2: #b4b8b0;
    --muted:  #8b9087;

    --good:      #7cc981;
    --good-bg:   #1d3320;
    --warn:      #e8a35c;
    --warn-bg:   #3a2a14;
    --danger:    #e07a72;
    --danger-bg: #3c1c1a;

    --accent: #7fa7d4;
    --on-accent: #10202f;   /* dark ink on the light-blue dark-mode accent */
  }
}

/* --------------------------------------------------------------------------
   2. Reset / base (pantry's, restated — tokens differ per app by design)
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  overscroll-behavior-y: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }

/* 16px minimum on anything typable, or iOS Safari zooms the page. */
input, select { font-size: 16px; }

.num { font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------------
   3. Frame: header with page links, view switcher
   -------------------------------------------------------------------------- */

.app-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: baseline; gap: 10px;
  padding: calc(var(--safe-t) + 10px) calc(var(--safe-r) + 16px) 8px calc(var(--safe-l) + 16px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.app-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }

.app-links { margin-left: auto; display: flex; gap: 6px; }
.nav-link {
  display: inline-flex; align-items: center;
  min-height: 32px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); color: var(--text-2);
  font-size: 13px; font-weight: 600; text-decoration: none;
  touch-action: manipulation;
}
.nav-link:active { background: var(--surface-2); }

/* Today | House — a two-tab segmented control under the header. */
.switch-row {
  max-width: 640px; margin: 0 auto;
  padding: 12px calc(var(--safe-r) + 16px) 0 calc(var(--safe-l) + 16px);
  display: flex;
}
.switch-btn {
  flex: 1 1 0; min-height: 38px;
  border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text-2);
  font-size: 14px; font-weight: 650;
  cursor: pointer; touch-action: manipulation;
}
.switch-btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.switch-btn:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: 0; }
.switch-btn[aria-selected="true"] {
  background: var(--accent); border-color: var(--accent);
  color: var(--on-accent); font-weight: 700;
}

.view {
  max-width: 640px; margin: 0 auto;
  padding: 4px calc(var(--safe-r) + 16px)
           calc(var(--safe-b) + 40px)
           calc(var(--safe-l) + 16px);
}

.footnote {
  max-width: 640px; margin: 0 auto;
  padding: 0 calc(var(--safe-r) + 18px) calc(var(--safe-b) + 26px) calc(var(--safe-l) + 18px);
  font-size: 12.5px; line-height: 1.5; color: var(--muted);
}

/* --------------------------------------------------------------------------
   4. Today: brief sections as cards
   -------------------------------------------------------------------------- */

/* Plain-text sections (weather, calendar, open tasks…) — one quiet card. */
.text-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 11px 12px;
  font-size: 14px; color: var(--text-2);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.text-card .tline { display: block; }
.text-card .tline + .tline { margin-top: 3px; }

/* The pantry summary card is a link — the whole card goes to /pantry/. */
.pantry-card {
  display: flex; align-items: center; gap: 11px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 11px 12px;
  text-decoration: none; color: inherit;
}
.pantry-card:active { background: var(--surface-2); }
.pantry-card .go { flex: none; color: var(--muted); font-size: 18px; }

/* Rows the ✓/💤 act on reuse .card/.badge/.main from page.css; the states
   below are this page's own. */
.card.handled { opacity: .62; }
.card.handled .name { text-decoration: line-through; }

.shop-row { display: flex; gap: 8px; }
.field {
  flex: 1 1 auto; min-width: 0; min-height: var(--tap); padding: 0 12px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); font-size: 16px;
  -webkit-appearance: none; appearance: none;
}
.field::placeholder { color: var(--muted); }

/* --------------------------------------------------------------------------
   5. House: per-property groups
   -------------------------------------------------------------------------- */

.prop-head {
  display: flex; align-items: baseline; gap: 8px;
  margin: 24px 2px 2px;
}
.prop-head h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.prop-head .prop-kind { font-size: 12px; color: var(--muted); }

.svc-list { display: flex; flex-direction: column; gap: 6px; }
.svc-row {
  display: flex; gap: 8px; align-items: baseline;
  font-size: 13px; color: var(--text-2);
  padding: 4px 2px;
}
.svc-row .svc-date { flex: none; width: 84px; color: var(--muted); font-variant-numeric: tabular-nums; }
.svc-row .svc-what { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.svc-row .svc-cost { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Warranty chip on an asset card — words + tint, never color alone. */
.chip {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
  white-space: nowrap;
}
.chip-good   { background: var(--good-bg);   color: var(--good); }
.chip-danger { background: var(--danger-bg); color: var(--danger); }

/* --------------------------------------------------------------------------
   6. Wider screens — secondary, but not broken
   -------------------------------------------------------------------------- */

@media (min-width: 700px) {
  .app-header {
    padding-left: max(calc(var(--safe-l) + 16px), calc(50% - 320px));
    padding-right: max(calc(var(--safe-r) + 16px), calc(50% - 320px));
  }
  .dock { left: 50%; right: auto; transform: translateX(-50%); width: 460px; }
}
