/*
  giannoccarol: personal site.
  One family, two widths: Fira Sans for reading, Fira Sans Compressed for the big titles.
  Black page, one orange accent for anything you can click, status colours only where they carry meaning.
*/

@font-face {
  font-family: "Fira Sans";
  src: url("../fonts/fira-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fira Sans";
  src: url("../fonts/fira-sans-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fira Sans Compressed";
  src: url("../fonts/fira-sans-compressed-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

/* ---------- tokens ---------- */

:root {
  color-scheme: dark;

  --paper: #000000;
  --ink: #f4f4f4;
  --muted: #9b9b9b;
  --line: #262626;
  --wash: #141414;
  --raised: #171717;
  --raised-2: #222222;
  --line-strong: #3d3d3d;
  --accent: #ff5a00;
  --on-accent: #000000;
  --link: #ff5a00;

  --works: #3fb950;
  --experimental: #f2c230;
  --broken: #f85149;

  --text: "Fira Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Fira Sans Compressed", "Fira Sans Condensed", "Arial Narrow", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "JetBrains Mono", Hack, Consolas, Menlo, monospace;

  --gutter: clamp(16px, 4vw, 56px);
  --measure: 40rem;
  --wide: 72rem;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.5rem;
  --step-3: 2rem;
  --step-4: clamp(2.5rem, 6vw, 4rem);
  --step-5: clamp(3.25rem, 9vw, 6.5rem);
  --step-hero: clamp(4.5rem, 17vw, 13rem);
}

/* Light theme, chosen with the button in the menu (dark stays the default). The bright orange stays for
   buttons, tiles and underlines; links use a darker orange that is readable on white. */
:root[data-theme="light"] {
  color-scheme: light;
  --paper: #ffffff;
  --ink: #141414;
  --muted: #5e5e5e;
  --line: #e0e0e0;
  --line-strong: #c4c4c4;
  --wash: #f3f3f3;
  --raised: #f0f0f0;
  --raised-2: #e5e5e5;
  --link: #c2410c;
  --works: #1a7f37;
  --experimental: #bf8700;
  --broken: #cf222e;
}

/* ---------- base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1rem;
}

@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: var(--step-0);
  line-height: 1.6;
  overflow-x: hidden;
}

svg,
img {
  display: block;
}

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

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

p,
ul,
ol,
dl,
table {
  margin: 0 0 1rem;
}

ul,
ol {
  padding-left: 1.25rem;
}

li + li {
  margin-top: 0.3rem;
}

h1,
h2,
h3,
h4,
h5 {
  margin: 0;
  line-height: 1.2;
  font-weight: 600;
}

strong {
  font-weight: 600;
}

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--wash);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  overflow-wrap: anywhere;
}

pre {
  font-family: var(--mono);
  font-size: var(--step--1);
  background: var(--wash);
  padding: 0.85rem 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 0.6rem 0 0;
}

pre code {
  background: none;
  padding: 0;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 0.9rem;
  z-index: 10;
}

.skip:focus {
  top: 0.5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- frame ---------- */

.page,
.footer {
  max-width: calc(var(--wide) + 2 * var(--gutter));
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* The masthead spans the whole window, so its glass background reaches both edges; the padding keeps its
   content in line with the page column. */
.masthead {
  padding-left: max(var(--gutter), calc((100% - var(--wide)) / 2));
  padding-right: max(var(--gutter), calc((100% - var(--wide)) / 2));
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding-top: 1.25rem;
}

.brand {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.sitenav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.4rem;
}

.sitenav a {
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.sitenav a:hover,
.sitenav a[aria-current="page"] {
  color: var(--ink);
}

/* theme switch: sun in the dark theme (go light), moon in the light one (go dark) */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  align-self: center;
  padding: 0.15rem;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

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

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

.theme-icon--moon,
.theme-label--dark,
:root[data-theme="light"] .theme-icon--sun,
:root[data-theme="light"] .theme-label--light {
  display: none;
}

:root[data-theme="light"] .theme-icon--moon {
  display: block;
}

:root[data-theme="light"] .theme-label--dark {
  display: inline;
}

/* language switch: same page in the other language */
.sitenav .lang {
  color: var(--link);
  padding-left: 1.4rem;
  border-left: 1px solid var(--line);
}

@media (max-width: 30rem) {
  .sitenav .lang {
    padding-left: 0;
    border-left: 0;
  }
}

/* small-screen menu (theme.js wraps the links and adds the button; without it the links just wrap) */
.sitenav-links {
  display: contents;
}

.menu-toggle {
  display: none;
}

@media (max-width: 52rem) {
  .has-menu .masthead {
    position: relative;
    flex-wrap: nowrap;
    align-items: center;
    padding-bottom: 0.9rem;
  }

  .has-menu .sitenav {
    flex-wrap: nowrap;
    align-items: center;
    gap: 0 1.1rem;
  }

  .has-menu .sitenav .lang {
    padding-left: 0;
    border-left: 0;
  }

  .has-menu .menu-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    margin: -0.5rem -0.6rem -0.5rem -0.3rem;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink);
    cursor: pointer;
  }

  .menu-toggle svg {
    width: 1.5rem;
    height: 1.5rem;
  }

  .menu-icon-close,
  .masthead.is-open .menu-icon-open {
    display: none;
  }

  .masthead.is-open .menu-icon-close {
    display: inline;
  }

  .has-menu .sitenav-links {
    display: none;
  }

  /* the open menu drops below the bar, over the page */
  .has-menu .masthead.is-open .sitenav-links {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 50;
    padding: 0 var(--gutter) 0.75rem;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
  }

  .has-menu .sitenav-links a {
    padding: 0.85rem 0;
    border-top: 1px solid var(--line);
    color: var(--ink);
    font-size: var(--step-1);
  }

  .has-menu .sitenav-links a[aria-current="page"] {
    color: var(--accent);
  }
}

.prose {
  max-width: var(--measure);
}

/* the big compressed titles */
.hero-name,
.page-title,
.device__name,
.section-title,
.work__title {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.005em;
  line-height: 0.92;
}

.hero-name {
  font-size: clamp(3rem, 6.8vw, 5.75rem);
  margin: 0 0 0 -0.02em;
}

.page-title {
  font-size: var(--step-5);
  margin: clamp(2rem, 6vw, 4rem) 0 0 -0.02em;
}

.lede {
  font-size: var(--step-2);
  line-height: 1.4;
  max-width: 34rem;
  margin: 1.5rem 0 0;
}

.section-title {
  font-size: clamp(2rem, 4.5vw, 3rem);
  margin: 0 0 1.25rem;
}

.hero-name + .lede {
  margin-top: 1.25rem;
}

/* ---------- home hero: name over a field of dots ---------- */

.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  min-height: clamp(24rem, 50vw, 34rem);
}

.hero__text {
  position: relative;
  z-index: 1;
  max-width: 34rem;
}

.dots {
  position: absolute;
  inset: 0 calc(-1 * var(--gutter));
  z-index: 0;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 12%, #000 86%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 12%, #000 86%, transparent 100%);
}

.dots canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ---------- home ---------- */

.home-section {
  margin-top: clamp(4rem, 10vw, 7rem);
}

.work {
  border-top: 2px solid var(--ink);
  padding-top: 1.5rem;
}

.work + .work {
  margin-top: clamp(3.5rem, 8vw, 5.5rem);
}

.work__title {
  font-size: var(--step-5);
  color: var(--ink);
  text-decoration: none;
  display: inline-block;
}

.work__title {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
}

.work__title:hover {
  color: var(--link);
}

/* the arrow says the title opens a page */
.work__arrow {
  width: 0.62em;
  height: 0.62em;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  display: grid;
  place-items: center;
  flex: none;
  margin-top: 0.08em;
}

.work__arrow svg {
  width: 58%;
  height: 58%;
}

@media (prefers-reduced-motion: no-preference) {
  .work__arrow {
    transition: transform 160ms ease-out;
  }
  .work__title:hover .work__arrow,
  .work__title:focus-visible .work__arrow {
    transform: translateX(0.12em);
  }
}

.work__intro .button {
  flex: none;
}

.work__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 1.5rem 4rem;
  margin-top: 1.5rem;
}

.work__body p {
  max-width: 30rem;
}

@media (max-width: 52rem) {
  .work__body {
    grid-template-columns: 1fr;
  }
}

.phones {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--line);
}

.phones li {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(7.5rem, 1fr) minmax(5.5rem, auto) minmax(8rem, auto);
  gap: 0.25rem 1rem;
  align-items: baseline;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}

.phones a {
  font-weight: 600;
}

.phones .os {
  color: var(--muted);
}

@media (max-width: 30rem) {
  .phones li {
    grid-template-columns: 1fr auto;
  }
  .phones .os {
    grid-column: 1;
    grid-row: 2;
    font-size: var(--step--1);
  }
  .phones .status {
    grid-row: 1 / span 2;
    grid-column: 2;
    align-self: center;
  }
}

.more {
  color: var(--muted);
  margin-top: 2rem;
}

/* ---------- tiles (home) ---------- */

.work__intro {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  margin: 1.25rem 0 1.5rem;
}

.work__intro p {
  margin: 0;
  max-width: 34rem;
}

.tiles {
  --cell: clamp(4.25rem, 9.6vw, 5.75rem);
  --gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(8, var(--cell));
  grid-auto-rows: var(--cell);
  grid-auto-flow: dense;
  gap: var(--gap);
}

.tiles > li {
  margin: 0;
}

@media (max-width: 47rem) {
  .tiles {
    --cell: calc((100vw - 2 * var(--gutter) - 3 * var(--gap)) / 4);
    grid-template-columns: repeat(4, var(--cell));
  }
}

.tile {
  grid-column: span 2;
  grid-row: span 2;
  position: relative;
  overflow: hidden;
  background: var(--tile-bg);
  color: var(--tile-fg);
}

.tile--wide {
  grid-column: span 4;
}

.tile--small {
  grid-column: span 1;
  grid-row: span 1;
}

/* low and wide, with words: for actions that need a name, like a download */
.tile--bar {
  grid-column: span 2;
  grid-row: span 1;
}

.tile__bar {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0 0.8rem;
  line-height: 1.2;
}

.tile__bar svg {
  width: 1.9rem;
  height: 1.9rem;
  flex: none;
}

.tile__bar strong {
  display: block;
  font-size: var(--step-0);
}

.tile__bar span span {
  display: block;
  font-size: var(--step--1);
  opacity: 0.8;
}

@media (max-width: 30rem) {
  .tile__bar {
    gap: 0.55rem;
    padding: 0 0.6rem;
  }
  .tile__bar svg {
    width: 1.5rem;
    height: 1.5rem;
  }
  .tile__bar span span {
    display: none;
  }
}

.tile > a {
  position: absolute;
  inset: 0;
  color: inherit;
  text-decoration: none;
}

.tile > a:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.tile__label {
  position: absolute;
  left: 0.65rem;
  right: 0.65rem;
  bottom: 0.5rem;
  font-size: var(--step--1);
  font-weight: 600;
  line-height: 1.25;
}

.tile__glyph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.tile__glyph svg {
  width: 42%;
  height: 42%;
  max-width: 3.5rem;
}

.tile--small .tile__glyph svg {
  width: 52%;
  height: 52%;
}

.tile--wide .tile__glyph svg {
  width: 21%;
}

.tile__glyph img {
  width: 52%;
  max-width: 5rem;
}

.tile--wide .tile__glyph img {
  width: 26%;
}

/* real phone photos: sized by the tile's height, since they are tall, and kept above the label so the
   label never sits on the coloured back of a phone */
.tile__glyph--photo {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 0.8rem;
}

.tile .tile__glyph--photo img {
  width: auto;
  max-width: none;
  height: calc(100% - 0.8rem - 2.3rem);
}

/* the turning 3D phone in a tile: the tile stays a plain link, so the model takes no clicks */
.tile .tile__3d {
  height: calc(100% - 0.8rem - 2.3rem);
  aspect-ratio: 3 / 4;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .tile {
    transition: transform 120ms ease-out;
  }
  .tile:active {
    transform: scale(0.97);
  }
}

/* live tiles: two faces that slide up and back */
.live__faces,
.live__face {
  position: absolute;
  inset: 0;
}

.live__face--back {
  transform: translateY(100%);
  padding: 0.7rem 0.7rem 2.2rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.live__big {
  font-family: var(--display);
  font-weight: 800;
  font-size: var(--step-3);
  line-height: 1;
}

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

.tile:not(.tile--wide) .live__big {
  font-size: var(--step-2);
}

@media (prefers-reduced-motion: no-preference) {
  .live .live__faces {
    animation: live-slide 15s cubic-bezier(0.5, 0, 0.2, 1) infinite;
    animation-delay: var(--live-delay, 2s);
  }
  .live:hover .live__faces,
  .live:focus-within .live__faces {
    animation-play-state: paused;
  }
}

@keyframes live-slide {
  0%,
  42% {
    transform: translateY(0);
  }
  48%,
  92% {
    transform: translateY(-100%);
  }
  98%,
  100% {
    transform: translateY(0);
  }
}

.c-accent { --tile-bg: var(--accent); --tile-fg: var(--on-accent); }
.c-dark { --tile-bg: var(--raised); --tile-fg: var(--ink); }
.c-dark2 { --tile-bg: var(--raised-2); --tile-fg: var(--ink); }

.c-dark,
.c-dark2 {
  box-shadow: inset 0 0 0 1px var(--line);
}

.tile:not(.c-accent):hover,
.tile:not(.c-accent):focus-within {
  --tile-bg: var(--accent);
  --tile-fg: var(--on-accent);
  box-shadow: none;
}

@media (prefers-reduced-motion: no-preference) {
  .tile {
    transition: transform 120ms ease-out, background-color 160ms ease-out, color 160ms ease-out;
  }
}

.contact {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
}

.contact li + li {
  margin-top: 0;
}

/* ---------- status words and markers ---------- */

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: var(--step--1);
  font-weight: 600;
  white-space: nowrap;
}

.status::before,
.mark li::before,
.legend li::before {
  content: "";
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--marker, var(--works));
  flex: none;
}

