/* Tiny Junction — tinyjunction.com
   Colours, type and voice follow the Tiny Junction brand guidelines v1.0. */

/* Self-hosted fonts (SIL OFL 1.1, see fonts/OFL-*.txt). Variable files: one per family and subset. */
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("fonts/outfit-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("fonts/outfit-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --teal: #2C7A78;        /* Shelter Teal */
  --teal-deep: #1F5C5A;   /* Teal Deep: roads, pressed states, small teal text on paper */
  --teal-mist: #CDE5E3;
  --paper: #F7F3EA;
  --ink: #1F1D2B;
  --ink-2: #4B4857;       /* body text on paper, 8.0:1 */
  --ink-3: #6B6877;       /* captions on paper, 4.9:1 */
  --fog: #D9D6CF;
  --yellow: #FFC42E;      /* Bay Yellow: one main button per screen */
  --yellow-base: #C99212;
  --white: #FFFFFF;

  --display: "Outfit", ui-rounded, system-ui, sans-serif;
  --text: "Inter", system-ui, -apple-system, sans-serif;

  --gutter: clamp(20px, 5vw, 48px);
  --section-pad: clamp(72px, 10vw, 120px);
}

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

/* `hidden` must win over component display rules (e.g. .game { display: grid }) */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;   /* 17 / 26, as in the guidelines */
  line-height: 1.53;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; }

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

h2 {
  font-size: clamp(2.25rem, 1.5rem + 3vw, 3.5rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
}

p { margin: 0; text-wrap: pretty; }

a { color: var(--teal-deep); }

::selection { background: var(--yellow); color: var(--ink); }

:focus-visible {
  outline: 3px solid var(--focus, var(--ink));
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap {
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 10;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-160%);
}
.skip:focus-visible { transform: none; }

/* Logo */

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--paper);
  --mono-bg: var(--teal);
  text-decoration: none;
}
.logo-mark { width: 30px; height: 38px; }
.logo-word {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.625rem;
  line-height: 1;
  letter-spacing: -0.03em;
  white-space: nowrap;
}
.logo-small .logo-mark { width: 24px; height: 30px; }
.logo-small .logo-word { font-size: 1.3125rem; }

/* Navigation */

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav a {
  display: inline-block;
  padding: 10px 0;
  color: inherit;
  font-weight: 500;
  font-size: 1rem;
  text-decoration: none;
}
.nav a:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

/* Buttons: toy keys that sit on a coloured base and press down */

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 56px;
  padding: 0 28px;
  border-radius: 999px;
  font-family: var(--text);
  font-weight: 600;
  font-size: 1.0625rem;
  text-decoration: none;
  box-shadow: 0 5px 0 var(--base);
  transition: transform .12s ease-out, box-shadow .12s ease-out;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 0 var(--base); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--base); }

.btn-main {
  --base: var(--yellow-base);
  background: var(--yellow);
  color: var(--ink);
}

.btn-game {
  --base: var(--route);
  min-height: 48px;
  padding: 0 22px;
  background: var(--ink);
  color: var(--paper);
  font-size: 1rem;
}

/* Hero */

.hero {
  --focus: var(--yellow);
  background: var(--teal);
  color: var(--paper);
  overflow: hidden;
}

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-block: 22px;
}

.hero-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  align-items: center;
  gap: 40px 56px;
  padding-block: 24px 88px;
}

