/*
 * webviglabs.com
 *
 * One stylesheet, no framework. Written mobile first:
 *   - base rules:      below 768px (mobile artboard M5-0, 390px)
 *   - min-width 768px:  tablet, desktop structure with 48px gutters
 *   - min-width 900px:  lab tiles go two-up
 *   - min-width 1200px: desktop artboard A6-0, 1440px
 *
 * Content width. Every block that spans the page sets
 *   padding-inline: var(--pad)
 * where --pad is max(gutter, (100% - 1200px) / 2). Text stays in a centred
 * 1200px column (120px gutters at 1440px) while tile backgrounds run full
 * bleed. --pad holds a percentage, so it resolves against whichever element
 * uses it; it is only used on elements whose containing block is the full
 * page width.
 *
 * Sections follow page order.
 */

/* ------------------------------------------------------------------------
 * Fonts
 * --------------------------------------------------------------------- */

@font-face {
  font-family: "Archivo";
  src: url(/fonts/archivo-var.woff2) format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url(/fonts/jetbrains-mono-400.woff2) format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ------------------------------------------------------------------------
 * Tokens (spec §4.1, palette P1) and layout variables
 * --------------------------------------------------------------------- */

:root {
  --ground: #FFFFFF;
  --ink: #2B2D31;
  --ink-2: #55585E;
  --cell: #EEF0F2;
  --gold: #F2CA50;
  --malinal: #131313;
  --chart-label: #A3A7AD;
  --footer-muted: #B5B8BE;

  /* Supporting colours taken from the artboards. */
  --on-dark: #F2F2F2;        /* text on graphite */
  --on-dark-2: #C9CCD1;      /* body text on graphite */
  --rule: #E1E4E8;           /* contact line top rule */
  --code-text: #E8E8E8;
  --code-muted: #8A8A8A;
  --code-rule: #2A2A2A;
  --code-cmd: var(--gold);
  --code-string: #A8D5A2;
  --code-key: #9CC3E6;

  --font-sans: "Archivo", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --gutter: 20px;
  --pad: max(var(--gutter), (100% - 1200px) / 2);
}

@media (min-width: 768px) {
  :root { --gutter: 48px; }
}

@media (min-width: 1200px) {
  :root { --gutter: 120px; }
}

/* ------------------------------------------------------------------------
 * Base
 * --------------------------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 25px;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, p, ul, pre {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
}

svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Display type: Archivo 800 at 112% width. */
.hero__title,
.products__title,
.tile__wordmark,
.tile__title,
.values__title,
.nav__wordmark {
  font-weight: 800;
  font-stretch: 112%;
}

/* Shared underline for text links. */
.tile__links a,
.contact__email,
.site-footer__links a {
  text-decoration: underline 1px;
  text-underline-position: from-font;
}

/* ------------------------------------------------------------------------
 * Focus and motion
 * A 2px ring: graphite on light ground and on gold, gold on dark surfaces.
 * --------------------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.tile--malinal :focus-visible {
  outline-color: var(--malinal);
}

/* Order matters: .api-card sits inside .tile--malinal and both selectors
   have the same specificity, so this rule must come after the one above. */
.api-card :focus-visible,
.site-footer :focus-visible {
  outline-color: var(--gold);
}

/* The page has no motion. This guards anything a browser or a later
   change might add. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------------------
 * 1. Nav
 * --------------------------------------------------------------------- */

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px var(--pad);
  border-bottom: 1px solid var(--cell);
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.nav__brand .mark {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.nav__wordmark {
  font-size: 17px;
  line-height: 22px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.nav__links {
  display: flex;
  gap: 16px;
}

.nav__links a {
  font-size: 15px;
  font-weight: 500;
  line-height: 18px;
  text-decoration: none;
}

.nav__links a:hover {
  text-decoration: underline 1px;
  text-underline-position: from-font;
}

.nav__item--desktop {
  display: none;
}

@media (min-width: 768px) {
  .nav {
    padding-block: 32px;
    border-bottom: 0;
  }

  .nav__brand {
    gap: 14px;
  }

  .nav__brand .mark {
    width: 32px;
    height: 32px;
  }

  .nav__wordmark {
    font-size: 20px;
    line-height: 24px;
  }

  .nav__links {
    gap: 36px;
  }

  .nav__item--desktop {
    display: list-item;
  }
}

/* ------------------------------------------------------------------------
 * 2. Hero
 * --------------------------------------------------------------------- */

.hero {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 48px var(--pad) 56px;
}

.hero__title {
  font-size: 50px;
  line-height: 50px;
  letter-spacing: -0.04em;
}

.hero__subhead {
  margin-top: 20px;
  font-size: 19px;
  line-height: 27px;
}

.cells--desktop {
  display: none;
}

@media (min-width: 768px) {
  .hero {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 48px;
    padding-top: 112px;
    padding-bottom: 128px;
  }

  .hero__text {
    flex: 0 1 700px;
    min-width: 0;
  }

  /* 104px at 1440, scaling down with the viewport on tablets. */
  .hero__title {
    font-size: clamp(3.125rem, 1rem + 6.2vw, 6.5rem);
    line-height: calc(1em - 4px);
  }

  .hero__subhead {
    margin-top: 32px;
    font-size: clamp(1.1875rem, 0.5rem + 1.6vw, 1.75rem);
    line-height: 1.36;
  }

  .hero__cells {
    flex: 0 1 500px;
    min-width: 0;
  }

  .cells--desktop {
    display: block;
  }

  .cells--mobile {
    display: none;
  }
}

/* Desktop: 700px text + 500px cells fill the 1200px column exactly. */
@media (min-width: 1200px) {
  .hero {
    gap: 0;
  }
}

/* ------------------------------------------------------------------------
 * 3. What we do
 * --------------------------------------------------------------------- */

.about {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 var(--pad) 56px;
}

.about__statement {
  font-size: 23px;
  font-weight: 600;
  line-height: 31px;
  letter-spacing: -0.015em;
}

.about__body {
  color: var(--ink-2);
  font-size: 16px;
  line-height: 26px;
}

@media (min-width: 768px) {
  .about {
    flex-direction: row;
    justify-content: space-between;
    gap: 80px;
    padding-bottom: 112px;
  }

  .about__statement {
    flex: 0 1 700px;
    font-size: clamp(1.4375rem, 0.5rem + 2.2vw, 2.25rem);
    line-height: 1.28;
    letter-spacing: -0.02em;
  }

  .about__body {
    flex: 0 1 420px;
    padding-top: 8px;
    font-size: 17px;
    line-height: 28px;
  }
}

/* ------------------------------------------------------------------------
 * 4. Products header
 * .products holds the header and the full-bleed tiles. It wraps as a flex
 * row so the title and intro can sit side by side on desktop while the
 * tiles each take a full line.
 * --------------------------------------------------------------------- */

.products {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
}

/* min-width: 0 stops the API card's unwrapped code widening the page. */
.products > .tile,
.products > .lab-tiles {
  flex: 0 0 100%;
  min-width: 0;
}

.products__title {
  flex: 0 0 100%;
  padding-inline: var(--pad);
  font-size: 31px;
  line-height: 36px;
  letter-spacing: -0.03em;
}

.products__intro {
  flex: 0 0 100%;
  padding: 10px var(--pad) 28px;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 24px;
}

@media (min-width: 768px) {
  .products__title {
    flex: 1 1 0;
    min-width: 0;
    padding-right: 48px;
    padding-bottom: 40px;
    font-size: clamp(1.9375rem, 1rem + 3vw, 3.5rem);
    line-height: 1.07;
  }

  .products__intro {
    flex: 0 0 auto;
    width: calc(380px + var(--pad));
    padding-top: 0;
    padding-left: 0;
    padding-bottom: 40px;
    font-size: 17px;
    line-height: 26px;
  }
}

/* ------------------------------------------------------------------------
 * 5–6. Tiles: shared parts
 * --------------------------------------------------------------------- */

.tile__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  line-height: 18px;
}

/* Status marker: a square. Filled on Malinal, outlined on the lab tiles. */
.tile__dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border: 1.5px solid currentColor;
}

.tile--malinal .tile__dot {
  background: currentColor;
  border: 0;
}

/* Chart labels: the SVG text elements carry no font of their own. */
.chart text {
  font: 11px/1 var(--font-mono);
}

@media (min-width: 768px) {
  .tile__label {
    gap: 10px;
    font-size: 15px;
  }

  .tile__dot {
    width: 10px;
    height: 10px;
  }
}

/* ------------------------------------------------------------------------
 * 5. Malinal tile (full-bleed gold)
 * --------------------------------------------------------------------- */

.tile--malinal {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 36px var(--pad) 40px;
  background: var(--gold);
  color: var(--malinal);
}

.tile--malinal .tile__main {
  display: flex;
  flex-direction: column;
}

.tile--malinal .tile__label {
  margin-bottom: 22px;
}

.tile__wordmark {
  font-size: 60px;
  line-height: 60px;
  letter-spacing: -0.04em;
}

.tile__tagline {
  margin-top: 12px;
  font-size: 18px;
  font-weight: 600;
  line-height: 25px;
}

.tile--malinal .tile__body {
  margin-top: 12px;
  font-size: 16px;
  line-height: 25px;
}

.tile__side {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}

.tile__terms {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 18px;
  border-top: 2px solid var(--malinal);
}

.tile__price {
  font-size: 16px;
  line-height: 24px;
}

.tile__refund {
  font-size: 15px;
  line-height: 23px;
}

.tile__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.tile__links a {
  font-size: 15px;
  font-weight: 700;
  line-height: 18px;
}

/* Tablet: still stacked, with desktop type. */
@media (min-width: 768px) {
  .tile--malinal {
    gap: 48px;
    padding-block: 64px;
  }

  .tile--malinal .tile__label {
    margin-bottom: 48px;
  }

  .tile__wordmark {
    font-size: 120px;
    line-height: 112px;
  }

  .tile__tagline {
    margin-top: 18px;
    font-size: 22px;
    line-height: 30px;
  }

  .tile--malinal .tile__body {
    max-width: 560px;
    margin-top: 18px;
    font-size: 18px;
    line-height: 29px;
  }

  .tile__side {
    gap: 28px;
    max-width: 540px;
  }

  .tile__terms {
    gap: 16px;
    padding-top: 24px;
  }

  .tile__price {
    font-size: 17px;
    line-height: 26px;
  }

  .tile__links {
    gap: 8px 24px;
  }

  .tile__links a {
    font-size: 16px;
    line-height: 20px;
  }
}

/* Desktop: text column left (label top, wordmark bottom), card right. */
@media (min-width: 1200px) {
  .tile--malinal {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
    gap: 40px;
    min-height: 640px;
  }

  .tile--malinal .tile__main {
    align-self: stretch;
  }

  .tile--malinal .tile__label {
    margin-bottom: auto;
    padding-bottom: 48px;
  }

  .tile__side {
    flex: 0 0 540px;
  }
}

/* ------------------------------------------------------------------------
 * 5a. API card
 * The code never wraps; narrow screens scroll it sideways.
 * --------------------------------------------------------------------- */

.api-card {
  overflow: hidden;
  border-radius: 8px;
  background: var(--malinal);
  color: var(--code-text);
  font-family: var(--font-mono);
}

.api-card__bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--code-rule);
}