.is-works {
  --marker: var(--works);
}

.is-experimental {
  --marker: var(--experimental);
}

.is-broken {
  --marker: var(--broken);
}

.is-testing {
  --marker: transparent;
}

.is-testing::before,
.is-testing li::before {
  box-shadow: inset 0 0 0 2px var(--muted);
}

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

.mark li,
.legend li {
  position: relative;
  padding-left: 1.3rem;
}

.mark li::before,
.legend li::before {
  position: absolute;
  left: 0;
  top: 0.58em;
}

.legend {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  color: var(--muted);
  font-size: var(--step--1);
}

.legend li + li {
  margin-top: 0;
}

.legend li::before {
  top: 0.48em;
}

/* ---------- ROMs page ---------- */

.rom-head {
  margin-top: clamp(2rem, 5vw, 3rem);
}

.rom-head__title {
  font-family: var(--display);
  font-weight: 800;
  font-size: var(--step-3);
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
}

.rom-head__title:hover {
  color: var(--link);
}

/* wraps instead of scrolling, so the current page is always visible on a phone */
.rom-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.75rem;
  border-bottom: 1px solid var(--line);
  margin-top: 1rem;
}

.lede + .rom-nav {
  margin-top: 2.5rem;
}

.rom-nav a {
  flex: none;
  padding: 0.9rem 0 0.75rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}

