/* /web only: tangerine hero, the scroll-driven previews, how I work.
   Preview layout: every .case holds a tall .case-track with a sticky stage (.case-pin) inside.
   preview.js maps how far the track has travelled to a translate3d on the long screenshot.
   Wider than 760px: browser window + desktop screenshot. 760px and narrower: phone + mobile one.
   Wider than 1000px the text pins beside the window; below that it scrolls by first and the
   device pins alone, as wide as the page allows. */

/* ---------- hero ---------- */

.web-hero {
  min-height: min(calc(86svh - 2 * var(--inset)), 50rem);
}

.web-hero h1 {
  font-size: clamp(3rem, 1.5rem + 6.6vw, 6.7rem);
}

.web-hero .hero-in {
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
}

.hello {
  --me: clamp(12rem, 24vw, 20.5rem);
  position: relative;
  width: var(--me);
  aspect-ratio: 1;
  justify-self: center;
  margin-top: 3rem;
}

.hello-disc {
  position: absolute;
  width: 134%;
  aspect-ratio: 1;
  left: 2%;
  top: -24%;
  border-radius: 50%;
  background: var(--teal);
  animation: pop 1.1s var(--spring-soft) 0.1s both;
}

.hello-me {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  animation: pop 1s var(--spring) 0.22s both;
  touch-action: manipulation;
}

.hello-bubble {
  position: absolute;
  right: 74%;
  bottom: 86%;
  width: max-content;
  max-width: 14.5rem;
  padding: 0.85rem 1.15rem;
  border-radius: 1.4rem 1.4rem 0.3rem 1.4rem;
  background: var(--cream);
  color: var(--ink);
  font-size: var(--step--1);
  font-weight: 600;
  line-height: 1.35;
  box-shadow: 0 0.75rem 1.5rem -0.75rem rgba(13, 19, 33, 0.45);
  animation: pop 0.9s var(--spring) 0.75s both;
  transform-origin: 100% 100%;
}

.hello .bub-ring {
  width: 12%;
  right: -5%;
  bottom: 10%;
  border: 0.22rem solid var(--cream);
  animation-delay: 0.6s;
}

.hello .bub-dot {
  width: 6%;
  left: 8%;
  bottom: -10%;
  background: var(--cream);
  animation-delay: 0.7s;
}

/* ---------- previews ---------- */

.cases {
  position: relative;
  /* the first browser window peeks into the first screen, under the hero */
  margin-top: -8rem;
  overflow-x: clip; /* the discs may poke past the edge; clip (unlike hidden) keeps sticky working */
}

.cases + .section {
  padding-top: calc(var(--section) * 0.55);
}

/* the section overlaps the bottom of the hero, and its sticky columns are taller than what they
   show: only the visible things take clicks, everything else lets them through (hero buttons!) */
.cases,
.case,
.case-track,
.case-text,
.case-pin {
  pointer-events: none;
}

.case-text > *,
.device > * {
  pointer-events: auto;
}

.case {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.4fr);
  column-gap: clamp(2rem, 5.5vw, 5.5rem);
  max-width: max(calc(var(--wrap) + 2 * var(--gutter)), 74vw);
  margin-inline: auto;
  padding-inline: var(--gutter);
  --disc: var(--teal);
  --visit-bg: var(--tangerine);
  --visit-fg: var(--ink);
}

.case:nth-of-type(even) {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.78fr);
  --disc: var(--tangerine);
  --visit-bg: var(--teal);
  --visit-fg: var(--cream);
}

.case:nth-of-type(even) .case-text {
  order: 2;
}

/* the next project already rises while the previous one leaves: no empty screen in between
   (the sticky columns are click-through, see above) */
.case + .case {
  margin-top: -14vh;
  margin-top: -14svh;
}

.case-text {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--s-5);
  height: 100vh;
  height: 100svh;
  padding-block: 6rem 3rem;
}

