/* The Garden landing: the tree in the flask over the sky, and the plain list of everything by year under it.
   Everything is scoped to #page-garden, which also lifts it over the loose-word rules for landings in pages.css.
   The reading pages a title opens have their own sheet, read.css. */
#page-garden {
  --paper: #f4f1ea; --paper-bright: #fbf8f2; --ink: #141414;
  --purple: #6032bb; --red: #c7331f;
  --veil: rgba(244, 241, 234, .86);
  --soft: #55514a;            /* secondary text: the ink let down into the paper, 7:1 on paper */
  --out: cubic-bezier(.16, 1, .3, 1);
  scrollbar-color: rgba(96, 50, 187, .5) transparent; scrollbar-width: thin;
  overflow-x: hidden;
}
#page-garden button { font: inherit; color: inherit; }
#page-garden :focus-visible { outline: 2px solid var(--purple); outline-offset: 3px; border-radius: 5px; }
#page-garden .about-back { background: var(--veil); }
#page-garden .about-back:focus-visible { outline-color: var(--ink); outline-offset: 2px; border-radius: 50%; }

/* pages.css fades loose words on a landing; here the whole landing fades as one, with the flight. */
#page-garden h2, #page-garden p { opacity: 1; transform: none; transition: none; max-width: none; margin: 0; font-size: inherit; line-height: inherit; }
.gd {
  position: relative; min-height: 100%; display: flex; flex-direction: column; align-items: center;
  padding: clamp(20px, 4vh, 44px) 16px clamp(64px, 12vh, 120px);
  font: 400 clamp(14px, 1.15vw, 16px)/1.65 'JetBrains Mono', ui-monospace, monospace; color: var(--ink);
  opacity: 0; transition: opacity 180ms ease-out; overflow-x: clip;
}
.page-in .gd { opacity: 1; transition: opacity 420ms cubic-bezier(.23, 1, .32, 1); }

/* The heading and its line, in a feathered clearing of paper: the sky thins behind them and still shows through. */
.gd-head { position: relative; isolation: isolate; text-align: center; margin: 0 0 clamp(8px, 2vh, 20px); padding: 0 56px; }
.gd-head::before { content: ''; position: absolute; inset: -50% -10%; z-index: -1; background: radial-gradient(closest-side, rgba(244, 241, 234, .82) 55%, rgba(244, 241, 234, 0) 100%); }
#page-garden .gd-head h2 { font: 700 clamp(30px, 6vmin, 64px)/1.05 'JetBrains Mono', monospace; letter-spacing: .02em; margin: 0 0 .3em; }
#page-garden .gd-head p { font-size: clamp(13px, 1.5vmin, 16px); color: var(--soft); }

.gd-plot { position: relative; isolation: isolate; width: 100%; max-width: 1180px; display: block; }
/* The plant stands in a feathered clearing too: the sky's glyphs would otherwise mix with the tree's own characters.
   It fades out well before the edges of the screen, so the sky still shows there and faintly through the middle. */
.gd-plot::before {
  content: ''; position: absolute; z-index: -1; left: 50%; top: -40px; bottom: -40px; width: min(100%, 980px); transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(244, 241, 234, .8) 58%, rgba(244, 241, 234, 0) 100%); pointer-events: none;
}

