/* Animated previews of the Home app on home.html. Each phone is drawn at 390 x 844 design
   pixels and scaled to its column: 1em inside a screen is 17 design pixels, the app's Body. */

@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

.hd-phone {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 390 / 844;
  margin-bottom: 0.875rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #000;
  container-type: inline-size;
}

.hd-screen {
  --text: #f2f2f7;
  --text-2: #98989f;
  --surface: #1c1c1e;
  --raised: #2c2c2e;
  --fill: rgb(118 118 128 / 0.24);
  --heat-start: #ff9500;
  --heat-end: #ff3b30;
  --water-end: #007aff;
  --accent: #ff9f0a;
  --green: #30d158;
  position: absolute;
  inset: 0;
  padding: 1.15em 0.94em 0;
  overflow: hidden;
  background: #000;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, 'Inter Tight', sans-serif;
  font-size: 13px;
  font-size: calc(100cqw * 17 / 390);
  line-height: 1.3;
  text-align: left;
  -webkit-font-smoothing: antialiased;
}

.hd-screen p,
.hd-screen dl,
.hd-screen dd {
  margin: 0;
}

/* Header */

.hd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hd-title {
  font-size: 2em;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hd-help {
  display: grid;
  place-items: center;
  width: 2.1em;
  height: 2.1em;
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  font-weight: 700;
}

.hd-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  margin-top: 0.45em;
  padding: 0.45em 0.95em;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.82em;
}

.hd-dot {
  width: 0.62em;
  height: 0.62em;
  border-radius: 50%;
  background: var(--green);
  animation: hd-pulse 2.4s ease-in-out infinite;
}

@keyframes hd-pulse {
  50% {
    opacity: 0.35;
  }
}

/* The hero card */

.hd-hero {
  margin-top: 1.1em;
  padding: 1.1em 1.1em 1.25em;
  border-radius: 1.3em;
  background: linear-gradient(135deg, var(--heat-start), var(--heat-end));
  color: #fff;
}

.hd-hero-top {
  display: flex;
  align-items: center;
  gap: 0.55em;
  font-weight: 600;
}

.hd-hero-top svg {
  width: 1.15em;
  height: 1.15em;
}

.hd-chev {
  margin-left: auto;
  font-size: 1.3em;
  line-height: 1;
  opacity: 0.85;
}