.rom-nav a:hover {
  color: var(--ink);
}

.rom-nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* overview: one card per phone */
.phone-cards {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: 2.5rem 3rem;
}

.phone-card {
  margin: 0;
  border-top: 2px solid var(--line);
  padding-top: 1.25rem;
  display: flex;
  flex-direction: column;
}

.phone-card.is-current {
  border-top-color: var(--accent);
}

.phone-card .phone-card__name {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.9rem, 2.6vw, 2.4rem);
  line-height: 1;
  margin: 0;
}

.phone-card__name a {
  color: var(--ink);
  text-decoration: none;
}

.phone-card__name a:hover {
  color: var(--link);
}

.phone-card .device__meta {
  font-size: var(--step-0);
  margin: 0.6rem 0 1rem;
}

.phone-card__date {
  color: var(--muted);
  font-size: var(--step--1);
}

.phone-card .actions {
  margin-top: auto;
  padding-top: 0.5rem;
}

.device {
  padding: clamp(3rem, 7vw, 5rem) 0 0;
}

.device__name {
  font-size: var(--step-5);
}

.device > header {
  margin-bottom: 2rem;
}

/* app pages: icon next to the name */
.app-head {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 1.5rem);
}

.app-head img {
  width: clamp(3.5rem, 8vw, 5.5rem);
  flex: none;
}

