/* Atkinson Hyperlegible Next covers Latin scripts only: Cyrillic, Urdu and Chinese use the system fonts below */
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/fonts/atkinson-hyperlegible-next.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  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: "Atkinson Hyperlegible Next";
  src: url("/fonts/atkinson-hyperlegible-next-latin-ext.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
  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;
}

/* Palette taken from the StraLanc logo */
:root {
  --butter: #ffeeaa;
  --butter-soft: #fff7d6;
  --teal: #008080;
  --teal-deep: #005c5c;
  --graphite: #4d4d4d;
  --ink: #262626;
  --page: #ffffff;
  --line: #e6dfc4;
  --text: var(--graphite);
  --heading: var(--ink);
  --link: var(--teal-deep);
  --band: var(--butter);
  --band-text: var(--ink);
  --surface: var(--butter-soft);
  --on-teal: #ffffff;
  --focus: #b35c00;
  --tuner-border: var(--ink);
  --mark: var(--ink);

  --font: "Atkinson Hyperlegible Next", "Segoe UI", system-ui, sans-serif;
  --step--1: 0.889rem;
  --step-0: 1.125rem;
  --step-1: 1.406rem;
  --step-2: 1.758rem;
  --step-3: 2.197rem;
  --step-4: clamp(2.5rem, 1.6rem + 4.4vw, 4.4rem);
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --wide: 72rem;

  color-scheme: light;
}

/* Dark theme: follows the system unless the visitor picked a theme (data-theme on <html>, see theme.js) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --page: #0f2626;
    --surface: #163333;
    --line: #2a4a4a;
    --text: #d9d4c0;
    --heading: #fff7d6;
    --link: #7fd6cf;
    --band: #163a3a;
    --band-text: #fff7d6;
    --teal: #4fb8b1;
    --teal-deep: #7fd6cf;
    --on-teal: #0f2626;
    --focus: #ffcf66;
    --tuner-border: var(--line);
    --mark: var(--heading);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --page: #0f2626;
  --surface: #163333;
  --line: #2a4a4a;
  --text: #d9d4c0;
  --heading: #fff7d6;
  --link: #7fd6cf;
  --band: #163a3a;
  --band-text: #fff7d6;
  --teal: #4fb8b1;
  --teal-deep: #7fd6cf;
  --on-teal: #0f2626;
  --focus: #ffcf66;
  --tuner-border: var(--line);
  --mark: var(--heading);
  color-scheme: dark;
}

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

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.55;
}

/* Scripts not covered by the brand font */
:lang(ru) {
  --font: "Atkinson Hyperlegible Next", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
}

:lang(zh) {
  --font: "Atkinson Hyperlegible Next", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei",
    system-ui, sans-serif;
}

:lang(ur) {
  --font: "Atkinson Hyperlegible Next", "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Noto Naskh Arabic",
    "Geeza Pro", "Segoe UI", system-ui, sans-serif;
}

:lang(ur) body,
body:lang(ur) {
  line-height: 1.9;
}

/* Nastaliq letters are tall: give controls and short labels room */
:lang(ur) :is(.button, .facts li, .lang-menu summary, label) {
  line-height: 1.9;
}

:lang(ur) :is(h1, h2, h3) {
  letter-spacing: normal;
  line-height: 1.45;
}

:lang(zh) :is(h1, h2, h3) {
  letter-spacing: normal;
  line-height: 1.25;
}

