/* Calculator */
.calc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 410px);
  grid-template-areas:
    "intro intro"
    "stage panel";
  column-gap: clamp(32px, 5vw, 72px);
  row-gap: 24px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 116px 24px 72px;
}
.calc-intro {
  grid-area: intro;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 24rem);
  align-items: end;
  gap: 24px 48px;
}
.calc-intro h1 {
  max-width: 15ch;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2.1rem, 1.1rem + 3.3vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.calc-intro p {
  color: var(--ink-soft);
  font-size: 1.0625rem;
  line-height: 1.5;
}

.calc-stage {
  grid-area: stage;
  min-width: 0;
}
.dial {
  position: relative;
  width: min(100%, 620px);
  aspect-ratio: 1;
  margin: 0 auto;
  container-type: inline-size;
  user-select: none;
  -webkit-user-select: none;
}
.dial-label {
  position: absolute;
  color: var(--ink-soft);
  font-size: 0.8125rem;
  line-height: 1;
  white-space: nowrap;
}
.dial-label-top {
  top: 2.2%;
  left: 50%;
  transform: translateX(-50%);
}
.dial-label-bottom {
  bottom: 2.2%;
  left: 50%;
  transform: translateX(-50%);
}
.dial-label-right {
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}
.dial-label-left {
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

.saucer {
  /* The porcelain instrument is artwork, not the page surface. Keep its
     glaze, hand, readout and drink tokens legible in either page theme. */
  --porcelain: #F7F7F4;
  --chip: #EDEDE8;
  --ink: #1B1C18;
  --ink-soft: #5E5F58;
  --pen: #2648CF;
  --cobalt: #2648CF;
  --glaze: #2648CF;
  --button-text: #FFFFFF;
  color: var(--ink);
  color-scheme: light;
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  background: radial-gradient(
    circle at 38% 30%,
    #ffffff 0%,
    var(--porcelain) 48%,
    var(--chip) 100%
  );
  box-shadow:
    inset 0 2px 1px #ffffff,
    inset 0 -10px 24px #15171c0a,
    0 42px 60px -34px #2b221759,
    0 12px 22px -12px #2b221740;
}
/* The raised lip where the rim meets the plate */
.saucer::before {
  content: "";
  position: absolute;
  inset: 6.5%;
  border-radius: 50%;
  box-shadow:
    inset 0 3px 8px #2b22170f,
    0 1px 0 #ffffffcc;
}
.dial.is-drop-target .saucer {
  box-shadow:
    inset 0 2px 1px #ffffff,
    inset 0 -10px 24px #15171c0a,
    0 0 0 3px #2855e833,
    0 42px 60px -34px #2b221759,
    0 12px 22px -12px #2b221740;
}
.liquid,
.glaze {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.glaze {
  overflow: visible;
  pointer-events: none;
}
.rim-line {
  fill: none;
  stroke: var(--glaze);
  stroke-width: 0.013;
  opacity: 0.92;
}
.rim-line-thin {
  stroke-width: 0.005;
}
.tick {
  stroke: var(--glaze);
  stroke-width: 0.007;
  stroke-linecap: round;
  opacity: 0.75;
}
.tick-major {
  stroke-width: 0.014;
  opacity: 0.95;
}
.hand-line {
  stroke: var(--ink);
  stroke-width: 0.008;
  stroke-linecap: round;
}
.now-dot {
  fill: var(--orange);
}

.well {
  position: absolute;
  inset: 30%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, var(--porcelain) 0%, var(--porcelain) 72%);
  box-shadow:
    inset 0 8px 16px #2b22171a,
    inset 0 -2px 3px #ffffff;
}
.readout {
  display: grid;
  justify-items: center;
  text-align: center;
  line-height: 1.15;
}
.readout-mg {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.75rem, 10cqi, 4.25rem);
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}
.readout-unit {
  margin-top: 0.3em;
  font-family: var(--display);
  font-size: clamp(0.75rem, 2.6cqi, 1rem);
}
.readout-when {
  max-width: 24cqi;
  margin-top: 0.6em;
  text-wrap: balance;
  color: var(--ink-soft);
  font-size: clamp(0.6875rem, 2.3cqi, 0.875rem);
}

.dial-hit {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  touch-action: pan-y;
}
.dial-hit.is-scrubbing {
  cursor: grabbing;
}
.tokens {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.token {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, #ffffff, var(--porcelain) 70%);
  box-shadow:
    inset 0 1px 0 #ffffff,
    0 0 0 1px #15171c10,
    0 8px 16px -6px #2b22176b;
  cursor: grab;
  touch-action: none;
  pointer-events: auto;
  transition:
    transform 0.25s var(--ease),
    opacity 0.2s,
    box-shadow 0.2s;
}
.token img {
  width: 40px;
  height: 40px;
  pointer-events: none;
  -webkit-user-drag: none;
}
.token:hover,
.token.is-dragging {
  transform: scale(1.1);
}
.token.is-dragging {
  z-index: 3;
  cursor: grabbing;
  transition:
    opacity 0.2s,
    box-shadow 0.2s;
}
.token.is-selected {
  box-shadow:
    inset 0 1px 0 #ffffff,
    0 0 0 2px var(--cobalt),
    0 8px 16px -6px #2b22176b;
}
.token.is-leaving {
  opacity: 0.35;
}
.token.is-waiting {
  opacity: 0;
  transform: translateY(-70px) scale(0.8);
  transition: none;
}
.token.is-dropping {
  transition:
    transform 0.6s var(--drop),
    opacity 0.25s;
}
.token-moon {
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  background: var(--cobalt);
  box-shadow:
    inset 0 1px 0 #ffffff55,
    0 8px 16px -6px #2855e8a0;
  color: #ffffff;
}
.token-moon svg {
  width: 18px;
  height: 18px;
}
.token::after {
  content: attr(data-time);
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--porcelain);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, -4px);
  transition:
    opacity 0.15s,
    transform 0.15s;
  pointer-events: none;
}
.token:hover::after,
.token:focus-visible::after,
.token.is-dragging::after {
  opacity: 1;
  transform: translate(-50%, 0);
}
.hand-knob {
  position: absolute;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow:
    0 0 0 3px var(--porcelain),
    0 3px 10px #15171c59;
  cursor: grab;
  touch-action: none;
  z-index: 2;
}
.hand-knob::before {
  content: "";
  position: absolute;
  inset: -11px;
  border-radius: 50%;
}

