/* Hadron case page, Figma frame 49:176. Its own stylesheet: nothing here is shared with light.css. */

:root {
  --bg: #282828;
  --text: #fff;
  --muted: #999;
  --back: #a2a2a2;
}

*, *::before, *::after { box-sizing: border-box; }

html { background: var(--bg); color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Golos Text", sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, p { margin: 0; font-weight: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; }

.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.site-header {
  display: flex;
  justify-content: center;
  width: 100%;
  padding-top: 48px;
}

/* The same file as on the main page, turned white */
.site-header__logo {
  flex: none;
  width: 180px;
  height: 34px;
  filter: brightness(0) invert(1);
}

.column { width: min(1080px, 100% - 80px); }

/* Last block on the page */
.findings { padding-bottom: 204px; }

/* Set on each text style, not on body: an em value set on body would inherit as a fixed length. */
.back,
.heading,
.lead,
.body,
.role__name,
.result__heading { letter-spacing: -0.04em; }

/* ---------- Back link ---------- */

.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 38px;
  color: var(--back);
  font-size: 18px;
  font-weight: 500;
  line-height: calc(28 / 18);
  transition: color 0.2s ease;
}

.back:hover,
.back:focus-visible { color: var(--text); }

.back__icon {
  flex: none;
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: url("assets/back-arrow.svg") center / contain no-repeat;
  mask: url("assets/back-arrow.svg") center / contain no-repeat;
}

/* ---------- Title ---------- */

.title {
  margin-top: 196px;
  font-size: 70px;
  font-weight: 500;
  letter-spacing: calc(-3 / 70 * 1em);
  line-height: calc(80 / 70);
  text-align: center;
}

.title__break-phone { display: none; }

/* ---------- Text blocks ---------- */

.heading {
  font-size: 32px;
  font-weight: 500;
  line-height: calc(40 / 32);
}

.lead {
  font-size: 24px;
  line-height: calc(32 / 24);
}

.body {
  color: var(--muted);
  font-size: 18px;
  line-height: calc(28 / 18);
}

.context,
.role__row {
  display: grid;
  grid-template-columns: calc(280 / 1080 * 100%) minmax(0, 1fr);
  column-gap: 40px;
  align-items: first baseline; /* the sizes differ, so the two columns line up on the first line's baseline */
}

.context { margin-top: 188px; }

.context__text {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ---------- Screens in a frame ---------- */

/* Figma 82:354: 15px of #0c0c0c around the screen at a 1080px card, scaling with it.
   hadron.js draws the squircle corners. */
.device {
  margin: 0;
  padding: calc(15.08 / 1080 * 100%);
  border-radius: 36px; /* until the squircle is drawn */
  background: #0c0c0c;
}

.device__screen {
  display: block;
  width: 100%;
  overflow: hidden;
  border-radius: 28px; /* until the squircle is drawn */
  isolation: isolate; /* keeps the rounded clip on the animation in Safari */
}

.role { margin-top: 164px; }

.role__rows { margin-top: 32px; }

.role__row {
  position: relative;
  padding-block: 24px;
}

.role__row:not(:last-child) { padding-bottom: 32px; }

/* Her brush line from Figma. A fixed width keeps the texture from being squeezed on small screens. */
.role__row:not(:last-child)::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -2px;
  left: 0;
  height: 4px;
  background: url("assets/case-divider.png") left center / 1080px 4px no-repeat;
}

.role__name {
  max-width: 250px; /* breaks before "that scales", as in Figma */
  font-size: 18px;
  font-weight: 500;
  line-height: calc(28 / 18);
}

/* ---------- White lower part with the brush edge ---------- */

/* Figma group 63:341. The edge repeats every 1388px, so a wider screen simply gets more of the
   same pattern at the same size. White starts under the edge, 53px below its top at full size. */
