/* Melly Labs — products
 * =====================
 *
 * Two of them, each given a page's worth of room rather than a panel's. Same
 * language as the manifest: ruled lines under the writing, a marker on the one
 * line that matters, warm grey frames waiting for pictures, and each piece
 * arriving as it is reached.
 */

/* start3.css locks the start page to one screen with overflow: hidden. Undoing
   only the horizontal half left the page unscrollable. */
body { height: auto; overflow-y: auto; overflow-x: hidden; }

main {
  /* start3.css holds the start page's main to one screen and centres it. This
     page runs on, so both have to be undone or the grid is centred inside a
     window-high box and its first row ends up above the top of the page. */
  height: auto; align-content: start; justify-items: stretch;
  position: relative; z-index: 10;
  padding: clamp(150px, 26vh, 280px) var(--edge) clamp(90px, 18vh, 220px);
  display: grid; grid-template-columns: repeat(12, 1fr);
  column-gap: clamp(16px, 2vw, 34px);
  row-gap: clamp(60px, 12vh, 150px);
  align-items: start;
}

/* --- Ruled writing ---------------------------------------------------------- */
.product p.what {
  line-height: var(--lh); --lh: 1.55em;
  padding-bottom: 3px;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent calc(var(--lh) - 2px),
    currentColor calc(var(--lh) - 2px),
    currentColor var(--lh)
  );
  font-size: clamp(1.2rem, 1.55vw, 1.6rem);
  max-width: 34ch;
}

/* The name, marked. */
.product h2 {
  font-size: clamp(1.45rem, 1.95vw, 2.05rem); font-weight: 400;
  line-height: 1.45; margin-bottom: .8em;
}
.product h2 .marker {
  display: inline-block;
  background-color: var(--green);
  padding: 0 .16em;
}
body.on-green .product h2 .marker { background-color: #fff; }
body.on-blue .product h2 .marker { background-color: #6a6aff; }

/* The way in. */
.go { display: flex; flex-wrap: wrap; align-items: baseline; gap: 14px 22px; margin-top: 1.8em; }
.go a {
  font-size: clamp(1.05rem, 1.3vw, 1.3rem);
  border-bottom: 2px solid currentColor; padding-bottom: 2px;
  transition: opacity .2s ease;
}
.go a:hover { opacity: .55; }
.go .fine { font-size: clamp(13px, 1vw, 15px); font-weight: 300; opacity: .6; }

/* The blocks are named .first and .second, not .one and .two: start3.css still
   carries the old products sheet, whose .one and .two set a grey text colour,
   and this page loads that stylesheet.
 */

/* --- The index --------------------------------------------------------------
 * Two names in the top right, opposite the opening line: what is on this page,
 * and a way straight to either one.
 */
.index {
  /* No measure on it: the sentence is meant to read as one line. It still wraps
     on a phone, where one line will not fit. */
  grid-column: 1 / -1; margin-inline: auto; max-width: none;
  margin-top: clamp(-92px, -9vh, -62px);
  font-size: clamp(1.05rem, 1.35vw, 1.35rem); font-weight: 400; line-height: 1.4;
  text-align: center;
}
/* The two names are the only thing ruled in it, and they are the way in. */
.index a {
  border-bottom: 2px solid currentColor; padding-bottom: 1px;
  transition: opacity .2s ease;
}
.index a:hover { opacity: .55; }

/* --- Where things sit -------------------------------------------------------
 * The manifest's way: no rows are pinned. The spans overlap the piece before
 * them, so each lands where it should, and the two that are meant to sit side
 * by side are the only ones whose columns leave room for each other.
 *
 * The opening line takes the full width for that reason: given seven columns it
 * left five free, and the first frame slid up beside it.
 */
/* The opening and the line under it, both centred and stacked: the sentence
   was in the corner, which set it against the opening rather than under it. */
.lede {
  grid-column: 1 / -1; text-align: center; margin-inline: auto;
  font-size: clamp(1.5rem, 2.6vw, 2.6rem); font-weight: 400;
  line-height: 1.15; letter-spacing: -0.02em;
  max-width: 22ch;
}

.first { grid-column: 2 / span 5; }
.shot-1 { grid-column: 8 / span 5; height: 34vw; margin-right: calc(var(--edge) * -1); }
.shot-2 { grid-column: 1 / span 5; height: 26vw; margin-left: calc(var(--edge) * -1); }
.second { grid-column: 7 / span 5; }

.shot { width: 100%; position: relative; background: #e6e2dd; overflow: hidden; }
.shot img { position: absolute; inset: 0; }

/* The panel sits in the top half of that photograph, so the crop is taken from
   the bottom of the desk rather than off the clock. */
.shot-2 img { object-position: center top; }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Arriving on the way past. */
[data-reveal] { opacity: 0; transform: translateY(28px); }
[data-reveal].seen {
  opacity: 1; transform: none;
  transition: opacity .8s ease, transform .8s cubic-bezier(.2, .7, .3, 1);
}
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
}

@media (max-width: 760px) {
  main {
    grid-template-columns: repeat(6, 1fr);
    row-gap: clamp(44px, 9vh, 90px);
    padding-top: clamp(90px, 16vh, 140px);
  }
  .lede { grid-column: 1 / -1; grid-row: 1; }
  .index { grid-column: 1 / -1; text-align: center; }
  .first { grid-column: 2 / span 5; }
  .shot-1 { grid-column: 3 / span 4; height: 70vw; margin-right: calc(var(--edge) * -1); }
  .shot-2 { grid-column: 1 / span 4; height: 52vw; margin-left: calc(var(--edge) * -1); }
  .second { grid-column: 1 / span 5; }
  .product p.what { max-width: none; }
}
