/* GrowthPub — a site built around four Hairline figures.
   Night drafting table: deep indigo ground, lilac-white ink, one pink highlight. */

:root {
  --ground: #100e34;
  --surface: #161447;
  --line: #2a2763;
  --ink: #eeecff;
  --soft: #a9a6d8;
  --pink: #ef7ac8;

  /* The figures set no colour of their own; the kernel reads these. */
  --hairline-plate: #1a1850;
  --hairline-edge: #8e8bd8;
  --hairline-mid: #5d5aa8;
  --hairline-lo: #35327c;
  --hairline-hi: #ef7ac8;
  --hairline-stroke: 1.1;

  --font-display: "Funnel Display", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Funnel Sans", ui-sans-serif, system-ui, sans-serif;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --gutter: clamp(1.25rem, 4vw, 3rem);

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;

  @media (prefers-reduced-motion: no-preference) {
    scroll-behavior: smooth;
  }
}

body {
  min-height: 100dvh;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
}

svg {
  display: block;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

:focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: var(--pink);
  color: var(--ground);
}

.wrap {
  width: 100%;
  max-width: calc(84rem + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: fixed;
  top: 0.75rem;
  left: var(--gutter);
  z-index: 10;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--ground);
  font-weight: 600;
  text-decoration: none;
  translate: 0 calc(-100% - 1rem);
  transition: translate 200ms var(--ease-out);
}
.skip:focus-visible {
  translate: 0 0;
}

.num {
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--soft);
}

/* ---------- The figures ---------- */

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 4;
  touch-action: pan-y;
  opacity: 0;
  transition: opacity 600ms var(--ease-out);
}
.stage.is-ready {
  opacity: 1;
}

/* ---------- Header ---------- */

.top__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 4.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand svg {
  width: 1.5rem;
  height: 1.5rem;
}

.top__nav {
  display: flex;
  gap: clamp(1.25rem, 3vw, 2.25rem);
  font-size: 0.9375rem;
}
.top__nav a {
  color: var(--soft);
  text-decoration: none;
  transition: color 150ms ease;
}
.top__nav a[aria-current] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--pink);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.45em;
}

@media (width < 48rem) {
  .top__nav {
    display: none;
  }
}

/* ---------- Opening: the four objects ---------- */

.hero {
  display: grid;
  gap: 1.5rem 3rem;
  padding-block: clamp(2rem, 6vw, 4.5rem) clamp(4rem, 9vw, 7rem);
}

.hero__title {
  font-size: clamp(2.75rem, 1.6rem + 5vw, 6.5rem);
  line-height: 0.95;
  letter-spacing: -0.035em;
  max-width: 11ch;
}

.hero__aside {
  display: grid;
  gap: 1rem;
  align-content: end;
  max-width: 30rem;
}

.lede {
  font-size: clamp(1.1875rem, 1.05rem + 0.45vw, 1.375rem);
  line-height: 1.45;
  color: var(--soft);
}

.hint {
  font-size: 0.9375rem;
  color: var(--soft);
}

@media (width >= 60rem) {
  .hero {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  }
  .objects {
    grid-column: 1 / -1;
  }
}