h1, h2, h3 {
  color: var(--heading);
  line-height: 1.12;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 {
  font-size: var(--step-4);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.02;
}

h2 {
  font-size: var(--step-3);
  font-weight: 750;
  letter-spacing: -0.015em;
}

h3 {
  font-size: var(--step-1);
  font-weight: 700;
}

p {
  margin: 0 0 1em;
  max-width: 62ch;
}

a {
  color: var(--link);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration-thickness: 0.14em;
}

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

img {
  max-width: 100%;
  height: auto;
}

.wrap {
  width: 100%;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  inset-inline-start: -999px;
  top: 0.5rem;
  background: var(--page);
  padding: 0.5rem 1rem;
  z-index: 10;
}

.skip:focus {
  inset-inline-start: 0.5rem;
}

/* Header */

.site-header {
  background: var(--page);
  color: var(--heading);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: inherit;
  font-weight: 750;
  font-size: var(--step-1);
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand img {
  width: 2.75rem;
  height: 2.75rem;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  color: inherit;
  font-weight: 600;
  text-decoration: none;
}

.site-nav a:hover {
  text-decoration: underline;
}

@media (max-width: 52rem) {
  .site-nav .optional {
    display: none;
  }
}

/* On phones the header keeps only the logo, the language menu and the theme button */
@media (max-width: 40rem) {
  .site-nav {
    display: none;
  }
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

/* Language menu: a native <details>, so it works without JavaScript */
.lang-menu {
  position: relative;
}

.lang-menu summary {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.75rem;
  padding: 0 0.8rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  color: var(--heading);
  font-weight: 700;
  font-size: var(--step--1);
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
}

.lang-menu summary::-webkit-details-marker {
  display: none;
}

.lang-menu summary:hover,
.lang-menu[open] summary {
  border-color: var(--teal);
}

.lang-menu summary svg {
  width: 1.2rem;
  height: 1.2rem;
}

.lang-menu ul {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 0.5rem);
  z-index: 20;
  min-width: 13rem;
  max-height: min(70vh, 32rem);
  overflow-y: auto;
  margin: 0;
  padding: 0.4rem;
  list-style: none;
  background: var(--page);
  border: 2px solid var(--line);
  border-radius: 1rem;
  box-shadow: 0 0.75rem 2rem rgba(0, 0, 0, 0.18);
}

.lang-menu a {
  display: block;
  padding: 0.5rem 0.8rem;
  border-radius: 0.6rem;
  color: var(--heading);
  text-decoration: none;
}

.lang-menu a:hover {
  background: var(--surface);
}

.lang-menu a[aria-current="page"] {
  font-weight: 800;
  color: var(--link);
}

.title-link {
  color: inherit;
  text-decoration: none;
}

.title-link:hover {
  text-decoration: underline;
}

.related li span {
  display: block;
}

.lang-list {
  display: grid;
  gap: 0.4rem;
  margin-top: 2rem;
  padding: 0;
  list-style: none;
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--heading);
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--teal);
}

.theme-toggle svg {
  width: 1.3rem;
  height: 1.3rem;
}

/* Invisible (but keeping its space) until theme.js runs; the icon shows the theme the button switches to */
.theme-toggle:not([data-state]) {
  visibility: hidden;
}

.theme-toggle[data-state="light"] .sun,
.theme-toggle[data-state="dark"] .moon {
  display: none;
}

/* Hero */

.hero {
  position: relative;
  overflow: hidden;
  background: var(--band);
  color: var(--band-text);
  padding: clamp(2rem, 6vw, 5rem) 0 clamp(3rem, 8vw, 6.5rem);
}

/* The arc and stroke from the logo, scaled up behind the hero */
.hero-arc {
  position: absolute;
  inset-inline-start: -5rem;
  bottom: -9rem;
  width: clamp(22rem, 42vw, 40rem);
  height: auto;
  color: var(--teal);
  opacity: 0.22;
  pointer-events: none;
}

.hero .wrap {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}

@media (max-width: 52rem) {
  .hero .wrap {
    grid-template-columns: minmax(0, 1fr);
  }
}

.hero h1 {
  color: inherit;
  max-width: 13ch;
}

.lead {
  font-size: var(--step-1);
  line-height: 1.45;
  max-width: 34ch;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.7rem 1.4rem;
  border: 2px solid var(--teal);
  border-radius: 999px;
  background: var(--teal);
  color: var(--on-teal);
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--teal-deep);
  border-color: var(--teal-deep);
}

.button.secondary {
  background: transparent;
  color: var(--band-text);
  border-color: currentColor;
}

.button.secondary:hover {
  background: rgba(0, 128, 128, 0.12);
}

/* Pitch-matching demo */

.tuner {
  background: var(--page);
  color: var(--text);
  border: 2px solid var(--tuner-border);
  border-radius: 1.5rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  box-shadow: 0.5rem 0.5rem 0 var(--teal);
}

