/* The curling sidebar: the light sidebar of a plant nursery's app, alone on a white page. The highlight and the line
   of the greenhouses are drawn under the rows, the letters over them. */
:root {
  --page: #ffffff;          /* the page */
  --bar: #f4f7f1;           /* the bar, the white of a misted glasshouse */
  --edge: #dfe6d8;          /* its edge and the line under the button */
  --ink: #15301e;           /* the page chosen, and a row pointed at */
  --muted: #5b6a5e;         /* the other rows */
  --frond: #b9da9b;         /* the highlight under the page chosen, at its root */
  --frond-tip: #e3f1d2;     /* and at its tip, where it unrolls last, like new growth */
  --peek: #e5ebdf;          /* the highlight that peeks out of a row pointed at */
  --guide: #b2c3ad;         /* the line of the greenhouses */
  --water: #2c72b0;         /* the count of plants to water */
  --tag: #15301e;           /* the name beside a folded icon */
  --tag-ink: #eef4e8;
  --focus: #2f6c3e;         /* the ring of the keyboard focus */
  --open: 256px;            /* the bar's width, open and folded */
  --shut: 64px;
}

* {
  box-sizing: border-box;
}

/* a tap is a click at once: no wait for a double tap */
html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Commissioner Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

/* as wide as the open bar either way, so the bar does not move as it folds; the names of the folded icons come
   out into the room on the right */
.fr-wrap {
  position: relative;
  width: var(--open);
}

.fr {
  position: relative;
  display: flex;
  flex-direction: column;
  width: var(--open);
  height: 520px;
  padding: 10px;
  overflow: hidden;
  background: var(--bar);
  border-radius: 18px;
  box-shadow:
    inset 0 0 0 1px var(--edge),
    0 1px 2px rgba(21, 48, 30, 0.05),
    0 26px 50px -30px rgba(21, 48, 30, 0.34);
}

.fr__head {
  flex: none;
  display: flex;
  padding-bottom: 7px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--edge);
}

.fr__toggle {
  display: grid;
  place-items: center;
  width: 44px;
  height: 40px;
  padding: 0;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.fr__toggle svg,
.fr__icon {
  width: 20px;
  height: 20px;
  flex: none;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (hover: hover) {
  .fr__toggle:hover {
    color: var(--ink);
    background: rgba(21, 48, 30, 0.05);
  }
}

.fr__toggle:active {
  transform: scale(0.94);
}

.fr__body {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* the two layers the script draws on, under and over the rows */
.fr__ground,
.fr__ink {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.fr__ink {
  z-index: 2;
  font-family: 'Commissioner Variable', system-ui, sans-serif;
  font-size: 14.5px;
  font-weight: 500;
}

.fr__ink text {
  text-anchor: middle;
}

.fr__stop-base {
  stop-color: var(--frond);
}

.fr__stop-tip {
  stop-color: var(--frond-tip);
}

.fr__peek {
  fill: var(--peek);
}

.fr__frond {
  fill: url(#fr-frond);
}

.fr__guide {
  fill: none;
  stroke: var(--guide);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* a name: grey, dark on the page chosen and under the pointer */
.fr-word {
  fill: var(--muted);
  transition: fill 0.25s ease;
}

.fr-word.is-on,
.fr-word.is-hover {
  fill: var(--ink);
}

.fr-badge rect {
  fill: var(--water);
}

.fr-badge text {
  fill: #ffffff;
  font-size: 11.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.fr-chev {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------------------------------------------------------------- the rows */
.fr__list,
.fr__sub {
  margin: 0;
  padding: 0;
  list-style: none;
}

.fr__list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 2px;
}

.fr__list--foot {
  margin-top: auto;
}

/* not positioned, so the rows inside measure their place from the body */
.fr__sub {
  display: grid;
  gap: 2px;
  padding: 2px 0;
  overflow: hidden;
}

.fr__item {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 40px;
  padding: 0 0 0 12px;
  color: var(--muted);
  font: inherit;
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  background: none;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  transition: color 0.25s ease;
  -webkit-tap-highlight-color: transparent;
}

.fr__item--child {
  height: 34px;
}

.fr__item[aria-current='page'],
.fr__item.is-within {
  color: var(--ink);
}

@media (hover: hover) {
  .fr__item:hover {
    color: var(--ink);
  }
}

.fr__icon {
  transition: transform 0.15s ease;
}

.fr__item:active .fr__icon {
  transform: scale(0.9);
}

.fr__item:focus,
.fr__toggle:focus {
  outline: none;
}

.fr__item:focus-visible,
.fr__toggle:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

/* the names and the count, for screen readers: the eye reads the ones the script draws */
.fr__label,
.fr__count {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- the name beside a folded icon */
.fr__tags {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  width: 1px;
  height: 1px;
  overflow: visible;
  pointer-events: none;
  font-family: 'Commissioner Variable', system-ui, sans-serif;
  font-size: 13.5px;
  font-weight: 600;
}

.fr__tags text {
  fill: var(--tag-ink);
  text-anchor: middle;
}

.fr-tag path {
  fill: var(--tag);
}