.api-card__label,
.api-card__status {
  color: var(--code-muted);
  font-size: 10px;
  line-height: 12px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.api-card__status {
  color: var(--gold);
}

.api-card__type {
  display: none;
}

.api-card pre {
  overflow-x: auto;
  white-space: pre;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 18px;
  font-variant-ligatures: none;
  tab-size: 2;
}

/* Syntax colours, as on the artboards. */
.tok-cmd { color: var(--code-cmd); }
.tok-str { color: var(--code-string); }
.tok-key { color: var(--code-key); }

/* The code blocks take focus so keyboard users can scroll them. The card
   clips its overflow, so the ring sits inside the block. */
.api-card pre:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -4px;
}

.api-card__request {
  padding: 12px 14px;
}

.api-card__label--response {
  padding: 10px 14px 0;
  border-top: 1px solid var(--code-rule);
}

.api-card__response {
  padding: 8px 14px 14px;
}

@media (min-width: 768px) {
  .api-card {
    /* --malinal (#131313) at 28% alpha, as on the artboard (#13131347). */
    box-shadow: 0 18px 40px rgb(19 19 19 / 0.28);
  }

  .api-card__bar {
    padding: 12px 18px;
  }

  .api-card__label,
  .api-card__status {
    font-size: 11px;
    line-height: 14px;
    letter-spacing: 0.08em;
  }

  .api-card__type {
    display: inline;
  }

  .api-card pre {
    font-size: 12.5px;
    line-height: 20px;
  }

  .api-card__request {
    padding: 16px 18px;
  }

  .api-card__label--response {
    padding: 12px 18px 0;
  }

  .api-card__response {
    padding: 10px 18px 18px;
  }
}

