/* HUA HUA: layout only. Every colour, face, corner and shadow is a Kaleidoscope token from the LNK
   lens (kit/lens-lnk.css). The only other colours on the page are each plant's own sky, computed by
   LNK Light and set from data (--sky-z, --sky-h), the way a photo's pixels are its own. */

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--f-ui);
  font-feature-settings: "liga" 1, "calt" 1;
}

.hua-mark, .hua-mark-inline {
  font-family: "LNK Mark", var(--f-ui);
  font-feature-settings: "liga" 1;
  color: var(--ink);
  text-decoration: none;
}
.hua-mark { font-size: 48px; line-height: 1; }

.hua-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 24px;
  align-items: end;
  padding: 48px max(16px, 5vw) 24px;
}
.hua-title h1 {
  margin: 0;
  font-family: var(--f-voice);
  font-weight: 300;
  font-size: 64px;
  line-height: 1;
  letter-spacing: -0.02em;
}
.hua-title h1 span { color: var(--light); font-weight: 400; margin-left: 8px; }
.hua-sub { margin: 4px 0 0; color: var(--ink-3); }
.hua-line { grid-column: 1 / -1; margin: 16px 0 0; max-width: 40em; color: var(--ink-2); font-size: 20px; line-height: 28px; }

main { padding: 0 max(16px, 5vw) 48px; }

/* the garden: one flower head of a life */
.hua-garden { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px 48px; align-items: start; }
.hua-garden-stage { position: relative; grid-column: 1 / -1; }
/* a grid item's minimum is its content's: without this, the scene's canvas (sized in device pixels)
   props its column open and the page scrolls sideways on a phone */
.hua-garden > * { min-width: 0; }
.hua-garden-side { grid-column: 1 / -1; }
.hua-garden .hua-legend { grid-column: 1 / -1; max-width: none; columns: 2 320px; column-gap: 48px; }
.hua-garden .hua-legend p { margin-top: 0; break-inside: avoid; }
.hua-scene, .hua-garden-stage canvas#tree { width: 100%; aspect-ratio: 16 / 10; }
/* Reserve 224px for the header, 24px to the switch, and 72px for the switch and its quiet WebGL line.
   The small viewport keeps phone toolbars from covering the switch; older browsers use vh. Never under 240px: a
   phone on its side is barely taller than the reserve, and there the page scrolls to the switch instead. */
.hua-scene, .hua-garden-stage canvas#tree, .hua-garden-stage canvas#garden {
  max-height: max(240px, calc(100vh - 320px));
  max-height: max(240px, calc(100svh - 320px));
}
/* every way to see the garden stands in one place, one shown at a time; when the garden takes the rings' place it is
   put under them, and they fade out over it */
.hua-garden-stage { display: grid; }
.hua-garden-stage > .hua-view { grid-area: 1 / 1; }
.hua-garden-stage canvas#tree {
  display: block;
  background: var(--ground);
  border-radius: var(--r3);
  touch-action: pan-y;
  cursor: grab;
  outline: none;
  transition: opacity var(--d-fade) var(--ease);
}
.hua-garden-stage canvas#tree:active { cursor: grabbing; }
.hua-garden-stage canvas#tree:focus-visible { box-shadow: var(--focus); }
.hua-garden-stage canvas#tree.hua-fading { opacity: 0; }  /* a press while they fade is still on the rings, and keeps them */
.hua-garden-stage canvas#tree[hidden] { display: none; }
.hua-scene[hidden] { display: none; }
.hua-3d-scene { display: block; width: 100%; max-width: 100%; height: 100%; touch-action: none; cursor: grab; border-radius: var(--r3); }
.hua-garden-stage canvas#garden {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  touch-action: manipulation;
  border-radius: var(--r3);
  background: radial-gradient(circle at 50% 50%, var(--stage-light), var(--ground) 70%);
}
.hua-garden-stage canvas#garden[hidden] { display: none; }
.hua-garden-now {
  position: absolute;
  left: 16px;
  bottom: 12px;
  margin: 0;
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--ink-3);
  pointer-events: none;
}
/* how to see the garden, and whether to hear it: one row that wraps on a phone */
.hua-garden-side { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.hua-garden-side > g-segmented-control { min-width: 0; }
.hua-garden-side > .hua-count { flex-basis: 100%; margin: 0; line-height: var(--lh-xs); }
.hua-listen[hidden] { display: none; }
.hua-every { margin: 48px 0 0; font-family: var(--f-voice); font-weight: 300; font-size: 32px; }

.hua-legend { max-width: 44em; color: var(--ink-3); line-height: 24px; }
.hua-legend b { color: var(--light); font-weight: 500; }
.hua-legend a { color: var(--ink-2); text-underline-offset: 3px; }
.hua-count { color: var(--ink-4); font-family: var(--f-mono); font-size: 12px; }

.hua-sort { margin: 24px 0; }
.hua-card:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.hua-field {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 4 260px;
  column-gap: 16px;
}
.hua-field > li { break-inside: avoid; margin: 0 0 16px; }

.hua-card {
  display: block;
  width: 100%;
  padding: 0;
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r2);
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.hua-sky {
  display: block;
  padding: 12px;
  background: linear-gradient(180deg, var(--sky-z, var(--sunk)), var(--sky-h, var(--sunk)));
}
.hua-sky img, .hua-sky video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--r1);
  box-shadow: var(--shadow-pop);
}
.hua-card-text { display: block; padding: 8px 12px 12px; }
.hua-name { display: block; font-size: 16px; line-height: 24px; color: var(--ink); }
.hua-latin { display: block; font-style: italic; color: var(--ink-3); font-size: 14px; line-height: 20px; }
.hua-meta { display: block; margin-top: 4px; font-family: var(--f-mono); font-size: 12px; line-height: 16px; color: var(--ink-4); }
.hua-meta .sun { color: var(--light); }
.hua-badge {
  display: inline-block;
  margin-left: 6px;
  font-family: var(--f-mono);
  font-size: 12px;
  color: var(--glass);
}

