/* Household display demo — tuned for iPad mini 2 / iOS 12 Safari.
   Old-Safari notes:
   - No `gap` inside flexbox (needs Safari 14.1). Use `grid-gap` for grids, margins for flex.
   - CSS custom properties, grid, and template literals are all fine on Safari 12. */

:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #1c232d;
  --line: #2a3038;
  --text: #e8edf2;
  --muted: #8a97a6;
  --accent: #4aa3ff;
  --good: #35c07a;
  --warn: #f0b23a;
  --pad: 18px;
  --radius: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ---------- Demo control bar (removed in the real wall build) ---------- */
.demo-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  height: 34px; line-height: 34px;
  background: rgba(0,0,0,0.55);
  border-bottom: 1px solid var(--line);
  font-size: 12px; color: var(--muted);
  padding: 0 10px; white-space: nowrap; overflow: hidden;
}
.demo-tag {
  background: var(--accent); color: #04101f; font-weight: 700;
  padding: 2px 7px; border-radius: 6px; font-size: 11px; margin-right: 10px;
}
.demo-btn {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 10px; font-size: 12px; margin-right: 8px; cursor: pointer;
}
.demo-btn:active { background: var(--accent); color: #04101f; }
.demo-hint { font-style: italic; }

/* ---------- Board ---------- */
.board {
  position: absolute; top: 34px; left: 0; right: 0; bottom: 0;
  display: grid;
  grid-gap: var(--pad);
  padding: var(--pad);
}

/* Info-forward: info dominant, photo one column on the right */
body[data-layout="info"] .board {
  grid-template-columns: 1.15fr 1fr 1.3fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "clock    weather  photo"
    "schedule chores   photo";
}
/* Photo-forward: big photo on the left, info stacked in a sidebar */
body[data-layout="photo"] .board {
  grid-template-columns: 1.75fr 1fr;
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas:
    "photo clock"
    "photo weather"
    "photo schedule"
    "photo chores";
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--pad);
  overflow: hidden;
}
.panel-title {
  font-size: 13px; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 10px;
}

.clock-panel    { grid-area: clock; }
.weather-panel  { grid-area: weather; }
.schedule-panel { grid-area: schedule; }
.chores-panel   { grid-area: chores; }
.photo-panel    { grid-area: photo; padding: 0; border: none; }

/* ---------- Clock ---------- */
.clock-panel { position: relative; display: block; }
.greeting { color: var(--muted); font-size: 18px; margin-bottom: 2px; }
.clock {
  font-size: 88px; font-weight: 700; line-height: 0.95;
  letter-spacing: -0.02em; display: inline-block;
}
.clock-ampm { display: inline-block; font-size: 26px; color: var(--muted); margin-left: 8px; }
.date { font-size: 20px; color: var(--text); margin-top: 4px; }

/* ---------- Weather ---------- */
.weather-now { display: flex; align-items: center; }
.weather-icon { font-size: 46px; margin-right: 12px; }
.weather-temp { font-size: 54px; font-weight: 700; margin-right: 14px; }
.weather-meta { font-size: 15px; color: var(--muted); }
.weather-hilo { margin-top: 3px; }
.weather-days { display: flex; margin-top: 14px; }
.wx-day {
  flex: 1 1 0; text-align: center; font-size: 13px; color: var(--muted);
  margin-right: 6px;
}
.wx-day:last-child { margin-right: 0; }
.wx-day .d { color: var(--text); margin-bottom: 4px; }
.wx-day .i { font-size: 22px; }
.wx-day .t { margin-top: 4px; color: var(--text); }

/* ---------- Schedule ---------- */
.events, .chores { list-style: none; margin: 0; padding: 0; }
.event { display: flex; align-items: flex-start; margin-bottom: 12px; }
.event:last-child { margin-bottom: 0; }
.event-time { width: 74px; flex: 0 0 74px; color: var(--muted); font-size: 15px; padding-top: 1px; }
.event-body { flex: 1 1 auto; }
.event-title { font-size: 18px; }
.event-where { font-size: 13px; color: var(--muted); margin-top: 1px; }
.event-dot {
  width: 8px; height: 8px; border-radius: 50%; margin: 7px 10px 0 0; flex: 0 0 8px;
  background: var(--muted);
}

/* Calendar legend (tappable to hide/show a calendar) */
.legend { display: flex; flex-wrap: wrap; margin: -2px 0 12px; }
.legend-chip {
  display: inline-flex; align-items: center;
  font-size: 13px; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 11px 3px 8px; margin: 0 8px 6px 0; cursor: pointer;
}
.legend-chip .legend-dot {
  width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; flex: 0 0 9px;
}
.legend-chip.off { color: var(--muted); opacity: 0.5; text-decoration: line-through; }
.legend-chip.off .legend-dot { background: var(--muted) !important; }

/* ---------- Chores ---------- */
.chore { display: flex; align-items: center; margin-bottom: 11px; }
.chore:last-child { margin-bottom: 0; }
.chore-check {
  width: 22px; height: 22px; flex: 0 0 22px; border-radius: 6px;
  border: 2px solid var(--line); margin-right: 11px; text-align: center;
  line-height: 20px; font-size: 15px; color: transparent;
}
.chore.done .chore-check { background: var(--good); border-color: var(--good); color: #04101f; }
.chore-label { flex: 1 1 auto; font-size: 17px; }
.chore.done .chore-label { color: var(--muted); text-decoration: line-through; }
.chore-who {
  font-size: 12px; color: var(--muted); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; margin-left: 8px;
}

/* ---------- Photo ---------- */
.photo-panel { position: relative; }
.photo-frame {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  border-radius: var(--radius);
  background-size: cover; background-position: center;
  -webkit-transition: opacity 0.8s ease; transition: opacity 0.8s ease;
}
.photo-caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 14px 16px; font-size: 15px;
  color: #fff; background: linear-gradient(to top, rgba(0,0,0,0.6), rgba(0,0,0,0));
}

/* ---------- Night dim ---------- */
.night-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 15;
  background: #000; opacity: 0; pointer-events: none;
  -webkit-transition: opacity 1.2s ease; transition: opacity 1.2s ease;
}
body.night .night-overlay { opacity: 0.62; }