/* ------------------------------------------------------------------------
 * 6. Lab tiles (full-bleed graphite and cell grey)
 * HTML order is label, chart, title, body: the mobile order. On desktop
 * the tile becomes a grid: label and chart share the top row (chart at the
 * right), then title, then body. The chart stays in flow, so its row always
 * reserves its height and the title can never run into it.
 * --------------------------------------------------------------------- */

.lab-tiles {
  display: flex;
  flex-direction: column;
}

.lab-tiles .tile {
  display: flex;
  flex-direction: column;
  padding: 36px var(--pad) 40px;
}

.tile--wheel {
  background: var(--ink);
  color: var(--on-dark);
}

.tile--dividend {
  background: var(--cell);
  color: var(--ink);
}

.lab-tiles .tile__art {
  width: 100%;
  height: 150px;
  margin-top: 24px;
}

.tile__title {
  margin-top: 24px;
  font-size: 36px;
  line-height: 40px;
  letter-spacing: -0.035em;
}

.lab-tiles .tile__body {
  margin-top: 12px;
  font-size: 16px;
  line-height: 25px;
}

.tile--wheel .tile__body {
  color: var(--on-dark-2);
}

.tile--dividend .tile__body {
  color: var(--ink-2);
}

@media (min-width: 768px) {
  .lab-tiles .tile {
    padding-block: 64px;
  }

  .lab-tiles .tile__art {
    width: 300px;
    height: auto;
    margin-top: 32px;
  }

  .tile__title {
    margin-top: 40px;
    font-size: 48px;
    line-height: 52px;
  }

  .lab-tiles .tile__body {
    max-width: 480px;
    margin-top: 18px;
    font-size: 18px;
    line-height: 29px;
  }
}

