/* sleep.eric.watch. eric.watch's canvas, surface and violet (docs/Colour.md); the amber and the
   blue are this site's own and mean warm and cool, on the dial and along each night's line. */
:root {
  --canvas: #0E1320;
  --surface: #182033;
  --slot: #2E3A52;
  --ink: #E8ECF4;
  --dim: #9AA5BD;
  --accent: #8B5CF6;
  --accent-ink: #A78BFA;
  --warm: #F5A524;
  --cool: #4CC2F1;
  --bad: #F87171;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: max(20px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
  background: var(--canvas);
  color: var(--ink);
  font: 17px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

main { max-width: 420px; margin: 0 auto; }
h1, h2 { margin: 0; font-weight: 800; letter-spacing: -0.02em; }
h1 { font-size: 26px; }
h2 { margin: 30px 0 12px; font-size: 20px; }
p { margin: 0; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: 0.5; cursor: default; }

.card { background: var(--surface); border-radius: 18px; padding: 24px; }

.pill {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 50px; padding: 0 22px; border-radius: 999px;
  background: var(--slot); font-weight: 700; text-decoration: none; color: var(--ink);
}
.pill.primary { background: var(--accent); color: #fff; }
.pill.ghost { width: 100%; background: none; border: 2px dashed var(--slot); color: var(--dim); }
.pill:hover { filter: brightness(1.1); }
.text { color: var(--dim); font-size: 15px; text-decoration: underline; text-underline-offset: 3px; }
.text.danger { color: var(--bad); }

.fault { margin-bottom: 14px; padding: 12px 16px; border-radius: 14px; background: color-mix(in srgb, var(--bad) 16%, var(--canvas)); color: #FECACA; font-size: 15px; }
.note { color: var(--dim); font-size: 14px; }

/* Linking, and every form field. */
form { display: grid; gap: 14px; }
label { display: grid; gap: 6px; color: var(--dim); font-size: 14px; }
input:not([type="range"]), textarea {
  width: 100%; min-height: 46px; padding: 0 14px; border: 0; border-radius: 12px;
  background: var(--slot); color: var(--ink); font: inherit; font-size: 17px;
}
textarea { padding: 12px 14px; resize: vertical; }
textarea::placeholder { color: var(--dim); }

/* The dial: this side of the bed, now. */
.dial { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 10px 0 0; }
.dial #cooler { justify-self: end; }
.dial output {
  min-width: 3ch; text-align: center; font-size: 88px; font-weight: 800; line-height: 1.1;
  letter-spacing: -0.04em; font-variant-numeric: tabular-nums; color: var(--dim);
}
.dial[data-on] output[data-tone="warm"] { color: var(--warm); }
.dial[data-on] output[data-tone="cool"] { color: var(--cool); }
.dial[data-on] output[data-tone="flat"] { color: var(--ink); }
.round { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: var(--slot); }
.status { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--dim); font-size: 15px; }
#power[aria-pressed="true"] { background: var(--accent); color: #fff; }
#phase:empty { display: none; }
.tonight { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; margin-top: 18px; }
.tonight:not(:has(button:not([hidden]))) { display: none; }

/* A night: the line its temperature follows, from on to off. */
#profiles { display: grid; gap: 12px; margin: 0 0 12px; padding: 0; list-style: none; }
.night { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 12px; padding: 14px 16px 12px; border-radius: 18px; background: var(--surface); }
.night[data-active] { box-shadow: inset 0 0 0 2px var(--accent); }
.night .run { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--slot); }
.night[data-active] .run { border-color: var(--accent); background: var(--accent) radial-gradient(circle, #fff 0 4px, transparent 5px); }
.night .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.night .edit { display: grid; place-items: center; width: 40px; height: 40px; margin: -6px -8px -6px 0; color: var(--dim); }
.night .edit svg { width: 18px; height: 18px; }
.night .line { grid-column: 1 / -1; width: 100%; height: auto; stroke-width: 0; overflow: visible; }
.night .line text { fill: var(--dim); stroke: none; font-size: 11px; font-variant-numeric: tabular-nums; }
.night .line .zero { stroke: var(--slot); stroke-width: 1; stroke-dasharray: 2 4; }
.night .line .path { stroke-width: 3; }
.night .line .area { opacity: 0.16; }
.night .line .mark { stroke: var(--dim); stroke-width: 1.6; }
.night .line .bedtime { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }

footer { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin-top: 40px; color: var(--dim); font-size: 15px; }
footer #email { flex: 1 1 100%; overflow: hidden; text-overflow: ellipsis; }

/* The night editor. */
dialog { width: min(420px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 24px; border: 0; border-radius: 18px; background: var(--surface); color: var(--ink); }
dialog:modal { overscroll-behavior: contain; }
dialog::backdrop { overflow: hidden; overscroll-behavior: contain; background: rgb(6 9 16 / 0.7); }
fieldset { display: grid; gap: 12px; margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0 0 8px; font-weight: 700; }
.inline { display: flex; align-items: center; gap: 10px; }
.inline input { width: 5.5em; }
.heat { grid-template-columns: 1fr auto; }
.heat output { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.heat input { grid-column: 1 / -1; width: 100%; height: 28px; margin: 0; appearance: none; background: none; }
.heat input::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--cool), var(--slot) 50%, var(--warm)); }
.heat input::-moz-range-track { height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--cool), var(--slot) 50%, var(--warm)); }
.heat input::-webkit-slider-thumb { appearance: none; width: 26px; height: 26px; margin-top: -9px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgb(0 0 0 / 0.5); }
.heat input::-moz-range-thumb { width: 26px; height: 26px; border: 0; border-radius: 50%; background: #fff; }
.actions { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; margin-top: 6px; }
.actions .text { justify-self: start; }

/* The sign-in page: id.eric.watch's card. */
.door { display: grid; place-items: center; min-height: 100dvh; }
.door main { display: grid; justify-items: center; gap: 14px; width: 100%; max-width: 360px; padding: 28px 24px; border-radius: 18px; background: var(--surface); }
.door img { border-radius: 18px; }
.door .pill { width: 100%; margin-top: 6px; }
.door p { color: #FECACA; font-size: 15px; }

[hidden] { display: none !important; }
