/* Harlo product page. Shares tokens, top bar, language switch and footer with styles.css. */

.hp-topbar {
  justify-content: space-between;
  align-items: center;
}

.hp-home {
  font-weight: 650;
  color: var(--ink);
  text-decoration: none;
  padding: 6px 0;
}

.hp-home:hover {
  text-decoration: underline;
  text-decoration-color: var(--orange);
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
}

.hp-home:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 2px;
}

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

.hp-hero {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 6fr);
  align-items: center;
  gap: clamp(24px, 4vw, 64px);
  max-width: 1280px;
  width: calc(100% - 2 * var(--gutter));
  margin: 18px auto 0;
  padding: clamp(32px, 5vw, 72px);
  border-radius: 28px;
  background: linear-gradient(180deg, var(--space-top), var(--space-bottom));
  color: var(--moon);
}

.hp-hero-text {
  max-width: var(--measure);
}

.hp-hero-text > p + p {
  margin-top: 1em;
}

.hp-hero h1 {
  margin: 0.15em 0 0.4em;
  font-size: clamp(3.5rem, 2rem + 6vw, 6.5rem);
  font-weight: 750;
  line-height: 1;
  letter-spacing: -0.035em;
  color: #f7ecd6;
}

.hp-hero h1 .zh {
  letter-spacing: 0.05em;
}

/* ---------- Sections ---------- */

.hp-section {
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(64px, 9vw, 120px) var(--gutter) 0;
}

/* the making-of stays folded until someone asks for it */
.hp-fold {
  max-width: 1120px;
  margin: clamp(48px, 7vw, 88px) auto 0;
}

.hp-fold + .hp-fold {
  margin-top: 0;
}

.hp-fold > summary {
  display: block;
  position: relative;
  padding: 26px calc(var(--gutter) + 40px) 26px var(--gutter);
  border-top: 1px solid var(--ink);
  cursor: pointer;
  list-style: none;
}

.hp-fold > summary::-webkit-details-marker {
  display: none;
}

.hp-fold > summary::after {
  content: "+";
  position: absolute;
  top: 18px;
  right: var(--gutter);
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.4;
  transition: transform 200ms ease;
}

.hp-fold[open] > summary::after {
  transform: rotate(45deg);
}

.hp-fold-q {
  display: block;
  font-size: clamp(1.25rem, 1.1rem + 0.8vw, 1.75rem);
  font-weight: 650;
  line-height: 1.25;
}