/* Two-up. Flex items resolve % padding against the full-width container,
   so var(--pad) still lines the outer edges up with the page column. */
@media (min-width: 900px) {
  .lab-tiles {
    flex-direction: row;
  }

  .lab-tiles .tile {
    flex: 1 1 0;
    min-width: 0;
  }

  .lab-tiles .tile--wheel {
    padding-right: 36px;
  }

  .lab-tiles .tile--dividend {
    padding-left: 36px;
  }

  /* Scales with the half-width tile so "Dividend research" stays on one
     line from 900px up (40px at 1200px); it reaches 48px at 1440px. */
  .tile__title {
    font-size: clamp(2.25rem, 0.1rem + 3.25vw, 3rem);
    line-height: 1.08;
  }
}

/* Desktop: 480px tiles. Top row: label left, chart right. The label and
   chart share one grid cell; the chart's top-left corner is empty, so where
   the boxes overlap on narrower desktops nothing visible collides. The
   middle row takes the slack, which pins title and body to the bottom. */
@media (min-width: 1200px) {
  .lab-tiles .tile {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
      "top"
      "title"
      "body";
    min-height: 480px;
  }

  .lab-tiles .tile--wheel {
    padding-right: 72px;
  }

  .lab-tiles .tile--dividend {
    padding-left: 72px;
  }

  .lab-tiles .tile__label {
    z-index: 1;
    grid-area: top;
    align-self: start;
    justify-self: start;
  }

  /* -16px: the artboard sets the chart 16px above the label line. */
  .lab-tiles .tile__art {
    grid-area: top;
    justify-self: end;
    width: 300px;
    margin: -16px 0 0;
  }

  .lab-tiles .tile__title {
    grid-area: title;
    align-self: end;
    margin-top: 32px;
  }

  /* The artboard reserves three body lines (3 × 29px line height), so
     the title sits at the same height in both tiles. */
  .lab-tiles .tile__body {
    grid-area: body;
    min-height: calc(3 * 29px);
  }
}

