/* The Interlude layout (LA-4052, design-choices.md "layout"). The owner's pages go back and forth
   between black and Paper. Black is Ora's voice: a card fills the screen with the page's name
   low on it, a hairline rule and a few short lines. Paper is the record: a sheet that scrolls up
   over the card and holds what people said and what needs the owner, in one column with a
   margin for labels, people and times.

   The pieces, in the order a page uses them:
     html[data-ground="black"]   the page's ground is Black; a .sheet and a sign-in card are Paper
     .pair                        one black card and the sheet that covers it
     .interlude                   the black card, sticky, one screen tall (.foot: the page's end)
     .speak / .say / .rule / .cols  what the card says
     .sheet / .inner              the Paper sheet and its column
     .band / .lab / .items / .it  a labelled band of rows inside the sheet
     .dock                         the slim black bar the name docks into (web/interlude.js)
     .curtain                     the black screen that carries a name between pages

   Motion is driven by --p, how far the cover is covered (0 to 1), which web/interlude.js sets
   from the scroll position. The scenes (a name rising in, the rule drawing itself) play when
   a .pair gets .playing. Reduced motion stops every one of them. */

/* The ground. Outside a sheet the few words on black use the dark theme's colours; inside a
   sheet, Paper's. With dark sheets picked in Settings (data-theme="dark") the sheet is a dark
   surface and design.css's dark tokens already hold. */
html[data-ground="black"] {
  background: #000000;
}
html[data-ground="black"] body {
  --bg: #000000;
  --surface: #141312;
  --surface-2: #1f1e1c;
  --text: #ece8df;
  --text-muted: #bdb7ab;
  --text-dim: #bdb7ab;
  --hairline: #262422;
  --hairline-strong: #383532;
  --control: #5f5a52;
  --accent: #f2e6d4;
  --on-accent: #23221f;
  --accent-text: #ece8df;
  --moss: #8fb394;
  --ochre: #d4aa62;
  --oxide: #e08272;
  --moss-tint: #18231a;
  --ochre-tint: #2a2213;
  --oxide-tint: #2c1815;
  --danger-text: #e08272;
  --paper: var(--surface);
  --paper-2: var(--surface-2);
  --ink: var(--text);
  --ink-muted: var(--text-muted);
  --ink-dim: var(--text-muted);
}
html[data-ground="black"]:not([data-theme="dark"]) .sheet,
html[data-ground="black"]:not([data-theme="dark"]) .sign-in-card,
html[data-ground="black"]:not([data-theme="dark"]) .gate .box {
  --bg: #f7f6f3;
  --surface: #f7f6f3;
  --surface-2: #ebe8e2;
  --text: #1f1e1c;
  --text-muted: #5e5950;
  --text-dim: #5e5950;
  --hairline: #e4e1db;
  --hairline-strong: #d6d3cd;
  --control: #b9b4ab;
  --accent: #1f1e1c;
  --on-accent: #f7f6f3;
  --accent-text: #1f1e1c;
  --moss: #3a5a40;
  --ochre: #7a5f2f;
  --oxide: #7a3030;
  --moss-tint: #e3ebe2;
  --ochre-tint: #f4e8d0;
  --oxide-tint: #f4e2de;
  --danger-text: #7a3030;
  --paper: #ffffff;
  --paper-2: #efede9;
  --ink: #1f1e1c;
  --ink-muted: #5e5950;
  --ink-dim: #5e5950;
  color: var(--text);
}
html[data-ground="black"] .sheet .card,
html[data-ground="black"] .sheet .queue-rows,
html[data-ground="black"] .sheet .calendar-rows,
html[data-ground="black"] .sheet .owes {
  --surface: #ffffff;
}

/* The black card. */
.pair {
  position: relative;
}
.interlude {
  position: sticky;
  top: 0;
  z-index: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: #000000;
  color: #ece8df;
  padding: 24px 40px 40px;
}
.interlude.foot {
  position: static;
  min-height: 0;
  padding-top: 48px;
}
.speak {
  width: 100%;
  max-width: 1120px;
  margin: auto auto 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.interlude.foot .speak {
  margin-top: 0;
}
.say {
  margin: 0;
  font-size: 48px;
  line-height: 1.1;
  font-weight: var(--weight-regular);
  letter-spacing: -0.02em;
  text-wrap: balance;
  max-width: 18ch;
  color: #ece8df;
  overflow-wrap: anywhere;
}
.say.small {
  font-size: 28px;
}
.rule {
  position: relative;
  height: 1px;
  background: #383532;
}
.cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 32px;
  font-size: 15px;
  line-height: 22px;
  color: #bdb7ab;
}
.cols p {
  margin: 0;
  overflow-wrap: anywhere;
}
.cols b {
  color: #ece8df;
  font-weight: var(--weight-medium);
}
.cols a {
  color: #ece8df;
}
.cols .lobby-line {
  color: #d4aa62;
}

