/* ==========================================================================
   Horizontal site (desktop). Built by js/hscroll.js: the sections stand in
   a row inside a sticky frame and the page scroll slides the row sideways.
   Everything here only applies when <html> has .hs-on, so phones keep the
   normal vertical page.
   ========================================================================== */

/* until the row is built, hide the page so it does not flash in a column */
html.hs-want:not(.hs-on) main,
html.hs-want:not(.hs-on) body > footer.contact { visibility: hidden; }

.hs { position: relative; }
.hs__stick {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  margin-left: var(--side-w);                 /* the menu stays free on the left; the row slides in under its edge */
  overflow: clip;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 40px);
  mask-image: linear-gradient(90deg, transparent 0, #000 40px);
}
.hs__track { display: flex; width: max-content; height: 100%; will-change: transform; }

/* ---- every section is a panel: full height, its own width, scrolls inside if it is taller than the window ---- */
.hs-on .hs__panel {
  flex: none;
  position: relative;
  box-sizing: border-box;
  width: min(var(--pw, 1100px), var(--hs-w, 100vw));
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 6.5rem clamp(2rem, 4vw, 4.5rem) 5.5rem;
  overflow: hidden auto;
  border: 0;
  border-left: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: rgba(243, 241, 235, 0.3) transparent;
}
.hs-on .hs__panel:first-child { border-left: 0; }
.hs-on .hs__panel.is-auto,
.hs-on .work.hs__panel,
.hs-on .lab.hs__panel,
.hs-on .case__coverpanel { width: max-content; max-width: none; }

/* home panels sit in the middle; with spacers, a taller panel still starts at its top */
.hs-on .hs__panel--c { display: flex; flex-direction: column; }
.hs-on .hs__panel--c::before,
.hs-on .hs__panel--c::after { content: ""; flex: 1 0 0; }

/* the case page article is only a holder now */
.hs-on article.case.wrap { padding: 0; }

/* the vertical scroll trail is replaced by the bar below */
.hs-on .trail { display: none; }

/* ---- progress bar along the bottom ---- */
.hsbar {
  position: fixed;
  z-index: 40;
  left: calc(var(--side-w) + 2rem);
  right: var(--gutter);
  bottom: 20px;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  pointer-events: none;
  color: var(--paper);
}
.hsbar__line { position: relative; flex: 1; height: 1px; background: var(--line-strong); }
.hsbar__fill {
  position: absolute;
  inset: 0;
  background: var(--accent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 60%, transparent);
  transform-origin: left;
  transform: scaleX(0);
}
.hsbar__tick {
  position: absolute;
  top: -3px;
  width: 1px;
  height: 7px;
  background: var(--text-muted);
  transition: background 0.3s var(--ease-out), height 0.3s var(--ease-out), top 0.3s var(--ease-out);
}
.hsbar__tick.is-past { background: var(--accent); }
.hsbar__tick.is-current { top: -6px; height: 13px; background: var(--paper); }
.hsbar__hint { color: var(--text-muted); transition: opacity 0.4s var(--ease-out); }
.hsbar__hint::after { content: " →"; }
.hsbar__label { min-width: 5.5ch; text-align: right; text-shadow: 0 0 8px rgba(5, 7, 11, 0.9); }
.hsbar__label span { color: var(--text-muted); }

/* ==========================================================================
   Homepage panels
   ========================================================================== */
.hs-on .hero.hs__panel {
  --pw: 9999px;
  display: grid;
  place-items: center;
  padding: 6rem 3rem;
}
.hs-on .hero__aside { left: 2.5rem; right: 2.5rem; bottom: 4.25rem; }

.hs-on .intro.hs__panel { --pw: 1040px; }
.hs-on .intro__grid { margin-top: 1.5rem; }

/* work: the projects stand side by side as cards */
.hs-on .work.hs__panel { padding-right: clamp(2rem, 4vw, 4.5rem); }
.hs-on .work .index {
  display: flex;
  align-items: flex-start;
  gap: clamp(1.5rem, 3vw, 3rem);
  margin-top: clamp(1.5rem, 1rem + 2vw, 3rem);
  border-top: 0;
}
.hs-on .index__item {
  width: clamp(250px, 21vw, 340px);
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "num" "media" "body" "aside";
  gap: 0.75rem;
  padding: 0;
  border-bottom: 0;
}
.hs-on .index__num { padding-top: 0; }
.hs-on .index__title { font-size: clamp(2rem, 1.2rem + 1.8vw, 3.25rem); }
.hs-on .index__desc { margin-top: 0.75rem; font-size: 0.95rem; }
.hs-on .index__aside { max-width: none; padding-top: 0; justify-content: space-between; }
.hs-on .index__meta { text-align: left; }
.hs-on .index__item::before { inset: -1rem; }
.hs-on .index__item:hover,
.hs-on .index__item:focus-within { border-bottom-color: transparent; }

/* lab: title and note on the sides, the board in the middle */
.hs-on .lab { --board-h: max(420px, calc(100svh - 13rem)); }
.hs-on .lab__inner.wrap {
  display: flex;
  align-items: center;
  gap: clamp(2rem, 4vw, 4rem);
  height: 100%;
  padding: 0;
}
.hs-on .lab__head { flex: 0 0 min(22rem, 24vw); flex-direction: column; align-items: flex-start; }
.hs-on .lab .section-title { font-size: clamp(1.5rem, 1rem + 1.6vw, 2.5rem); letter-spacing: 0.12em; }
.hs-on .lab .board { flex: none; margin: 0; width: calc(var(--board-h) * 1.15); }
.hs-on .lab__note { flex: 0 0 min(18rem, 20vw); margin: 0; }

