/* ---- Shells ---------------------------------------------------------- */

.page {
  max-width: var(--page-width);
  margin-inline: auto;
  overflow-x: clip; /* illustrations bleed past the editorial column */
}

.shell {
  width: min(100% - 2 * var(--space-m), var(--content-width));
  margin-inline: auto;
  margin-top: 50px;
}

/* ---- Masthead -------------------------------------------------------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-m);
  padding: 15.5px var(--page-inset) 16px;
  background: transparent;
}

.masthead__logo {
  display: block;
  width: 206px;
  aspect-ratio: 904 / 384;
  flex: none;
}

.masthead__actions {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 16px;
}

.action {
  --action-fill: var(--koroche-ink);
  --action-fill-active: var(--action-fill);
  flex: none;
  display: grid;
  place-items: center;
  height: 60px;
  padding: 0 28px;
  border: 0;
  border-radius: var(--radius-action);
  background: var(--action-fill);
  color: var(--koroche-on-ink);
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.action:focus {
  outline: none;
}

.action--secondary {
  --action-fill: #f0f0f0;
  --action-fill-active: #dedede;
  color: var(--koroche-text);
}

/* ---- Beta club ------------------------------------------------------- */

.beta-club {
  padding-bottom: calc(var(--space-m) * 1.5);
  scroll-margin-top: 180px;
}

.action.action--beta {
  --action-fill: var(--koroche-text);
  --action-fill-active: #222;
  --action-hover-rotation: -1deg;
  width: 100%;
  height: auto;
  min-height: 176px;
  padding: var(--space-l);
  border-radius: var(--space-m);
  color: var(--koroche-paper);
  font-family: var(--font-text);
  font-size: clamp(42px, 4.65vw, 56px);
  font-weight: var(--type-action-weight);
  line-height: 1.2;
  text-align: center;
  text-wrap: balance;
  white-space: normal;
}

@media (min-width: 900px) {
  .action.action--beta {
    white-space: nowrap;
  }
}

/* ---- Shared button ink ----------------------------------------------- */

.action.action--ink {
  position: relative;
  isolation: isolate;
  background: transparent;
}

.action--ink::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  background: var(--action-fill);
  pointer-events: none;
}

.action--ink > span {
  pointer-events: none;
}

.action--ink:active::before {
  background: var(--action-fill-active);
}

.action--ink:active .action__ink-surface {
  color: var(--action-fill-active);
}

.action__ink-surface {
  position: absolute;
  z-index: -1;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  visibility: hidden;
  color: var(--action-fill);
  pointer-events: none;
}

.action--ink[data-ink-hover]::before {
  visibility: hidden;
}

.action--ink[data-ink-hover] .action__ink-surface {
  visibility: visible;
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .action--ink::before,
  .action--ink .action__ink-surface,
  .action--ink > span {
    transform-origin: center;
    transition: transform 100ms ease-out;
  }

  .action--ink[data-ink-hover]::before,
  .action--ink[data-ink-hover] .action__ink-surface,
  .action--ink[data-ink-hover] > span {
    transform: scale(1.02) rotate(var(--action-hover-rotation, -5deg));
  }
}

@media (max-width: 899px) {
  .beta-club {
    padding-top: var(--space-l);
    padding-bottom: calc(var(--space-2xs) * 3);
    scroll-margin-top: 120px;
  }

  .action.action--beta {
    min-height: 144px;
    padding: var(--space-m) calc(var(--space-s) / 2);
    border-radius: var(--radius-action);
  }
}

/* ---- Hero ------------------------------------------------------------ */

.news-create-feed {
  margin-top: 32px;
}

.action.action--create-feed {
  min-height: 80px;
  padding: 20px 24px;
  border-radius: var(--radius-action);
  font-size: clamp(24px, 3vw, 32px);
  text-decoration: none;
}

.action.action--create-feed:focus-visible {
  outline: 2px solid var(--koroche-ink);
  outline-offset: 5px;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 88px;
  padding-bottom: var(--space-2xl);
  text-align: center;
}

.hero__display {
  width: var(--type-display-1-width);
  max-width: 100%;
}

.hero__lead {
  position: relative;
  width: var(--type-lead-width);
  max-width: 100%;
  aspect-ratio: 667.473 / 139.321;
  margin-top: 18px;
}

.hero__lead img {
  position: absolute;
  inset: 0.62% 0.09% auto;
  width: 99.82%;
  height: 98.75%;
}

/* ---- Feature rows ---------------------------------------------------- */

.feature {
  display: grid;
  grid-template-columns: var(--copy-width) 1fr;
  /* Widen the copy into the gap while preserving the illustration columns. */
  column-gap: calc(var(--space-2xl) - 56.2px);
  align-items: center;
  min-height: 672px;
  padding-block: var(--space-xl);
  border-top: 1px solid var(--koroche-rule);
}

.feature--art-first {
  grid-template-columns: 1fr var(--copy-width);
}