.app-head--small img {
  width: 3rem;
}

.app-head--phone img {
  width: auto;
  height: 3.6rem;
}

.device-hero {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 1.5rem 2rem;
  align-items: center;
}

/* The phone sits in the middle of the free space next to the title, the
   intro text and the buttons. */
.device-hero__photo {
  justify-self: center;
  width: auto;
  height: clamp(12rem, 30vw, 26rem);
}

.device-hero .prose,
.device-hero .actions {
  margin-top: 1.5rem;
}

/* the 3D model (phone3d.js) takes the photo's place; the photo stays for browsers without WebGL */
img.is-replaced {
  display: none;
}

.device-hero__3d {
  justify-self: center;
  height: clamp(13rem, 33vw, 28rem);
  aspect-ratio: 3 / 4;
  cursor: grab;
  touch-action: pan-y;
  outline-offset: 4px;
}

.device-hero__3d.is-dragging {
  cursor: grabbing;
}

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

  .device-hero__photo {
    grid-row: 1;
    height: 13rem;
  }

  .device-hero__3d {
    grid-row: 1;
    height: 15rem;
  }
}

.shot {
  margin: 2.5rem 0 0;
}

.shot img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
}

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

kbd {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.05em 0.35em;
  white-space: nowrap;
}

.device__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: var(--step-1);
}

