/* Tokens come from frontend/design-system/themes/platform00000.css; the fonts are in
   /shared/fonts/fonts.css. */

:root {
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --tracking-tight: -0.025em;
  --tracking-wide: 0.025em;
  --rounded: 0.25rem;
  --rounded-lg: 0.5rem;
  --rounded-full: 9999px;

  --color-brand: #336099;
  --color-brand-dark: #294d7a;
  --color-brand-light: #d6dfeb;
  --color-accent: #fdbf54;
  --color-surface: #eeeceb;
  --color-border: #d8d9da;
  --color-text-heading: #000000;
  --color-text-primary: #000000;
  --color-text-muted: #3c4045;
  --color-text-link: #336099;

  --typography-headings-font-family: 'Poppins', sans-serif;
  --typography-body-font-family: 'Alegreya Sans', sans-serif;
  --typography-mono-font-family: 'Roboto Mono', monospace;
  --typography-components-button-font-family: 'Poppins', sans-serif;

  --spacing-button-sm-padding-x: 1rem;
  --spacing-button-sm-min-height: 32px;
  --spacing-button-lg-padding-x: 2rem;
  --spacing-button-lg-min-height: 48px;
  --border-radius-button-sm-border-radius: 0.125rem;
  --border-radius-button-lg-border-radius: 0.125rem;

  --topbar-height: 52px;
}

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

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

body {
  margin: 0;
  font-family: var(--typography-body-font-family);
  font-size: var(--text-lg);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background: #ffffff;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
}

a {
  color: var(--color-text-link);
}

:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--typography-headings-font-family);
  font-weight: 700;
  color: var(--color-text-heading);
}

/* Heading emphasis, as in the platform's Section and HeroSection variants */

.heading__highlight {
  /* Thick accent stroke painted behind the lower part of the glyphs */
  background-image: linear-gradient(var(--color-accent), var(--color-accent));
  background-repeat: no-repeat;
  background-size: 100% 0.35em;
  background-position: 0 85%;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.heading__nowrap {
  white-space: nowrap;
}

h2 .heading__mark {
  color: var(--color-accent);
}

/* The period stays in the text; the hero shows it as the square accent dot on the baseline. */
h1 .heading__mark {
  display: inline-block;
  width: 0.16em;
  height: 0.16em;
  margin-left: 0.16em;
  overflow: hidden;
  color: transparent;
  background-color: var(--color-accent);
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--topbar-height);
  background: #ffffff;
  border-bottom: 1px solid var(--color-border);
}

/* The bar spans the window; its content keeps the page's content width. */
.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 100%;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 0.25em;
  min-width: 0;
}

.topbar__mark {
  flex: none;
  width: auto;
  height: 32px;
  margin-right: 4px;
}

.topbar__name {
  font-weight: 700;
}

.topbar__nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar__toggle {
  display: none;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--rounded);
  background: #ffffff;
  font-size: var(--text-base);
  cursor: pointer;
}

.menu {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.menu a {
  display: flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--rounded);
  font-size: var(--text-base);
  text-decoration: none;
  color: var(--color-text-muted);
}

.menu a:hover {
  background: var(--color-surface);
  color: var(--color-text-primary);
}

/* Buttons follow the platform's button tokens */

.btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  border: 1px solid var(--color-brand);
  background: #ffffff;
  font-family: var(--typography-components-button-font-family);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-brand);
}

.btn:hover {
  background: var(--color-brand-light);
}

.btn--sm {
  min-height: var(--spacing-button-sm-min-height);
  padding: 0 var(--spacing-button-sm-padding-x);
  border-radius: var(--border-radius-button-sm-border-radius);
  font-size: var(--text-sm);
}

.btn--lg {
  min-height: var(--spacing-button-lg-min-height);
  padding: 0 var(--spacing-button-lg-padding-x);
  border-radius: var(--border-radius-button-lg-border-radius);
  font-size: var(--text-lg);
}

.btn--primary {
  background: var(--color-brand);
  color: #ffffff;
}

.btn--primary:hover {
  border-color: var(--color-brand-dark);
  background: var(--color-brand-dark);
}

/* Hero */

.hero {
  padding: 112px 0 96px;
  border-bottom: 1px solid var(--color-border);
}

