/* Hallmark · shape: app screen · genre: editorial · theme: Garden (deal 3/3, seed indoor-plant-light-meter-4773·6f5f75af·2026-11-24·r0)
 * nav: name, spot, thumb dock · signature: the band ring · states: empty, reading, saved, error
 * axes: light/roman-serif/chromatic-green · posture: committed · contrast: pass · v2.0.0 */
/* Hallmark · pre-emit critique: P5 H5 E5 S5 R5 V4 · weakest: E, the empty state must not borrow the number's size */
/* Hallmark · answered F4 · measure is the one filled control */
/* Hallmark · answered F6 · the lux figure is the only display type, and only after a reading */

@import url("./tokens.css");
@import url("./base.css");

:root { --dock: 8.25rem; --safe-b: env(safe-area-inset-bottom, 0px); --ring: 10.5rem; }

html, body { height: 100%; overflow: hidden; }
body {
  color: var(--color-ink-2);
  min-height: 100dvh;
  background: var(--color-paper);
}

.skip {
  position: absolute;
  left: var(--space-md);
  top: calc(-1 * var(--space-3xl));
  z-index: var(--z-toast);
  padding: var(--space-xs) var(--space-md);
  background: var(--color-ink);
  color: var(--color-paper-2);
}
.skip:focus-visible { top: var(--space-md); }

.top, main, .dock { width: 100%; margin-inline: auto; }

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  padding: max(var(--space-lg), env(safe-area-inset-top)) var(--space-sm) 0;
}
.word {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-lg);
  color: var(--color-ink);
}
.where { margin: 0; font-size: var(--text-sm); color: var(--color-muted); }

main {
  height: calc(100dvh - 4.5rem);
  overflow: hidden;
  padding: 0 0 calc(var(--dock) + var(--safe-b));
  display: grid;
}

.screen {
  grid-area: 1 / 1;
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding-bottom: var(--space-sm);
  scrollbar-width: thin;
  opacity: 1;
  transform: none;
  transition: opacity 280ms var(--ease-out), transform 320ms var(--ease-out);
}
.screen[hidden] {
  display: block !important;
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
  transform: translateY(12px);
}
.screen[data-screen="read"] {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: 0 0 var(--space-sm);
  overflow: hidden;
}
.screen[data-screen="read"][hidden] { display: flex !important; }
.screen[data-screen="plant"] {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-content: start;
  padding-bottom: var(--space-lg);
  overflow: auto;
}
/* Pan rail: sideways travel is the range of plants. Native overflow is the
   control, the same floor scroll-craft uses when motion is reduced. */
.stage {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  align-items: end;
  margin-inline: 0;
  overflow: hidden;
}
.rail {
  display: flex;
  align-items: stretch;
  gap: 0;
  height: 100%;
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 7%;
  touch-action: pan-x;
  padding-inline: 7%;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.rail::-webkit-scrollbar { display: none; }
.rail:focus-visible { outline: 2px solid var(--color-focus); outline-offset: -2px; }
.rail.is-dragging { scroll-snap-type: none; }
.plant-card {
  flex: 0 0 86%;
  min-width: 0;
  scroll-snap-align: center;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  overflow: visible;
  --near: 0;
}
.plant-card img {
  /* Height is a share of the stage, so a taller phone grows the plant with it. */
  width: auto;
  height: 94%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  object-position: center bottom;
  pointer-events: none;
  transform-origin: center bottom;
  opacity: calc(0.42 + var(--near) * 0.58);
  transition: height 280ms var(--ease-out), opacity 220ms var(--ease-out);
}
.plant-card:active img { transform: scale(0.97); }
.screen[data-has-reading] .stage { display: none; }

.intro { display: grid; gap: var(--space-xs); padding-inline: var(--space-md); }
.name-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); }
.info {
  flex: 0 0 auto;
  width: 1.75rem;
  height: 1.75rem;
  min-height: 1.75rem;
  border: var(--rule-hair) solid var(--color-rule-2);
  border-radius: 50%;
  background: transparent;
  color: var(--color-muted);
  font: 600 0.72rem/1 var(--font-display);
  cursor: pointer;
  transition: transform 180ms var(--ease-out), background 180ms var(--ease-out);
}
.info:active { transform: scale(0.94); background: var(--color-paper-3); }
.for {
  margin: 0;
  font-size: var(--text-2xl);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--color-ink);
  transition: opacity 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.for.is-changing { opacity: 0.35; transform: translateY(4px); }