.hd-temp {
  margin: 0.1em 0 0.05em -0.04em;
  font-size: 6.2em;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.hd-hero-line {
  font-size: 1.05em;
}

.hd-hero-line + .hd-hero-line {
  margin-top: 0.55em;
  opacity: 0.9;
}

/* Cards */

.hd-card {
  margin-top: 0.7em;
  padding: 1.1em 1.1em 1.15em;
  border-radius: 1.3em;
  background: var(--surface);
}

.hd-label {
  display: flex;
  align-items: center;
  gap: 0.6em;
  color: var(--text-2);
  font-size: 0.8em;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hd-info {
  display: inline-grid;
  place-items: center;
  width: 1.55em;
  height: 1.55em;
  border: 0.12em solid currentColor;
  border-radius: 50%;
  font-size: 0.95em;
  letter-spacing: 0;
}

/* The heat pump diagram: the app's own drawing, from SystemDiagram.svelte */

.hd-diagram {
  display: block;
  width: 100%;
  margin: 0.7em 0 0.4em;
}

.hd-diagram .pipe {
  fill: none;
  stroke-width: 5;
  stroke-linecap: round;
  transition: stroke 0.6s, opacity 0.6s;
}

.hd-diagram .out {
  stroke: var(--heat-end);
}

.hd-diagram .back {
  stroke: var(--water-end);
}

[data-mode='radiators'] .hd-diagram .rad,
[data-mode='tank'] .hd-diagram .tnk {
  stroke-dasharray: 7 7;
  animation: hd-run var(--flow, 1s) linear infinite;
}

[data-mode='radiators'] .hd-diagram .tnk,
[data-mode='tank'] .hd-diagram .rad {
  stroke: var(--text-2);
  opacity: 0.3;
}

@keyframes hd-run {
  to {
    stroke-dashoffset: -28;
  }
}

.hd-diagram .box {
  fill: var(--raised);
  stroke: var(--text-2);
  stroke-width: 1.5;
}

.hd-diagram .ring {
  fill: none;
  stroke: var(--text-2);
  stroke-width: 1.5;
}

.hd-diagram .fan path {
  fill: var(--text);
}

.hd-diagram .fan {
  transform-origin: 200px 77px;
  animation: hd-spin var(--fan, 1s) linear infinite;
}

@keyframes hd-spin {
  to {
    transform: rotate(360deg);
  }
}

.hd-diagram .radiator {
  fill: var(--raised);
  stroke: var(--text-2);
  stroke-width: 1.5;
  transition: fill 0.6s, stroke 0.6s;
}

.hd-diagram .fins {
  stroke: var(--text-2);
  stroke-width: 1.5;
  transition: stroke 0.6s;
}

[data-mode='radiators'] .hd-diagram .radiator {
  fill: var(--heat-start);
  stroke: var(--heat-end);
}

[data-mode='radiators'] .hd-diagram .fins {
  stroke: var(--heat-end);
}

.hd-diagram .wisps path {
  fill: none;
  stroke: var(--heat-end);
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0;
}

[data-mode='radiators'] .hd-diagram .wisps path {
  animation: hd-rise 2.4s ease-in-out infinite;
}

.hd-diagram .wisps path:nth-child(2) {
  animation-delay: 0.8s;
}

.hd-diagram .wisps path:nth-child(3) {
  animation-delay: 1.6s;
}

@keyframes hd-rise {
  0% {
    opacity: 0;
    transform: translateY(4px);
  }
  40% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    transform: translateY(-8px);
  }
}

.hd-diagram .empty {
  fill: var(--fill);
}

.hd-diagram .water {
  fill: var(--heat-start);
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transform: scaleY(var(--level, 0.725));
  transition: transform 1.4s ease-in-out;
}

.hd-diagram .tank {
  fill: none;
  stroke: var(--text-2);
  stroke-width: 1.5;
}

.hd-diagram .target {
  stroke: var(--text);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
}

.hd-diagram .reading {
  font: 600 20px -apple-system, BlinkMacSystemFont, system-ui, 'Inter Tight', sans-serif;
  fill: var(--text);
  paint-order: stroke;
  stroke: var(--raised);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.hd-figs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35em 1.2em;
}

.hd-figs + .hd-figs {
  margin-top: 0.6em;
}

.hd-figs div {
  min-width: 4.5em;
}

.hd-figs dt {
  color: var(--text-2);
  font-size: 0.82em;
}

.hd-figs dd {
  font-size: 1.18em;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.hd-figs .hd-out {
  color: var(--heat-end);
}

.hd-figs .hd-back {
  color: var(--water-end);
}

.hd-words {
  margin-top: 0.6em !important;
  font-size: 0.82em;
  line-height: 1.4;
}

.hd-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7em;
}

.hd-pair .hd-card {
  padding-top: 1.3em;
}

.hd-pair .hd-big {
  margin-top: 0.4em;
  color: var(--accent);
  font-size: 1.18em;
  font-weight: 600;
}

/* The tab bar */

.hd-tabs {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: 6.3em;
  padding-top: 0.6em;
  border-top: 1px solid rgb(84 84 88 / 0.6);
  background: rgb(22 22 23 / 0.94);
  color: var(--text-2);
  font-size: 0.78em;
  text-align: center;
}

.hd-tabs span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25em;
}

.hd-tabs svg {
  width: 2.1em;
  height: 2.1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hd-tabs .on {
  color: var(--accent);
}

/* Control */

.hd-screen .hd-section {
  margin: 1.4em 0 0.45em 0.94em;
  color: var(--text-2);
  font-size: 0.88em;
  text-transform: uppercase;
}

.hd-screen .hd-head + .hd-section {
  margin-top: 1em;
}

.hd-group {
  overflow: hidden;
  border-radius: 0.75em;
  background: var(--surface);
}

.hd-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75em;
  min-height: 2.94em;
  padding: 0.4em 0.94em;
  transition: background-color 0.5s;
}

.hd-row + .hd-row::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 3.6em;
  border-top: 1px solid rgb(84 84 88 / 0.6);
}

.hd-row.hd-tap {
  background: #3a3a3c;
  transition: none;
}

.hd-tone {
  display: grid;
  flex: none;
  place-items: center;
  width: 1.76em;
  height: 1.76em;
  border-radius: 0.42em;
  color: #fff;
}