.hero h1 {
  max-width: 20ch;
  margin-bottom: 24px;
  font-size: var(--text-5xl);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

.lead {
  max-width: 58ch;
  margin: 0 0 16px;
  font-size: var(--text-xl);
  line-height: var(--leading-relaxed);
  color: var(--color-text-muted);
}

.hero__note {
  margin: 0 0 32px;
  font-family: var(--typography-mono-font-family);
  font-size: var(--text-sm);
  color: var(--color-brand);
}

/* Sections */

.section {
  padding: 80px 0;
  /* Anchored sections stop below the sticky top bar. */
  scroll-margin-top: var(--topbar-height);
}

.section--surface {
  background: var(--color-surface);
}

.section h2 {
  margin-bottom: 32px;
  font-size: var(--text-3xl);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

.section__lead {
  max-width: 60ch;
  margin: -12px 0 32px;
  font-size: var(--text-xl);
  line-height: var(--leading-relaxed);
  color: var(--color-text-muted);
}

/* How it works */

.steps {
  max-width: 720px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.step {
  position: relative;
  padding: 20px 0 20px 64px;
  border-top: 1px solid var(--color-border);
  counter-increment: step;
}

.step:last-child {
  border-bottom: 1px solid var(--color-border);
}

.step::before {
  content: counter(step);
  position: absolute;
  top: 18px;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--rounded-full);
  background: var(--color-brand-light);
  font-family: var(--typography-headings-font-family);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-brand-dark);
}

.step h3 {
  margin-bottom: 4px;
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
}

.step p {
  margin: 0;
  color: var(--color-text-muted);
}

/* Who does which step: a lane per party, the change travels between them (app.js).
   Layers from the bottom: lanes, links, steps, the travelling change. */

.how {
  /* The captions use the diagram's column spacing. */
  --flow-gap: 28px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.flow {
  /* Read by app.js to route the links between steps. */
  --flow-axis: row;
  position: relative;
  display: grid;
  grid-template-columns: 104px repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(2, 108px);
  gap: 12px var(--flow-gap);
}

.flow__lane {
  grid-column: 1 / -1;
  grid-row: var(--lane);
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-radius: var(--rounded-lg);
  font-family: var(--typography-headings-font-family);
  font-size: var(--text-sm);
  font-weight: 700;
}

.flow__lane--you {
  background: color-mix(in srgb, var(--color-accent) 22%, #ffffff);
}

.flow__lane--engine {
  background: color-mix(in srgb, var(--color-brand) 12%, #ffffff);
}

.flow__links {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.flow__links path {
  fill: none;
  stroke: var(--color-text-muted);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}

.flow__node {
  position: relative;
  z-index: 2;
  grid-column: calc(var(--step) + 1);
  grid-row: var(--lane);
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--rounded-lg);
  background: #ffffff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.flow__node--you.is-active {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 45%, transparent);
}

.flow__node--engine.is-active {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px var(--color-brand-light);
}

.flow__num {
  font-family: var(--typography-mono-font-family);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.flow__label {
  font-family: var(--typography-headings-font-family);
  font-size: var(--text-base);
  font-weight: 700;
  line-height: var(--leading-snug);
}

.flow__loop {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  margin-top: 2px;
  font-family: var(--typography-mono-font-family);
  font-size: 0.75rem;
  line-height: var(--leading-snug);
  color: var(--color-text-muted);
}

.flow__loop-icon {
  flex: none;
  margin-top: 2px;
}

.flow__loop-word.is-current {
  color: var(--color-brand-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.how.is-animated .flow__node.is-active .flow__loop-icon {
  animation: flow-spin 1s linear infinite;
}

@keyframes flow-spin {
  to {
    transform: rotate(360deg);
  }
}

.flow__done {
  position: absolute;
  top: -10px;
  right: -10px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--rounded-full);
  background: var(--color-accent);
  color: var(--color-text-heading);
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.flow__node.is-done .flow__done {
  opacity: 1;
  transform: scale(1);
}

/* app.js moves it with a transform; the offsets centre it on that point. */
.flow__token {
  position: absolute;
  top: -8px;
  left: -8px;
  z-index: 3;
  width: 16px;
  height: 16px;
  border: 3px solid #ffffff;
  border-radius: var(--rounded-full);
  background: var(--color-text-heading);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.how.is-animated .flow__token {
  opacity: 1;
}

.how.is-resetting .flow__token {
  opacity: 0;
}

/* Every caption stays visible; the current step's caption takes its party's colour. */

.step {
  transition: border-color 0.3s ease;
}

.step::before {
  transition: background-color 0.3s ease, color 0.3s ease;
}

.step--you.is-active {
  border-top-color: var(--color-accent);
}

.step--you.is-active::before {
  background: var(--color-accent);
  color: var(--color-text-heading);
}

.step--engine.is-active {
  border-top-color: var(--color-brand);
}

.step--engine.is-active::before {
  background: var(--color-brand);
  color: #ffffff;
}

/* On wider screens the captions stand side by side. */
@media (min-width: 761px) {
  .steps {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    column-gap: var(--flow-gap);
    max-width: none;
  }

  .step {
    padding: 16px 0 0;
    border-top-width: 2px;
  }

  .step:last-child {
    border-bottom: 0;
  }

  .step::before {
    position: static;
    width: 32px;
    height: 32px;
    margin-bottom: 12px;
    font-size: var(--text-sm);
  }

  .step h3,
  .step p {
    font-size: var(--text-base);
  }
}

/* Cards */

.cards {
  display: grid;
  gap: 16px;
}

.cards--2 {
  grid-template-columns: repeat(2, 1fr);
}

.cards--3 {
  grid-template-columns: repeat(3, 1fr);
}

.card {
  padding: 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--rounded-lg);
  background: #ffffff;
}

.card h3 {
  margin-bottom: 8px;
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
}

.card p {
  margin: 0;
  color: var(--color-text-muted);
}

.card--statement {
  max-width: 720px;
  border-left: 4px solid var(--color-accent);
}

.loop__label {
  margin-bottom: 16px !important;
  font-family: var(--typography-mono-font-family);
  font-size: var(--text-sm);
}

.loop__steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.loop__steps li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--typography-headings-font-family);
  font-size: var(--text-base);
  font-weight: 700;
}

.loop__steps li + li::before {
  content: "→";
  font-family: var(--typography-body-font-family);
  font-weight: 400;
  color: var(--color-text-muted);
}

/* Cards that point to the other products, side by side: the inverse one is the main link,
   the soft one a quieter second. */
.crosslinks {
  margin-top: 40px;
}

/* The right padding keeps the text clear of the bulb. */
.crosslink {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  padding-right: 95px;
}

/* The other product's bulb as a backdrop, slightly past the right and bottom edges and
   cut off by the card, yet recognisable. The text comes later in the card and is
   positioned, so it paints above it. */
.crosslink__art {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: auto;
  height: 114px;
  opacity: 0.35;
  pointer-events: none;
}

.crosslink > :not(.crosslink__art) {
  position: relative;
}

/* Inverse card in the brand blue. */
.card--statement.crosslink {
  max-width: none;
  border-top-color: var(--color-brand);
  border-right-color: var(--color-brand);
  border-bottom-color: var(--color-brand);
  background: var(--color-brand);
}

.card--statement.crosslink h3 {
  color: #ffffff;
}

.card--statement.crosslink p {
  color: rgba(255, 255, 255, 0.8);
}

/* The bulbs' dark parts would vanish on the blue, so they turn light as in the dark-mode
   favicon. */
.card--statement.crosslink .crosslink__art path[fill="#3C4045"],
.card--statement.crosslink .tag-link__icon path[fill="#3C4045"] {
  fill: #eeeceb;
}

/* The tag inverted for the blue card: white outline and text instead of blue. */
.card--statement.crosslink .tag-link {
  border-color: #ffffff;
  background: transparent;
  color: #ffffff;
}

.card--statement.crosslink .tag-link:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* The quieter card: a light brand tint and normal text; a white tag would stand out too
   much on it. */
.crosslink--soft {
  border-color: color-mix(in srgb, var(--color-brand) 15%, #ffffff);
  background: color-mix(in srgb, var(--color-brand) 8%, #ffffff);
}

.crosslink--soft .tag-link {
  background: transparent;
}

.crosslink--soft .tag-link:hover {
  background: var(--color-brand-light);
}

/* A link that names another product inside a sentence, with its icon; it stays as tall
   as the line. */
.tag-link {
  margin: 0 4px;
  padding: 1px 8px 1px 6px;
  border: 1px solid var(--color-brand);
  border-radius: var(--rounded);
  background: #ffffff;
  white-space: nowrap;
  text-decoration: none;
  color: var(--color-text-link);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.tag-link:hover {
  background: var(--color-brand-light);
}

.tag-link__icon {
  width: auto;
  height: 0.9em;
  margin-right: 4px;
  vertical-align: -0.1em;
}

/* FAQ */

.faq {
  max-width: 720px;
}

.faq__item {
  border-top: 1px solid var(--color-border);
}

.faq__item:last-child {
  border-bottom: 1px solid var(--color-border);
}

/* The whole question row is the button, so the answer opens wherever it is clicked. The
   small bottom padding keeps an open answer close to its question. */
.faq__question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 20px 0 4px;
  border: 0;
  background: none;
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  text-align: left;
  cursor: pointer;
}

/* Points right when closed and turns down when open, as in the platform accordion. */
.faq__chevron {
  display: inline-flex;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

.faq__chevron svg {
  width: 100%;
  height: 100%;
}

.faq__item.is-open .faq__chevron {
  transform: rotate(90deg);
}

/* The answer's row grows from nothing to its full height; the inner box clips it meanwhile. */
.faq__answer {
  display: grid;
  grid-template-rows: 1fr;
}

.faq__answer-inner {
  overflow: hidden;
}

.faq__answer p {
  margin: 0;
  padding-bottom: 20px;
  color: var(--color-text-muted);
}

/* Without JS every answer stays open and the question is plain text. app.js marks the
   list ready, and only then are the answers folded. */
.faq:not(.is-ready) .faq__question {
  cursor: default;
}

.faq:not(.is-ready) .faq__chevron {
  display: none;
}

.faq.is-ready .faq__item:not(.is-open) .faq__question {
  padding-bottom: 20px;
}

.faq.is-ready .faq__item:not(.is-open) .faq__answer {
  grid-template-rows: 0fr;
}

.faq.is-ready .faq__item:not(.is-open) .faq__answer-inner {
  visibility: hidden;
}

/* app.js turns the motion on with the first click, so the answers fold on load without
   moving. */
@media (prefers-reduced-motion: no-preference) {
  .faq.is-animated .faq__question {
    transition: padding-bottom 0.2s ease;
  }

  .faq.is-animated .faq__answer {
    transition: grid-template-rows 0.2s ease;
  }

  .faq.is-animated .faq__answer-inner {
    transition: visibility 0.2s;
  }

  .faq.is-animated .faq__chevron {
    transition: transform 0.2s ease;
  }
}

/* Contact */

.contact__options {
  display: flex;
  flex-wrap: wrap;
  gap: 32px 64px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.contact__options li {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

.contact__options p {
  margin: 0;
}

.contact__icon {
  width: 40px;
  height: 40px;
  color: var(--color-brand);
}

/* Footer follows the platform's FooterSection */

.footer {
  padding: 64px 0 32px;
  background: var(--color-text-heading);
  color: #ffffff;
}

/* The brand-blue link colour is unreadable on the black footer. */
.footer a {
  color: #ffffff;
}

.footer a:hover {
  text-decoration: none;
}

.footer__content {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 32px;
}

.footer__section h3 {
  margin-bottom: 16px;
  font-size: var(--text-lg);
  color: #ffffff;
}

/* "Dive brightly.in development" has the size of the footer's "Contact" heading. The
   wordmark is sized as one of its words: its lowercase letters match the x-height of
   the heading font, and its baseline sits on theirs (in logo-light.svg the baseline is
   89 of 112 units high). That leaves it below the brand manual's 136px minimum width. */
.footer__brand {
  display: flex;
  align-items: baseline;
  gap: 0.25em;
  margin-bottom: 16px;
  font-family: var(--typography-headings-font-family);
  font-size: var(--text-lg);
  font-weight: 700;
  color: #ffffff;
}

/* Baseline alignment puts the image's bottom on the text baseline, so it moves down by
   the part of the wordmark below its own baseline. */
.footer__logo {
  position: relative;
  top: 0.23em;
  display: block;
}

.footer__logo img {
  display: block;
  width: auto;
  height: 1.1em;
}

.footer__section p {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.8);
}

.footer__bottom {
  padding-top: 32px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  text-align: center;
}

.footer__bottom p {
  margin: 0;
  font-size: var(--text-base);
  color: rgba(255, 255, 255, 0.6);
}

.footer__bottom a {
  color: inherit;
}

/* Below the width the full menu needs, it folds under the Menu button (see app.js). */

@media (max-width: 960px) {
  .topbar__toggle {
    display: block;
  }

  .topbar__nav {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 16px 16px;
    background: #ffffff;
    border-bottom: 1px solid var(--color-border);
  }

  .topbar.is-open .topbar__nav {
    display: flex;
  }

  .menu {
    flex-direction: column;
  }

  .menu a {
    justify-content: center;
  }

  .topbar__nav .btn {
    align-self: center;
  }
}

/* Narrow screens */

@media (max-width: 760px) {
  .wrap {
    padding: 0 16px;
  }

  .hero {
    padding: 56px 0 48px;
  }

  .hero h1 {
    font-size: var(--text-4xl);
  }

  .lead {
    font-size: var(--text-lg);
  }

  .section {
    padding: 48px 0;
  }

  .section h2 {
    margin-bottom: 24px;
    font-size: var(--text-2xl);
  }

  .cards--2,
  .cards--3 {
    grid-template-columns: 1fr;
  }

  /* The lanes turn into columns and the steps run top to bottom. */
  .flow {
    --flow-axis: column;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: 44px repeat(5, auto);
    gap: 24px 12px;
  }

  .flow__lane {
    grid-column: var(--lane);
    grid-row: 1 / -1;
    align-items: flex-start;
    justify-content: center;
    padding: 12px;
  }

  .flow__node {
    grid-column: var(--lane);
    grid-row: calc(var(--step) + 1);
    justify-self: center;
    width: calc(100% - 20px);
  }
}