.need { margin: 0; max-width: 26ch; }
.bands {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xs);
  margin: var(--space-md) 0 0;
  padding: 0;
  list-style: none;
}
dialog.sheet {
  width: min(28rem, 100%);
  max-height: min(70dvh, 100%);
  margin: auto auto 0;
  border: 0;
  border-radius: 1.25rem 1.25rem 0 0;
  padding: var(--space-lg) var(--space-lg) calc(var(--space-lg) + var(--safe-b));
  transform: translateY(110%);
  opacity: 0;
  transition: transform 420ms var(--ease-out), opacity 280ms var(--ease-out), overlay 420ms allow-discrete, display 420ms allow-discrete;
}
dialog.sheet[open] { transform: none; opacity: 1; }
@starting-style {
  dialog.sheet[open] { transform: translateY(110%); opacity: 0; }
}
dialog.sheet[open].is-closing {
  transform: translateY(110%);
  opacity: 0;
}
dialog.sheet::backdrop {
  background: color-mix(in oklab, var(--color-ink) 36%, transparent);
  opacity: 0;
  transition: opacity 360ms var(--ease-out), overlay 360ms allow-discrete, display 360ms allow-discrete;
}
dialog.sheet[open]::backdrop { opacity: 1; }
@starting-style { dialog.sheet[open]::backdrop { opacity: 0; } }
dialog.sheet[open].is-closing::backdrop { opacity: 0; }
dialog.sheet form { display: flex; flex-direction: column; min-width: 0; }
dialog.sheet menu {
  margin-top: var(--space-lg);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-xs);
  width: 100%;
}
dialog.sheet menu button {
  display: block;
  box-sizing: border-box;
  width: 100%;
  max-width: none;
  flex: 0 0 auto;
  min-height: 48px;
  border-radius: var(--radius-pill);
  text-align: center;
}
dialog.sheet p + p { margin-top: var(--space-sm); }
dialog.sheet .field { margin-inline: 0; }
dialog.sheet .help { margin-inline: 0; }
.bands li {
  padding: var(--space-sm);
  border-radius: 12px;
  background: var(--color-paper-2);
  color: var(--color-ink);
  font-size: var(--text-sm);
}
.bands li:nth-child(3) { background: var(--tint-moss); }
.screen[data-has-reading] .intro { display: none; }

.ring {
  width: var(--ring);
  transition: background var(--dur-short) var(--ease-out);
  height: var(--ring);
  margin: 0 auto var(--space-xl);
  border-radius: 50%;
  background: conic-gradient(var(--color-accent) calc(var(--fill, 0) * 1%), var(--color-paper-3) 0);
  display: grid;
  place-items: center;
}
.ring span {
  width: calc(var(--ring) - 2.25rem);
  height: calc(var(--ring) - 2.25rem);
  border-radius: 50%;
  background: var(--color-paper);
}

.lux {
  margin: 0 var(--space-md);
  min-height: 1.05em;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-lead);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--color-ink);
  max-width: 16ch;
}
.lux[data-value] {
  font-size: var(--text-display);
  line-height: 0.9;
  letter-spacing: var(--tracking-display);
  font-variant-numeric: tabular-nums;
  max-width: none;
}
.unit { margin: var(--space-xs) var(--space-md) 0; font-size: var(--text-sm); color: var(--color-muted); }
.band {
  margin: var(--space-md) var(--space-md) 0;
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--color-ink);
}
.verdict { margin: var(--space-xs) var(--space-md) 0; max-width: 32ch; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: var(--space-sm) var(--space-md) 0;
  border-top: var(--rule-hair) solid var(--color-rule);
}
.stats:not(:has(dd:not(:empty))) { display: none; }
.stats div { padding: var(--space-sm) 0 0; }
.stats div + div { padding-left: var(--space-sm); border-left: var(--rule-hair) solid var(--color-rule); }
.stats dt { font-size: var(--text-sm); color: var(--color-muted); font-weight: 400; }
.stats dd {
  margin: var(--space-3xs) 0 0;
  font-size: var(--text-xl);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-ink);
  min-height: 1.2em;
}

.fit {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-md);
  margin: 0 var(--space-md);
}
.fit p { margin: 0; }
.fit p + p { color: var(--color-muted); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }

.status {
  margin: 0 var(--space-md) var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-card);
  background: var(--tint-clay);
  color: var(--color-ink);
}
.status[data-tone="ok"] { background: var(--tint-moss); }
.status[data-tone="bad"] { background: color-mix(in oklab, var(--color-error) 16%, var(--color-paper)); }