.caption {
  max-width: 34rem;
  min-height: 1.6em;
  margin: 10px auto 0;
  text-align: center;
  font-size: 1.0625rem;
  font-weight: 500;
}
.caption-actions {
  min-height: 34px;
  text-align: center;
}

.tray {
  margin-top: 18px;
}
.tray-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 8px;
}
.tray-head h2,
.drinks-head h2 {
  font-size: 1rem;
  font-weight: 600;
}
.tray-head p {
  color: var(--ink-soft);
  font-size: 0.9375rem;
}
.tray-list {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tray-item {
  display: grid;
  justify-items: center;
  gap: 2px;
  width: 100%;
  padding: 10px 2px 12px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  cursor: grab;
  touch-action: pan-x;
  user-select: none;
  -webkit-user-select: none;
}
.tray-item,
.remove {
  transition-property: color, background-color, border-color, transform;
  transition-duration: var(--motion-feedback);
  transition-timing-function: var(--ease);
}
.tray-item:hover:not(:disabled):not([aria-disabled="true"]) {
  background: var(--porcelain);
}
@media (prefers-reduced-motion: no-preference) {
  .tray-item:active:not(:disabled):not([aria-disabled="true"]),
  .remove:active:not(:disabled):not([aria-disabled="true"]) {
    transform: scale(var(--press-scale));
    transition-duration: var(--motion-feedback), var(--motion-feedback),
      var(--motion-feedback), var(--motion-press);
  }
}
.tray-item img {
  width: 60px;
  height: 60px;
  margin-bottom: 4px;
  pointer-events: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 6px 6px #2b22172e);
}
.tray-item span {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}
.tray-item small {
  color: var(--ink-soft);
  font-size: 0.75rem;
}
.drag-ghost {
  position: fixed;
  z-index: 70;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  pointer-events: none;
  filter: drop-shadow(0 14px 12px #2b22174d);
  transform: scale(1.1) rotate(-6deg);
}

/* Side panel */
.calc-panel {
  grid-area: panel;
  align-self: start;
  position: sticky;
  top: 92px;
  display: grid;
  gap: 28px;
  padding-top: 8px;
}
.bedtime-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-weight: 600;
}
.bedtime-field input {
  min-height: 48px;
  padding: 6px 12px;
  border: 0;
  border-radius: 12px;
  background: var(--porcelain);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--cobalt);
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.125rem;
}
.facts {
  margin: 16px 0 0;
}
.facts div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.facts dt {
  color: var(--ink-soft);
}
.facts dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.result-onset {
  display: grid;
  justify-items: start;
  gap: 10px;
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.result-onset h2 {
  font-size: 1.0625rem;
  line-height: 1.4;
}
.result-onset p {
  color: var(--ink-soft);
  font-size: 0.9375rem;
}
.result-onset .button {
  max-width: 100%;
  white-space: normal;
  text-align: center;
}
.drinks-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.day-note,
.empty-note {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}
.drink-list {
  display: grid;
  gap: 2px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}
.drink-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto auto 32px;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 4px;
  border-radius: 14px;
  transition: background-color 0.2s;
}
.drink-row.is-selected {
  background: var(--pen-wash);
}
.drink-row img {
  width: 40px;
  height: 40px;
}
.drink-name {
  overflow: hidden;
  font-weight: 600;
  font-size: 0.9375rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drink-row input {
  min-height: 36px;
  padding: 4px 6px;
  border: 0;
  border-radius: 9px;
  background: var(--porcelain);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}
.drink-row input[type="time"] {
  width: 6.6em;
}
input[type="time"]::-webkit-calendar-picker-indicator {
  display: none;
}
.mg-field {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-soft);
  font-size: 0.8125rem;
}
.mg-field input {
  width: 4.2em;
  color: var(--ink);
  text-align: right;
}
.remove {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}
.remove:hover:not(:disabled):not([aria-disabled="true"]) {
  background: var(--quiet-hover);
  color: var(--ink);
}
.remove svg {
  width: 14px;
  height: 14px;
}
.share-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.share-note {
  min-height: 1.5em;
  margin-top: -16px;
  color: var(--ink-soft);
  font-size: 0.875rem;
}
.noscript {
  grid-column: 1 / -1;
  padding: 16px;
  border-radius: 14px;
  background: var(--porcelain);
}

