/* The spreadsheet layer of the landing hero comparison.
   This is a deliberate artifact pinned to one fixed palette, so it is kept out
   of the themed stylesheets on purpose: it should look like a spreadsheet
   window in every app theme. */

.compare__sheet {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  background: #F5F2EC;
  color: #26241F;
  font-size: clamp(8px, 1.02cqw, 13px);
  line-height: 1.35;
  clip-path: inset(0 calc(100% - var(--pos)) 0 0);
  overflow: hidden;
}

/* Without the slider script nothing but the board is shown. */

.compare__sheet,
.compare__chip,
.compare__range,
.compare__divider {
  display: none;
}

.compare.is-live .compare__sheet {
  display: flex;
}

.compare.is-live .compare__chip {
  display: inline-block;
}

.compare.is-live .compare__range {
  display: block;
}

.compare.is-live .compare__divider {
  display: block;
}

/* Window chrome ----------------------------------------------------------- */

.sheet-window__bar {
  display: flex;
  align-items: center;
  gap: 0.45em;
  flex: 0 0 auto;
  padding: 0.7em 0.9em;
  background: #E9E4D8;
  border-bottom: 1px solid #D9D4C7;
}

.sheet-window__dot {
  width: 0.85em;
  height: 0.85em;
  border-radius: 50%;
  background: #C9C2B2;
}

.sheet-window__dot:nth-child(1) {
  background: #D9A39B;
}

.sheet-window__dot:nth-child(2) {
  background: #E0C48E;
}

.sheet-window__dot:nth-child(3) {
  background: #AFC3A0;
}

.sheet-window__file {
  margin-left: 0.55em;
  color: #6F6858;
  font-size: 1em;
}

/* One continuous grid under the whole sheet: the tables are laid on top of
   it, and it keeps running below them to the bottom of the frame. */

.sheet-window__body {
  --sheet-row: calc(1.91em + 1px);
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  padding: 0.9em;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(var(--sheet-row) - 1px),
    #D9D4C7 calc(var(--sheet-row) - 1px),
    #D9D4C7 var(--sheet-row)
  );
  background-origin: content-box;
  background-clip: content-box;
  background-repeat: repeat;
  /* The collapsed table borders add 2px outside its rows; shifting the grid by
     that much keeps the first row below the tables flush with their edge. */
  background-position: 0 2px;
}

.sheet-window__tables {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  gap: 0.85em;
}

.sheet-window__tables > .sheet-table--bills {
  flex: 0 0 55%;
}

.sheet-window__tables > .sheet-table--checks {
  flex: 0 1 45%;
  min-width: 0;
}

/* The grid ---------------------------------------------------------------- */

.sheet-table {
  border-collapse: collapse;
  table-layout: fixed;
}

.sheet-table th,
.sheet-table td {
  height: var(--sheet-row);
  padding: 0.28em 0.45em;
  border: 1px solid #D9D4C7;
  background: #F5F2EC;
  text-align: left;
  vertical-align: top;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.sheet-table thead th {
  background: #E9E4D8;
  font-weight: 600;
}

.sheet-table tbody th {
  font-weight: 400;
}

.sheet-table .sheet-table__num {
  text-align: right;
  white-space: nowrap;
}

.sheet-table__total th,
.sheet-table__total td {
  background: #E9E4D8;
  font-weight: 600;
}

.sheet-table--bills th:nth-child(1) {
  width: 24%;
}

.sheet-table--bills th:nth-child(2) {
  width: 14%;
}

.sheet-table--bills th:nth-child(3) {
  width: 18%;
}

.sheet-table--bills th:nth-child(4) {
  width: 44%;
}

.sheet-table--checks th:nth-child(1) {
  width: 30%;
}

.sheet-table--checks th:nth-child(2) {
  width: 18%;
}

.sheet-table--checks th:nth-child(3) {
  width: 30%;
}

.sheet-table--checks th:nth-child(4) {
  width: 22%;
}

/* Chips, divider, grip ---------------------------------------------------- */

.compare__chip {
  position: absolute;
  top: 0.9rem;
  z-index: 3;
  padding: 0.32rem 0.68rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.01em;
  pointer-events: none;
}

.compare__chip--sheet {
  left: 0.9rem;
  background: #F5F2EC;
  color: #26241F;
  border: 1px solid #D9D4C7;
}

.compare__chip--board {
  right: 0.9rem;
  background: rgba(6, 38, 43, 0.9);
  color: #FEF8E8;
  border: 1px solid rgba(254, 248, 232, 0.28);
}

/* A chip belongs to the side it names: the script hides it as soon as the
   divider reaches it, so the label of the side not being shown is never left
   hanging over the other side's image. */

.compare__chip.is-away {
  visibility: hidden;
}

.compare__divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 2px;
  margin-left: -1px;
  z-index: 4;
  background: #FFFFFF;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2);
}

/* Parked at either end, the divider's own line would paint a stray hairline
   along the frame's edge, so it steps aside until the slider moves again. */

.compare[data-position="0"] .compare__divider,
.compare[data-position="100"] .compare__divider {
  visibility: hidden;
}

.compare__grip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2.4rem;
  height: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: #FFFFFF;
  color: #26241F;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
  font-size: 1rem;
  line-height: 1;
}

.compare.is-dragging {
  cursor: ew-resize;
}

/* The keyboard control is invisible but real, and never eats pointer input. */

.compare__range {
  position: absolute;
  inset: 0;
  z-index: 5;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.compare__range:focus ~ .compare__divider .compare__grip,
.compare__range:focus-visible ~ .compare__divider .compare__grip {
  outline: 3px solid #DE9022;
  outline-offset: 3px;
}

/* Narrow frames stack the two tables inside the window. */

@container (max-width: 620px) {
  .sheet-window__tables {
    flex-direction: column;
  }

  .sheet-window__tables > .sheet-table {
    flex: 0 0 auto;
    width: 100%;
  }
}
