/* Helder Labs homepage. One page, no build step, no script.
   Layout: a plain page with a big title, and three flat colour tiles, one per project.
   The three tile colours also make up the track under the title. */

@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('fonts/bricolage-grotesque-latin-opsz-normal.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Hanken Grotesk';
  src: url('fonts/hanken-grotesk-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --font-display: 'Bricolage Grotesque', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --font-body: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --bg: #fbfbfd;
  --ink: #12141c;
  --ink-soft: #5b6070;
  --line: #aab0c2;
  --orange: #f25a1d; /* the knob, as in the logo */

  /* one set per tile: background, text, softer text */
  --games: #5236e6;
  --games-fg: #ffffff;
  --games-soft: #e4dcff;
  --learn: #c4e0fb;
  --learn-fg: #0f2340;
  --learn-soft: #2c4a73;
  --trust: #ffc83d;
  --trust-fg: #17161c;
  --trust-soft: #4a3a0a;

  --radius: 2rem;
  --gutter: clamp(1rem, 4vw, 2rem);
  --page-width: 72rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0d12;
    --ink: #f2f3f8;
    --ink-soft: #a3a8b8;
    --line: #3a3e50;
  }
}

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

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

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Tiles tilt a little on hover and would reach past the edge */
.page {
  overflow-x: hidden;
}

.wrap {
  width: 100%;
  max-width: var(--page-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

a {
  color: inherit;
}

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

/* ---------- Top bar ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.25rem;
  padding-bottom: 0.5rem;
}

.logo {
  display: inline-flex;
  border-radius: 9px;
  transition: transform 0.3s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.logo:hover {
  transform: rotate(-8deg) scale(1.06);
}
.logo-bg {
  fill: #14161f;
  stroke: var(--line);
  stroke-width: 1;
}
.logo-line {
  fill: none;
  stroke: #ffffff;
  stroke-width: 3;
  stroke-linecap: round;
}
.logo-knob {
  fill: var(--orange);
  stroke: #ffffff;
  stroke-width: 3;
}

.pill {
  display: inline-block;
  padding: 0.55rem 1.15rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  font-weight: 650;
  font-size: 0.95rem;
  line-height: 1.2;
  text-decoration: none;
  color: var(--ink);
  transition: background-color 0.2s ease, color 0.2s ease;
}
.pill:hover,
.pill:focus-visible {
  background: var(--ink);
  color: var(--bg);
}

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

.hero {
  padding-top: clamp(2.5rem, 7vw, 5.5rem);
  padding-bottom: clamp(2.25rem, 5vw, 3.5rem);
}

/* Sizes inside use em, so the track and the knob follow the title */
.title-wrap {
  position: relative;
  display: inline-block;
  padding-bottom: 0.2em;
  font-size: clamp(3.3rem, 13vw, 9.5rem);
}
.title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1em;
  line-height: 0.95;
  letter-spacing: -0.025em;
}

/* A slider under the title, like the logo. The three colours are the three tiles. */
.track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  height: 0.075em;
  border-radius: 999px;
  overflow: hidden;
  transform-origin: left center;
  animation: grow 0.8s 0.15s cubic-bezier(0.5, 0, 0.2, 1) backwards;
}
.seg {
  display: block;
  height: 100%;
}
.seg-games {
  flex: 4;
  background: var(--games);
}
.seg-learn {
  flex: 3;
  background: var(--learn);
}
.seg-trust {
  flex: 3;
  background: var(--trust);
}
.knob {
  position: absolute;
  left: 94%;
  bottom: -0.0675em;
  width: 0.21em;
  height: 0.21em;
  margin-left: -0.105em;
  border-radius: 50%;
  background: var(--orange);
  border: 0.045em solid var(--bg);
  animation: slide 1.2s 0.35s cubic-bezier(0.65, 0, 0.25, 1) backwards;
}

@keyframes grow {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}
@keyframes slide {
  from {
    left: 3%;
  }
  to {
    left: 94%;
  }
}

.lede .s {
  display: inline-block;
}
.lede {
  margin: 1.4rem 0 0;
  max-width: 36rem;
  font-size: clamp(1.2rem, 2.4vw, 1.5rem);
  line-height: 1.4;
  color: var(--ink-soft);
}

/* ---------- Tiles ---------- */

