/* The app, on the page.
 *
 * The phone is a faithful copy of the product's screens, so its palette is the
 * app's own light one and does not follow the site's theme -- a phone that
 * changed colour with the visitor's system setting would stop being a phone.
 * Everything outside the bezel uses the site tokens. */

#app [hidden] {
  display: none !important;
}

.app-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.75rem, 4vw, 3rem);
  align-items: center;
  justify-items: center;
  margin-top: 2rem;
}

@media (min-width: 62rem) {
  .app-grid {
    grid-template-columns: 352px minmax(0, 1fr);
    justify-items: stretch;
    align-items: center;
  }
}

/* ---------------------------------------------------------------- phone */

.phone {
  width: 352px;
  max-width: 100%;
  border-radius: 40px;
  padding: 11px;
  background: linear-gradient(160deg, #34383f, #0e1013 55%, #202329);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, 0.06) inset,
    0 50px 90px -50px rgba(0, 0, 0, 0.95);
}

.screen {
  position: relative;
  background: #f4f6f8;
  border-radius: 30px;
  overflow: hidden;
  color: #141f2a;
  display: flex;
  flex-direction: column;
  height: 640px;
}

.st-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: #141f2a;
  font-variant-numeric: tabular-nums;
}

.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 16px 12px;
  background: #fff;
}

.app-bar .who {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.app-bar img {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex: none;
}

.app-bar .who b {
  font-family: var(--display);
  font-size: 14.5px;
  letter-spacing: -0.01em;
}

.app-bar .who small {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  color: #7a8593;
  letter-spacing: 0.04em;
}

.conn {
  font-family: var(--mono);
  font-size: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid #cbd3dc;
  color: #33414f;
  background: #f1f4f7;
  white-space: nowrap;
}

.conn i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #98a2ae;
  display: block;
}

.conn.running {
  color: #0b6d3b;
  border-color: rgba(14, 138, 74, 0.35);
  background: rgba(14, 138, 74, 0.08);
}

.conn.running i {
  background: #0e8a4a;
}

.conn.waiting {
  color: #8a6518;
  border-color: rgba(201, 150, 47, 0.5);
  background: rgba(201, 150, 47, 0.12);
}

.conn.waiting i {
  background: #c9962f;
}

/* The pulse is the one thing on the phone that moves on its own: it is the
   screen saying the connection is live, which no static pill can say. */
.motion .conn.running i {
  animation: beat 2.4s ease-out infinite;
}

.motion .conn.waiting i {
  animation: beat 0.9s ease-out infinite;
}

@keyframes beat {
  0% {
    box-shadow: 0 0 0 0 currentColor;
  }
  70%,
  100% {
    box-shadow: 0 0 0 6px rgba(0, 0, 0, 0);
  }
}

.tabs {
  display: flex;
  background: #fff;
  border-bottom: 1px solid #e3e7ec;
}

.tabs button {
  flex: 1;
  appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 11px 4px 9px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  color: #7a8593;
  transition:
    color 0.16s,
    border-color 0.16s;
}

.tabs button[aria-selected="true"] {
  color: #141f2a;
  border-bottom-color: var(--brass-lit);
  font-weight: 600;
}

.tabs button:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: -2px;
}

.badge {
  display: inline-block;
  margin-left: 5px;
  min-width: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #d8402f;
  color: #fff;
  font-size: 9.5px;
  line-height: 15px;
  font-weight: 600;
}

.panes {
  flex: 1;
  overflow-y: auto;
  background: #f4f6f8;
  padding: 12px 13px 18px;
}

.screen .card {
  background: #fff;
  border: 1px solid #e3e7ec;
  border-radius: 14px;
  padding: 13px;
  margin: 0 0 10px;
}

.screen .card h4 {
  margin: 0 0 9px;
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  color: #7a8593;
  font-weight: 500;
}