.feature--intro {
  grid-template-columns: 1fr auto;
  column-gap: var(--space-2xl);
}

.feature__copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-s);
  width: var(--copy-width);
}

.feature__icon {
  display: block;
  /* Together with the 20px flex gap: 18px instead of 12px. */
  margin-bottom: -2px;
}

.feature__art {
  justify-self: end;
  margin-inline-end: calc(var(--art-bleed) * -1);
}

.feature--art-first .feature__art {
  justify-self: start;
  margin-inline-start: calc(var(--art-bleed) * -1);
  margin-inline-end: 0;
}

.feature--intro .feature__art {
  justify-self: end;
  margin-inline: 0;
}

.feature__display {
  container-type: inline-size;
  display: grid;
  align-items: center;
  aspect-ratio: 342 / 142;
  width: var(--type-display-2-width);
  justify-self: end;
}

/* The shared stage reserves both lines of the kid version during every swap. */
.feature__display > .type-display-2 {
  justify-self: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: visible;
}

/* Per-block illustration sizes, straight from the mock-up. */
.objection {
  position: relative;
  container-type: inline-size;
  width: 542px;
}

.objection__quote {
  position: absolute;
  z-index: 1;
  /* Same direct positioning as bubble__quote, without a transformed text
     container. 51% - 55% of the 85.24% width preserves the original position. */
  bottom: calc(74.2% + 3.2cqw);
  left: 4.118%;
  width: 85.24%;
  font-size: 4.6125cqw;
  line-height: 1.28;
  color: var(--koroche-objection-ink);
}

.art--objection {
  width: 542px;
}

.art--feed {
  width: 519px;
}

.art--voices {
  width: 555px;
  rotate: 2.06deg;
}

/* ---- Speech-bubble block (block 3) ------------------------------------
   A fixed 624 x 583 stage from the mock-up, re-expressed in percentages so it
   scales with its column instead of hard-coding pixels. */

.bubble {
  container-type: inline-size;
  position: relative;
  width: 624px;
  aspect-ratio: 624 / 583;
}

.bubble__quote {
  position: absolute;
  /* Keep the quote inside the content column while the artwork bleeds left. */
  left: var(--art-bleed);
  bottom: calc(69.01% + 3.2cqw);
  width: 55.13%;
  font-size: 4.006cqw;
  line-height: 1.286;
}

.bubble__dot {
  position: absolute;
}

.bubble__dot--lg {
  left: 14%;
  top: 30.99%;
  width: 7.71%;
}

.bubble__dot--sm {
  left: 21%;
  top: 39.74%;
  width: 5.4%;
}