/* contact */
.hs-on .contact.hs__panel { --pw: 9999px; }                /* the last panel fills the frame, so no half of the previous one shows */
.hs-on .contact.hs__panel .contact__grid { max-width: 1100px; }
.hs-on .contact__title { font-size: clamp(1.6rem, 1rem + 2.2vw, 3.2rem); }
.hs-on .contact__grid { margin-top: 2rem; }
.hs-on .contact__base { margin-top: 2.5rem; }

/* ==========================================================================
   Case pages and About
   ========================================================================== */
.hs-on header.hs__panel { --pw: 1120px; }
.hs-on .case__title { margin-top: 1.25rem; }

/* cover: sized by the window height so a whole row of phones fits on screen */
.hs-on .case__coverpanel { padding-inline: clamp(1.5rem, 3vw, 3rem); display: flex; flex-direction: column; justify-content: center; }
.hs-on .case__coverpanel .case__cover { margin: 0; }
.hs-on .case__coverpanel .phones.case__cover {
  width: calc((100svh - 14rem) * 1.75);
  max-width: 1180px;
  min-width: 640px;
}
.hs-on .case__coverpanel figure.case__cover img {
  width: auto;
  height: calc(100svh - 13rem);
  max-width: none;
}
.hs-on .case__coverpanel div.case__cover { width: calc((100svh - 16rem) * 1.78); max-height: none !important; }
.hs-on .case__note { margin-top: 1rem; }

/* numbered sections: the title first, then every block of the section in one row.
   Pictures and videos are sized by the window height, so they always fit on screen. */
.hs-on { --blk-h: calc(100svh - 13rem); }
.hs-on .case-sec.hs__panel {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: clamp(2.5rem, 4vw, 4.5rem);
  width: max-content;
  max-width: none;
  margin: 0;
  border-top: 0;
}
.hs-on .case-sec__head { flex: 0 0 clamp(15rem, 19vw, 20rem); position: static; }
.hs-on .case-sec__body {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: clamp(2rem, 3vw, 3.5rem);
  min-width: 0;
}
.hs-on .case-sec__body > *,
.hs-on .hs__group { flex: none; }
.hs-on .hs__group { display: grid; gap: 1rem; align-content: start; }

/* text blocks are reading columns */
.hs-on .case-sec__body > p,
.hs-on .case-sec__body > ul.case-list,
.hs-on .case-sec__body > blockquote,
.hs-on .case-sec__body > ol,
.hs-on .case-sec__body > .mission { width: clamp(20rem, 25vw, 27rem); max-width: none; }
.hs-on .hs__group > ul.case-list { width: clamp(20rem, 25vw, 27rem); max-width: none; }
.hs-on .case-sec__body > .stats { width: clamp(28rem, 36vw, 40rem); }
.hs-on .case-sec__body > .quote { margin: 0; }
.hs-on .case-sec__body > span { align-self: center; }

/* inventory slots (About) */
.hs-on .hs__group > .slots,
.hs-on .case-sec__body > .slots { width: clamp(26rem, 33vw, 36rem); max-width: none; }

/* pictures: as large as the window allows, never cropped */
.hs-on .case-sec__body .fig,
.hs-on .case-sec__body .figs { max-width: none; }
.hs-on .case-sec__body .fig img { width: auto; height: auto; max-width: none; max-height: var(--blk-h); }
.hs-on .case-sec__body .figs { width: max-content; gap: 1.5rem; }
.hs-on .case-sec__body .figs .fig { flex: none; min-width: 0; }
.hs-on .case-sec__body .fig--video video { width: auto; height: min(var(--blk-h), 540px); max-width: none; }

/* phone recordings */
.hs-on .case-sec__body .phones { display: flex; gap: clamp(1.25rem, 2vw, 2.25rem); width: max-content; max-width: none; }
.hs-on .case-sec__body .phone-shot { width: calc((var(--blk-h) - 10.5rem) * 0.494); }
.hs-on .case-sec__body .phone-shot video { width: 100%; height: auto; }

/* live prototype: the phone and its notes side by side */
.hs-on .proto { display: flex; align-items: center; gap: 2.5rem; margin: 0; width: max-content; }
.hs-on .proto__frame { flex: none; width: calc(var(--blk-h) * 0.5); height: var(--blk-h); min-height: 0; }
.hs-on .proto__notes { width: 18rem; }

/* cards in a row */
.hs-on .features,
.hs-on .insights,
.hs-on .concepts { display: flex; flex-direction: row; align-items: flex-start; gap: 2rem; width: max-content; max-width: none; }
.hs-on .features li { width: clamp(11.5rem, 14vw, 14rem); }
.hs-on .features img { width: auto; height: auto; max-height: calc(var(--blk-h) - 11rem); max-width: 100%; }
.hs-on .insights li { width: clamp(15rem, 19vw, 18rem); }
.hs-on .concepts li { width: clamp(14rem, 17vw, 16rem); }

/* "How I got there": a narrow panel with the words running along a line */
.hs-on .case-divider.hs__panel {
  --pw: 7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  padding: 6.5rem 0 5.5rem;
}
.hs-on .case-divider::before,
.hs-on .case-divider::after { width: 1px; height: auto; flex: 1; }
.hs-on .case-divider span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }

.hs-on .case-next.hs__panel {
  --pw: 9999px;
  align-content: center;
  border-top: 0;
}
.hs-on .case-next .contact.wrap { padding: 0; margin-top: 2rem; }
.hs-on .case-next .contact__base { margin-top: 0; }