.field, .choice { display: grid; gap: var(--space-2xs); margin: var(--space-sm) var(--space-md) 0; }
.field span, .choice legend { font-size: var(--text-sm); color: var(--color-muted); }
.choice { border: 0; padding: 0; }
.choice label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 44px;
  color: var(--color-ink);
}
input, select {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--space-md);
  border: var(--rule-hair) solid var(--color-rule-2);
  border-radius: 12px;
  background: var(--color-paper-2);
  color: var(--color-ink);
  font: 400 var(--text-md)/1 var(--font-body);
}
.choice input { width: 1.15rem; height: 1.15rem; min-height: 0; padding: 0; accent-color: var(--color-accent-2); }
input:focus-visible, select:focus-visible, button:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}
input:disabled, select:disabled, button:disabled { opacity: 0.45; cursor: not-allowed; }
.help { margin: var(--space-sm) var(--space-md) 0; font-size: var(--text-sm); color: var(--color-muted); }
.help:empty { display: none; }

.plant-actions {
  display: grid;
  gap: 0;
  margin-top: var(--space-md);
  padding-bottom: var(--space-sm);
}

.spots { list-style: none; margin: var(--space-md) 0 0; padding: 0 var(--space-md); }
.spots li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-sm);
  align-items: center;
  min-height: 72px;
  border-top: var(--rule-hair) solid var(--color-rule);
}

.spots h2 { margin: 0; font-size: var(--text-lg); font-weight: 600; }
.spots p { margin: var(--space-3xs) 0 0; font-size: var(--text-sm); color: var(--color-muted); }
.spots b { font-size: var(--text-xl); font-variant-numeric: tabular-nums; }
.screen[data-screen="spots"] { display: flex; flex-direction: column; overflow: hidden; }
.screen[data-screen="spots"][hidden] { display: flex !important; }
.screen[data-screen="spots"]:has(#spot-empty:not([hidden])) { overflow: hidden; }
.screen[data-screen="spots"]:has(#spot-list li) { overflow: auto; }
.empty {
  display: grid;
  align-content: end;
  justify-items: center;
  text-align: center;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 var(--space-md) var(--space-lg);
}
.empty img {
  width: auto;
  height: auto;
  max-height: min(42dvh, 100%);
  max-width: min(92%, 28rem);
  object-fit: contain;
  object-position: center bottom;
  margin-bottom: var(--space-md);
}
.empty h1 { font-size: var(--text-2xl); max-width: 12ch; margin-bottom: var(--space-sm); }

.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-sticky-nav);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-sm) calc(var(--space-sm) + var(--safe-b));
  background: var(--color-paper-2);
  border-top: var(--rule-hair) solid var(--color-rule);
}
.tabs { display: flex; grid-column: 1 / -1; gap: var(--space-2xs); }
.tabs button, .quiet, .textish, .save, .go {
  min-height: 48px;
  border: 0;
  background: transparent;
  color: var(--color-ink-2);
  font: 500 var(--text-sm)/1 var(--font-body);
  cursor: pointer;
}
.tabs button {
  flex: 1;
  border-radius: var(--radius-pill);
  color: var(--color-muted);
  transition: background 220ms var(--ease-out), color 220ms var(--ease-out);
}
.tabs button[aria-selected="true"] { color: var(--color-ink); background: var(--color-paper-3); }
.go, #calib-save {
  background: var(--color-accent);
  color: var(--color-accent-ink);
  border-radius: var(--radius-pill);
  padding: 0 var(--space-lg);
  font-size: var(--text-md);
  font-weight: 600;
}
.save { padding: 0 var(--space-sm); color: var(--color-ink); }
.textish {
  margin: 0 var(--space-md);
  padding: 0;
  min-height: 44px;
  text-decoration: underline;
  text-underline-offset: 0.16em;
  text-decoration-color: var(--color-accent-2);
  color: var(--color-ink);
}
.tabs button:active, .quiet:active, .save:active, .go:active, .textish:active { opacity: 0.72; }
.tabs button:disabled, .save:disabled, .go:disabled { opacity: 0.4; cursor: not-allowed; }

dialog {
  width: min(24rem, calc(100% - 2 * var(--space-md)));
  border: 0;
  border-radius: var(--radius-card);
  background: var(--color-paper-2);
  color: var(--color-ink);
  padding: var(--space-lg);
}
dialog::backdrop { background: color-mix(in oklab, var(--color-ink) 42%, transparent); }
dialog h2 { margin-bottom: var(--space-xs); font-size: var(--text-xl); }
dialog menu { gap: var(--space-xs); margin: var(--space-lg) 0 0; padding: 0; }
dialog .go { border: 0; }

@media (min-width: 60rem) {
  body { background: var(--color-paper-3); }
  .top, main, .dock { width: min(28rem, 100%); }
  main { background: var(--color-paper); }
}

@media (prefers-reduced-motion: reduce) {
  .ring { background: var(--color-paper-3); }
  .ring[data-fill] { background: var(--color-accent); }
  .plant-card img, .for, .screen, dialog.sheet, dialog.sheet::backdrop { transform: none; transition: none; animation: none; }
  .screen[hidden] { opacity: 0; }
  .rail { scroll-snap-type: x proximity; }
}