.hp-fold-sub {
  display: block;
  margin-top: 6px;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.hp-fold .hp-section:first-of-type {
  padding-top: clamp(24px, 4vw, 40px);
}

.hp-fold[open] {
  padding-bottom: clamp(48px, 7vw, 88px);
}

.hp-h2 {
  margin: 0 0 0.7em;
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.hp-h3 {
  margin: clamp(40px, 6vw, 64px) 0 0.8em;
  font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
  font-weight: 650;
  line-height: 1.25;
}

.hp-lede {
  max-width: 40rem;
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
}

.hp-note {
  max-width: 40rem;
  margin-top: 2em;
  color: var(--ink-soft);
}

:root[data-lang="zh"] .hp-hero-text,
:root[data-lang="zh"] .hp-lede,
:root[data-lang="zh"] .hp-note,
:root[data-lang="zh"] .hp-prose,
:root[data-lang="zh"] .hp-stage-summary,
:root[data-lang="zh"] .hp-method {
  line-height: 1.8;
}

.hp-prose {
  max-width: 40rem;
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
}

.hp-prose p + p {
  margin-top: 1em;
}

/* ---------- How it is made ---------- */

.hp-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: clamp(32px, 5vw, 48px) 0 0;
  border-top: 2px solid var(--ink);
}

.hp-stats > div {
  padding: 18px 16px 20px 0;
  border-bottom: 1px solid #dedede;
}

.hp-stat-num {
  display: block;
  white-space: nowrap;
  font-size: clamp(2rem, 1.5rem + 1.8vw, 3rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.hp-stat-num small {
  margin-left: 0.15em;
  font-size: 0.42em;
  font-weight: 650;
  letter-spacing: 0;
}

.hp-stat-label {
  display: block;
  margin-top: 8px;
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--ink-soft);
}

/* ---------- Timeline: who was working when ---------- */

.hp-tl {
  position: relative;
  margin: clamp(40px, 6vw, 64px) 0 0;
  --tl-claude: #e39a00;
  --tl-codex: #2f5597;
  --tl-sleep: #e7e7ea;
}

.hp-tl .hp-h3 {
  margin-top: 0;
  margin-bottom: 0.3em;
}

.hp-tl-sub {
  max-width: 44rem;
  color: var(--ink-soft);
}

.hp-tl-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.hp-tl-legend li {
  display: flex;
  align-items: center;
  gap: 7px;
}

.sw {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.sw-claude { background: var(--tl-claude); }
.sw-codex { background: var(--tl-codex); }
.sw-han { width: 2px; height: 14px; border-radius: 1px; background: var(--ink); }
.sw-sleep { background: var(--tl-sleep); }

.hp-tl-plot {
  margin-top: 18px;
  touch-action: pan-y;
}

.hp-tl-plot svg {
  display: block;
  width: 100%;
  overflow: visible;
}

.hp-tl-plot text {
  font-family: inherit;
  fill: var(--ink-soft);
}

.hp-tl-plot .tl-strong {
  fill: var(--ink);
  font-weight: 650;
}

.hp-tl-presets {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.hp-tl-presets button {
  appearance: none;
  padding: 5px 12px;
  border: 1px solid #c9c9c9;
  border-radius: 999px;
  background: none;
  font: inherit;
  font-size: 0.875rem;
  color: var(--ink-soft);
  cursor: pointer;
}

.hp-tl-presets button[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.hp-tl-presets button:focus-visible,
.hp-tl-overview:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 6px;
}

.hp-tl-overview {
  margin-top: 6px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.hp-tl-overview:active {
  cursor: grabbing;
}

.hp-tl-overview svg {
  display: block;
  width: 100%;
  /* the frame's grips sit half outside the strip at either end */
  overflow: visible;
}

.hp-tl-overview text {
  fill: var(--ink-soft);
}

.hp-tl-hint {
  margin-top: 6px;
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.hp-tl-tip {
  position: absolute;
  z-index: 3;
  min-width: 11rem;
  max-width: 17rem;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 0 0 1px #dedede;
  font-size: 0.875rem;
  line-height: 1.45;
  pointer-events: none;
}

.hp-tl-tip b {
  font-variant-numeric: tabular-nums;
}

.hp-tl-tip .tip-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.hp-tl-tip .tip-key {
  width: 10px;
  height: 2px;
  border-radius: 1px;
}

.hp-tl-tip .tip-tasks {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #eee;
  color: var(--ink-soft);
}

/* ---------- One batch, as a loop ---------- */

.hp-flow-wrap {
  position: relative;
}

.hp-flow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 28px;
  counter-reset: flow;
  position: relative;
  padding-bottom: 44px;
}

.hp-flow li {
  position: relative;
  counter-increment: flow;
  padding: 14px 14px 16px;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.hp-flow li.hp-flow-split {
  background: linear-gradient(90deg, rgba(227, 154, 0, 0.14), rgba(47, 85, 151, 0.12));
}

.hp-flow-who {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
}

.hp-flow-who::before {
  content: counter(flow) " ";
  color: var(--ink-soft);
  font-weight: 650;
}

/* arrow to the next box */
.hp-flow li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -24px;
  width: 20px;
  height: 2px;
  background: var(--ink);
}

.hp-flow li:not(:last-child)::before {
  content: "";
  position: absolute;
  top: calc(50% - 5px);
  right: -25px;
  width: 0;
  height: 0;
  border-left: 7px solid var(--ink);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

/* the way back from the phone to Han: a line under the row */
.hp-flow::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 14px;
  height: 18px;
  border: 2px solid var(--orange);
  border-top: 0;
  border-radius: 0 0 14px 14px;
}

.hp-flow-back {
  position: absolute;
  left: 50%;
  bottom: 15px;
  margin: 0;
  transform: translate(-50%, 50%);
  padding: 0 10px;
  background: var(--paper);
  font-size: 0.875rem;
  font-weight: 650;
  white-space: nowrap;
}

/* ---------- Stages ---------- */

.hp-legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 28px;
  margin: 28px 0 0;
  font-size: 0.9375rem;
}

.hp-legend dt {
  font-weight: 650;
}

.hp-legend dd {
  margin: 2px 0 0;
  color: var(--ink-soft);
  line-height: 1.5;
}

.hp-legend dt::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 2px;
  vertical-align: 0.05em;
}

.hp-legend div:nth-child(1) dt::before { background: var(--orange); }
.hp-legend div:nth-child(2) dt::before { background: #cfd3dc; }
.hp-legend div:nth-child(3) dt::before { background: var(--ink); }

.hp-stages {
  margin-top: clamp(32px, 5vw, 48px);
}

.hp-stage {
  border-top: 2px solid var(--ink);
  padding: 22px 0 30px;
}

.hp-stage-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 4px 18px;
}

.hp-stage-no {
  font-size: 0.9375rem;
  font-weight: 650;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.hp-stage h3 {
  margin: 0;
  font-size: clamp(1.375rem, 1.1rem + 1vw, 1.875rem);
  font-weight: 700;
  line-height: 1.2;
}

.hp-stage-cost {
  font-size: clamp(1.375rem, 1.1rem + 1vw, 1.875rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.hp-stage-when {
  grid-column: 2 / 4;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}

.hp-stage-body {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: 20px clamp(24px, 4vw, 56px);
  margin-top: 16px;
}

.hp-stage-summary {
  max-width: 36rem;
}

.hp-stage-features {
  margin: 0;
  padding-left: 1.1em;
  color: var(--ink-soft);
  line-height: 1.5;
}

.hp-stage-features li + li {
  margin-top: 0.35em;
}

.hp-stage-meta {
  margin-top: 14px;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}

/* share of tokens by kind, and of cost against the whole project */
.hp-bar {
  display: flex;
  height: 10px;
  margin-top: 10px;
  border-radius: 3px;
  overflow: hidden;
  background: #e6e6e6;
}

.hp-bar span {
  display: block;
  height: 100%;
}

.hp-bar .fresh { background: var(--orange); }
.hp-bar .cached { background: #cfd3dc; }
.hp-bar .output { background: var(--ink); }

.hp-share {
  height: 6px;
  margin-top: 14px;
  border-radius: 3px;
  background: #e6e6e6;
}

.hp-share span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--ink);
}

.hp-stage details {
  margin-top: 20px;
}

.hp-stage summary {
  display: inline-block;
  cursor: pointer;
  font-weight: 650;
  padding: 6px 0;
  list-style: none;
  text-decoration: underline;
  text-decoration-color: var(--orange);
  text-decoration-thickness: 3px;
  text-underline-offset: 5px;
}

.hp-stage summary::-webkit-details-marker {
  display: none;
}

.hp-stage summary:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 2px;
}

.hp-rows {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
}

.hp-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 20px;
  padding: 14px 0;
  border-bottom: 1px solid #dedede;
}

.hp-row h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
}

.hp-row-cost {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.hp-row p {
  grid-column: 1 / 3;
  max-width: 44rem;
  color: var(--ink-soft);
  font-size: 0.9375rem;
  line-height: 1.55;
}

:root[data-lang="zh"] .hp-row p {
  line-height: 1.75;
}

.hp-row-meta {
  grid-column: 1 / 3;
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.hp-chip {
  display: inline-block;
  margin: 0 6px 4px 0;
  padding: 1px 8px;
  border: 1px solid #c9c9c9;
  border-radius: 999px;
  font-size: 0.8125rem;
  color: var(--ink);
  white-space: nowrap;
}

.hp-chip.openai {
  border-color: var(--ink);
}

.hp-error {
  margin-top: 24px;
  color: var(--ink);
}

/* ---------- Models ---------- */

.hp-table-wrap {
  overflow-x: auto;
}

.hp-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.hp-table th,
.hp-table td {
  padding: 12px 12px 12px 0;
  text-align: left;
  border-bottom: 1px solid #dedede;
  white-space: nowrap;
}

.hp-table th {
  font-size: 0.875rem;
  font-weight: 650;
  color: var(--ink-soft);
  border-bottom: 2px solid var(--ink);
}

.hp-table .num {
  text-align: right;
}

.hp-table tfoot td {
  font-weight: 700;
  border-bottom: 0;
}

/* generated-work table: long cells wrap instead of running off the side */
.hp-table.hp-gen th,
.hp-table.hp-gen td {
  white-space: normal;
  vertical-align: top;
}

.hp-method {
  max-width: 44rem;
  margin-top: 24px;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}

.hp-method a {
  color: var(--ink);
  text-decoration-color: var(--orange);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.hp .footer {
  margin-top: clamp(72px, 10vw, 140px);
}

/* ---------- Narrow screens ---------- */

@media (max-width: 900px) {
  .hp-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hp-flow {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
    padding-bottom: 0;
    padding-left: 26px;
  }

  .hp-flow li:not(:last-child)::after {
    top: auto;
    bottom: -20px;
    right: auto;
    left: 50%;
    width: 2px;
    height: 16px;
  }

  .hp-flow li:not(:last-child)::before {
    top: auto;
    bottom: -21px;
    right: auto;
    left: calc(50% - 5px);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 7px solid var(--ink);
    border-bottom: 0;
  }

  /* the way back runs up the left edge */
  .hp-flow::after {
    left: 0;
    right: auto;
    top: 24px;
    bottom: 24px;
    width: 14px;
    height: auto;
    border: 2px solid var(--orange);
    border-right: 0;
    border-radius: 14px 0 0 14px;
  }

  .hp-flow-back {
    left: -4px;
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%) rotate(-90deg);
  }

  .hp-stage-body {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .hp-hero {
    grid-template-columns: minmax(0, 1fr);
    padding: 28px 22px 36px;
    border-radius: 22px;
  }

  .hp-hero-art {
    width: min(70%, 300px);
    margin: 0 auto;
    /* room for Harlo's speech bubble above the orb */
    padding-top: 40px;
  }

  .hp-legend {
    grid-template-columns: minmax(0, 1fr);
  }

  .hp-stage-head {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  /* "Used by" repeats what the model name already says; drop it to fit a phone */
  .hp-table th:nth-child(2),
  .hp-table td:nth-child(2) {
    display: none;
  }

  .hp-table th,
  .hp-table td {
    padding-right: 8px;
  }

  .hp-table.hp-gen {
    min-width: 640px;
  }

  .hp-table.hp-gen th:nth-child(2),
  .hp-table.hp-gen td:nth-child(2) {
    display: table-cell;
  }

  .hp-stage-no {
    grid-column: 1 / 3;
  }

  .hp-stage-when {
    grid-column: 1 / 3;
  }
}