.case-text h3 {
  font-size: var(--step-3);
  letter-spacing: -0.028em;
}

.case-text p {
  color: var(--muted);
  max-width: 44ch;
}

.case-track {
  height: calc(var(--len, 2) * 100vh);
  height: calc(var(--len, 2) * 100svh);
}

.case-pin {
  position: sticky;
  top: 0;
  display: grid;
  place-items: center;
  height: 100vh;
  height: 100svh;
  padding-block: 6rem 4.5rem;
}

.device {
  position: relative;
  isolation: isolate;
  width: 100%;
}

.device-disc {
  position: absolute;
  z-index: -1;
  width: 56%;
  aspect-ratio: 1;
  right: -9%;
  top: -17%;
  border-radius: 50%;
  background: var(--disc);
}

.case:nth-of-type(even) .device-disc {
  right: auto;
  left: -9%;
  top: auto;
  bottom: -19%;
}

.device-body {
  position: relative;
  border-radius: 1.25rem;
  background: var(--surface);
  box-shadow: var(--shadow-l);
  overflow: hidden;
}

.device-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 2.75rem;
  padding-inline: 1.1rem;
}

.device-bar::after {
  content: "";
  width: 2.9rem;
}

.dots {
  display: flex;
  gap: 0.4rem;
}

.dots i {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--brick);
}

.dots i:nth-child(2) {
  background: var(--tangerine);
}

.dots i:nth-child(3) {
  background: var(--teal);
}

.url {
  flex: 1;
  max-width: 22rem;
  margin-inline: auto;
  padding: 0.3rem 1rem;
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.screen {
  position: relative;
  width: 100%; /* definite, so max-height shortens the window instead of narrowing it */
  aspect-ratio: 16 / 10;
  max-height: calc(100svh - 13.5rem);
  overflow: hidden;
  background: #fff;
}

.screen img {
  width: 100%;
  max-width: none;
  height: auto;
}

/* promoted to its own layer only while its project is near the viewport (preview.js) */
.screen img.is-live {
  will-change: transform;
}

/* how far through the site we are: a squiggle that the scroll draws */
.device-progress {
  position: absolute;
  left: 1.25rem;
  bottom: -2.6rem;
  width: clamp(7rem, 12vw, 11rem);
  pointer-events: none;
}

.device-progress svg {
  width: 100%;
  height: 1.1rem;
  stroke: var(--progress, var(--disc));
  stroke-width: 5px;
}

@media (prefers-color-scheme: dark) {
  .case:nth-of-type(odd) {
    --progress: #3aa3bb; /* teal is too dim for a thin line on ink */
  }
}

.device-progress .is-track {
  position: absolute;
  inset: 0;
  opacity: 0.2;
}

.case:nth-of-type(even) .device-progress {
  left: auto;
  right: 9.5rem;
}

/* round sticker on the corner of the device: the link to the live site */
.visit {
  position: absolute;
  z-index: 2;
  right: -1.75rem;
  bottom: -2.75rem;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.3rem;
  width: 7.75rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--visit-bg);
  color: var(--visit-fg);
  font: 700 1.02rem/1.08 var(--font-display);
  letter-spacing: -0.01em;
  text-align: center;
  text-decoration: none;
  rotate: -8deg;
  box-shadow: 0 1rem 2rem -1rem rgba(13, 19, 33, 0.55);
  transition:
    scale 0.7s var(--spring),
    rotate 0.7s var(--spring),
    translate 0.8s var(--spring);
}

.visit.is-magnet {
  transition:
    scale 0.7s var(--spring),
    rotate 0.7s var(--spring),
    translate 0.2s ease-out;
}

.visit .icon {
  width: 1.35rem;
  height: 1.35rem;
}

.visit:active {
  scale: 0.95;
}

@media (hover: hover) {
  .visit:hover {
    scale: 1.1;
    rotate: 5deg;
  }
}