.tiles {
  list-style: none;
  margin-top: 0;
  margin-bottom: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  grid-template-areas: 'games' 'learn' 'trust' 'more';
  padding-top: 0.5rem;
  padding-bottom: clamp(3rem, 7vw, 5rem);
}

.tile-games {
  grid-area: games;
}
.tile-learn {
  grid-area: learn;
}
.tile-trust {
  grid-area: trust;
}
.more {
  grid-area: more;
}

@media (min-width: 40rem) {
  .tiles {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: 'games games' 'learn trust' 'more more';
    gap: 1.25rem;
  }
}
@media (min-width: 64rem) {
  .tiles {
    grid-template-columns: 7fr 5fr;
    grid-template-areas: 'games learn' 'games trust' 'more more';
  }
}

.tile {
  --tilt: -0.5deg;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: 'art' 'name' 'text' 'go';
  grid-template-rows: 1fr auto auto auto;
  row-gap: 0.6rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  border-radius: var(--radius);
  background: var(--t-bg);
  color: var(--t-fg);
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.tile:hover,
.tile:focus-within {
  transform: translateY(-6px) rotate(var(--tilt));
}

.art {
  grid-area: art;
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.name {
  grid-area: name;
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 5.5vw, 3.6rem);
  line-height: 1;
  letter-spacing: -0.02em;
}
.text {
  grid-area: text;
  margin: 0;
  max-width: 34rem;
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--t-soft);
}
.go {
  grid-area: go;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
  padding-top: 0.6rem;
}
.domain {
  font-weight: 650;
  font-size: 0.95rem;
}
.go-btn {
  display: grid;
  place-items: center;
  width: 2.9rem;
  height: 2.9rem;
  flex: none;
  border-radius: 50%;
  background: var(--t-fg);
  color: var(--t-bg);
  transition: transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.go-btn svg {
  width: 1.3rem;
  height: 1.3rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tile:hover .go-btn,
.tile:focus-within .go-btn {
  transform: rotate(-45deg) scale(1.08);
}

/* One link per tile, stretched over the whole tile */
.link {
  color: inherit;
  text-decoration: none;
}
.link::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}
.link:focus-visible {
  outline: none;
}
.link:focus-visible::after {
  outline: 3px solid var(--t-fg);
  outline-offset: -8px;
  border-radius: var(--radius);
}

.tile-games {
  --t-bg: var(--games);
  --t-fg: var(--games-fg);
  --t-soft: var(--games-soft);
  --tilt: -0.5deg;
}
.tile-games .art {
  align-self: center;
  justify-self: center;
  max-width: 34rem;
}
.tile-games .name {
  font-size: clamp(3rem, 7vw, 4.75rem);
}

/* Learn and Trustme: title on the left, a small drawing on the right */
.tile-learn,
.tile-trust {
  grid-template-columns: minmax(0, 1fr) clamp(6.5rem, 42%, 14rem);
  grid-template-areas: 'name art' 'text text' 'go go';
  grid-template-rows: auto auto 1fr;
  column-gap: 1rem;
  row-gap: 0.9rem;
}
.tile-learn,
.tile-trust {
  container-type: inline-size;
}
.tile-learn .name,
.tile-trust .name {
  align-self: center;
  font-size: clamp(1.9rem, 4vw + 0.6rem, 3.2rem);
}
/* Size the title to its tile, so it never runs into the drawing */
@supports (width: 1cqw) {
  .tile-learn .name,
  .tile-trust .name {
    font-size: clamp(1.9rem, 12cqw, 3.2rem);
  }
}
.tile-learn .go,
.tile-trust .go {
  align-self: end;
}
.tile-learn {
  --t-bg: var(--learn);
  --t-fg: var(--learn-fg);
  --t-soft: var(--learn-soft);
  --tilt: 0.6deg;
}
.tile-trust {
  --t-bg: var(--trust);
  --t-fg: var(--trust-fg);
  --t-soft: var(--trust-soft);
  --tilt: -0.5deg;
}

/* Room for what comes next */
.more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  padding: 1.4rem;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  color: var(--ink-soft);
}
.more-plus {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border: 2px solid var(--line);
  border-radius: 50%;
}
.more-plus svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}
.more-text {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
}

/* ---------- Drawings ---------- */