/* ------------------------------------------------------------------------
 * 7. How we work
 * --------------------------------------------------------------------- */

.values {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 56px var(--pad) 48px;
}

.values__title {
  font-size: 34px;
  line-height: 38px;
  letter-spacing: -0.03em;
}

.values__list {
  display: grid;
  gap: 28px;
}

.value {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 18px;
  border-top: 2px solid var(--ink);
}

.value__title {
  font-size: 19px;
  font-weight: 700;
  line-height: 24px;
}

.value__text {
  color: var(--ink-2);
  font-size: 16px;
  line-height: 25px;
}

@media (min-width: 768px) {
  .values {
    gap: 56px;
    padding-top: 128px;
    padding-bottom: 112px;
  }

  .values__title {
    font-size: clamp(1.9375rem, 1rem + 3vw, 3.5rem);
    line-height: 1.07;
  }

  .values__list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 40px;
  }

  .value {
    gap: 14px;
    padding-top: 24px;
  }

  .value__title {
    font-size: 22px;
    line-height: 28px;
  }
}

@media (min-width: 900px) {
  .values__list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ------------------------------------------------------------------------
 * 8. Contact line
 * --------------------------------------------------------------------- */

.contact {
  padding: 22px var(--pad);
  border-top: 1px solid var(--rule);
}

.contact__line {
  font-size: 15px;
  line-height: 22px;
}

.contact__email {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 6px;
  font-size: 16px;
  font-weight: 700;
  line-height: 20px;
}

/* The footer carries the location on mobile. */
.contact__place {
  display: none;
}

@media (min-width: 768px) {
  .contact {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 24px;
    padding-block: 28px;
  }

  .contact__line {
    font-size: 17px;
  }

  .contact__email {
    display: inline;
    margin-top: 0;
    font-size: inherit;
    line-height: inherit;
  }

  .contact__place {
    display: block;
    color: var(--ink-2);
    font-size: 15px;
    line-height: 18px;
  }
}

/* ------------------------------------------------------------------------
 * 9. Footer (graphite)
 * --------------------------------------------------------------------- */

.site-footer {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px var(--pad) 36px;
  background: var(--ink);
  color: var(--on-dark);
}

.site-footer__top {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.site-footer__legal {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  line-height: 18px;
}

.site-footer__legal .mark {
  flex-shrink: 0;
}

.site-footer__links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.site-footer__links a {
  font-size: 15px;
  line-height: 18px;
}

.site-footer__disclaimer {
  color: var(--footer-muted);
  font-size: 13px;
  line-height: 20px;
}

@media (min-width: 768px) {
  .site-footer {
    gap: 20px;
    padding-top: 32px;
    padding-bottom: 48px;
  }

  .site-footer__top {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 28px;
  }

  .site-footer__legal {
    gap: 12px;
    font-size: 15px;
  }

  .site-footer__links {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px 28px;
  }

  .site-footer__disclaimer {
    max-width: 820px;
  }
}