.objects {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(0.75rem, 1.5vw, 1.25rem);
  margin-top: clamp(1.5rem, 4vw, 3rem);
  padding: 0;
  list-style: none;
}
@media (width < 60rem) {
  .objects {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.object {
  display: grid;
  gap: 0.25rem;
  height: 100%;
  padding: 0.5rem 0.5rem 1rem;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: var(--surface);
  text-decoration: none;
  transition: border-color 200ms ease;
  -webkit-tap-highlight-color: transparent;
}
.object__label {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding-inline: 0.6rem;
  font-family: var(--font-display);
  font-size: clamp(1rem, 0.9rem + 0.4vw, 1.25rem);
  font-weight: 600;
}

/* ---------- Chapters: a pinned object, and the steps it answers ---------- */

.chapter {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  column-gap: clamp(2rem, 5vw, 5rem);
  border-top: 1px solid var(--line);
}
.chapter--flip {
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
}
.chapter--flip .chapter__figure {
  order: 2;
}

.chapter__pin {
  position: sticky;
  top: 0;
  height: 100svh;
  display: grid;
  place-items: center;
}
.chapter__pin .stage {
  max-width: min(100%, calc(86svh * 1.25));
}

.chapter__text {
  padding-bottom: 22svh;
}

.chapter__head {
  display: grid;
  gap: 1rem;
  align-content: center;
  min-height: 70svh;
  padding-top: 6rem;
}
.chapter__title {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  font-size: clamp(2.25rem, 1.5rem + 2.8vw, 4rem);
  line-height: 1;
  letter-spacing: -0.03em;
}
.chapter__intro {
  max-width: 28rem;
}

.step {
  display: grid;
  gap: 0.7rem;
  align-content: center;
  min-height: 78svh;
  max-width: 32rem;
  opacity: 0.32;
  transition: opacity 350ms ease;
}
.step.is-active {
  opacity: 1;
}
.step h3 {
  font-size: clamp(1.5rem, 1.2rem + 1.1vw, 2.125rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
}
.step h3 a {
  text-decoration: none;
}
.step p {
  color: var(--soft);
}
.step p.step__body {
  font-size: 1.125rem;
  color: var(--ink);
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  font-size: 0.9375rem;
  color: var(--soft);
  font-variant-numeric: tabular-nums;
}
.facts .live {
  color: var(--pink);
}

.text-link {
  justify-self: start;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--pink);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.25em;
  transition: color 150ms ease;
}

@media (width < 60rem) {
  .chapter,
  .chapter--flip {
    grid-template-columns: minmax(0, 1fr);
  }
  /* The pin joins the chapter's own grid, so it sticks for the whole chapter. */
  .chapter__figure {
    display: contents;
  }
  .chapter__pin {
    z-index: 1;
    height: 44svh;
    padding-block: 0.5rem;
    background: linear-gradient(var(--ground) 84%, rgb(16 14 52 / 0));
  }
  .chapter__pin .stage {
    width: auto;
    height: 100%;
    /* An aspect-ratio box's automatic minimum width is height × ratio, which beats max-width. */
    min-width: 0;
    max-width: 100%;
  }
  .chapter__head {
    min-height: auto;
    padding-top: 1.5rem;
  }
  .step {
    align-content: start;
    min-height: 62svh;
    padding-top: 2.5rem;
  }
}

/* ---------- Button ---------- */

.btn {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0.75rem 1.4rem;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--ground);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 200ms ease, transform 140ms var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.btn:active {
  transform: scale(0.97);
}

/* ---------- Contact ---------- */

.chapter--contact .chapter__head {
  min-height: auto;
  padding-top: clamp(4rem, 10vw, 8rem);
}

.contact {
  display: grid;
  gap: 1.5rem;
  max-width: 32rem;
  padding-block: 2.5rem 6rem;
}

.field {
  display: grid;
  gap: 0.4rem;
}
.field label {
  font-weight: 500;
}
.field input,
.field textarea {
  width: 100%;
  min-height: 3rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--hairline-mid);
  border-radius: 0.75rem;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: max(1rem, 1em);
  transition: border-color 150ms ease;
}
.field textarea {
  min-height: 9rem;
  resize: vertical;
}
.field :focus-visible {
  outline: 2px solid var(--pink);
  outline-offset: 2px;
  border-color: var(--pink);
}
.field :user-invalid {
  border-color: var(--pink);
}
.error {
  display: none;
  color: var(--pink);
  font-size: 0.9375rem;
}
.field:has(:user-invalid) .error {
  display: block;
}

.contact__send {
  display: grid;
  gap: 0.6rem;
}
.contact__status:empty {
  display: none;
}
.contact__status {
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--surface);
}

.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

@media (width < 60rem) {
  /* A pinned figure and a phone keyboard would leave no room for the field. */
  .chapter--contact .chapter__pin {
    position: static;
    height: auto;
    background: none;
  }
  .chapter--contact .chapter__pin .stage {
    width: 100%;
    height: auto;
    max-width: 22rem;
    margin-inline: auto;
  }
  .chapter--contact .chapter__head {
    padding-top: 0.5rem;
  }
}

/* ---------- Essay pages ---------- */

