/*
 * Control repairs
 *
 * The site can stay crooked while its controls remain readable.  This file
 * is deliberately a narrow override layer: it fixes content fit and hit
 * areas without replacing the hand-painted silhouettes from styles.css.
 */

.site-header .header-actions,
.site-header .language-picker,
.language-toggle,
.hero-eyebrow,
.joint-sketch,
.joint-control,
.button,
.text-button,
.comic-heading-aside,
.comic-end,
.site-footer {
  box-sizing: border-box;
}

/* The globe is a small local raster mark, so the language control reads as
 * one object instead of a loose EN label and a falling chevron. */
.site-header {
  z-index: 40;
}

.language-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 92px;
  min-height: 44px;
  padding: 8px 13px;
  white-space: nowrap;
  line-height: 1;
  vertical-align: middle;
}

.language-toggle .language-globe {
  display: block;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  object-fit: contain;
  transform: rotate(-7deg);
  filter: none;
}

.language-toggle #language-short,
.language-toggle .chevron {
  display: inline-block;
  flex: 0 0 auto;
  line-height: 1;
  transform: none;
}

/* The older paint pass gave the short code its own baseline wobble. Keep the
 * wobble on the raster globe, so EN cannot fall below the painted surface. */
#language-toggle #language-short {
  transform: none;
}

.language-toggle .chevron {
  margin-top: 0;
  font-size: 16px;
  /* This glyph's ink sits below its baseline; center the ink beside EN. */
  transform: translateY(-7px) rotate(3deg);
}

.language-menu {
  min-width: 178px;
  z-index: 30;
  top: calc(100% + 8px);
  right: 0;
  background-color: var(--paper);
}

/* Keep the two hero eyebrow fragments in separate, breathable pieces. */
.hero-eyebrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  column-gap: 12px;
  row-gap: 10px;
  max-width: 100%;
  line-height: 1.3;
}

.hero-eyebrow > p {
  margin: 0;
  flex: 0 1 auto;
}

.hero-eyebrow .episode-tag {
  display: inline-block;
  flex: 0 0 auto;
  margin: 0;
  white-space: nowrap;
}

/* The note owns its own lane above the joint.  This removes the old absolute
 * collision while retaining the deliberately bad rotation of the raster. */
.smoke-invitation {
  min-width: 0;
}

.joint-sketch {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 184px;
  height: auto;
  padding: 2px 4px 0;
  overflow: visible;
}

.joint-sketch .hand-note {
  position: static;
  display: block;
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  padding: 0 4px;
  text-align: center;
  line-height: 1.25;
  white-space: normal;
  transform: rotate(-5deg);
}

.joint-sketch .joint-control {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 360px);
  min-width: 44px;
  min-height: 74px;
  padding-top: 30px;
  margin: 0 auto;
}

.joint-sketch .joint-control img {
  display: block;
  width: min(100%, 330px);
  height: auto;
  aspect-ratio: 3 / 1;
  object-fit: fill;
  margin: 0 auto;
  transform: rotate(-9deg);
  transform-origin: 8% 77%;
}

.floating-inhale .joint-control img {
  aspect-ratio: 3 / 1;
  object-fit: fill;
}

.joint-sketch .joint-wisp {
  position: absolute;
  right: 7%;
  top: 46%;
  pointer-events: none;
}

.inhale-label,
#inhale-hint,
.trip-status {
  position: relative;
  z-index: 2;
  margin-inline: auto;
  text-align: center;
}

/* Paint buttons remain ragged, but their labels and arrows share one row. */
.button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 12px 22px;
  line-height: 1.05;
  white-space: nowrap;
  text-align: center;
}

.button > [data-copy],
.text-button > [data-copy],
.button > .control-label,
.text-button > .control-label {
  display: inline-block;
  min-width: 0;
  line-height: 1.05;
  white-space: nowrap;
  font: inherit;
}

.button > [aria-hidden="true"],
.text-button > [aria-hidden="true"],
.button > .control-arrow,
.text-button > .control-arrow {
  display: inline-block;
  flex: 0 0 auto;
  min-width: 1.15em;
  line-height: 1;
  transform: rotate(-4deg);
  font-family: var(--scribble-font), var(--body-font);
  font-size: 16px;
}

.button > .control-label,
.text-button > .control-label {
  font-size: 11px;
}

.button > .control-arrow,
.text-button > .control-arrow {
  font-size: 16px;
}

.comic-heading-aside .text-button {
  width: auto;
  min-width: 176px;
  max-width: 100%;
  padding-inline: 17px;
}

.comic-end .text-button,
.site-footer .text-button {
  min-width: 156px;
}

.air-button {
  min-height: 44px;
  padding: 9px 12px;
  line-height: 1.1;
  white-space: nowrap;
}

.floating-inhale > button:first-child {
  min-width: 44px;
  min-height: 44px;
}

@media (max-width: 850px) {
  .hero-eyebrow {
    align-items: flex-start;
    row-gap: 8px;
  }

  .joint-sketch {
    min-height: 190px;
  }

  .joint-sketch .joint-control {
    width: min(100%, 310px);
  }

  .joint-sketch .joint-control img {
    width: min(100%, 285px);
    transform: rotate(-9deg);
  }

  .comic-heading-aside .text-button {
    min-width: 168px;
  }
}

@media (max-width: 600px) {
  .language-toggle {
    min-width: 82px;
    padding-inline: 10px;
  }

  .language-toggle .language-globe {
    width: 16px;
    height: 16px;
  }

  .hero-eyebrow {
    column-gap: 8px;
    row-gap: 9px;
  }

  .hero-eyebrow > p {
    flex-basis: 100%;
  }

  .hero-eyebrow .episode-tag {
    margin-left: 4px;
  }

  .joint-sketch {
    min-height: 202px;
    gap: 9px;
  }

  .joint-sketch .hand-note {
    max-width: 240px;
    font-size: 15px;
  }

  .joint-sketch .joint-control {
    width: min(100%, 285px);
  }

  .joint-sketch .joint-control img {
    width: min(100%, 265px);
    transform: rotate(-9deg);
  }

  .button,
  .text-button {
    min-height: 44px;
    padding-inline: 16px;
  }

  .button > .control-label,
  .text-button > .control-label {
    font-size: 10px;
  }

  .button > .control-arrow,
  .text-button > .control-arrow {
    font-size: 15px;
  }

  .comic-heading-aside {
    align-items: center;
  }

  .comic-heading-aside .text-button {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 52vw;
    padding-inline: 13px;
    font-size: 9px;
  }

  .comic-end .text-button,
  .site-footer .text-button {
    min-width: 142px;
  }
}

@media (max-width: 360px) {
  .language-toggle {
    min-width: 76px;
    gap: 5px;
    padding-inline: 8px;
  }

  .language-toggle .language-globe {
    width: 15px;
    height: 15px;
  }

  .joint-sketch .hand-note {
    max-width: 210px;
    font-size: 14px;
  }

  .joint-sketch .joint-control img {
    width: min(100%, 240px);
    transform: rotate(-9deg);
  }

  .comic-heading-aside .text-button {
    font-size: 8px;
    padding-inline: 10px;
  }
}
