/* Domus · design tokens and layout. Dark and light follow the device. See docs/de/design.md. */

@font-face {
  font-family: Geist;
  src: url("/fonts/geist.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: radial-gradient(120% 60% at 50% 0%, #1c1d21 0%, #0c0d0f 62%);
  --bg-solid: #0c0d0f;
  --card: rgba(255, 255, 255, 0.045);
  --line: rgba(255, 255, 255, 0.08);
  --ctrl: rgba(255, 255, 255, 0.07);
  --ctrl-on: rgba(255, 255, 255, 0.16);
  --sheet: #1b1c20;
  --text: #f4f4f2;
  --text-2: #a3a3a9;
  --text-3: #6f6f76;
  --inverse: #0c0d0f;
  --track: rgba(255, 255, 255, 0.06);
  --knob: #f4f4f2;
  --mark: rgba(255, 255, 255, 0.28);
  --heat: #ff8a45;
  --heat-ink: #ffb07a;
  --heat-soft: rgba(255, 138, 69, 0.14);
  --heat-fill: linear-gradient(0deg, #ff6a2b 0%, #ffb36b 100%);
  --idle-fill: rgba(255, 255, 255, 0.22);
  --bloom: rgba(255, 106, 43, 0.18);
  --cool: #8fb8ff;
  --cool-soft: rgba(143, 184, 255, 0.12);
  --warn: #ffd27a;
  --warn-soft: rgba(255, 196, 77, 0.1);
  --danger: #ff8a80;
  --shadow: none;
  --font: Geist, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: linear-gradient(180deg, #fbfaf8 0%, #f1f0ec 100%);
  --bg-solid: #f4f3f0;
  --card: #ffffff;
  --line: rgba(18, 19, 22, 0.07);
  --ctrl: #ecebe7;
  --ctrl-on: #ffffff;
  --sheet: #ffffff;
  --text: #121316;
  --text-2: #5f5f66;
  --text-3: #85858c;
  --inverse: #ffffff;
  --track: #efeeea;
  --knob: #ffffff;
  --mark: rgba(18, 19, 22, 0.22);
  --heat: #e2601c;
  --heat-ink: #b4500f;
  --heat-soft: #fdeadc;
  --heat-fill: linear-gradient(0deg, #f08a3c 0%, #f6b77a 100%);
  --idle-fill: #d9d7d1;
  --bloom: rgba(240, 138, 60, 0.16);
  --cool: #4c7bd9;
  --cool-soft: #e7eefc;
  --warn: #7a5300;
  --warn-soft: #fff3d6;
  --danger: #c0362c;
  --shadow: 0 1px 2px rgba(18, 19, 22, 0.04), 0 8px 24px rgba(18, 19, 22, 0.06);
  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: linear-gradient(180deg, #fbfaf8 0%, #f1f0ec 100%);
    --bg-solid: #f4f3f0;
    --card: #ffffff;
    --line: rgba(18, 19, 22, 0.07);
    --ctrl: #ecebe7;
    --ctrl-on: #ffffff;
    --sheet: #ffffff;
    --text: #121316;
    --text-2: #5f5f66;
    --text-3: #85858c;
    --inverse: #ffffff;
    --track: #efeeea;
    --knob: #ffffff;
    --mark: rgba(18, 19, 22, 0.22);
    --heat: #e2601c;
    --heat-ink: #b4500f;
    --heat-soft: #fdeadc;
    --heat-fill: linear-gradient(0deg, #f08a3c 0%, #f6b77a 100%);
    --idle-fill: #d9d7d1;
    --bloom: rgba(240, 138, 60, 0.16);
    --cool: #4c7bd9;
    --cool-soft: #e7eefc;
    --warn: #7a5300;
    --warn-soft: #fff3d6;
    --danger: #c0362c;
    --shadow: 0 1px 2px rgba(18, 19, 22, 0.04), 0 8px 24px rgba(18, 19, 22, 0.06);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
/* Like a native app: the page itself never moves, only .scroller scrolls, the tab bar stays. */
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  position: fixed;
  inset: 0;
  background: var(--bg);
  background-color: var(--bg-solid);
  color: var(--text);
  font-family: var(--font);
  font-feature-settings: "tnum";
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
#app { height: 100%; display: flex; flex-direction: column; }
.scroller {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: none; -webkit-overflow-scrolling: touch;
}
.tabbar {
  flex: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 6px max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg-solid) 88%, transparent);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 50px;
  font-size: 11px; font-weight: 500; color: var(--text-3);
}
.tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tab[aria-current="page"] { color: var(--text); }
.tab[aria-current="page"] svg { stroke-width: 2; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--heat); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.view {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding:
    max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right))
    24px max(20px, env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------- Bausteine ---------- */

.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; }
.brand { display: flex; flex-direction: column; gap: 2px; }
.eyebrow { font-size: 12px; font-weight: 500; letter-spacing: 0.24em; color: var(--text-3); }
.title { margin: 0; font-size: 28px; font-weight: 500; letter-spacing: -0.03em; }
.sub { font-size: 14px; color: var(--text-2); }
.icon-btn {
  width: 42px; height: 42px; flex: none; border-radius: 21px;
  background: var(--ctrl); border: 1px solid var(--line); color: var(--text-2);
  display: grid; place-items: center;
}
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.pill-btn {
  min-height: 42px; padding: 0 18px; border-radius: 21px; border: 0;
  background: var(--ctrl); font-size: 15px; font-weight: 500;
}
.pill-btn.primary { background: var(--text); color: var(--inverse); }

.card {
  border-radius: 22px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.group-label { padding-left: 4px; font-size: 13px; color: var(--text-3); }
.group { display: flex; flex-direction: column; gap: 8px; }
.note { font-size: 13px; color: var(--text-2); line-height: 1.4; }

.seg {
  display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; gap: 2px; padding: 3px;
  border-radius: 13px; background: var(--ctrl);
}
.seg button {
  border: 0; border-radius: 10px; min-height: 38px; background: transparent; color: var(--text-2);
  font-size: 14px; font-weight: 500;
}
.seg button[aria-pressed="true"] { background: var(--ctrl-on); color: var(--text); box-shadow: var(--shadow); }
.seg.locked { opacity: 0.45; }

.switch {
  flex: none; width: 50px; height: 30px; border-radius: 15px; border: 0; padding: 2px;
  background: var(--ctrl); display: flex; justify-content: flex-start; transition: background 0.2s;
}
.switch::after { content: ""; width: 26px; height: 26px; border-radius: 13px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.switch[aria-checked="true"] { background: var(--heat); justify-content: flex-end; }
.switch:disabled { opacity: 0.45; }

.rows { padding: 0 16px; }
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  min-height: 52px; padding: 12px 0; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row-text { display: flex; flex-direction: column; gap: 3px; }
.row-label { font-size: 15px; }
.row-value { font-size: 15px; color: var(--text-2); }

.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button {
  width: 36px; height: 36px; border-radius: 18px; border: 1px solid var(--line); background: var(--ctrl);
  font-size: 18px; line-height: 1;
}
.stepper button:disabled { opacity: 0.35; }
.stepper output { min-width: 58px; text-align: center; font-size: 15px; }

.banner { border-radius: 16px; padding: 12px 14px; font-size: 14px; line-height: 1.4; }
.banner.warn { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--line); }
.banner.info { background: var(--ctrl); color: var(--text-2); }

/* ---------- Übersicht ---------- */

.hero {
  position: relative; overflow: hidden; border-radius: 28px; background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--shadow); padding: 20px 18px 18px 22px;
  display: grid; grid-template-columns: minmax(0, 1fr) 124px; gap: 10px; min-height: 366px;
}
.hero::before {
  content: ""; position: absolute; left: -80px; bottom: -120px; width: 360px; height: 300px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--bloom), transparent); opacity: 0; transition: opacity 0.6s; pointer-events: none;
}
.hero.heating::before { opacity: 1; }
.hero-text { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; min-width: 0; }
.chip {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px;
  background: var(--ctrl); color: var(--text-2); font-size: 13px; font-weight: 500;
}
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 4px; background: var(--text-3); }
.chip.heating { background: var(--heat-soft); color: var(--heat-ink); }
.chip.heating::before { background: var(--heat); box-shadow: 0 0 8px var(--heat); }
.label { font-size: 13px; color: var(--text-3); }
.big { font-size: 86px; font-weight: 300; line-height: 0.9; letter-spacing: -0.06em; }
.big small { font-size: 40px; letter-spacing: -0.03em; color: var(--text-2); }
.target { font-size: 30px; font-weight: 400; letter-spacing: -0.03em; }
.hero.heating .target { color: var(--heat); }

.slider-wrap { position: relative; height: 330px; align-self: center; }
.slider-marks { position: absolute; inset: 0 auto 0 0; width: 40px; pointer-events: none; }
.slider-marks span {
  position: absolute; right: 0; transform: translateY(50%); font-size: 16px; font-weight: 500; color: var(--text-2); line-height: 1;
}
.slider-marks span.on { color: var(--heat-ink); font-weight: 600; }
.slider {
  position: absolute; right: 0; top: 0; bottom: 0; width: 76px; border-radius: 28px; overflow: hidden;
  background: var(--track); box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12); touch-action: none; cursor: ns-resize;
}
.slider-fill { position: absolute; left: 0; right: 0; bottom: 0; background: var(--idle-fill); transition: height 0.25s var(--ease); }
.hero.heating .slider-fill { background: var(--heat-fill); }
.slider.dragging .slider-fill, .slider.dragging .slider-knob { transition: none; }
.slider-line { position: absolute; left: 0; right: 0; height: 0; border-top: 1.5px solid var(--mark); pointer-events: none; }
.slider-room { position: absolute; left: 0; right: 0; height: 0; border-top: 1.5px dashed var(--text-2); opacity: 0.55; pointer-events: none; }
.slider-knob {
  position: absolute; left: 50%; width: 36px; height: 5px; margin: 0 0 -3px -18px; border-radius: 3px;
  background: var(--knob); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: bottom 0.25s var(--ease); pointer-events: none;
}