/* Reading sections */
.explain,
.drinks-table,
.faq {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 24px clamp(32px, 5vw, 72px);
  max-width: 1280px;
  margin: 0 auto;
  padding: 72px 24px;
}
.explain h2,
.drinks-table h2,
.faq h2,
.onset-band h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.6rem, 1.1rem + 1.6vw, 2.5rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  text-wrap: balance;
}
.explain-body {
  display: grid;
  gap: 20px;
  max-width: 62ch;
  font-size: 1.0625rem;
}
.decay {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.decay li {
  display: grid;
  justify-items: center;
  gap: 2px;
  text-align: center;
}
.decay li::before {
  content: "";
  width: calc(max(var(--size), 0.16) * min(96px, 18vw));
  aspect-ratio: 1;
  margin-bottom: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #c98a52 0%, #68321200 60%),
    radial-gradient(circle at 50% 55%, #68321a 0%, #3a2114 100%);
  box-shadow:
    inset 0 -4px 8px #0000004d,
    0 8px 14px -8px #3a211499;
}
.decay b {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.0625rem;
}
.decay span,
.decay-caption {
  color: var(--ink-soft);
  font-size: 0.875rem;
}
.decay-caption {
  margin-top: -8px;
}

.drinks-table {
  grid-template-columns: minmax(0, 1fr);
}
.table-intro {
  max-width: 60ch;
  margin-top: -8px;
  color: var(--ink-soft);
}
.table-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px clamp(32px, 5vw, 72px);
  align-items: start;
}
.table-group summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  font-weight: 600;
  font-size: 1.0625rem;
  list-style: none;
  cursor: pointer;
}
.table-group summary::-webkit-details-marker {
  display: none;
}
.table-group summary span {
  color: var(--ink-soft);
  font-weight: 400;
  font-size: 0.9375rem;
}
.table-group summary span::after {
  content: "Show";
  margin-left: 12px;
  color: var(--cobalt);
  font-weight: 600;
}
.table-group[open] summary span::after {
  content: "Hide";
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}
caption {
  margin-bottom: 6px;
  text-align: left;
  font-weight: 600;
  font-size: 1.0625rem;
}
th,
td {
  padding: 9px 8px 9px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: baseline;
}
thead th {
  color: var(--ink-soft);
  font-size: 0.8125rem;
  font-weight: 500;
}
tbody th {
  font-weight: 500;
}
td:nth-child(3),
thead th:nth-child(3) {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
td:nth-child(3) {
  font-weight: 600;
}
td:nth-child(4),
thead th:nth-child(4) {
  padding-left: 16px;
  padding-right: 0;
  color: var(--ink-soft);
  font-size: 0.8125rem;
  white-space: nowrap;
}
td a {
  color: var(--cobalt);
  text-underline-offset: 3px;
}

.faq-list {
  display: grid;
}
.faq details {
  border-top: 1px solid var(--line);
}
.faq details:last-child {
  border-bottom: 1px solid var(--line);
}
.faq summary {
  position: relative;
  padding: 18px 40px 18px 0;
  font-weight: 600;
  font-size: 1.0625rem;
  list-style: none;
  cursor: pointer;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  background:
    linear-gradient(var(--ink), var(--ink)) center / 12px 2px no-repeat,
    linear-gradient(var(--ink), var(--ink)) center / 2px 12px no-repeat;
  transition: transform var(--motion-disclosure) var(--ease);
}
.faq details[open] summary::after {
  transform: rotate(45deg);
}
.faq details p {
  max-width: 64ch;
  padding-bottom: 20px;
  color: var(--ink-soft);
}

/* Onset: the one dark panel on the page */
.onset-band {
  /* This promotional block deliberately stays dark in both appearances. */
  --ink: #1B1C18;
  --porcelain: #F7F7F4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 40px;
  max-width: 1232px;
  margin: 48px auto 24px;
  padding: clamp(32px, 5vw, 64px);
  overflow: hidden;
  border-radius: 32px;
  background: var(--ink);
  color: var(--porcelain);
}
@media (min-width: 1280px) {
  .onset-band {
    margin-inline: auto;
  }
}
.onset-copy {
  display: grid;
  justify-items: start;
  gap: 18px;
  max-width: 34rem;
}
.onset-copy img {
  border-radius: 14px;
}
.onset-copy p {
  color: #c9ccd3;
  font-size: 1.0625rem;
}
.onset-shot {
  width: min(300px, 32vw);
  height: auto;
  margin: 0 20px -160px 0;
  border-radius: 34px;
  box-shadow:
    0 0 0 8px #262a33,
    0 40px 80px -30px #000000;
  transform: rotate(4deg);
}


@media (max-width: 1040px) {
  .calc {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "intro"
      "stage"
      "panel";
  }
  .calc-intro {
    grid-template-columns: minmax(0, 1fr);
  }
  .calc-panel {
    position: static;
    max-width: 620px;
    width: 100%;
    margin: 0 auto;
  }
  .tray {
    max-width: 620px;
    margin-inline: auto;
  }
  .tray-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .explain,
  .faq {
    grid-template-columns: minmax(0, 1fr);
  }
  .table-groups {
    grid-template-columns: minmax(0, 1fr);
  }
  .onset-band {
    grid-template-columns: minmax(0, 1fr);
    margin-inline: 16px;
  }
  .onset-shot {
    width: min(240px, 64vw);
    margin: 0 auto -150px;
  }
}

@media (max-width: 560px) {
  .calc {
    padding: 96px 16px 48px;
  }
  .explain,
  .drinks-table,
  .faq {
    padding: 48px 16px;
  }
  .dial-label {
    font-size: 0.75rem;
  }
  .token {
    width: 42px;
    height: 42px;
    margin: -21px 0 0 -21px;
  }
  .token img {
    width: 34px;
    height: 34px;
  }
  .token-moon {
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
  }
  .tray-list {
    display: flex;
    gap: 2px;
    margin-inline: -16px;
    padding-inline: 10px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .tray-list::-webkit-scrollbar {
    display: none;
  }
  .tray-list li {
    flex: 0 0 84px;
    scroll-snap-align: start;
  }
  .drink-row {
    grid-template-columns: 36px minmax(0, 1fr) auto 44px;
    gap: 6px;
  }
  .drink-row img {
    width: 36px;
    height: 36px;
  }
  .drink-row input[type="time"] {
    width: 6.4em;
  }
  .drink-row .drink-name { grid-column: 2 / 4; }
  .drink-row > input[type="time"] { grid-column: 1 / 3; grid-row: 2; }
  .drink-row .mg-field { grid-column: 3; grid-row: 2; }
  .drink-row .remove { grid-column: 4; grid-row: 1 / 3; width: 44px; height: 44px; }
  .drink-row input { font-size: 16px; min-height: 44px; }
  td:nth-child(4),
  thead th:nth-child(4) {
    display: none;
  }
  .decay {
    gap: 4px;
  }
}

