/* hive: comb's control page. Stacks are a honeycomb that fills with honey
   while comb is awake and turns to wax while it sleeps. Dark only. */
:root {
  color-scheme: dark;
  --ground: #15120d;
  --line: #2a231a;
  --line-strong: #3e3527;
  --wax: #2e261b;
  --text: #efe7d8;
  --text-2: #cfc3ae;
  --muted: #a89b84;
  --honey: #eba53a;
  --honey-light: #f3c27a;
  --honey-ink: #1d1404;
  --danger: #ff8a7a;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
::selection {
  background: var(--honey);
  color: var(--ground);
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 420px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 24px;
}

button {
  font: inherit;
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.55;
}
:focus-visible {
  outline: 2px solid var(--honey);
  outline-offset: 2px;
}
a {
  color: var(--honey-light);
}

h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}
.meta {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
}

/* Header */
.top {
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.brand svg {
  width: 20px;
  height: 20px;
}
.logo-cell {
  fill: transparent;
  transition: fill 0.4s;
}
[data-state='awake'] .logo-cell {
  fill: var(--honey);
}

/* Machine line */
.machine {
  padding: 12px 14px;
  border: 1px solid #2e271d;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.machine-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.state {
  margin: 0;
  font-weight: 600;
}
.action {
  height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
}
.action.wake {
  border: 0;
  background: var(--honey);
  color: var(--honey-ink);
}
#action-error {
  margin: -12px 0 0;
  color: var(--danger);
  font-size: 13px;
}

/* Status mark: three cells that glow in a wave while comb is up. */
.mark {
  position: relative;
  width: 26px;
  height: 26px;
  flex: none;
}
.mark span {
  position: absolute;
  width: 12px;
  height: 13.86px;
  background: #4a3e2c;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  transition: background 0.3s;
}
.mark span:nth-child(1) {
  left: 6.75px;
  top: 0;
}
.mark span:nth-child(2) {
  left: 0;
  top: 11.7px;
}
.mark span:nth-child(3) {
  left: 13.5px;
  top: 11.7px;
}
.mark.live span {
  background: var(--honey);
  animation: wave 2.4s ease-in-out infinite;
}
.mark.waking span {
  background: var(--honey-light);
  animation: wave 0.8s ease-in-out infinite;
}
.mark span:nth-child(2) {
  animation-delay: 0.2s;
}
.mark span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes wave {
  0%,
  100% {
    opacity: 0.35;
  }
  40% {
    opacity: 1;
  }
}

/* The comb: one cell per service, coloured per stack. */
.comb {
  position: relative;
  margin: 0 auto;
}
.cell {
  position: absolute;
  width: 66px;
  height: 76.2px;
  background: var(--wax);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  padding: 0 3px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
}
.cell-fill,
.cell-sheen {
  position: absolute;
  inset: 0;
  display: none;
}
.cell-name,
.cell-tag {
  position: relative;
}
.cell-name {
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.15;
}
.cell-tag {
  font-size: 9px;
  opacity: 0.8;
}
[data-state='awake'] .cell {
  color: var(--honey-ink);
}
[data-state='awake'] .cell-fill {
  display: block;
  background: var(--c);
  animation: fill 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
[data-state='awake'] .cell-sheen {
  display: block;
  background: linear-gradient(115deg, rgb(255 236 190 / 0) 35%, rgb(255 236 190 / 0.38) 50%, rgb(255 236 190 / 0) 65%);
  background-size: 320% 100%;
  background-position: 100% 0;
  animation: sheen 7s linear infinite;
}
@keyframes fill {
  from {
    clip-path: inset(100% 0 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}
@keyframes sheen {
  0%,
  72% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0% 0;
  }
}

/* Activity */
.days {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.day {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
}
.track {
  position: relative;
  height: 12px;
  border-radius: 3px;
  background: #221c15;
}
.track span {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 3px;
  background: var(--honey);
}
.axis {
  display: flex;
  justify-content: space-between;
  padding: 6px 0 4px 80px;
  font-size: 11px;
  color: var(--muted);
}
.events {
  list-style: none;
  margin: 0;
  padding: 0;
}
.events li {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.events time {
  width: 92px;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.events span {
  display: flex;
  align-items: center;
  gap: 8px;
}
.events span::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6e6352;
}
.events .woke::before {
  background: var(--honey);
}

/* Automation switches */
.switch {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}
.switch > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.switch input {
  width: 20px;
  height: 20px;
  flex: none;
  accent-color: var(--honey);
}

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