.paper {
  --edge-width: 1388px;
  --edge-height: 76px;
  --white-from: 53px;
  --edge-overlap: 48px;
  --edge-shift: 38px;
  position: relative;
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: 136px;
  padding-block: 164px 180px;
  background-color: transparent;
  background-image: url("assets/case-edge.svg"), linear-gradient(#fff, #fff);
  background-position: left top, left var(--white-from);
  background-repeat: repeat-x, no-repeat;
  background-size: var(--edge-width) var(--edge-height), 100% 100%;
}

/* The lower edge (Figma 85:952): the same shape in the page's dark colour, tearing up into the white. */
.paper::after {
  content: "";
  position: absolute;
  top: calc(100% - var(--edge-overlap));
  left: 0;
  width: 100%;
  height: var(--edge-height);
  background: var(--bg);
  -webkit-mask: url("assets/case-edge.svg") var(--edge-shift) 0 / var(--edge-width) var(--edge-height) repeat-x;
  mask: url("assets/case-edge.svg") var(--edge-shift) 0 / var(--edge-width) var(--edge-height) repeat-x;
  pointer-events: none;
}

/* Figma 76:346. The player takes her Lottie animation's proportions so nothing is cropped. */
.result__text,
.started__text {
  display: grid;
  grid-template-columns: calc(280 / 1080 * 100%) minmax(0, 1fr);
  column-gap: 40px;
  align-items: first baseline;
}

.result__heading {
  color: var(--bg);
  font-size: 32px; /* same as .heading */
  font-weight: 500;
  line-height: calc(40 / 32);
}

.result__text .body { color: var(--bg); }

.result__device { margin-top: 40px; }

.result__player { aspect-ratio: 1440 / 998; }

.result__player svg { display: block; }

.result__player video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Figma 85:893. The screen fills the frame's width; the empty bottom of the image is cropped. */
.started { margin-top: 120px; }

.started__copy {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.started__copy .lead { color: var(--bg); }
.started__copy .body { color: #757575; }

.started__device { margin-top: 40px; }

.started__image {
  height: auto;
  aspect-ratio: 1049.84 / 682.4;
  object-fit: cover;
  object-position: 50% 0;
}

/* Sits in the gap under the frame, so the 120px between blocks is still measured from the frame. */
.started__note {
  margin: 12px 0 -32px;
  color: #757575;
  font-size: 14px;
  letter-spacing: -0.04em;
  line-height: calc(20 / 14);
  text-align: center;
}

/* Figma 85:906 */
.bottleneck { margin-top: 120px; }

.bottleneck__copy {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.bottleneck__copy .lead { color: var(--bg); }
.bottleneck__copy .body { color: #757575; }

.funnel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 24px;
}

.funnel__label {
  color: #000;
  font-size: 14px;
  letter-spacing: -0.04em;
  line-height: calc(20 / 14);
}

.funnel__row {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--bg);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.5;
}

.funnel__name {
  flex: none;
  width: 200px;
}

/* The brush bars: 460px wide at 100% in Figma, the rest of the row is left for the value. One brush
   stroke at a fixed scale is cut to length and keeps its real right tip, so the texture never squeezes. */
.funnel__bar {
  --brush-width: 460px;
  --brush-height: 24.66px;
  --tip: 20px;
  --ink: #4c4c4c;
  position: relative;
  flex: none;
  width: calc((100% - 200px - 32px - 68px) * var(--share) / 100);
  max-width: calc(var(--brush-width) * var(--share) / 100); /* never longer than the brush stroke itself */
  height: var(--brush-height);
}

.funnel__bar--dark { --ink: var(--bg); }

.funnel__bar::before,
.funnel__bar::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  background: var(--ink);
  -webkit-mask: url("assets/case-funnel-100.svg") left center / var(--brush-width) var(--brush-height) no-repeat;
  mask: url("assets/case-funnel-100.svg") left center / var(--brush-width) var(--brush-height) no-repeat;
}

.funnel__bar::before {
  left: 0;
  right: calc(var(--tip) - 1px);
}

.funnel__bar::after {
  right: 0;
  width: var(--tip);
  -webkit-mask-position: right center;
  mask-position: right center;
}

/* Figma 85:905 and 85:894: the dark part after the lower edge */
.question {
  margin-top: 192px;
  color: var(--text);
  font-size: 56px;
  font-weight: 500;
  letter-spacing: calc(-2.4 / 56 * 1em);
  line-height: calc(64 / 56);
  text-align: center;
}

.findings .context { margin-top: 165px; }
.findings .role__rows { margin-top: 40px; }
.findings .role__row .body { color: var(--text); }

/* Figma 107:2 to 107:115: the blocks after What we found */
.findings .block { margin-top: 120px; }

.block__device { margin-top: 40px; }
.block__image { height: auto; }

.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0;
  padding: 0;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.5;
  list-style: none;
}

.steps li {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* The back link's chevron, turned to point forward */
.steps li + li::before {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  background: var(--back);
  -webkit-mask: url("assets/back-arrow.svg") center / contain no-repeat;
  mask: url("assets/back-arrow.svg") center / contain no-repeat;
  transform: scaleX(-1);
}

.steps__active { color: #c5fe02; }
.steps__optional { color: var(--muted); }

.metrics {
  width: 100%;
  margin-top: 40px;
  border-collapse: collapse;
  letter-spacing: -0.04em;
}

.metrics th,
.metrics td {
  padding: 24px 24px 32px 0;
  font-size: 18px;
  line-height: calc(28 / 18);
  text-align: left;
  vertical-align: top;
}

.metrics thead th {
  padding-block: 12px 20px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  line-height: calc(20 / 14);
}

.metrics thead th:not(:first-child),
.metrics td { width: 164px; }

.metrics tbody th,
.metrics td:last-child { font-weight: 500; }

.metrics td:nth-child(2) { color: var(--muted); }

.metrics tr:not(:last-child) { background: url("assets/case-divider.png") left bottom / 1080px 4px no-repeat; }

.metrics tbody tr:last-child th,
.metrics tbody tr:last-child td { padding-bottom: 24px; }

.metrics th:last-child,
.metrics td:last-child { padding-right: 0; }

.metrics__note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: -0.04em;
  line-height: calc(20 / 14);
}

/* ---------- Footer ---------- */

.site-logo {
  display: block;
  flex: none;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  width: min(1080px, 100% - 80px);
  padding-block: 40px 56px;
}

/* The same file as on the main page, turned white */
.site-footer__logo {
  width: 180px;
  height: 34px;
  filter: brightness(0) invert(1);
}

.site-footer__contacts {
  display: flex;
  align-items: center;
  gap: 32px;
}

.site-footer__email,
.site-footer__link {
  position: relative;
  color: var(--text);
  font: inherit;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: calc(28 / 18);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

/* Both labels share one cell, so "Copied" doesn't move anything. */
.site-footer__email {
  display: grid;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.site-footer__address,
.site-footer__copied {
  grid-area: 1 / 1;
  text-align: left;
  transition: opacity 0.2s ease;
}

.site-footer__copied { opacity: 0; }
.site-footer__email.is-copied .site-footer__address { opacity: 0; }
.site-footer__email.is-copied .site-footer__copied { opacity: 1; }

/* The main page's arrow, drawn in the text colour. */
.site-footer__link::after {
  content: "";
  position: absolute;
  top: calc(-3 / 18 * 1em);
  left: 100%;
  width: calc(8 / 18 * 1em);
  height: calc(8 / 18 * 1em);
  background: currentColor;
  -webkit-mask: url("assets/name-arrow.svg") center / contain no-repeat;
  mask: url("assets/name-arrow.svg") center / contain no-repeat;
  opacity: 0;
  transition: opacity 0.2s ease;
}

@media (hover: hover) {
  .site-footer__email:hover .site-footer__address,
  .site-footer__link:hover { text-decoration-line: underline; }

  .site-footer__link:hover::after { opacity: 1; }
}

.site-footer__email:focus-visible .site-footer__address,
.site-footer__link:focus-visible { text-decoration-line: underline; }

/* ---------- Adaptation: tablet ---------- */

@media (max-width: 1199.98px) {
  .paper { padding-block: 140px 160px; }

  .findings { padding-bottom: 160px; }

  .question {
    margin-top: 160px;
    font-size: min(56px, 4.6vw);
  }

  .findings .context { margin-top: 120px; }

  .title {
    margin-top: 120px;
    font-size: min(70px, 5.8vw);
  }

  .context { margin-top: 120px; }
  .role { margin-top: 120px; }
}

/* ---------- Adaptation: phone ---------- */

@media (max-width: 809.98px) {
  .site-header { padding-top: 32px; }

  /* A phone shows only a quarter of the pattern, so the edge is drawn at 72% of its size. */
  .paper {
    --edge-width: 1000px;
    --edge-height: 54.8px;
    --white-from: 38.2px;
    --edge-overlap: 34.6px;
    --edge-shift: 27.4px;
    margin-top: 72px;
    padding-block: 104px 96px;
  }

  .findings { padding-bottom: 120px; }

  .question {
    margin-top: 104px;
    font-size: min(44px, 7.2vw); /* small enough to keep the second sentence on one line */
    line-height: 1.25;
    text-wrap: balance;
  }

  .findings .context { margin-top: 72px; }
  .findings .role__rows { margin-top: 16px; }

  .block__device { margin-top: 24px; }

  .steps { margin-top: 8px; font-size: 14px; }
  .steps li { gap: 8px; }
  .steps { gap: 6px 8px; }
  .steps li + li::before { width: 12px; height: 12px; }

  .metrics { margin-top: 16px; table-layout: fixed; }

  .metrics th,
  .metrics td {
    padding: 14px 8px 18px 0;
    font-size: 14px;
    line-height: calc(20 / 14);
  }

  .metrics thead th { padding-block: 8px 12px; font-size: 13px; }

  .metrics thead th:not(:first-child),
  .metrics td { width: 58px; }

  .metrics thead th:last-child,
  .metrics td:last-child { width: 68px; }

  .metrics tbody tr:last-child th,
  .metrics tbody tr:last-child td { padding-bottom: 14px; }

  .metrics__note { font-size: 13px; line-height: 1.45; }

  .result__text,
  .started__text { display: block; }

  .started { margin-top: 72px; }
  .started__copy { margin-top: 8px; gap: 12px; }
  .started__device { margin-top: 24px; }
  .started__note { margin: 8px 0 -28px; font-size: 13px; }

  .bottleneck { margin-top: 72px; }
  .bottleneck__copy { margin-top: 8px; gap: 12px; }

  .funnel { gap: 20px; padding-top: 12px; }

  /* The name goes above the bar, so the bar gets the whole row and the shares stay readable. */
  .funnel__row {
    flex-wrap: wrap;
    gap: 6px 12px;
    font-size: 14px;
    line-height: calc(20 / 14);
  }

  .funnel__name { width: 100%; }

  .funnel__bar {
    --brush-width: 368px;
    --brush-height: 19.7px;
    --tip: 16px;
    width: calc((100% - 12px - 42px) * var(--share) / 100);
  }

  .result__heading { font-size: 26px; line-height: calc(34 / 26); }
  .result__heading + .body { margin-top: 8px; }

  .result__device { margin-top: 24px; }

  .device { border-radius: 11px; }
  .device__screen { border-radius: 9px; }

  .column { width: calc(100% - 48px); }

  .back {
    margin-top: 32px;
    font-size: 16px;
    line-height: 1.5;
  }

  /* Three lines as in Figma 71:342, enlarged to 36px on a 402px screen and scaled with it.
     The negative margin lets the longest line use a little of the page's side padding. */
  .title {
    margin-top: 72px;
    margin-inline: -8px;
    font-size: min(48px, 8.96vw);
    line-height: 1.25;
  }

  .title__break-desktop { display: none; }
  .title__break-phone { display: inline; }

  .context,
  .role__row { display: block; }

  .context { margin-top: 88px; }
  .role { margin-top: 88px; }

  .heading { font-size: 26px; line-height: calc(34 / 26); }
  .lead { font-size: 20px; line-height: 1.4; }
  .body { font-size: 16px; line-height: 1.5; }

  .context__text { margin-top: 16px; gap: 12px; }

  .role__rows { margin-top: 16px; }

  .role__row { padding-block: 20px; }
  .role__row:not(:last-child) { padding-bottom: 24px; }

  .role__name { max-width: none; font-size: 16px; line-height: 1.5; }
  .role__name + .body { margin-top: 4px; }

  .site-footer {
    flex-direction: column;
    gap: 36px;
    width: calc(100% - 48px);
    padding-block: 32px 48px;
  }

  .site-footer__contacts { gap: 24px; }

  .site-footer__email,
  .site-footer__link { font-size: 16px; line-height: 1.5; }
}

.device.is-squircle,
.device.is-squircle .device__screen { border-radius: 0; }

/* Smallest phones, same as the main page */
@media (max-width: 359.98px) {
  .column { width: calc(100% - 32px); }
}