.hero h1 {
  max-width: 11ch;
  margin-bottom: 24px;
  font-size: clamp(2.875rem, 1.5rem + 4.6vw, 5.5rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.lede {
  max-width: 31em;
  margin-bottom: 36px;
  font-size: 1.25rem;
  line-height: 1.55;
}

.junction { margin: 0; }
.junction svg {
  width: 100%;
  max-width: 560px;
  height: auto;
  margin-inline: auto;
  overflow: visible;
}
.junction figcaption {
  margin-top: 6px;
  text-align: center;
  font-weight: 500;
  font-size: 0.9375rem;
}

@media (max-width: 880px) {
  .hero-body { grid-template-columns: minmax(0, 1fr); padding-bottom: 64px; }
  .junction svg { max-width: 460px; }
  .stop-names text { font-size: 26px; }
}

/* The junction drawing */

.road {
  stroke: var(--teal-deep);
  stroke-width: 60;
  stroke-dasharray: 1;
  animation: draw .6s cubic-bezier(.3, .7, .3, 1) var(--d) backwards;
}
.road-unbuilt {
  stroke-dasharray: none;
  animation: fade .4s var(--d) backwards;
}
.road-gap {
  stroke: var(--teal-deep);
  stroke-width: 60;
  stroke-dasharray: 12 9;
  opacity: .75;
  animation: fade .4s .3s backwards;
}
.lanes path {
  stroke: var(--paper);
  stroke-width: 3;
  stroke-dasharray: 12 10;
  opacity: .5;
  animation: fade .4s .5s backwards;
}

.roundabout {
  transform-box: fill-box;
  transform-origin: center;
  animation: pop .5s cubic-bezier(.3, 1.4, .6, 1) .2s backwards;
}

.stop {
  transform-box: fill-box;
  transform-origin: center;
  animation: pop .45s cubic-bezier(.3, 1.5, .6, 1) var(--d) backwards;
}
.stop.is-arriving { animation: bump .4s cubic-bezier(.3, 1.6, .6, 1); }

.stop-names text {
  font-family: var(--display);
  font-weight: 600;
  font-size: 22px;
  fill: var(--paper);
  animation: fade .4s .9s backwards;
}

.car { cursor: pointer; outline: none; }
.car .hit { fill: transparent; }
.car .ring {
  fill: none;
  stroke: var(--yellow);
  stroke-width: 4;
  opacity: 0;
}
.car:focus-visible .ring { opacity: 1; }

.car-body {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform .25s cubic-bezier(.3, .7, .3, 1), opacity .25s;
  animation: arrive .6s cubic-bezier(.2, .8, .2, 1) 1s backwards;
}
.car:hover .car-body,
.car:focus-visible .car-body {
  transform: translate(calc(var(--nx) * 1px), calc(var(--ny) * 1px));
}
.car.is-going .car-body {
  transform: translate(calc(var(--tx) * 1px), calc(var(--ty) * 1px)) scale(.3);
  opacity: 0;
  transition: transform .6s cubic-bezier(.55, 0, .7, .4), opacity .2s .4s;
}
.car.is-reset .car-body { transition: none; }

@keyframes draw   { from { stroke-dashoffset: 1; } }
@keyframes fade   { from { opacity: 0; } }
@keyframes pop    { from { opacity: 0; transform: scale(.6); } }
@keyframes bump   { 50% { transform: scale(1.1); } }
@keyframes arrive {
  from {
    opacity: 0;
    transform: translate(calc(var(--ax) * 1px), calc(var(--ay) * 1px)) scale(.5);
  }
}

/* Games */

.games { padding-block: var(--section-pad); }

.section-head p {
  max-width: 34em;
  margin-top: 16px;
  font-size: 1.1875rem;
  line-height: 1.6;
  color: var(--ink-2);
}

.game-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 72px 64px;
  margin-top: 64px;
}

.game {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  align-items: start;
  gap: 28px;
  scroll-margin-top: 32px;
  border-radius: 28px;
}
.game:focus { outline: none; }
.game:focus-visible { outline: 3px solid var(--ink); outline-offset: 16px; }

.game-icon {
  width: 128px;
  height: 128px;
  border-radius: 22.5%;
  overflow: hidden;
}

.game-icon-next {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px dashed var(--fog);
  color: var(--teal);
  --mono-bg: var(--paper);
}
.game-icon-next svg { width: 48px; height: 60px; }

.game h3 {
  font-size: 2rem;
  line-height: 1.05;
  letter-spacing: -0.03em;
}
.game h3 a {
  color: inherit;
  text-decoration: none;
}
.game h3 a:hover {
  text-decoration: underline;
  text-decoration-color: var(--route);
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
}
.tagline {
  margin-top: 6px;
  font-family: var(--display);
  font-weight: 500;
  font-size: 1.25rem;
  color: var(--teal-deep);
}
.game-body > p:not(.tagline):not(.platforms) {
  max-width: 36em;
  margin-top: 12px;
  color: var(--ink-2);
}
.platforms {
  margin-top: 12px;
  font-size: 0.9375rem;
  color: var(--ink-3);
}
.game .btn { margin-top: 22px; }

@media (max-width: 960px) {
  .game-list { grid-template-columns: minmax(0, 1fr); gap: 56px; }
}
@media (max-width: 520px) {
  .game { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .game-icon { width: 104px; height: 104px; }
}

/* How we make them */

.craft {
  background: var(--white);
  padding-block: var(--section-pad);
}
.craft h2 { margin-bottom: 48px; }

.principles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 40px 48px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.principles li {
  padding-top: 20px;
  border-top: 3px solid var(--teal);
}
.principles h3 {
  margin-bottom: 10px;
  font-size: 1.625rem;   /* 26 / 32 */
  line-height: 1.23;
  letter-spacing: -0.02em;
}
.principles p { color: var(--ink-2); }

/* About */

.about { padding-block: var(--section-pad); }

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 620px);
  align-items: center;
  gap: 48px 80px;
}

.seal { width: 100%; max-width: 300px; height: auto; }
.seal-text {
  font-family: var(--display);
  font-weight: 600;
  fill: var(--teal);
  text-anchor: middle;
}
.seal-mark { color: var(--teal); --mono-bg: var(--white); }

.about-copy h2 { margin-bottom: 20px; }
.about-copy p {
  margin-top: 16px;
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--ink-2);
}

@media (max-width: 760px) {
  .about-grid { grid-template-columns: minmax(0, 1fr); }
  .seal { max-width: 200px; }
}

/* Contact */

.contact {
  --focus: var(--yellow);
  background: var(--ink);
  color: var(--paper);
  padding-block: clamp(64px, 8vw, 96px);
}
.contact-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
}
.contact h2 { margin-bottom: 14px; }
.contact p { max-width: 34em; font-size: 1.125rem; }

/* Footer */

.footer {
  --focus: var(--yellow);
  background: var(--teal);
  color: var(--paper);
  padding-block: 28px;
}
.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
}
.copyright { font-size: 0.875rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