/* Games */
.g-halo {
  fill: #6347f2;
}
.ph-body {
  fill: #170a4f;
}
.ph-body-m {
  fill: #0f0638;
}
.ph-screen {
  fill: #ffffff;
}
.ph-pink {
  fill: #ff7ac2;
}
.ph-cyan {
  fill: #3fe3d3;
}
.ph-amber {
  fill: #ffc83d;
}
.ph-dot,
.ph-bar {
  fill: #ffffff;
}
.ph-bar-soft {
  opacity: 0.55;
}
.ph-ring {
  fill: none;
  stroke: #0f3d3a;
  stroke-width: 9;
}
.ph-check {
  fill: none;
  stroke: #0f3d3a;
  stroke-width: 11;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ph-label {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-anchor: middle;
  fill: #6a5fc0;
}
.ph-tile {
  fill: #ece7ff;
}
.ph-letter {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  text-anchor: middle;
  fill: #3b24b5;
}
.ph-btn {
  fill: #ffc83d;
}
.ph-btn-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 19px;
  text-anchor: middle;
  fill: #170a4f;
}
.g-squig {
  fill: none;
  stroke: #ffc83d;
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.g-spark-w {
  fill: #ffffff;
}
.g-spark-a {
  fill: #ffc83d;
}
.ph {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transition: transform 0.45s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.ph-l {
  transform: rotate(-8deg);
}
.ph-r {
  transform: rotate(8deg);
}
.tile-games:hover .ph-l,
.tile-games:focus-within .ph-l {
  transform: rotate(-15deg) translate(-8px, 0);
}
.tile-games:hover .ph-r,
.tile-games:focus-within .ph-r {
  transform: rotate(15deg) translate(8px, 0);
}
.tile-games:hover .ph-m,
.tile-games:focus-within .ph-m {
  transform: translateY(-8px);
}
.conf {
  transition: transform 0.6s ease;
}
.tile-games:hover .conf,
.tile-games:focus-within .conf {
  transform: translateY(-10px);
}

/* Learn */
.l-moon {
  fill: #fff7e0;
}
.l-moon-cut {
  fill: var(--t-bg);
}
.l-step {
  fill: #7fb2ea;
}
.l-wave,
.l-track {
  fill: none;
  stroke: #16407a;
  stroke-width: 6;
  stroke-linecap: round;
}
.l-wave-soft {
  stroke: #8fc0f2;
}
.l-knob {
  fill: var(--orange);
  stroke: var(--t-bg);
  stroke-width: 4;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.tile-learn:hover .l-knob,
.tile-learn:focus-within .l-knob {
  transform: translateX(76px);
}

/* Trustme */
.t-bubble-shape {
  fill: #ffffff;
}
.t-bubble-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 19px;
  text-anchor: middle;
  fill: #17161c;
}
.t-plat {
  fill: #17161c;
}
.t-edge {
  fill: #2dd4bf;
}
.t-pole-line {
  fill: none;
  stroke: #17161c;
  stroke-width: 4;
  stroke-linecap: round;
}
.t-flag {
  fill: #ff4d5e;
}
.t-bubble,
.t-pole {
  transform-box: fill-box;
  transition: transform 0.4s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.t-bubble {
  transform-origin: 30% 100%;
}
.t-pole {
  transform-origin: 50% 100%;
}
.tile-trust:hover .t-bubble,
.tile-trust:focus-within .t-bubble {
  transform: translateY(-5px) rotate(-3deg);
}
.tile-trust:hover .t-pole,
.tile-trust:focus-within .t-pole {
  transform: rotate(-12deg);
}

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

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding-top: 1.5rem;
  padding-bottom: 2.5rem;
  border-top: 2px solid var(--line);
  font-size: 0.95rem;
  color: var(--ink-soft);
}
.foot p {
  margin: 0;
}
.foot a {
  color: var(--ink);
  text-underline-offset: 3px;
}

/* ---------- 404 ---------- */

.lost {
  padding-top: clamp(3rem, 10vw, 7rem);
  padding-bottom: 6rem;
}
.lost h1 {
  margin: 0 0 1rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.8rem, 10vw, 6.5rem);
  line-height: 1;
  letter-spacing: -0.025em;
}
.lost p {
  margin: 0 0 1.75rem;
  font-size: 1.25rem;
  color: var(--ink-soft);
}

/* ---------- Less motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .track,
  .knob {
    animation: none;
  }
  .tile,
  .logo,
  .go-btn,
  .ph,
  .conf,
  .l-knob,
  .t-bubble,
  .t-pole,
  .pill {
    transition: none;
  }
}
