/* Furrow: the search and research page. It is built from the landing page's pieces
   (landing.css) and the centred first screen of pages.css. What is its own is here: the live
   result page, lit from behind by the passages answers rest on; three pieces of the result
   page in tiles; an illustrative research run; and the library's shelf. */

/* The light behind the product on this page is what an answer rests on: the preview's own
   source passages, set as type (field.js fills the block) and lit from behind the frame's
   upper edge. It stands in the room between the opening words and the frame, and no higher. */
.sky-hero .lit {
  --room: clamp(190px, 21vw, 300px);
  margin-top: var(--room);
}

.lit .glyphs {
  bottom: calc(100% - 1px);
  left: 50%;
  width: 100vw;
  height: calc(var(--room) - 24px);
  transform: translateX(-50%);
  background-image: radial-gradient(
    ellipse 46% 100% at 50% 100%,
    #FFFFFF 0%,
    #FFEBDD 10%,
    #FFC4C2 24%,
    rgba(246, 146, 170, 0.92) 40%,
    rgba(214, 132, 232, 0.7) 56%,
    rgba(150, 128, 240, 0.36) 74%,
    rgba(130, 110, 226, 0) 96%
  );
}

.lit .shot {
  margin-top: 0;
}

/* The result page itself, live, laid out at the size it was designed for and scaled down to
   the frame. A picture of it would go soft on a sharp screen and stale when the page changes;
   this is the real page, so it is neither. It is only to be looked at here: it cannot be
   scrolled or focused, and the whole frame is one link to the page. The scale is the frame's
   width over the page's, worked out as a plain number (a length over a length). */
.shot {
  container-type: inline-size;
  aspect-ratio: 1440 / 900;
  background: var(--bg);
}

.shot iframe {
  display: block;
  width: 1440px;
  height: 900px;
  border: 0;
  pointer-events: none;
  transform-origin: 0 0;
  transform: scale(tan(atan2(100cqw, 1440px)));
}

.shot-open {
  position: absolute;
  z-index: 1;
  inset: 0;
  border-radius: inherit;
}

/* The scaled page is painted in a layer of its own, so the light along the frame's top edge
   is lifted back over it. */
.shot::before {
  z-index: 2;
}

/* The frame clips anything outside it, so the ring is drawn inside its edge. */
.shot-open:focus-visible {
  outline-offset: -4px;
}

.sky-hero .caption {
  margin-inline: auto;
  text-align: center;
}

/* Search: the answer's tile runs the width of the row, its words beside the piece of the page
   they describe, so its well is only as tall as what stands in it. The other two share the row
   under it. */
.reading .tile {
  grid-column: span 6;
}

.reading .tile--wide {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  column-gap: 56px;
}

.reading .tile--wide .tile-head {
  align-self: start;
  padding-top: 8px;
}

.reading .tile--wide .tile-art {
  margin-top: 0;
}

/* One sentence of the answer at reading size, with its first phrase open. */
.said {
  padding: 24px 22px 4px;
  font: 400 clamp(25px, 2.3vw, 32px) / 1.24 var(--display);
  letter-spacing: -0.006em;
}

.said mark {
  margin: 0 -2px;
  padding: 0 2px;
  border-radius: 3px;
  background: var(--wash);
  color: inherit;
  text-decoration: underline var(--ember) 2px;
  text-underline-offset: 0.2em;
}

.said sup {
  position: relative;
  top: -0.2em;
  margin-left: 3px;
  color: var(--ember);
  font: 600 11px/1 var(--mono);
  vertical-align: super;
}

/* The note as the result page sets it, here under its sentence rather than beside it. */
.said-note {
  margin: 18px 22px 0;
  padding-bottom: 26px;
}

.said-note .note-excerpt {
  font-size: 16px;
}

/* The words the phrase rests on, lit in the passage as the result page lights them. */
.said-note mark {
  padding: 0 2px;
  border-radius: 3px;
  background: var(--wash);
  color: var(--fg);
}

/* Who is speaking: the source's own line under its name. */
.sheet-context {
  margin-top: 8px;
  color: var(--body);
  font-size: 14.5px;
  line-height: 1.45;
}

.sheet-doi {
  margin-top: 8px;
}

/* The questions the result page offers about an answer, as its rows look there. */
.asks {
  display: grid;
  gap: 4px;
  padding: 12px 10px 18px;
}

.asks li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 10px;
  border-radius: 14px;
  color: var(--body);
  font-size: 16px;
}

.asks li:first-child {
  background: rgba(255, 244, 230, 0.07);
  color: var(--fg);
}