.tuner h2 {
  font-size: var(--step-2);
  margin-bottom: 0.35em;
}

.tuner p {
  font-size: var(--step--1);
  line-height: 1.5;
}

.tuner-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1rem 0;
}

.tuner .button {
  min-height: 2.75rem;
  padding: 0.55rem 1.1rem;
}

.tuner .button.secondary {
  color: var(--heading);
}

.tuner label {
  display: block;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 0.35rem;
}

.slider-scale {
  display: flex;
  justify-content: space-between;
  font-size: var(--step--1);
}

input[type="range"] {
  width: 100%;
  height: 2.75rem;
  margin: 0;
  accent-color: var(--teal);
  cursor: pointer;
}

.meter {
  position: relative;
  height: 0.75rem;
  margin: 1rem 0 0.5rem;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--line), var(--butter) 42%, var(--teal) 50%, var(--butter) 58%, var(--line));
}

.meter[hidden] {
  display: none;
}

.meter-mark {
  position: absolute;
  top: 50%;
  inset-inline-start: 50%;
  width: 1.1rem;
  height: 1.1rem;
  border: 3px solid var(--page);
  border-radius: 50%;
  background: var(--mark);
  transform: translate(-50%, -50%);
  transition: inset-inline-start 0.4s ease-out;
}

[dir="rtl"] .meter-mark {
  transform: translate(50%, -50%);
}

@media (prefers-reduced-motion: reduce) {
  .meter-mark {
    transition: none;
  }
}

.tuner-result {
  min-height: 1.6em;
  font-weight: 700;
  color: var(--heading);
  margin: 0;
}

/* Sections */

.section {
  padding: clamp(3rem, 8vw, 6rem) 0;
}

.section-intro {
  margin-bottom: 2.5rem;
}

.section + .section {
  border-top: 1px solid var(--line);
}

/* Projects */

.featured {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(1.25rem, 4vw, 3rem);
  align-items: start;
  padding: clamp(1.5rem, 4vw, 3rem);
  border-radius: 2rem;
  background: var(--surface);
  margin-bottom: 3rem;
}

.featured .app-icon {
  width: clamp(6rem, 14vw, 10rem);
}

.featured h3 {
  font-size: var(--step-3);
  letter-spacing: -0.015em;
}

@media (max-width: 40rem) {
  .featured {
    grid-template-columns: minmax(0, 1fr);
  }
}

.app-icon {
  display: block;
  width: 5.5rem;
  aspect-ratio: 1;
  border-radius: 22%;
  background: #ffffff;
  box-shadow: 0 0 0 1px var(--line);
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}

.facts li {
  padding: 0.2rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--teal);
  color: var(--heading);
  font-size: var(--step--1);
}

.collections {
  margin: 0 0 1.5rem;
  padding-inline-start: 1.2em;
  columns: 2 14rem;
  column-gap: 2rem;
}

.collections li {
  break-inside: avoid;
}

.app-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.app {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 1.5rem;
  align-items: center;
  padding: 1.75rem 0;
  border-top: 1px solid var(--line);
}

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

.app h3 {
  margin-bottom: 0.25em;
}

.app p {
  margin: 0;
}

.platform {
  display: block;
  font-size: var(--step--1);
  margin-bottom: 0.35rem;
}

.app-links {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.app-links a {
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 46rem) {
  .app {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }

  .app .app-icon {
    width: 4rem;
  }

  .app-links {
    grid-column: 2;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
  }
}

.note {
  margin-top: 1.5rem;
  font-size: var(--step--1);
}

/* About */

.about .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}