.device__meta .status {
  font-size: var(--step-0);
  color: var(--ink);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 2rem 0 0;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.5rem 1.2rem;
  border-radius: 4px;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  line-height: 1.2;
}

.button:hover {
  border-color: var(--link);
  color: var(--link);
}

.button--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.button--primary:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.button--primary:hover svg {
  color: var(--paper);
}

.button svg {
  width: 1.05em;
  height: 1.05em;
  flex: none;
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 1rem 2rem;
  margin: 2.5rem 0 0;
}

.facts div {
  border-top: 1px solid var(--line);
  padding-top: 0.6rem;
  min-width: 0;
}

.facts dt {
  color: var(--muted);
  font-size: var(--step--1);
}

.facts dd {
  margin: 0;
  font-variant-numeric: tabular-nums lining-nums;
}

/* phone hardware: label and value on one row, stacked on narrow screens */
.specs {
  display: grid;
  grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr);
  max-width: var(--measure);
  margin: 0;
}

.specs dt,
.specs dd {
  margin: 0;
  padding: 0.6rem 0;
  border-top: 1px solid var(--line);
}

.specs dt {
  color: var(--muted);
  padding-right: 1.5rem;
}

.specs dd {
  font-variant-numeric: tabular-nums lining-nums;
}

.specs-source {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: var(--step--1);
}

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

  .specs dd {
    border-top: 0;
    padding-top: 0;
  }
}

.onthispage {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 2rem 0 0;
}

.onthispage li + li {
  margin-top: 0;
}

.intro {
  margin-top: 2.5rem;
}

.intro p:first-child {
  font-size: var(--step-1);
  line-height: 1.55;
}

.news {
  margin: 2rem 0 0;
  padding: 1.25rem 1.5rem 0.25rem;
  border-left: 3px solid var(--accent);
  background: var(--wash);
  border-radius: 0 6px 6px 0;
  max-width: var(--measure);
}

.news h2 {
  font-size: var(--step-1);
  margin: 0 0 0.6rem;
}

/* sections inside a phone */
.block {
  margin-top: clamp(3rem, 6vw, 4.5rem);
}

.block > h2 {
  font-size: var(--step-3);
  letter-spacing: -0.01em;
  margin: 0 0 1.25rem;
}

.block h3 {
  font-size: var(--step-1);
  margin: 2.25rem 0 0.75rem;
}

.status-title {
  font-size: var(--step-1);
  margin: 2.25rem 0 0.25rem;
}

.board {
  columns: 2 20rem;
  column-gap: 3.5rem;
}

.board > div {
  break-inside: avoid;
  padding-top: 1rem;
}

.board h3,
.board h4 {
  font-size: var(--step-0);
  margin: 0 0 0.5rem;
}

.board ul {
  margin: 0;
}

.callouts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: 0 3.5rem;
}

.warning {
  border-left: 3px solid var(--experimental);
  padding: 0.15rem 0 0.15rem 1rem;
  max-width: var(--measure);
}

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  max-width: var(--measure);
}