.asks-glyph {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--well);
  box-shadow: inset 0 0 0 1px rgba(255, 244, 230, 0.07);
  color: var(--ember);
}

.asks-from {
  flex: none;
  margin-left: auto;
  padding-left: 12px;
  color: var(--soft);
  font-size: 13px;
  white-space: nowrap;
}

/* Research: a run of the workspace. The question and its plan on the left, and on the right,
   standing on the floor of the frame, what answered each part. */
.run-body {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  column-gap: 56px;
  align-items: end;
  margin-top: 20px;
  padding: 36px 40px 0;
}

.run-asked {
  padding-bottom: 40px;
}

.run-question {
  margin-top: 12px;
  font: 400 clamp(32px, 3.6vw, 50px) / 1.04 var(--display);
  letter-spacing: -0.012em;
}

.run-plan {
  max-width: 24em;
  margin-top: 20px;
  color: var(--body);
}

.run-parts {
  display: grid;
  gap: 8px;
  padding: 14px 14px 18px;
}

/* Each part has a mark: lit where a passage answered it, open where nothing did. */
.run-parts li {
  position: relative;
  padding: 14px 18px 15px 46px;
  border-radius: 12px;
  background: rgba(9, 7, 12, 0.5);
}

.run-parts li::before {
  content: "";
  position: absolute;
  top: 21px;
  left: 19px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ember);
  box-shadow: 0 0 10px rgba(255, 122, 92, 0.8);
}

.run-part {
  font: 400 clamp(20px, 1.8vw, 24px) / 1.18 var(--display);
}

.run-found {
  margin-top: 6px;
  color: var(--body);
  font-size: 15.5px;
  line-height: 1.45;
}

.run-from {
  margin-top: 4px;
  color: var(--soft);
  font: 500 11.5px/1.5 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.run-gap {
  color: var(--soft);
}

.run-parts .run-gap::before {
  background: none;
  box-shadow: inset 0 0 0 2px rgba(244, 239, 233, 0.42);
}

.run-gap .run-from {
  color: var(--ember);
}

/* Library: the argument beside the shelf it is about. */
.library-prose {
  margin-top: 24px;
  font-size: 17px;
}

#library .today {
  margin-top: 32px;
}

.shelf {
  display: grid;
  gap: 4px;
  padding: 14px 10px 18px;
}

.shelf a {
  display: block;
  padding: 14px 14px 15px;
  border-radius: 14px;
  text-decoration: none;
}

.shelf a:hover {
  background: rgba(255, 244, 230, 0.07);
}

.shelf-q {
  display: block;
  color: var(--fg);
  font: 400 clamp(23px, 2.2vw, 29px) / 1.14 var(--display);
}

.shelf-from {
  display: block;
  margin-top: 6px;
  color: var(--soft);
  font-size: 14.5px;
}

@media (max-width: 900px) {
  .reading .tile {
    grid-column: 1 / -1;
  }

  .reading .tile--wide {
    display: flex;
  }

  .reading .tile--wide .tile-head {
    padding-top: 0;
  }

  .reading .tile--wide .tile-art {
    margin-top: 28px;
  }

  .run-body {
    grid-template-columns: minmax(0, 1fr);
  }

  .run-asked {
    padding-bottom: 28px;
  }
}

@media (max-width: 720px) {
  /* On a phone the frame shows the page as a phone lays it out, cut a little short of a full
     screen so the frame is never taller than the screen it is on. */
  .shot {
    aspect-ratio: 390 / 720;
  }

  .shot iframe {
    width: 390px;
    height: 720px;
    transform: scale(tan(atan2(100cqw, 390px)));
  }

  .reading .tile--wide .tile-art {
    margin-top: 22px;
  }

  .said {
    padding: 18px 16px 4px;
  }

  .said-note {
    margin-inline: 16px;
  }

  .asks {
    padding: 8px 4px 12px;
  }

  /* The row is too narrow for both here, so the source goes under the question. */
  .asks li {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    column-gap: 12px;
    row-gap: 2px;
    font-size: 15.5px;
  }

  .asks-glyph {
    grid-row: span 2;
  }

  .asks-from {
    margin-left: 0;
    padding-left: 0;
  }

  .run-body {
    margin-top: 16px;
    padding: 24px 14px 0;
  }

  .run-asked {
    padding-inline: 6px;
  }

  .run-parts {
    padding: 10px 8px 12px;
  }

  .run-parts li {
    padding: 12px 14px 13px 38px;
  }

  .run-parts li::before {
    top: 19px;
    left: 15px;
  }

  .shelf {
    padding: 8px 4px 12px;
  }

  .shelf a {
    padding: 12px;
  }
}