/* The plain list. It sits in a feathered clearing: paper that thins out at the edges, never a panel. */
.gd-index { position: relative; width: 100%; max-width: 62ch; margin: clamp(36px, 7vh, 80px) auto 0; padding: 8px 4px; }
.gd-index::before { content: ''; position: absolute; inset: -40px -56px; z-index: -1; background: var(--paper); filter: blur(22px); opacity: .9; border-radius: 40%; }
.gd-year { margin: 0 0 22px; }
.gd-year h3 { font: 700 13px/1.4 'JetBrains Mono', monospace; margin: 28px 0 6px; letter-spacing: .04em; }
.gd-year:first-child h3 { margin-top: 0; }
.gd-year ul { list-style: none; margin: 0; padding: 0; }
/* With nothing published, the list is one quiet line and there is no tree. */
#page-garden .gd-none { text-align: center; color: var(--soft); }
#page-garden .row {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 18px; align-items: baseline; width: calc(100% + 16px);
  padding: 7px 8px; margin: 0 -8px; border: 0; border-radius: 5px; background: none; text-align: left; cursor: pointer;
  text-decoration: none; color: inherit; transition: background 150ms ease-out, color 150ms ease-out, opacity 300ms ease-out;
}
.row .t { font-weight: 500; text-decoration: underline; text-underline-offset: .22em; text-decoration-thickness: .07em; text-decoration-color: color-mix(in srgb, var(--ink) 35%, transparent); }
.row .m { font-size: 12.5px; color: var(--soft); white-space: nowrap; font-variant-numeric: tabular-nums; }
.row .k { grid-column: 1 / -1; font-size: 12.5px; color: var(--soft); }
#page-garden .row:hover, #page-garden .row.lit { background: var(--ink); color: var(--paper-bright); }
.row:hover :is(.m, .k), .row.lit :is(.m, .k) { color: color-mix(in srgb, var(--paper-bright) 78%, transparent); }
.row:hover .t, .row.lit .t { text-decoration-color: currentColor; }
/* While the tree is zoomed into one kind, the other kinds' rows go quiet (still readable, still pressable). */
.gd-index.focus .row:not(.of-kind):not(:hover):not(:focus-visible) { opacity: .5; }
@media (max-width: 720px) { .gd-index::before { inset: -40px -12px; } }
@media (max-width: 520px) { #page-garden .row { grid-template-columns: 1fr; } .row .m { white-space: normal; } }

/* ------------------------------------------------------------------ the tree (tree.js draws it)
   The flask, the trunk, the boughs and the leaves are characters on a canvas, drawn through a camera; this styles
   what sits over them: the kind names at the bough ends and, when the camera is on a bough, its heading and the
   titles on their twigs. */
#page-garden .tree {
  position: relative; width: 100%; height: 700px; margin: 0 auto;
  --fx: 0; --fy: 0; --lfs: 15px; --hfs: 34px;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}

/* The canvas is seen through a window the size of the plot. As the camera nears a bough the edges of the
   window feather, so what slides out of frame thins away instead of being cut. */