.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 2.5rem;
}

.steps > li + li {
  margin-top: 0.9rem;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.05rem;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: var(--step--1);
  border: 1.5px solid var(--ink);
}

.table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0;
}

.modes {
  width: 100%;
  max-width: 52rem;
  border-collapse: collapse;
}

.modes th,
.modes td {
  text-align: left;
  vertical-align: top;
  padding: 0.7rem 1.25rem 0.7rem 0;
  border-bottom: 1px solid var(--line);
}

.modes thead th {
  font-weight: 400;
  color: var(--muted);
  font-size: var(--step--1);
  border-bottom-color: var(--ink);
}

.modes tbody th {
  white-space: nowrap;
}

.links {
  list-style: none;
  padding: 0;
  max-width: 52rem;
  border-top: 1px solid var(--line);
}

.links li {
  margin: 0;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 15rem) 1fr;
  gap: 0.2rem 1.5rem;
}

.links a {
  font-weight: 600;
}

.links span {
  color: var(--muted);
}

@media (max-width: 40rem) {
  .links li {
    grid-template-columns: 1fr;
  }
}

.credits {
  list-style: none;
  padding: 0;
  columns: 2 22rem;
  column-gap: 3.5rem;
}

.credits li {
  break-inside: avoid;
  margin: 0 0 0.85rem;
}

/* in progress: 1520 and 930 */
.group {
  margin-top: clamp(4rem, 9vw, 6rem);
  padding-top: 2rem;
  border-top: 2px solid var(--ink);
}

.group > p {
  max-width: var(--measure);
}

.telegram {
  margin: 2rem 0 0;
  padding: 1.25rem 1.5rem;
  border-radius: 4px;
  background: var(--accent);
  color: var(--on-accent);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
}

.telegram p {
  margin: 0;
  max-width: 34rem;
}

.telegram strong {
  display: block;
  font-size: var(--step-2);
  line-height: 1.25;
}

.telegram .button {
  background: #000000;
  border-color: #000000;
  color: #ffffff;
}

.telegram .button:hover {
  background: transparent;
  color: #000000;
}

.pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr));
  gap: 0 4rem;
}

.columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 0 2rem;
}

.columns h2 {
  font-size: var(--step-0);
  margin: 1.75rem 0 0.6rem;
}

.inline-links {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin-top: 1.5rem;
}

.inline-links li + li {
  margin-top: 0;
}

/* apps and tools */
.tools {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: 2rem 3.5rem;
}

.tools li {
  margin: 0;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.tools h2 {
  font-size: var(--step-1);
  margin: 0 0 0.35rem;
}

.tools p {
  margin: 0 0 0.35rem;
}

.tools .meta {
  color: var(--muted);
  font-size: var(--step--1);
}

/* ---------- contact form ---------- */

.contact-form {
  max-width: 36rem;
}

.field {
  margin: 0 0 1.25rem;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.65rem 0.8rem;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: var(--line-strong);
}

.field textarea {
  resize: vertical;
  min-height: 10rem;
}

/* honeypot: off screen, out of the tab order, hidden from screen readers */
.trap {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.turnstile {
  min-height: 65px;
}

.contact-form .actions {
  margin-top: 1rem;
}

button.button {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button.button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.form-status {
  min-height: 1.6em;
  margin: 1rem 0 0.5rem;
}

.form-status.is-error {
  color: var(--broken);
}

.form-note {
  color: var(--muted);
  font-size: var(--step--1);
}

/* ---------- footer ---------- */

.footer {
  margin-top: 6rem;
  padding-top: 1.5rem;
  padding-bottom: 2.5rem;
  color: var(--muted);
  font-size: var(--step--1);
}

.footer p {
  margin: 0 0 0.35rem;
  max-width: var(--measure);
}

.footer a {
  color: inherit;
}

/* ---------- motion on the home page ----------
   Everything below applies only under html.anim, which assets/js/motion.js sets unless the system asks for
   reduced motion. The progress bar and the pointer light are elements that script adds. */

/* ---------- scroll progress ---------- */
.progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 50;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(var(--p, 0));
  pointer-events: none;
}

/* ---------- cursor light ---------- */
.cursor-glow {
  position: fixed;
  left: 0;
  top: 0;
  width: 46rem;
  height: 46rem;
  margin: -23rem 0 0 -23rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 90, 0, 0.13) 0%, rgba(255, 90, 0, 0.05) 35%, rgba(255, 90, 0, 0) 68%);
  pointer-events: none;
  z-index: -1;
  will-change: transform;
}
:root[data-theme="light"] .cursor-glow {
  background: radial-gradient(circle, rgba(255, 90, 0, 0.12) 0%, rgba(255, 90, 0, 0.04) 35%, rgba(255, 90, 0, 0) 68%);
}