/* The Paper sheet and its column. */
.sheet {
  position: relative;
  z-index: 1;
  background: var(--surface);
  color: var(--text);
  border-radius: 12px 12px 0 0;
  padding: 8px 0 32px;
}
.sheet.end {
  border-radius: 12px;
}
.inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 40px;
}

/* A band: a label in the margin and rows beside it. */
.band {
  display: grid;
  grid-template-columns: 176px minmax(0, 1fr);
  gap: 0 24px;
  border-top: 1px solid var(--hairline);
}
.band:first-child {
  border-top: 0;
}
.lab {
  margin: 0;
  font-size: 13px;
  font-weight: var(--weight-semibold);
  padding: 16px 0;
  color: var(--text);
}
.lab small {
  display: block;
  font-size: 13px;
  font-weight: var(--weight-regular);
  color: var(--text-muted);
}
.items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.it {
  display: grid;
  grid-template-columns: 136px minmax(0, 1fr) auto;
  gap: 2px 16px;
  padding: 14px 0;
  border-top: 1px solid var(--hairline);
  align-items: start;
}
.it:first-child {
  border-top: 0;
}
.it .own {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 24px;
  font-size: 13px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.it .own .initial {
  width: 24px;
  height: 24px;
  font-size: 12px;
}
.it .what {
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  font-size: 15px;
  line-height: 22px;
  font-weight: var(--weight-medium);
  overflow-wrap: anywhere;
}
.it.plain .what {
  font-weight: var(--weight-regular);
}
/* The why Ora wrote under a task's title (LA-4211), quieter than the title. */
.what .why,
.task-said .why {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  line-height: 19px;
  font-weight: var(--weight-regular);
  color: var(--ink-muted);
}
.it .who {
  grid-column: 2;
  grid-row: 2;
  margin: 0;
  font-size: 13px;
  line-height: 18px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.it .state-chip {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
}
.it .acts {
  grid-column: 3;
  grid-row: 2;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-self: end;
  font-size: 14px;
}
.it .body {
  grid-column: 2 / -1;
  grid-row: 3;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 8px;
  min-width: 0;
}
/* The one row in focus sits on sand, the whole row, out to the sheet's edges. */
.it.focus {
  background: var(--selected);
  color: var(--on-selected);
  margin: 0 -40px 0 -240px;
  padding: 16px 40px 16px 240px;
  border-top: 0;
}
.it.focus + .it {
  border-top: 0;
}
.it.focus .who,
.it.focus .own {
  color: #5e5950;
}
.quote {
  border-top: 1px solid var(--selected-edge);
  border-bottom: 1px solid var(--selected-edge);
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.quote .k {
  font-size: 13px;
  color: var(--text-muted);
}
.quote .s {
  font-weight: var(--weight-semibold);
}
.taps {
  display: flex;
  gap: 8px 16px;
  align-items: center;
  flex-wrap: wrap;
}

/* Dock: the name and the count in a slim black bar once the cover is covered. */
.dock {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 48px;
  margin-bottom: -48px;
  padding: 0 40px;
  background: #000000;
  color: #ece8df;
  opacity: clamp(0, calc((var(--p, 0) - 0.6) / 0.3), 1);
  pointer-events: none;
}
html.docked .dock {
  pointer-events: auto;
}
.dock .dock-mark {
  font-size: 18px;
  font-weight: var(--weight-medium);
  letter-spacing: -0.02em;
  color: #ece8df;
}
.dock .dock-name {
  font-weight: var(--weight-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dock .dock-count {
  color: #bdb7ab;
  white-space: nowrap;
}
.dock nav {
  margin-left: auto;
  display: flex;
  gap: 16px;
}
.dock nav a {
  color: #bdb7ab;
  font-size: 14px;
  font-weight: var(--weight-regular);
}
.dock nav a[aria-current="page"] {
  color: #ece8df;
  font-weight: var(--weight-semibold);
}
/* The cover's own header steps aside as the bar arrives, so the two never show at once. */
.pair.cover-pair .interlude .site-top,
.pair.cover-pair .interlude .top-row {
  opacity: clamp(0, calc(1 - (var(--p, 0) - 0.15) / 0.35), 1);
}

/* Recede: the cover's words leave as the Paper covers them. */
.pair.cover-pair .interlude .speak {
  opacity: calc(1 - 1.4 * var(--p, 0));
  transform: translateY(calc(-96px * var(--p, 0))) scale(calc(1 - 0.08 * var(--p, 0)));
  transform-origin: left bottom;
}
/* Dawn: light comes before the page. */
.sheet {
  box-shadow: 0 -40px 80px rgba(242, 230, 212, 0.1);
}
.sheet::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: var(--selected-edge);
  border-radius: 12px 12px 0 0;
}
.pair.cover-pair .interlude .rule::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #d8c6aa;
  opacity: var(--p, 0);
}

/* The scene: the card's words rise in, the rule draws itself, the small lines follow. */
.pair.staged .interlude .say {
  opacity: 0;
  transform: translateY(16px);
}
.pair.staged .interlude .rule {
  transform: scaleX(0);
  transform-origin: left;
}
.pair.staged .interlude .cols {
  opacity: 0;
  transform: translateY(8px);
}
.pair.playing .interlude .say {
  animation: say-in 520ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.pair.playing .interlude .rule {
  animation: rule-in 640ms cubic-bezier(0.2, 0.7, 0.2, 1) 180ms both;
  transform-origin: left;
}
.pair.playing .interlude .cols {
  animation: say-in 520ms cubic-bezier(0.2, 0.7, 0.2, 1) 420ms both;
}
@keyframes say-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
@keyframes rule-in {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* The curtain between pages: black, with the next page's name where its cover will put it. */
.curtain {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #000000;
  color: #ece8df;
  display: flex;
  align-items: flex-end;
  padding: 40px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms ease;
}
.curtain.on {
  opacity: 1;
  pointer-events: auto;
}
.curtain .say {
  margin-bottom: 92px;
}
.curtain .say small {
  display: block;
  font-size: 15px;
  color: #bdb7ab;
  margin-top: 12px;
  font-weight: var(--weight-regular);
}

@media (prefers-reduced-motion: reduce) {
  .pair.staged .interlude .say,
  .pair.staged .interlude .cols {
    opacity: 1;
    transform: none;
  }
  .pair.staged .interlude .rule {
    transform: none;
  }
  .pair.playing .interlude .say,
  .pair.playing .interlude .rule,
  .pair.playing .interlude .cols {
    animation: none;
  }
  .pair.cover-pair .interlude .speak,
  .pair.cover-pair .interlude .site-top,
  .pair.cover-pair .interlude .top-row {
    opacity: 1;
    transform: none;
  }
  .dock {
    opacity: 1;
    pointer-events: auto;
  }
  .curtain {
    transition: none;
  }
}

@media (max-width: 720px) {
  .interlude {
    padding: 12px 16px 28px;
  }
  .say {
    font-size: 32px;
  }
  .say.small {
    font-size: 22px;
  }
  .cols {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
  .inner {
    padding: 0 16px;
  }
  .band {
    grid-template-columns: minmax(0, 1fr);
  }
  .lab {
    padding-bottom: 0;
  }
  .it {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
  .it > * {
    grid-column: 1 !important;
    grid-row: auto !important;
    justify-self: start;
  }
  .it.focus {
    margin: 0 -16px;
    padding: 16px;
  }
  .dock {
    padding: 0 16px;
    gap: 12px;
  }
  .dock nav {
    display: none;
  }
  .curtain {
    padding: 24px 16px;
  }
}

/* A band's margin can hold more than the label: the Approve all link under "Needs you". */
.margin {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px 0;
}
.margin .lab {
  padding: 0;
}
.margin .approve-all {
  font-size: 14px;
}
/* A heading that names a section for a screen reader and takes no room. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  margin: 0;
}
/* A line of fine print at the end of a band's rows. */
.credit {
  grid-column: 2;
  margin: 0;
  padding: 0 0 12px;
  font-size: 13px;
  color: var(--text-muted);
}
@media (max-width: 720px) {
  .margin {
    padding-bottom: 0;
  }
  .credit {
    grid-column: 1;
  }
}
