/* Week 06, Set 2 · Rail: the Notch sketch, turned for the web. On the phone, the menu button sat in a
   scoop cut out of the bottom tab bar. On a web page the bar stands up: a thin green-to-blue rail down
   the left edge of a pale page, the scoop cut into its right side, the round button sitting in it.
   Pressed, the menu drips out of the scoop: a liquid neck runs out of the button and a sheet swells
   from its end, and stays joined to the button by that neck while it is open. The rows are a plain
   straight list; one highlight flows from row to row like a bead of liquid, a deep green rim on its
   left. Currency drips its own small sheet out to the right.
   Every value the spec reports is set here, once, as a token; the page and the spec read the same numbers. */
@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@500;700&display=swap");

:root {
  /* colour */
  --g1: #86cba4;             /* the green end of the rail and the menu */
  --g2: #7fa6c7;             /* the blue end */
  --grad: linear-gradient(170deg, var(--g1), var(--g2));
  --night: #e4e8e7;          /* the page */
  --panel: #f4f6f5;          /* cards on the page */
  --rule-dark: #d3dbd9;      /* the page's grid and card edges */
  --ink: #ffffff;            /* text on the gradient */
  --ink-soft: rgba(255, 255, 255, .72);  /* section names, chips */
  --ink-off: rgba(255, 255, 255, .45);   /* unavailable */
  --rule: rgba(255, 255, 255, .3);       /* the rule under a section name */
  --deep: #3f7778;           /* the rim, the badge, the pressed highlight */
  --paper: #233638;          /* text on the page */
  --dim: #6b7f80;

  /* type */
  --font: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --label-size: 13px; --track: .06em;
  --sect-size: 9.5px;

  /* the rail and its scoop */
  --rail-w: 56px;            /* a thin rail */
  --scoop: 42px;             /* radius of the cut the button sits in */
  --fab: 60px;               /* the round button */

  /* the menu: a sheet that drips out of the scoop */
  --sheet-w: 248px;
  --sheet-r: 18px;           /* its corners */
  --sheet-pad: 10px;
  --sheet-gap: 18px;         /* from the scoop's edge to the sheet */
  --neck: 26px;              /* the liquid neck joining the button to the sheet, at its thickest */
  --row-h: 44px; --row-px: 16px; --row-gap: 14px;
  --sect-h: 30px;            /* a section name's row */
  --icon: 18px; --icon-stroke: 1.5;
  --glow: rgba(255, 255, 255, .26);   /* the highlight under the pointed-at row */
  --glow-r: 4px;
  --rim: 3px;                /* the deep green rim on its left */
  --sub-w: 150px;            /* Currency's own small sheet */
  --switch-w: 32px; --switch-h: 18px;   /* a toggle's switch */

  /* motion: a thick liquid. Things swell out on a damped spring, a touch past their size, and settle slowly */
  --liquid: linear(0, 0.028, 0.089, 0.179, 0.283, 0.384, 0.491, 0.591, 0.681, 0.756, 0.824, 0.881, 0.924, 0.961, 0.988, 1.007, 1.022, 1.03, 1.035, 1.037, 1.036, 1.034, 1.031, 1.028, 1.024, 1.02, 1.016, 1.013, 1.01, 1.007, 1.005, 1.003, 1.002, 1.001, 1, 0.999, 1);   /* 0.72 damping */
  --liquid-time: 529ms;      /* it has visibly arrived by about 280ms; the rest is the settle */
  --liquid-soft: linear(0, 0.028, 0.103, 0.195, 0.297, 0.401, 0.51, 0.602, 0.685, 0.756, 0.822, 0.872, 0.912, 0.946, 0.969, 0.987, 1, 1.009, 1.014, 1.017, 1.018, 1.018, 1.017, 1.015, 1.013, 1.011, 1.01, 1.008, 1.006, 1.005, 1.004, 1.003, 1.002, 1.001, 1.001, 1, 1);   /* 0.78 damping, quicker */
  --soft-time: 406ms;
  --neck-time: 150ms;        /* the neck runs out of the button before the sheet swells */
  --wipe-time: 200ms;        /* the scoop opens a little wider */
  --wipe-ease: cubic-bezier(.75, 0, .2, 1);
  --goo: 8;                  /* blur of the goo filter: button, neck and sheet fuse like thick liquid */
  --sway-time: 9s;           /* the gradient sways back and forth, slow and calm, while the menu is out */
  --row-step: 18ms;          /* rows come in from the middle outward */
  --scramble-time: 200ms;    /* the label scrambles, then settles into its word */
  --morph-time: 240ms;       /* the three lines turn to a cross */
  --bar-ease: cubic-bezier(.2, .8, .2, 1);
  --hover-time: 140ms;
  --close-time: 180ms;       /* rows go, the sheet shrinks back down its neck into the button */
}

/* ---------- the menu: the sheet ----------
   The sheet, its neck and the button's blob are drawn in one SVG under a goo filter, so they read as one
   body of liquid; the rows sit over the sheet as plain HTML. week-06-rail-menu.html sizes them. */
.r-goo { position: absolute; left: 0; top: 0; width: 1200px; height: 760px; overflow: visible; pointer-events: none; }   /* its own fixed space, however wide the app is */

/* ---------- one row, every configuration ---------- */
.r-list { position: absolute; display: flex; flex-direction: column; padding: var(--sheet-pad) 0; }
.r-row { position: relative; display: flex; align-items: center; gap: var(--row-gap); width: 100%; height: var(--row-h); margin: 0; padding: 0 var(--row-px); border: 0; background: transparent;
  color: var(--ink); cursor: pointer; font: 700 var(--label-size)/1 var(--font); letter-spacing: var(--track); text-transform: uppercase; text-align: left; }