@media (max-width: 46rem) {
  .about .wrap {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* STRA across, LANC down, sharing the A: the logo as a word grid */
.crossword {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(5, 1fr);
  width: min(14rem, 70vw);
  aspect-ratio: 4 / 5;
  font-weight: 400;
  font-size: clamp(2.75rem, 7vw, 3.8rem);
  line-height: 1;
  color: var(--heading);
}

.crossword span {
  display: grid;
  place-items: center;
}

.crossword .s { grid-area: 2 / 1; }
.crossword .t { grid-area: 2 / 2; }
.crossword .r { grid-area: 2 / 3; }
.crossword .l { grid-area: 1 / 4; }
.crossword .a { grid-area: 2 / 4; color: var(--teal); font-weight: 800; }
.crossword .n { grid-area: 3 / 4; }
.crossword .c { grid-area: 4 / 4; }

.crossword .strappa {
  grid-area: 3 / 1 / 4 / 4;
  align-self: start;
  justify-self: start;
  padding-top: 0.6rem;
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--text);
}

.crossword .lanciotti {
  grid-area: 5 / 3 / 6 / 5;
  justify-self: end;
  align-self: start;
  font-size: var(--step--1);
  font-weight: 600;
  color: var(--text);
}

/* Links */

.links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.links a {
  display: block;
  height: 100%;
  padding: 1.25rem 1.5rem;
  border: 2px solid var(--line);
  border-radius: 1rem;
  color: var(--text);
  text-decoration: none;
}

.links a:hover {
  border-color: var(--teal);
}

.links strong {
  display: block;
  font-size: var(--step-1);
  color: var(--heading);
}

.links .url {
  display: block;
  margin-top: 0.5rem;
  color: var(--link);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
  overflow-wrap: anywhere;
}

/* Footer */

.site-footer {
  background: var(--band);
  color: var(--band-text);
  padding: 2.5rem 0;
  font-size: var(--step--1);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
}

.site-footer p {
  margin: 0;
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer a {
  color: inherit;
}

/* Project pages */

.page-hero {
  background: var(--band);
  color: var(--band-text);
  padding: clamp(1.5rem, 4vw, 3rem) 0 clamp(2.5rem, 6vw, 4.5rem);
}

.page-hero .wrap {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(1.25rem, 4vw, 3rem);
  align-items: center;
}

.page-hero h1 {
  color: inherit;
  margin-bottom: 0.3em;
}

.page-hero .lead {
  max-width: 46ch;
  margin-bottom: 0;
}

.page-hero .app-icon {
  width: clamp(5.5rem, 14vw, 9rem);
}

@media (max-width: 40rem) {
  .page-hero .wrap {
    grid-template-columns: minmax(0, 1fr);
  }
}

.breadcrumb {
  grid-column: 1 / -1;
  font-size: var(--step--1);
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.breadcrumb li + li::before {
  content: "/";
  margin-inline-end: 0.5rem;
}

.breadcrumb a {
  color: inherit;
}

.page-hero .facts {
  margin-top: 1.25rem;
}

.page-hero .actions {
  margin-top: 1.5rem;
}

.content {
  display: grid;
  gap: clamp(2.5rem, 6vw, 4rem);
  padding-top: clamp(2.5rem, 6vw, 4.5rem);
  padding-bottom: clamp(3rem, 8vw, 6rem);
}

.content h2 {
  font-size: var(--step-2);
}

.content ul,
.content ol {
  margin: 0 0 1em;
  padding-inline-start: 1.3em;
  max-width: 62ch;
}

.content li + li {
  margin-top: 0.4em;
}

.games {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 1.5rem 2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.content .games {
  padding-inline-start: 0;
  max-width: none;
}

.content .games li + li {
  margin-top: 0;
}

.games h3 {
  font-size: var(--step-0);
  margin-bottom: 0.25em;
}

.games p {
  margin: 0;
}

.screens {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 0;
}

.screens figure {
  flex: 0 1 15rem;
  margin: 0;
}

.screens.wide figure {
  flex-basis: 40rem;
}

.screens img {
  display: block;
  width: 100%;
  border-radius: 1rem;
  box-shadow: 0 0 0 1px var(--line);
}

.screens figcaption {
  margin-top: 0.6rem;
  font-size: var(--step--1);
}

.related {
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border-radius: 1.5rem;
  background: var(--surface);
}

.related ul {
  margin-bottom: 0;
}

/* Text pages (privacy policy, 404) */

.prose {
  max-width: 44rem;
  padding-top: clamp(2rem, 6vw, 4rem);
  padding-bottom: clamp(3rem, 8vw, 6rem);
}

.prose h2 {
  font-size: var(--step-2);
  margin-top: 1.75em;
}