/* The About page shares this layout: the figure beside, the text after it. */
.essay,
.about {
  display: grid;
  gap: 2rem;
  padding-block: clamp(1.5rem, 4vw, 3rem) clamp(4rem, 9vw, 7rem);
}
.essay__pin .stage,
.about__pin .stage {
  max-width: 22rem;
  margin-inline: auto;
}
@media (width >= 60rem) {
  .essay,
  .about {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    column-gap: clamp(2rem, 5vw, 5rem);
  }
  .essay__pin,
  .about__pin {
    position: sticky;
    top: 2rem;
  }
  .essay__pin .stage,
  .about__pin .stage {
    max-width: none;
  }
}

.essay__body,
.about__body {
  max-width: 40rem;
}
.essay__back {
  display: inline-block;
  margin-bottom: 2rem;
  color: var(--soft);
  font-size: 0.9375rem;
  text-decoration: none;
  transition: color 150ms ease;
}
.essay__body > h1,
.about__body > h1 {
  margin-block: 0.75rem 1rem;
  font-size: clamp(2.5rem, 1.6rem + 3.6vw, 4.75rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
}
.dek {
  font-size: clamp(1.1875rem, 1.05rem + 0.45vw, 1.375rem);
  line-height: 1.45;
  color: var(--soft);
}

.prose {
  margin-top: 2.5rem;
  font-size: 1.1875rem;
  line-height: 1.7;
}
.prose > * + * {
  margin-top: 1.1em;
}
.prose h1,
.prose h2,
.prose h3 {
  margin-top: 2em;
  line-height: 1.12;
  letter-spacing: -0.02em;
}
.prose h2 {
  font-size: 1.875rem;
}
.prose h3 {
  font-size: 1.375rem;
}
.prose h3:empty {
  display: none;
}
.prose h2 + *,
.prose h3 + * {
  margin-top: 0.6em;
}
.prose strong {
  font-weight: 650;
}
.prose a {
  text-decoration-color: var(--pink);
  text-underline-offset: 0.2em;
}
.prose ul,
.prose ol {
  padding-left: 1.3em;
}
.prose li + li {
  margin-top: 0.4em;
}
.prose li::marker {
  color: var(--pink);
}
.prose blockquote {
  padding-left: 1.1em;
  border-left: 2px solid var(--pink);
  color: var(--soft);
  font-style: italic;
}
.prose code {
  padding: 0.1em 0.35em;
  border-radius: 0.3em;
  background: var(--surface);
  font-size: 0.85em;
}

.essay__next {
  display: grid;
  gap: 0.5rem;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}
.essay__next a {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.2rem + 1.1vw, 2.125rem);
  font-weight: 600;
  line-height: 1.1;
  text-decoration: none;
}

/* ---------- About ---------- */

.about__body > h1 {
  margin-top: 0;
}

.offices {
  display: grid;
  gap: 1rem;
  margin-top: 2.5rem;
}
@media (width >= 40rem) {
  .offices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.office {
  display: grid;
  gap: 0.75rem;
  align-content: start;
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: var(--surface);
  transition: border-color 200ms ease;
}
.office h2 {
  font-size: 1.375rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.office address {
  font-style: normal;
  color: var(--soft);
}
.office__entity {
  color: var(--ink);
  font-weight: 600;
}

.about__contact {
  margin-top: 2.5rem;
  color: var(--soft);
}

/* ---------- Footer ---------- */

.foot {
  border-top: 1px solid var(--line);
}
.foot__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding-block: 2.5rem;
  color: var(--soft);
  font-size: 0.9375rem;
}
.foot__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
}

/* ---------- Hover, on pointers that hover ---------- */

@media (hover: hover) and (pointer: fine) {
  .top__nav a:hover,
  .essay__back:hover {
    color: var(--ink);
  }
  .object:hover,
  .office:hover {
    border-color: var(--hairline-mid);
  }
  .text-link:hover,
  .step h3 a:hover,
  .essay__next a:hover {
    color: var(--pink);
  }
  .btn:hover {
    background-color: var(--pink);
  }
}

/* ---------- The opening, once ---------- */

.rise {
  @media (prefers-reduced-motion: no-preference) {
    animation: rise 800ms var(--ease-out) var(--d, 0ms) both;
  }
  @media (prefers-reduced-motion: reduce) {
    animation: fade 400ms ease both;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    translate: 0 18px;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}