.hua-unlit { margin-top: 48px; }
.hua-unlit h2 { font-family: var(--f-voice); font-weight: 300; font-size: 32px; margin: 0 0 8px; }
.hua-unlit > p { max-width: 44em; color: var(--ink-3); line-height: 24px; }

/* inside Kaleidoscope's sheet: the plant on its own sky, then what the light was */
.hua-sheet-stage {
  display: grid;
  place-items: center;
  padding: 16px;
  margin: 0 0 16px;
  border-radius: var(--r2);
  background: linear-gradient(180deg, var(--sky-z, var(--sunk)), var(--sky-h, var(--sunk)));
}
.hua-sheet-stage img, .hua-sheet-stage video {
  display: block;
  max-width: 100%;
  max-height: 60vh;
  border-radius: var(--r1);
  box-shadow: var(--shadow-pop);
}
/* the picture on the stage, and a plant's outline on it when its name is pointed at */
.hua-frame { position: relative; display: inline-block; max-width: 100%; }
.hua-outline {
  position: absolute;
  left: calc(var(--x0) * 100%);
  top: calc(var(--y0) * 100%);
  width: calc((var(--x1) - var(--x0)) * 100%);
  height: calc((var(--y1) - var(--y0)) * 100%);
  border: 2px solid var(--light);
  border-radius: var(--r1);
  box-shadow: 0 0 12px var(--light);
  pointer-events: none;
}
.hua-plants { line-height: 24px; }
.hua-plantname {
  font: inherit;
  color: var(--light);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
.hua-plantname:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 2px; }
.hua-3d { display: block; width: 100%; height: auto; touch-action: none; cursor: grab; border-radius: var(--r1); }
.hua-3d:active { cursor: grabbing; }
.hua-kicker { margin: 0 0 8px; font-family: var(--f-mono); font-size: 12px; color: var(--ink-3); }
.hua-sheet-body .hua-latin { margin: 0 0 8px; }
.hua-toggle { margin: 16px 0; }
.hua-sunline { color: var(--light); line-height: 24px; }
.hua-sheet-body h3 { margin: 24px 0 8px; font-size: 12px; font-weight: 500; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; }

.hua-foot {
  padding: 24px max(16px, 5vw) 48px;
  border-top: 1px solid var(--line);
  color: var(--ink-4);
  font-size: 12px;
  line-height: 20px;
}
.hua-foot a { color: var(--ink-3); }

@media (max-width: 760px) {
  .hua-head { grid-template-columns: 1fr; padding-top: 32px; }
  .hua-title h1 { font-size: 40px; }
  .hua-line { font-size: 16px; line-height: 24px; }
  .hua-sheet-stage { padding: 8px; }
  .hua-garden { grid-template-columns: 1fr; }
  .hua-scene, .hua-garden-stage canvas#tree { aspect-ratio: 4 / 5; }
}

@media (prefers-reduced-motion: reduce) {
  .hua-sky video { display: none; }
  .hua-garden-stage canvas#tree { transition: none; }
}