/* ---------- how I work ---------- */

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(2rem, 4vw, 4rem);
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
  list-style: none;
}

.steps li {
  display: grid;
  align-content: start;
  justify-items: start;
  gap: var(--s-3);
}

.step-n {
  display: grid;
  place-items: center;
  width: 4.5rem;
  aspect-ratio: 1;
  margin-bottom: var(--s-4);
  border-radius: 50%;
  background: var(--bub-bg);
  color: var(--bub-fg);
  font: 800 1.9rem/1 var(--font-display);
}

.steps p {
  color: var(--muted);
  max-width: 34ch;
}

/* ---------- narrower screens ---------- */

/* less room beside the headline: the speech bubble moves under the photo */
@media (min-width: 761px) and (max-width: 1100px) {
  .hello {
    margin-top: 0;
    margin-bottom: 4.5rem;
  }
  .hello-bubble {
    right: -6%;
    bottom: auto;
    top: 104%;
    border-radius: 1.4rem 0.3rem 1.4rem 1.4rem;
    transform-origin: 100% 0;
  }
}

@media (max-width: 1000px) {
  .case,
  .case:nth-of-type(even) {
    column-gap: 2rem;
  }
  .visit {
    right: -0.75rem;
  }
}

/* tablet upright: not enough room for two columns, so the text scrolls by first
   and then the browser window pins alone, as wide as the page */
@media (min-width: 761px) and (max-width: 1000px) and (min-height: 621px) {
  .cases {
    margin-top: 0;
  }
  .case,
  .case:nth-of-type(even) {
    display: block;
  }
  .case + .case {
    margin-top: 0;
  }
  .case-text {
    position: static;
    height: auto;
    padding-block: clamp(4.5rem, 10vw, 6rem) 0;
  }
  .case-text p {
    max-width: 56ch;
  }
  .case-pin {
    padding-block: 5.5rem 4.75rem;
  }
}

@media (max-width: 860px) {
  .steps {
    grid-template-columns: minmax(0, 1fr);
  }
  .steps li {
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: var(--s-5);
  }
  .step-n {
    grid-row: span 2;
    width: 3.75rem;
    margin: 0;
    font-size: 1.6rem;
  }
}

/* wide but very short (a phone on its side): only the device pins, the text scrolls normally */
@media (min-width: 761px) and (max-height: 620px) {
  .cases {
    margin-top: 0;
  }
  .case + .case {
    margin-top: 0;
  }
  .case-text {
    position: static;
    height: auto;
    justify-content: flex-start;
    padding-block: 5.5rem 2rem;
  }
  .case-pin {
    padding-block: 5.5rem 3.25rem;
  }
  .screen {
    max-height: calc(100svh - 11.75rem);
  }
}