.tree-view {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none;
  -webkit-mask-image:
    linear-gradient(to bottom, transparent 0, #000 calc(var(--fy) * 30px), #000 calc(100% - var(--fy) * 64px), transparent 100%),
    linear-gradient(to right, transparent 0, #000 calc(var(--fx) * 30px), #000 calc(100% - var(--fx) * 30px), transparent 100%);
  mask-image:
    linear-gradient(to bottom, transparent 0, #000 calc(var(--fy) * 30px), #000 calc(100% - var(--fy) * 64px), transparent 100%),
    linear-gradient(to right, transparent 0, #000 calc(var(--fx) * 30px), #000 calc(100% - var(--fx) * 30px), transparent 100%);
  -webkit-mask-composite: source-in; mask-composite: intersect;
}
.tree-ink { position: absolute; left: 0; top: 0; width: 100%; }

/* A kind is a button: its name at the end of its bough, and a hit area over the outer part of the bough. */
.tree-kinds { position: absolute; inset: 0; pointer-events: none; }
#page-garden .tree-kind {
  position: absolute; left: 0; top: 0; z-index: 2; margin: 0; padding: 0; border: 0; background: none; outline: none;
  color: var(--ink); cursor: pointer; pointer-events: auto; border-radius: 8px; will-change: transform; touch-action: manipulation;
}
.tree-kind .n {
  position: absolute; isolation: isolate; white-space: nowrap; border-radius: 5px;
  font: 700 var(--lfs)/1.25 'JetBrains Mono', ui-monospace, monospace; letter-spacing: .01em;
  text-decoration: underline; text-underline-offset: .26em; text-decoration-thickness: .08em;
  text-decoration-color: color-mix(in srgb, var(--ink) 38%, transparent);
  transition: color 160ms ease-out, text-decoration-color 160ms ease-out;
}
.tree-kind .n::before {
  content: ''; position: absolute; inset: -9px -16px; z-index: -1; background: var(--paper); filter: blur(8px);
  opacity: .94; border-radius: 40%;
}
.tree-kind.lit .n, .tree-kind:focus-visible .n { color: var(--purple); text-decoration-color: currentColor; }
@media (hover: hover) { .tree-kind:hover .n { color: var(--purple); text-decoration-color: currentColor; } }
.tree-kind:focus-visible .n { outline: 2px solid var(--purple); outline-offset: 5px; }
.tree-kind.gone .n { opacity: 0; }

/* The zoomed view: nothing here is a panel. The heading rides the tip of the bough, the titles ride its leaves. */
.tree-zoom { position: absolute; inset: 0; visibility: hidden; pointer-events: none; }
.tree.zooming .tree-zoom { visibility: visible; }

.tree-head {
  position: absolute; left: 0; top: 0; z-index: 3; width: max-content; isolation: isolate; transform-origin: 0 0;
  will-change: transform; cursor: default;
}
.tree-head::before {
  content: ''; position: absolute; inset: -10px -22px; z-index: -1; background: var(--paper); filter: blur(14px);
  opacity: .86; border-radius: 40%;
}
.tree-h { margin: 0; outline: none; font: 700 var(--hfs)/1.25 'JetBrains Mono', ui-monospace, monospace; letter-spacing: .01em; }
#page-garden .tree-blurb { font-size: 14px; line-height: 1.5; color: var(--soft); opacity: 0; }

.tree-list { list-style: none; margin: 0; padding: 0; }
#page-garden .tree-piece {
  position: absolute; left: 0; top: 0; z-index: 2; width: max-content; min-height: 44px; margin: 0; padding: 4px 8px; border: 0;
  background: none; color: var(--ink); text-align: left; text-decoration: none; cursor: pointer; border-radius: 5px; will-change: transform;
  display: grid; align-content: center; touch-action: manipulation;
}
#page-garden .tree-piece.l { text-align: right; }
.tree[data-zoom="in"] .tree-piece.on { pointer-events: auto; }
.tree-piece .w { position: relative; display: block; isolation: isolate; opacity: 0; }
.tree-piece .w::before {
  content: ''; position: absolute; inset: -6px -14px; z-index: -1; background: var(--paper); filter: blur(9px);
  opacity: .86; border-radius: 16px;
}
.tree-piece .t {
  display: block; font-weight: 500; font-size: 15px; line-height: 1.3; text-wrap: balance; overflow-wrap: anywhere;
  text-decoration: underline; text-underline-offset: .22em; text-decoration-thickness: .07em;
  text-decoration-color: color-mix(in srgb, var(--ink) 35%, transparent);
  transition: color 150ms ease-out, text-decoration-color 150ms ease-out;
}
.tree-piece .m { display: block; margin-top: 1px; font-size: 12.5px; line-height: 1.35; color: var(--soft); font-variant-numeric: tabular-nums; }
.tree-piece.lit .t, .tree-piece:focus-visible .t { color: var(--purple); text-decoration-color: currentColor; }
@media (hover: hover) { .tree-piece:hover .t { color: var(--purple); text-decoration-color: currentColor; } }
#page-garden .tree-piece:focus-visible { outline: 2px solid var(--purple); outline-offset: 1px; }
.tree.narrow .tree-piece .t { font-size: 14px; }

/* Reduced motion: the tree stands grown and still, the two views change places through a short fade, and colour
   still answers the hand. */
#page-garden .tree.still { transition: opacity 130ms ease-out; }
#page-garden .tree.still.xfade { opacity: 0; }