.hd-tone svg {
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hd-tone.heat {
  background: linear-gradient(135deg, var(--heat-start), var(--heat-end));
}

.hd-tone.water {
  background: linear-gradient(135deg, #32ade6, #007aff);
}

.hd-tone.grey {
  background: #8e8e93;
}

.hd-tone.cool {
  background: #30b0c7;
}

.hd-tone.light {
  background: #ffcc00;
  color: #1c1c1e;
}

.hd-tone.green {
  background: #34c759;
}

.hd-row-name {
  flex: none;
}

.hd-row-value {
  margin-left: auto;
  color: var(--text-2);
  font-size: 0.94em;
  text-align: right;
  white-space: nowrap;
}

.hd-row-value.hd-changed {
  animation: hd-fade-in 0.5s ease-out;
}

@keyframes hd-fade-in {
  from {
    opacity: 0;
  }
}

.hd-row::after {
  content: '›';
  color: rgb(152 152 159 / 0.7);
  font-size: 1.2em;
}

/* Reports */

.hd-seg {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 1em;
  padding: 0.2em;
  border-radius: 0.6em;
  background: var(--surface);
  font-weight: 500;
  text-align: center;
}

.hd-seg::before {
  content: '';
  position: absolute;
  top: 0.2em;
  bottom: 0.2em;
  left: 0.2em;
  width: calc(50% - 0.2em);
  border-radius: 0.45em;
  background: var(--raised);
  transition: transform 0.35s ease;
}

.hd-seg[data-period='year']::before {
  transform: translateX(100%);
}

.hd-seg span {
  position: relative;
  padding: 0.45em 0;
}

.hd-picker {
  display: flex;
  align-items: center;
  gap: 0.6em;
  margin-top: 0.7em;
}

.hd-round {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.6em;
  height: 2.6em;
  border-radius: 50%;
  background: var(--surface);
  font-size: 1em;
}

.hd-round.dim {
  color: rgb(152 152 159 / 0.4);
}

.hd-month {
  flex: 1;
  padding: 0.75em;
  border: 1px solid rgb(152 152 159 / 0.5);
  border-radius: 0.75em;
  font-weight: 600;
  text-align: center;
}

.hd-cop-card {
  margin-top: 0.7em;
  padding: 1em 1.1em 1.15em;
  border-radius: 1.3em;
  background: var(--surface);
}

.hd-muted {
  color: var(--text-2);
}

.hd-cop-card .hd-cop {
  margin: 0.05em 0 0.1em -0.03em;
  font-size: 4.7em;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.hd-cop-card p + p {
  margin-top: 0.5em;
}

.hd-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7em;
  margin-top: 0.7em;
}

.hd-tile {
  padding: 1em 1em 1.1em;
  border-radius: 1.1em;
  background: var(--surface);
}

.hd-tile p {
  font-size: 0.8em;
}

.hd-tile .hd-num {
  margin: 0.35em 0;
  font-size: 1.3em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Teletext */

.hd-tt {
  --text: #fff;
  --text-2: #0ff;
  --surface: #000;
  --raised: #000;
  --fill: #00f;
  --heat-start: #f00;
  --heat-end: #f00;
  --water-end: #0ff;
  font-family: 'VT323', ui-monospace, Menlo, monospace;
  font-size: calc(100cqw * 17 / 390 * 1.2);
  line-height: 1.25;
}

.hd-tt-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.95em;
}

.hd-tt-top .y {
  color: #ff0;
}

.hd-tt-q {
  display: grid;
  place-items: center;
  width: 1.75em;
  height: 1.75em;
  background: #00f;
  color: #ff0;
  font-size: 1.1em;
}

.hd-tt-greet {
  display: inline-block;
  margin-top: 0.15em;
  padding: 0.25em 0.4em;
  background: #00f;
  color: #ff0;
  font-size: 1.65em;
}

.hd-tt-pill {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 0.45em;
  margin-top: 0.4em;
  padding: 0.35em 0.6em;
  background: #00f;
  color: #0ff;
  font-size: 0.8em;
}

.hd-tt-pill .hd-dot {
  background: #0f0;
}

.hd-tt-hero {
  margin-top: 0.9em;
  padding: 1em 1em 1.1em;
  background: #f00;
  color: #000;
}

.hd-tt-hero .hd-temp {
  font-size: 4.8em;
  line-height: 1;
}

.hd-tt-bar {
  margin-top: 0.6em;
  padding: 0.15em 0.5em;
  background: #0ff;
  color: #000;
  font-size: 1.05em;
}

.hd-tt .hd-system {
  padding: 0 0.6em;
}

.hd-tt .hd-diagram .reading {
  font-family: 'VT323', ui-monospace, monospace;
  font-size: 24px;
  font-weight: 400;
}

.hd-tt .hd-figs dd {
  font-weight: 400;
}

.hd-tt-tabs {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 4.3em;
  border-top: 1px solid #00f;
  background: #000;
  font-size: 1em;
}

.hd-tt-tabs .now {
  padding: 0 0.15em;
  background: #f00;
  color: #000;
}

/* Hold still offscreen, and for anyone who has asked for less motion */

.hd-phone.hd-paused *,
.hd-phone.hd-paused *::before {
  animation-play-state: paused !important;
}

@media (prefers-reduced-motion: reduce) {
  .hd-phone *,
  .hd-phone *::before {
    animation: none !important;
    transition: none !important;
  }

  [data-mode='radiators'] .hd-diagram .wisps path {
    opacity: 0.6;
  }
}