/* phone: the text scrolls by first, then the phone pins and the site travels inside it */
@media (max-width: 760px) {
  .web-hero .hero-in {
    grid-template-columns: minmax(0, 1fr);
  }

  .hello {
    --me: 6.5rem;
    display: flex;
    align-items: center;
    gap: 1.1rem;
    width: 100%;
    aspect-ratio: auto;
    margin-top: var(--s-4);
  }

  .hello-disc,
  .hello .bub {
    display: none;
  }

  .hello-me {
    position: static;
    flex: none;
  }

  .hello-bubble {
    position: static;
    max-width: 13.5rem;
    border-radius: 1.4rem 1.4rem 1.4rem 0.3rem;
    transform-origin: 0 100%;
  }

  .cases {
    margin-top: 0;
  }

  .case,
  .case:nth-of-type(even) {
    display: block;
    max-width: none;
    padding-inline: 0;
  }

  .case-text {
    position: static;
    height: auto;
    padding: clamp(4.5rem, 16vw, 6rem) var(--gutter) 0;
  }

  .case-track {
    height: calc(var(--len-m, 2) * 100vh);
    height: calc(var(--len-m, 2) * 100svh);
  }

  .case + .case {
    margin-top: 0;
  }

  /* room for the floating photo above and the progress squiggle below; the phone takes the rest */
  .case-pin {
    padding: 4.75rem 0 3.5rem;
    overflow: hidden;
    overflow: clip;
  }

  .device {
    width: auto;
  }

  .device-disc,
  .case:nth-of-type(even) .device-disc {
    width: 150%;
    inset: 12% auto auto -25%;
  }

  .device-body {
    padding: 0.5rem;
    border-radius: 2.6rem;
    background: var(--device);
    box-shadow:
      inset 0 0 0 1.5px rgba(255, 255, 255, 0.16),
      var(--shadow-l);
  }

  /* the browser bar becomes the phone's status bar: the island sits on it, not on the site */
  .device-bar {
    position: relative;
    display: block;
    height: 1.9rem;
    padding: 0;
    border: 0;
    border-radius: 2.1rem 2.1rem 0 0;
    background: #fff;
  }

  .device-bar > * {
    display: none;
  }

  .device-bar::after {
    content: none;
  }

  .device-bar::before {
    content: "";
    position: absolute;
    top: 0.45rem;
    left: 50%;
    width: 30%;
    height: 1.1rem;
    margin-left: -15%;
    border-radius: 1rem;
    background: var(--device);
  }

  .screen {
    height: min(100vh - 11.15rem, 37rem, 150vw);
    height: min(100svh - 11.15rem, 37rem, 150vw);
    width: auto;
    max-height: none;
    aspect-ratio: 9 / 19.5;
    border-radius: 0 0 2.1rem 2.1rem;
  }

  .device-progress,
  .case:nth-of-type(even) .device-progress {
    left: 50%;
    right: auto;
    bottom: -2.4rem;
    width: 7rem;
    margin-left: -3.5rem;
  }

  /* on the corner of the phone, not on top of the site it shows */
  .visit {
    right: -2.75rem;
    bottom: -1.9rem;
    width: 5.9rem;
    font-size: 0.88rem;
  }

  .visit .icon {
    width: 1.15rem;
    height: 1.15rem;
  }
}

/* ---------- no motion wanted, or no script: nothing pins. With a mouse or trackpad each
   screenshot scrolls natively inside its frame. On touch screens the frame stays still and shows
   the top of the site: a frame that swallows every swipe would trap the page scroll there, and
   the round sticker opens the live site anyway. ---------- */

@media (prefers-reduced-motion: reduce) {
  .cases,
  .case + .case {
    margin-top: 0;
  }
  .case-text,
  .case-pin {
    position: static;
    height: auto;
  }
  .case-track {
    height: auto;
  }
  .case-pin {
    padding-block: 2.5rem 5.5rem;
  }
  .screen:focus-visible {
    outline-offset: -4px;
  }
  .device-progress {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) and (hover: hover) {
  .screen {
    overflow-y: auto;
    scrollbar-width: thin;
  }
}

@media (prefers-reduced-motion: reduce) and (min-width: 761px) {
  .case {
    align-items: center;
    padding-block: 4rem;
  }
}

html:not(.js) .cases,
html:not(.js) .case + .case {
  margin-top: 0;
}

html:not(.js) .case-text,
html:not(.js) .case-pin {
  position: static;
  height: auto;
}

html:not(.js) .case-track {
  height: auto;
}

html:not(.js) .case-pin {
  padding-block: 2.5rem 5.5rem;
}

@media (hover: hover) {
  html:not(.js) .screen {
    overflow-y: auto;
    scrollbar-width: thin;
  }
}

html:not(.js) .device-progress {
  display: none;
}

/* "Pozri ukážky" lands where the first window has just risen into view, its site still at the top */
@media (min-width: 761px) {
  #ukazky {
    scroll-margin-top: 28vh;
    scroll-margin-top: 28svh;
  }
}