/* ---------- masthead: clear at the top, glass once the page scrolls, hides while scrolling down ---------- */
.anim .masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  padding-bottom: 0.9rem;
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), background-color 0.3s ease;
}
.anim .masthead.is-stuck {
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  /* soft lower edge instead of a hard line */
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 0.7rem), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 0.7rem), transparent);
}
.anim .masthead.is-hidden {
  transform: translateY(-110%);
}
/* an open small-screen menu keeps the bar in view, and the faded edge would hide the menu below it */
.anim .masthead.is-open {
  transform: none;
  -webkit-mask-image: none;
  mask-image: none;
}

/* ---------- name: letters rise one by one ---------- */
.anim .hero-name .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.06em;
}
.anim .hero-name .char {
  display: inline-block;
  animation: char-rise 0.9s cubic-bezier(0.2, 0.75, 0.15, 1) both;
  animation-delay: calc(0.15s + var(--i) * 0.035s);
}
/* only the keyframes hide the letters: if animations never run, the name stays visible */
@keyframes char-rise {
  from { transform: translateY(105%); }
  to { transform: translateY(0); }
}

/* ---------- words of the line under the name ---------- */
.anim .hero .lede .word {
  display: inline-block;
  animation: word-in 0.7s ease both;
  animation-delay: calc(0.85s + var(--i) * 0.045s);
}
@keyframes word-in {
  from { opacity: 0; filter: blur(6px); transform: translateY(0.4em); }
  to { opacity: 1; filter: blur(0); transform: none; }
}

/* ---------- reveal on scroll ---------- */
.anim .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: var(--d, 0s);
}
.anim .reveal.in {
  opacity: 1;
  transform: none;
}

/* project blocks: the rule above draws itself, the arrow spins in */
.anim .work {
  position: relative;
  border-top-color: transparent;
}
.anim .work::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -2px;
  height: 2px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.1s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.anim .work.in::before {
  transform: scaleX(1);
}
.anim .work .work__arrow {
  transform: scale(0) rotate(-180deg);
  transition: transform 0.7s cubic-bezier(0.3, 1.4, 0.4, 1) 0.45s;
}
.anim .work.in .work__arrow {
  transform: none;
}
.anim .work.in .work__title:hover .work__arrow {
  transform: translateX(0.12em) rotate(-45deg);
  transition-delay: 0s;
}

/* ---------- tiles: turnstile entry, then 3D tilt under the pointer ---------- */
.anim .tile {
  animation: turnstile 0.75s cubic-bezier(0.2, 0.7, 0.2, 1) backwards paused;
  animation-delay: calc(var(--i, 0) * 0.07s);
  transform-origin: left center;
  transition: transform 0.18s ease-out, background-color 0.16s ease-out, color 0.16s ease-out;
}
.anim .tile.in {
  animation-play-state: running;
}
@keyframes turnstile {
  from {
    opacity: 0;
    transform: perspective(900px) rotateY(-80deg) translateX(-12px);
  }
}
.anim .tile.tilting {
  transform: perspective(700px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) scale(1.03);
  z-index: 2;
}
.anim .tile.tilting::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, 0.18), transparent 55%);
}

/* the Telegram plane floats */
.anim .tile .tile__glyph svg use[href$="#plane"] {
  animation: plane 3.2s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes plane {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(3px, -4px) rotate(-6deg); }
}

/* ---------- magnetic buttons ---------- */
.anim .button {
  transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1), background-color 0.2s, color 0.2s, border-color 0.2s;
  transform: translate(var(--mx, 0px), var(--my, 0px));
}

/* ---------- parallax ---------- */
.anim .hero__text,
.anim .dots {
  will-change: transform;
}

/* the dot field moves slower than the page but never spills into the next section */
.anim .hero {
  overflow-y: clip;
}
