/* Home: the split face. Photo on the left half (professional), illustration on the
   right half (creative). --split is the share of the face shown as the photo. */

.page-home {
  background:
    radial-gradient(ellipse 70% 60% at 50% 70%, #fafaf8 0%, transparent 70%),
    var(--paper);
}

.home {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100svh;
  min-height: 640px;
  padding-top: var(--header-h);
  overflow: hidden;
}

/* The home page keeps the original's type: JetBrains Mono headings, Open Sans for the blurbs. */
.hello,
.side-title {
  font-family: "JetBrains Mono Original", var(--mono);
  font-weight: 400;
  letter-spacing: -0.07em;
  color: #222;
}

.hello {
  min-height: 1.2em;
  margin: clamp(8px, 3vh, 36px) var(--gutter) 0;
  text-align: center;
  font-size: clamp(34px, calc(1vw + 29px), 82px);
  line-height: 1.2;
}

.stage {
  position: relative;
  width: min(1320px, 100%);
  margin-inline: auto;
  cursor: pointer;
}

/* ---------- Background: code on the professional side, paint on the creative side ---------- */

.stage-code,
.stage-paint {
  position: absolute;
  pointer-events: none;
  transition: opacity 0.2s linear;
  animation: rise 1.6s var(--ease-out) 0.35s both;
}

.stage-code {
  bottom: 5%;
  right: calc(50% + 40px);
  width: 460px;
  color: #b9b9b4;
  opacity: min(1, var(--split) * 2);
  transform: translateX(calc((var(--split) - 0.5) * 30px));
}
.stage-code pre {
  margin: 0;
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.65;
  color: #a5a5a0;
}
.stage-code pre span { color: var(--blue-ink); }
.stage-chart {
  width: 210px;
  margin: 14px 0 0 40px;
  stroke: #c8c8c3;
  stroke-width: 2;
}
.stage-chart .curve-b { stroke: var(--blue); stroke-width: 2.5; }
.stage-chart .ci { stroke: var(--blue); stroke-width: 4; stroke-linecap: round; }

.stage-paint {
  bottom: 8%;
  left: calc(50% + 60px);
  width: min(520px, 38vw);
  margin: 0;
  opacity: min(1, (1 - var(--split)) * 2);
  transform: translateX(calc((var(--split) - 0.5) * 30px));
}

/* ---------- The face ---------- */

.face {
  position: absolute;
  left: 50%;
  bottom: 0;
  height: min(100%, 980px);
  aspect-ratio: 640 / 1000;
  translate: -50% 0;
  pointer-events: none;
  animation: rise 1.4s var(--ease-out) 0.15s both;
}

.face img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: contain;
  object-position: bottom;
  user-select: none;
  -webkit-user-drag: none;
}

.face-photo {
  clip-path: inset(0 calc((1 - var(--split)) * 100%) 0 0);
}

.seam {
  position: absolute;
  top: 6%;
  bottom: 0;
  left: calc(var(--split) * 100%);
  width: 2px;
  margin-left: -1px;
  background: linear-gradient(transparent, var(--blue) 12%, var(--blue) 80%, transparent);
  opacity: 0;
  transition: opacity 0.4s;
}
.stage.is-live .seam { opacity: 1; }

.seam-handle {
  position: absolute;
  top: 44%;
  left: 50%;
  width: 34px;
  height: 34px;
  translate: -50% -50%;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.18);
}
.seam-handle::before,
.seam-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 7px;
  height: 7px;
  border: solid var(--ink);
  border-width: 0 0 2px 2px;
}
.seam-handle::before { left: 8px; transform: translateY(-50%) rotate(45deg); }
.seam-handle::after { right: 8px; transform: translateY(-50%) rotate(-135deg); }

.seam-tag {
  position: absolute;
  bottom: 7%;
  left: 12px;
  /* slides from the right of the seam to the left of it, so it never leaves the portrait */
  translate: calc(var(--split) * (-100% - 24px)) 0;
  padding: 4px 8px;
  background: var(--ink);
  color: #fff;
  font-family: var(--mono);
  font-size: 14px;
  white-space: nowrap;
}
.seam-tag b { color: var(--blue); font-weight: 700; }

/* ---------- The two sides (these are the links) ---------- */

.side {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  padding-bottom: 12vh;
  text-decoration: none;
  z-index: 2;
}
.side--pro { left: 0; align-items: flex-end; text-align: right; padding: 0 clamp(210px, 21vw, 300px) 12vh clamp(32px, 5vw, 96px); }
.side--creative { right: 0; align-items: flex-start; padding: 0 clamp(32px, 5vw, 96px) 12vh clamp(210px, 21vw, 300px); }

.side-title {
  font-size: clamp(30px, calc(0.9vw + 22px), 52px);
  line-height: 1.2;
}
.side-desc {
  max-width: 19em;
  font-family: var(--sans);
  font-size: clamp(15px, calc(0.5vw + 10px), 21px);
  line-height: 1.6;
}
/* The blurb gets the blue highlight only on the side you're on, sweeping in like the nav links. */
.side .hl {
  padding: 0 0.1em;
  background-size: 0% 100%;
  transition: background-size 0.5s var(--ease-out);
}
.side--pro .hl { background-position: 100% 0; }
.side.is-active .hl { background-size: 100% 100%; }

/* Both sides are fully visible while the face is split down the middle, and the side you
   move away from fades out completely, along with its background. */
.side--pro { opacity: min(1, var(--split) * 2); }
.side--creative { opacity: min(1, (1 - var(--split)) * 2); }
.side:focus-visible { outline-offset: -8px; }

.side,
.face,
.stage-code,
.stage-paint { will-change: opacity, transform; }

@keyframes rise {
  from { opacity: 0; transform: translateY(80px); }
}

/* ---------- Short screens: trim the chrome so the face still fits ---------- */

@media (max-height: 860px) and (min-width: 901px), (max-width: 1200px) and (min-width: 901px) {
  .stage-code pre { font-size: 14px; }
  .stage-chart { display: none; }
}

/* ---------- Phones and tablets: face on top, two buttons underneath ---------- */

@media (max-width: 900px) {
  .home {
    grid-template-rows: auto 1fr auto;
    min-height: 560px;
  }
  .hello { font-size: clamp(34px, 9vw, 56px); }
  .stage { cursor: grab; touch-action: pan-y; }
  .stage:active { cursor: grabbing; }
  .face { height: 100%; }
  .stage-code { display: none; }
  .stage-paint { left: 50%; width: 80vw; bottom: 4%; translate: -50% 0; opacity: 0.35; }
  .seam-tag { font-size: 12px; }
  .seam-handle { display: none; }
}

.mobile-sides { display: none; }

@media (max-width: 900px) {
  .stage .side { display: none; }
  .mobile-sides {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 14px var(--gutter) calc(18px + env(safe-area-inset-bottom));
    background: var(--paper);
    position: relative;
    z-index: 3;
  }
  .mobile-sides a {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 14px;
    border: 2px solid var(--ink);
    color: var(--ink);
    text-decoration: none;
    font-family: "JetBrains Mono Original", var(--mono);
    font-weight: 400;
    font-size: 17px;
    letter-spacing: -0.02em;
    line-height: 1.1;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.35s var(--ease-out), border-color 0.35s var(--ease-out);
    animation: rise 0.9s var(--ease-out) both;
  }
  .mobile-sides a:last-child { animation-delay: 0.1s; }
  .mobile-sides small {
    font-family: var(--sans);
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0;
    color: var(--ink-2);
  }
  .mobile-sides a.is-active { background: var(--blue); border-color: var(--blue); }
}