.bubble__mascot {
  position: absolute;
  left: 17%;
  top: 34.82%;
  width: 49.46%;
  height: 59.24%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bubble__mascot-frame {
  position: relative;
  width: 95.52%;
  height: 96.47%;
  overflow: hidden;
  rotate: -2.43deg;
}

.bubble__mascot-frame > img,
.bubble__mascot-frame > .wizard-wiggle {
  position: absolute;
  left: 0;
  top: 0;
  width: 125.5%;
  height: 104.04%;
  max-width: none;
}

/* ---- Foot ------------------------------------------------------------ */

.shell.site-footer {
  margin-top: var(--space-l);
}

.site-footer__logo {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
  color: var(--koroche-text);
  opacity: 1;
}

.page__foot {
  height: var(--space-2xl);
}

/* ---- Tablet and mobile ----------------------------------------------- */

@media (max-width: 1199px) {
  :root {
    --page-inset: var(--space-l);
    --art-bleed: 0px;
  }

  .feature__art {
    width: 100%;
  }

  .art--objection,
  .art--feed,
  .art--voices,
  .bubble {
    width: 100%;
    max-width: 100%;
  }

  .feature--intro {
    grid-template-columns: minmax(0, 1fr) minmax(0, 342px);
    column-gap: var(--space-l);
  }

  .feature__display {
    max-width: 100%;
  }
}

@media (max-width: 899px) {
  :root {
    --type-title-size: 27px;
    --type-title-leading: 33px;
    --type-body-size: 19px;
    --type-body-leading: 25px;
    --type-action-size: 18px;
    --type-action-leading: 24px;
    --mobile-gutter: max(clamp(20px, 5vw, 32px), env(safe-area-inset-left), env(safe-area-inset-right));
  }

  .shell {
    width: min(calc(100% - 2 * var(--mobile-gutter)), 620px);
    margin-top: 0;
  }

  .shell.site-footer {
    margin-top: calc(var(--space-l) * 2);
  }

  .masthead {
    padding: max(12px, env(safe-area-inset-top)) max(var(--mobile-gutter), env(safe-area-inset-right)) 12px max(var(--mobile-gutter), env(safe-area-inset-left));
    gap: var(--space-xs);
  }

  .masthead__logo {
    width: 148px;
    min-height: 44px;
    display: grid;
    align-items: center;
  }

  .action {
    height: 50px;
    padding-inline: 20px;
  }

  .hero {
    padding-top: 100px;
    padding-bottom: 100px;
  }

  .hero__lead {
    width: min(100%, 500px);
    aspect-ratio: auto;
    margin-top: 24px;
  }

  .type-lead {
    font-size: 26px;
    line-height: 1.3;
    text-wrap: pretty;
  }

  .feature,
  .feature--art-first,
  .feature--intro {
    grid-template-columns: minmax(0, 1fr);
    row-gap: var(--space-l);
    min-height: 0;
    padding-block: var(--space-l);
  }

  .feature__copy,
  .feature__art {
    width: 100%;
    justify-self: stretch;
    margin-inline: 0;
  }

  .feature__copy {
    gap: 16px;
    max-width: 480px;
    margin-inline: auto;
  }

  .feature--art-first { row-gap: calc(var(--space-l) * 2); }

  .feature__copy .type-title { text-wrap: balance; }
  .feature__copy .type-body { text-wrap: pretty; }

  .feature--intro {
    row-gap: calc(var(--space-l) * 2);
    padding-bottom: calc(var(--space-l) * 2 - 20px);
  }

  .feature__art {
    max-width: 480px;
    justify-self: center;
  }

  .feature--art-first .feature__art,
  .feature--intro .feature__art {
    justify-self: center;
    margin-inline: 0;
  }

  .feature--intro .feature__art {
    justify-self: end;
  }

  .feature__display {
    justify-self: center;
    margin-inline: 0;
    width: min(342px, 90%);
    aspect-ratio: 342 / 142;
  }

  .feature--intro .feature__display {
    position: relative;
    top: -50px;
  }

  .feature--art-first .feature__art,
  .feature--art-first .bubble {
    order: 1;
  }

  .art--voices {
    rotate: 0deg;
  }

  .objection__quote {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    width: 100%;
    padding-inline: 8px;
    font-size: 21px;
    line-height: 1.3;
    text-wrap: pretty;
  }

  .art--objection {
    margin-top: -22cqw;
  }

  .bubble {
    display: grid;
    grid-template-columns: 1fr;
    aspect-ratio: auto;
  }

  .bubble__quote {
    position: relative;
    left: auto;
    bottom: auto;
    transform: none;
    width: 100%;
    padding-inline: 0;
    font-size: 21px;
    line-height: 1.3;
    text-wrap: pretty;
  }

  .bubble__mascot {
    position: relative;
    left: auto;
    top: auto;
    width: 60%;
    height: auto;
    aspect-ratio: 309 / 345;
    margin-top: 28px;
    margin-left: 5%;
  }

  .bubble__dot--lg { top: auto; bottom: 61cqw; left: 8%; width: 7.71%; }
  .bubble__dot--sm { top: auto; bottom: 52cqw; left: 15%; width: 5.4%; }

  .page__foot { height: 40px; }
}

@media (max-width: 599px) {
  .beta-club { padding-top: 80px; }

  :root {
    --type-title-size: 28px;
    --type-title-leading: 34px;
    --type-body-size: 18px;
    --type-body-leading: 26px;
  }

  .masthead {
    gap: 8px;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: 10px;
  }

  .masthead__logo {
    width: 104px;
    min-width: 80px;
    flex-shrink: 1;
  }

  .masthead__actions {
    margin-left: auto;
    gap: 8px;
  }

  .masthead__actions .action {
    padding-inline: 12px;
  }

  .action {
    height: 44px;
    padding-inline: 16px;
    font-size: 16px;
    border-radius: 12px;
  }

  .hero { padding-top: 88px; padding-bottom: 88px; }
  .hero__lead { margin-top: 20px; top: -8px; }
  .hero__lead br { display: none; }
  .type-lead { font-size: 22px; line-height: 1.35; }
  .feature { padding-block: 40px; row-gap: 32px; }
  .feature--art-first { row-gap: 64px; }
  .feature--intro { row-gap: 48px; padding-bottom: 60px; }
  .objection__quote, .bubble__quote { font-size: 20px; }
}

@media (max-width: 359px) {
  :root { --mobile-gutter: max(16px, env(safe-area-inset-left), env(safe-area-inset-right)); }
  .masthead__logo { width: 96px; }
  .action { padding-inline: 12px; }
  .masthead__actions [data-change-text-style] {
    width: 96px;
    padding-inline: 8px;
    white-space: normal;
    line-height: 17px;
  }
}

/* ---- Frame sequences -------------------------------------------------- */

koroche-sequence,
koroche-wiggle {
  display: block;
  position: relative;
}

koroche-sequence svg,
koroche-wiggle svg {
  display: block;
  width: 100%;
  height: auto;
}


.sequence__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.bubble__mascot-frame > .wizard-wiggle svg {
  width: 100%;
  height: 100%;
}