.steps { display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; gap: 10px; align-items: center; }
.step {
  height: 56px; border-radius: 18px; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow);
  display: grid; place-items: center;
}
.step svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.steps-mid { display: flex; justify-content: center; align-items: center; min-height: 56px; font-size: 14px; color: var(--text-3); text-align: center; }
.steps-mid .pill-btn { color: var(--text); }

.presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.preset {
  min-height: 56px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.preset strong { font-size: 17px; font-weight: 500; }
.preset span { font-size: 11px; opacity: 0.75; }
.preset[aria-pressed="true"] { background: var(--text); color: var(--inverse); border-color: transparent; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tile {
  text-align: left; border-radius: 20px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-height: 72px;
}
.tile strong { font-size: 17px; font-weight: 500; }
.tile.active { background: var(--cool-soft); }
.stamp { text-align: center; font-size: 12px; color: var(--text-3); }

/* ---------- Wochenplan ---------- */

.days { display: flex; gap: 6px; }
.days button {
  flex: 1; min-height: 44px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--text-2);
  font-size: 14px; font-weight: 500;
}
.days button[aria-pressed="true"] { background: var(--text); color: var(--inverse); border-color: transparent; }
.days button.today { box-shadow: inset 0 -2px 0 var(--heat); }
.chart { padding: 18px 16px 12px; display: flex; flex-direction: column; gap: 10px; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; }
.chart-head strong { font-size: 17px; font-weight: 500; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart-axis { display: flex; justify-content: space-between; margin-right: 26px; font-size: 11px; color: var(--text-3); }
.point {
  width: 100%; display: flex; align-items: center; gap: 14px; min-height: 54px; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; padding: 0; text-align: left;
}
.point:last-child { border-bottom: 0; }
.point .dot { width: 8px; height: 8px; border-radius: 4px; background: var(--heat); flex: none; }
.point .dot.cool { background: var(--cool); }
.point .time { width: 60px; font-size: 18px; }
.point .what { flex: 1; font-size: 14px; color: var(--text-2); }
.point .temp { font-size: 18px; }
.point.changed .time, .point.changed .temp { color: var(--heat); }

/* ---------- Blätter und Leisten ---------- */

.scrim {
  position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, 0.45); display: flex; align-items: flex-end; justify-content: center;
  animation: fade 0.2s ease;
}
.sheet {
  width: 100%; max-width: 520px; border-radius: 26px 26px 0 0; background: var(--sheet); border: 1px solid var(--line);
  padding: 10px 20px max(24px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px;
  animation: rise 0.32s var(--ease);
}
.sheet::before { content: ""; align-self: center; width: 40px; height: 5px; border-radius: 3px; background: var(--ctrl); }
.sheet { position: relative; touch-action: none; }
.sheet-close {
  position: absolute; top: 12px; right: 14px; width: 36px; height: 36px; border-radius: 18px; border: 0;
  background: var(--ctrl); color: var(--text-2); display: grid; place-items: center;
}
.sheet-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.sheet h2 { margin: 4px 0 0; font-size: 22px; font-weight: 500; letter-spacing: -0.02em; }
.option {
  display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 14px 16px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--card);
}
.option[aria-pressed="true"] { border-color: var(--text); }
.option strong { font-size: 16px; font-weight: 500; }
.option span { font-size: 13px; color: var(--text-2); }
.checks { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.checks button {
  min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text-2); font-size: 14px;
}
.checks button[aria-pressed="true"] { background: var(--text); color: var(--inverse); border-color: transparent; }
.checks button:disabled { opacity: 0.35; }

.confirm {
  position: sticky; bottom: 12px; z-index: 20; border-radius: 24px; background: var(--sheet);
  border: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35); animation: rise 0.3s var(--ease);
}
.confirm ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 15px; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-top: 4px; }
.pair button { min-height: 46px; border-radius: 16px; border: 1px solid var(--line); background: transparent; font-size: 15px; font-weight: 500; }
.pair button.primary { background: var(--text); color: var(--inverse); border-color: transparent; }

.toast {
  position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 40; transform: translateX(-50%);
  max-width: calc(100% - 40px); padding: 12px 16px; border-radius: 14px; background: var(--text); color: var(--inverse);
  font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); animation: rise 0.3s var(--ease);
}

/* ---------- Sperre ---------- */

.lock { flex: 1; justify-content: center; gap: 22px; }
.lock form { display: flex; flex-direction: column; gap: 12px; }
.lock input {
  min-height: 54px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); color: var(--text);
  padding: 0 16px; font: inherit; font-size: 17px;
}
.lock button[type="submit"] { min-height: 54px; border-radius: 16px; border: 0; background: var(--text); color: var(--inverse); font-size: 16px; font-weight: 500; }
.error { color: var(--danger); font-size: 14px; min-height: 20px; }

@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (min-width: 700px) {
  .view { padding-top: 48px; }
}