.motor-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.motor-state {
  font-family: var(--display);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.motor-state.on {
  color: #0e8a4a;
}

.motor-state.off {
  color: #5a6672;
}

.motor-state.wait {
  color: #8a6518;
}

.motor-sub {
  font-family: var(--mono);
  font-size: 10.5px;
  color: #7a8593;
  margin-top: 2px;
}

.pump {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 21px;
  background: #f1f4f7;
  border: 1px solid #e3e7ec;
  flex: none;
  transition:
    background 0.25s,
    border-color 0.25s;
}

.pump.on {
  background: rgba(14, 138, 74, 0.09);
  border-color: rgba(14, 138, 74, 0.3);
}

.pump .glyph {
  display: block;
  line-height: 1;
}

.motion .pump.on .glyph {
  animation: turn 7s linear infinite;
}

.pump.wait {
  background: rgba(201, 150, 47, 0.12);
  border-color: rgba(201, 150, 47, 0.4);
}

@keyframes turn {
  to {
    transform: rotate(360deg);
  }
}

.kv {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.kv .cell {
  background: #f7f9fb;
  border: 1px solid #e9edf1;
  border-radius: 10px;
  padding: 8px 9px;
  text-align: center;
}

.kv .cell .p {
  font-family: var(--mono);
  font-size: 9.5px;
  color: #7a8593;
  letter-spacing: 0.06em;
}

.kv .cell .n {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.limit-note {
  font-family: var(--mono);
  font-size: 10px;
  color: #7a8593;
  margin-top: 7px;
  text-align: right;
}

.ctl-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ctl-note {
  font-family: var(--mono);
  font-size: 10.5px;
  color: #7a8593;
  margin-top: 8px;
  line-height: 1.5;
  min-height: 2.6em;
}

.btn {
  appearance: none;
  border: 1px solid #cbd3dc;
  background: #fff;
  color: #141f2a;
  border-radius: 10px;
  padding: 10px 13px;
  min-height: 2.75rem;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--body);
  transition:
    transform 0.12s,
    filter 0.16s,
    opacity 0.16s;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn:focus-visible {
  outline: 2px solid var(--brass-lit);
  outline-offset: 2px;
}

.btn-on {
  background: #0e8a4a;
  border-color: #0e8a4a;
  color: #fff;
}

.btn-off {
  background: #c2321f;
  border-color: #c2321f;
  color: #fff;
}

.settings {
  margin: 0;
  display: grid;
  gap: 8px;
}

.settings > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.settings dt {
  font-size: 12px;
  color: #5a6672;
}

.settings dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 11.5px;
  color: #141f2a;
  text-align: right;
}

.pane-note {
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.6;
  color: #7a8593;
  margin: 0;
  max-width: none;
}

.log {
  display: grid;
  gap: 8px;
}

.log .ev {
  display: grid;
  grid-template-columns: 2.9rem 1fr;
  gap: 8px;
  font-size: 11.5px;
  line-height: 1.45;
  color: #33414f;
}

.log .at {
  font-family: var(--mono);
  font-size: 10.5px;
  color: #98a2ae;
  font-variant-numeric: tabular-nums;
}

.log .ev.alarm {
  color: #c2321f;
}

.log .ev.warn {
  color: #8a6518;
}

.motion .log .ev.fresh {
  animation: land 0.45s ease-out;
}

@keyframes land {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

/* ------------------------------------------------------ beside the phone */

.app-side {
  display: grid;
  gap: 1.6rem;
  align-content: center;
  width: 100%;
  min-width: 0;
  max-width: 34rem;
}

.app-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.05rem;
}

.app-points li {
  position: relative;
  margin: 0;
  padding-left: 2.35rem;
}

.app-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.15rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 8px;
  background: var(--brass-wash);
  border: 1px solid rgba(201, 150, 47, 0.35);
}

.app-points li::after {
  content: "";
  position: absolute;
  left: 0.52rem;
  top: 0.62rem;
  width: 0.42rem;
  height: 0.22rem;
  border-left: 2px solid var(--brass);
  border-bottom: 2px solid var(--brass);
  transform: rotate(-45deg);
}

.app-points b {
  display: block;
  font-family: var(--display);
  font-size: 1.02rem;
  color: var(--ink);
  letter-spacing: -0.008em;
}

.app-points span {
  display: block;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ink-mid);
  margin-top: 0.1rem;
}

/* ------------------------------------------------------------ the stores */

.stores {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.store {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 1rem 0.6rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  position: relative;
}

.store svg {
  width: 1.6rem;
  height: 1.6rem;
  flex: none;
}

.store .t {
  display: grid;
  line-height: 1.15;
}

.store .t small {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  color: var(--brass);
}

.store .t b {
  font-family: var(--display);
  font-size: 0.98rem;
  letter-spacing: -0.01em;
}

.stores-note {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin: -0.9rem 0 0;
}