.r-row:focus-visible { outline: none; }
.r-ico { flex: none; width: var(--icon); height: var(--icon); transition: scale var(--soft-time) var(--liquid-soft); }
.r-ico * { stroke-width: var(--icon-stroke); }
.r-label { flex: 1; white-space: nowrap; }
/* the right side: a badge, an arrow, a shortcut or the submenu mark */
.r-key { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: rgba(255, 255, 255, .2); color: var(--ink); font: 700 10px/1 var(--font); letter-spacing: .04em; }
.r-key.is-count { background: var(--deep); }
.r-end { width: 10px; height: 10px; }
/* the submenu mark: › while Currency's sheet is shut, turning over to ‹ as it opens */
.r-chev { width: 11px; height: 11px; transition: rotate var(--soft-time) var(--liquid-soft); }
.has-sub.is-open > .r-row .r-chev { rotate: 180deg; }
.r-row:hover .r-ico, .r-row:focus-visible .r-ico, .r-row.is-hover .r-ico, .has-sub.is-open > .r-row .r-ico { scale: 1.1; }
.r-row:active .r-ico, .r-row.is-press .r-ico, .r-row.is-picked .r-ico { scale: .92; }
.r-row[aria-disabled="true"] { color: var(--ink-off); cursor: default; }
.r-row[aria-disabled="true"] .r-ico { scale: 1 !important; }

/* a toggle: a switch at the right end of the row; on, its track goes deep green and the knob slides over */
.r-switch { position: relative; flex: none; width: var(--switch-w); height: var(--switch-h); border-radius: calc(var(--switch-h) / 2); background: rgba(255, 255, 255, .28);
  transition: background-color var(--hover-time); }
.r-switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: calc(var(--switch-h) - 6px); height: calc(var(--switch-h) - 6px); border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(20, 50, 55, .3); transition: translate var(--soft-time) var(--liquid-soft); }
.r-toggle[aria-checked="true"] .r-switch { background: var(--deep); }
.r-toggle[aria-checked="true"] .r-switch::after { translate: calc(var(--switch-w) - var(--switch-h)) 0; }
/* pressed, the row goes deep green too, so an on track lightens to stay visible */
.r-toggle[aria-checked="true"]:active .r-switch, .r-toggle[aria-checked="true"].is-press .r-switch { background: rgba(255, 255, 255, .38); }

/* the highlight: one bead of light that flows to whichever row is pointed at, a deep green rim on its left */
.r-glow { position: absolute; left: 8px; right: 8px; top: 0; height: var(--row-h); border-radius: var(--glow-r); background: var(--glow); pointer-events: none;
  translate: 0 var(--gy, 0px); opacity: 0; transition: translate var(--soft-time) var(--liquid-soft), opacity 140ms linear, background-color var(--hover-time); }
.r-glow::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: var(--rim); border-radius: 2px; background: var(--deep); }
.r-glow.is-on { opacity: 1; }
.r-glow.is-press { background: var(--deep); }

/* a section: its name, small, a rule after it */
.r-sect { display: flex; align-items: center; gap: 10px; height: var(--sect-h); padding: 0 var(--row-px); font: 700 var(--sect-size)/1 var(--font); letter-spacing: .24em;
  text-transform: uppercase; color: var(--ink-soft); }
.r-sect::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

/* Currency's choices, in its own small sheet */
.r-choice .r-tick { flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0; }
.r-choice[aria-checked="true"] .r-tick { opacity: 1; }

/* ---------- the round button in the scoop ---------- */
.fab { position: relative; width: var(--fab); height: var(--fab); padding: 0; border: 0; border-radius: 50%; cursor: pointer; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--g1), var(--g2)); box-shadow: 0 8px 18px -8px rgba(40, 80, 90, .6); transition: box-shadow var(--hover-time), scale 100ms; }
.fab i { position: absolute; width: 20px; height: 2px; background: #fff; transition: translate var(--morph-time) var(--bar-ease), rotate var(--morph-time) var(--bar-ease), opacity 160ms, background-color var(--hover-time); }
.fab i:nth-child(1) { translate: 0 -6px; } .fab i:nth-child(3) { translate: 0 6px; }
.fab:hover, .fab:focus-visible, .fab.is-hover { box-shadow: 0 12px 22px -8px rgba(40, 80, 90, .65), 0 0 0 6px rgba(134, 203, 164, .3); outline: none; }
.fab:active, .fab.is-press { scale: .93; }
.fab[aria-expanded="true"] i:nth-child(1) { translate: 0; rotate: 45deg; }
.fab[aria-expanded="true"] i:nth-child(2) { opacity: 0; }
.fab[aria-expanded="true"] i:nth-child(3) { translate: 0; rotate: -45deg; }

/* ---------- the spec, under each prototype ---------- */
.spec { padding: 48px 32px 64px; background: #f2f4f3; color: #34494a; font: 14px/1.6 var(--font); }
.spec h2 { margin: 0 0 4px; font: 700 22px/1.2 var(--font); letter-spacing: .12em; text-transform: uppercase; color: var(--deep); }
.spec > p { margin: 0 0 24px; color: var(--dim); max-width: 70ch; }
.spec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.spec-card { padding: 14px 16px 12px; border: 1px solid #dfe5e3; background: #fff; }
.spec-card h3 { margin: 0 0 10px; font: 700 11px/1 var(--font); letter-spacing: .16em; text-transform: uppercase; color: #6e9a8c; }
.spec-card dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 12px; }
.spec-card dt { color: var(--dim); }
.spec-card dd { margin: 0; color: #213436; text-align: right; overflow-wrap: anywhere; }
.spec-card dd i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.spec-measure { position: absolute; left: -9999px; top: 0; }
