/* Arrive's global styles: tokens, type, buttons, surfaces, header and footer, matched to the desktop app's look.
   Page types add their own stylesheet: home.css, prose.css, blog.css, faq.css. Use the tokens below rather than
   repeating raw colours, radii and sizes. */

/* Fonts: self-hosted Latin subsets from Google Fonts (Catamaran and Karla are variable). Until they load, text
   shows in a local fallback resized to each font's width and height (size-adjust, then ascent/descent divided by
   it), so the swap doesn't move the page. Measured against Arial and Courier New at each weight in use. */

@font-face {
  font-family: 'Catamaran';
  font-weight: 700 800;
  font-display: swap;
  src: url(../fonts/catamaran-latin.woff2) format('woff2');
}

@font-face {
  font-family: 'Karla';
  font-weight: 400 700;
  font-display: swap;
  src: url(../fonts/karla-latin.woff2) format('woff2');
}

@font-face {
  font-family: 'Roboto Mono';
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/roboto-mono-latin.woff2) format('woff2');
}

@font-face {
  font-family: 'Catamaran fallback';
  font-weight: 700;
  src: local('Arial Bold'), local('Arial-BoldMT');
  size-adjust: 91.18%;
  ascent-override: 120.64%;
  descent-override: 59.22%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'Catamaran fallback';
  font-weight: 800;
  src: local('Arial Bold'), local('Arial-BoldMT');
  size-adjust: 94.25%;
  ascent-override: 116.71%;
  descent-override: 57.29%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'Karla fallback';
  font-weight: 400;
  src: local('Arial'), local('ArialMT');
  size-adjust: 102.01%;
  ascent-override: 90.19%;
  descent-override: 24.51%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'Karla fallback';
  font-weight: 500;
  src: local('Arial'), local('ArialMT');
  size-adjust: 104.06%;
  ascent-override: 88.41%;
  descent-override: 24.02%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'Karla fallback';
  font-weight: 600;
  src: local('Arial Bold'), local('Arial-BoldMT');
  size-adjust: 97.99%;
  ascent-override: 93.89%;
  descent-override: 25.51%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'Karla fallback';
  font-weight: 700;
  src: local('Arial Bold'), local('Arial-BoldMT');
  size-adjust: 99.22%;
  ascent-override: 92.72%;
  descent-override: 25.2%;
  line-gap-override: 0%;
}

@font-face {
  font-family: 'Roboto Mono fallback';
  font-weight: 700;
  src: local('Courier New Bold'), local('CourierNewPS-BoldMT');
  ascent-override: 105%;
  descent-override: 27%;
  line-gap-override: 0%;
}

:root {
  --brand: #fe2d76;
  --brand-bg: #2a1829;
  --brand-border: #691e3f;
  --aqua: #3fd0c8;
  --primary: #121621;
  --secondary: #1f232d;
  --tertiary: #181d29;
  --light: #f1f1f1;
  --contrast: #e1e1e1;
  --text: #c7cfd5;
  /* Grayed-out text: the app's blue-gray for secondary paragraphs. */
  --gray: #9aa5ad;
  --disabled: #828489;
  --glass-border: rgba(255, 255, 255, 0.12);
  --tip-bg: #040508;
  --globe-dot: #8a8f9c;
  --globe-rim: rgba(255, 255, 255, 0.1);
  --globe-glow: rgba(254, 45, 118, 0.18);

  /* Surfaces and lines */
  --hairline: rgba(255, 255, 255, 0.08);
  --hairline-faint: rgba(255, 255, 255, 0.06);
  --fill-subtle: rgba(255, 255, 255, 0.03);
  --fill-hover: rgba(255, 255, 255, 0.06);
  --glass-bg: rgba(31, 35, 45, 0.72);
  --tile-bg: linear-gradient(170deg, #1c212d, #141822);
  --band-bg: linear-gradient(180deg, #171b27, #141824);
  --aqua-soft: rgba(63, 208, 200, 0.14);
  --brand-soft: rgba(254, 45, 118, 0.08);
  --brand-glow: 0 0 8px 1px rgba(254, 45, 118, 0.7);
  --aqua-glow: 0 0 8px 1px rgba(63, 208, 200, 0.7);
  --shadow-float: 0 12px 30px rgba(0, 0, 0, 0.35);

  /* Type scale. Body text is the article size; new pages inherit it from body. */
  --text-body: 1.125rem;
  --leading-body: 1.75;
  --text-lead: 1.25rem;
  --text-small: 1rem;
  --text-meta: 0.875rem;
  --text-button: 1rem;

  /* Radii */
  --radius-sm: 6px;
  --radius-xs: 10px;
  --radius-md: 14px;
  --radius: 18px;
  --radius-lg: 22px;
  --radius-xl: 28px;
  --radius-pill: 999px;

  /* Measures */
  --container: 1200px;
  --measure: 700px;
  --measure-wide: 880px;
  --measure-media: 1040px;
  --column: calc(var(--measure) + 2 * var(--gutter));
  --column-wide: calc(var(--measure-wide) + 2 * var(--gutter));
  --tap: 44px;

  --font-display: 'Catamaran', 'Catamaran fallback', sans-serif;
  --font-body: 'Karla', 'Karla fallback', sans-serif;
  --font-mono: 'Roboto Mono', 'Roboto Mono fallback', monospace;

  --header-height: 72px;
  --gutter: 24px;
  --section-space: 160px;
  --track-inset: max(var(--gutter), calc((100vw - var(--container)) / 2 + var(--gutter)));
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --radius: 18px;
  --ease: 0.2s ease;

  color-scheme: dark;
}

/* Reset */

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

html {
  scroll-behavior: smooth;
  /* Every anchor jump stops just below the sticky header; targets don't need their own offset. */
  scroll-padding-top: calc(var(--header-height) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--primary);
  color: var(--contrast);
  font: 400 var(--text-body) / var(--leading-body) var(--font-body);
  -webkit-font-smoothing: antialiased;
}

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

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

a {
  color: inherit;
  text-decoration: none;
}

svg {
  display: block;
}

/* Images keep their width and height attributes (so space is saved while they load) but scale with the layout. */
img {
  max-width: 100%;
  height: auto;
}

[hidden] {
  display: none !important;
}

/* Buttons start blank, so a <button> and a link with the same class look the same. */
button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.skip-link {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-xs);
  background: var(--light);
  color: var(--primary);
  font-weight: 700;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

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

/* The faint plum glow the app window has, held to the viewport so every page gets the same glow. */
.brand-wash::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(90% 60% at 100% 8%, hsla(303, 27%, 13%, 0.9) 0%, hsla(303, 27%, 13%, 0.4) 35%, transparent 70%),
    radial-gradient(80% 50% at 0% 62%, hsla(303, 27%, 13%, 0.55) 0%, transparent 65%);
}

/* Type */

h1,
h2,
h3 {
  color: var(--light);
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.015em;
}

h1 {
  font-size: clamp(3.4rem, 7.2vw, 6.2rem);
  line-height: 0.95;
  letter-spacing: -0.025em;
}

h2 {
  font-size: clamp(2.2rem, 4.4vw, 3.6rem);
  line-height: 1.06;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 1.35rem;
  line-height: 1.25;
}

p {
  color: var(--text);
}

.lead {
  font-size: var(--text-lead);
  line-height: 1.6;
}

/* Fades content up as it scrolls into view. site.js adds .reveal-ready when it starts, so if the script never runs,
   nothing stays hidden. */
.reveal-ready [data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
}

.reveal-ready [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

.status {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--disabled);
  font: 700 14px/21px var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.status.on {
  color: var(--contrast);
}

.status-led {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--disabled);
}

.status.on .status-led {
  background: var(--brand);
  box-shadow: var(--brand-glow);
}

/* Layout */

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

.section {
  padding: var(--section-space) 0 0;
}

.section-head {
  display: grid;
  gap: 16px;
  max-width: 640px;
  margin-bottom: 56px;
}

/* Buttons */

.button-primary,
.button-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 48px;
  padding: 0 26px;
  border-radius: var(--radius-lg);
  font: 700 var(--text-button) / 1 var(--font-body);
  white-space: nowrap;
  transition: filter var(--ease), box-shadow var(--ease), background-color var(--ease), border-color var(--ease);
}

.button-primary {
  background: var(--brand);
  color: #fff;
}

.button-primary:hover {
  filter: brightness(1.08);
  box-shadow: 0 0 16px rgba(254, 45, 118, 0.4);
}

.button-ghost {
  border: 1px solid var(--glass-border);
  background: var(--fill-subtle);
  color: var(--contrast);
}

.button-ghost:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: var(--hairline-faint);
}

.button-small {
  height: 38px;
  padding: 0 18px;
  font-size: var(--text-small);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--gray);
  transition: color var(--ease), background-color var(--ease);
}

.icon-button:hover {
  background: var(--hairline-faint);
  color: var(--light);
}

.icon-button .icon {
  width: 19px;
  height: auto;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--contrast);
  font-weight: 600;
  transition: color var(--ease);
}

.text-link:hover {
  color: #fff;
}

.inline-link {
  color: var(--contrast);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.3);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--ease);
}

.inline-link:hover {
  text-decoration-color: currentColor;
}

/* Surfaces */

.glass-card {
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background:
    radial-gradient(60% 80% at 0% 0%, rgba(63, 208, 200, 0.12), transparent 70%),
    radial-gradient(60% 80% at 100% 100%, rgba(254, 45, 118, 0.14), transparent 70%),
    linear-gradient(160deg, rgba(58, 64, 82, 0.5), rgba(24, 28, 38, 0.55));
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 0 40px var(--fill-subtle);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
}

.pink-card {
  border: 1px solid rgba(255, 150, 190, 0.18);
  border-radius: var(--radius);
  background: radial-gradient(200% 200% at 50% 25%, var(--brand-bg) 0%, transparent 60%), var(--primary);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 190, 215, 0.22),
    inset 0 0 40px rgba(254, 45, 118, 0.06);
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header-height);
  border-bottom: 1px solid var(--hairline-faint);
  background: rgba(18, 22, 33, 0.72);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
}

.site-header-inner {
  display: flex;
  align-items: center;
  gap: 40px;
  height: 100%;
}

.site-logo {
  flex: none;
  color: var(--light);
}

.site-logo svg {
  width: auto;
  height: 34px;
}

.site-nav {
  display: flex;
  gap: 32px;
}

.site-nav a {
  color: var(--gray);
  font-size: var(--text-small);
  font-weight: 600;
  transition: color var(--ease);
}

.site-nav a:hover {
  color: var(--light);
}

.site-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.mobile-menu {
  display: none;
}

.mobile-menu summary {
  display: grid;
  align-content: center;
  gap: 6px;
  width: var(--tap);
  height: var(--tap);
  padding: 0 12px;
  cursor: pointer;
  list-style: none;
}

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

.mobile-menu summary span {
  height: 2px;
  border-radius: 1px;
  background: var(--contrast);
  transition: transform var(--ease);
}

/* The two lines cross into an X while the menu is open. */
.mobile-menu[open] summary span:first-child {
  transform: translateY(4px) rotate(45deg);
}

.mobile-menu[open] summary span:last-child {
  transform: translateY(-4px) rotate(-45deg);
}

.mobile-menu-panel {
  position: fixed;
  top: var(--header-height);
  right: 0;
  left: 0;
  display: grid;
  padding: 8px var(--gutter) 20px;
  border-bottom: 1px solid var(--hairline);
  background: var(--primary);
  box-shadow: var(--shadow-float);
}

.mobile-menu-panel a {
  display: flex;
  align-items: center;
  min-height: 52px;
  border-bottom: 1px solid var(--hairline-faint);
  color: var(--contrast);
  font-size: var(--text-lead);
  font-weight: 600;
}

.mobile-menu-panel a[aria-current] {
  color: var(--light);
}

.mobile-menu-panel a:hover {
  color: var(--light);
}

/* A disclosure chevron (_includes/icons/chevron). It flips over its middle rather than spinning: it flattens
   into a line, then opens the other way. */
.chevron {
  flex: none;
  width: 17px;
  height: 9px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.is-open .chevron,
[open] > summary .chevron {
  transform: scaleY(-1);
}

/* A link that ends in an arrow, for "see more" style links. */

.text-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap);
  margin-top: 4px;
  color: var(--aqua);
  font-size: var(--text-small);
  font-weight: 700;
}

.text-arrow::after {
  content: '→';
  transition: transform var(--ease);
}

.text-arrow:hover::after {
  transform: translateX(3px);
}

/* A game in the app's game tile (_includes/game-tiles), with its icon masked in the text colour. A variant can
   resize the tile with --tile-size and --tile-icon. */

.game-tiles li,
.game-tiles a {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--light);
  font-weight: 600;
}

.game-tiles-more,
.game-tiles .game-tiles-more a {
  color: var(--gray);
}

.game-tile {
  --tile-size: 40px;
  --tile-icon: 22px;
  flex: none;
  width: var(--tile-size);
  height: var(--tile-size);
  border-radius: var(--radius-xs);
  background: var(--fill-hover);
}

.game-tile::before {
  content: '';
  display: block;
  width: var(--tile-icon);
  height: var(--tile-icon);
  margin: calc((var(--tile-size) - var(--tile-icon)) / 2);
  background: currentColor;
  -webkit-mask: var(--game-icon) center / contain no-repeat;
  mask: var(--game-icon) center / contain no-repeat;
}

/* Icons drawn as filled tiles rather than marks get rounded corners, as in the app. */
.game-tile.is-filled::before {
  border-radius: var(--radius-sm);
}

/* Page header: breadcrumbs, the page's title and a lead line, above every page but the homepage. */

.page-header {
  display: grid;
  gap: 20px;
  padding-top: 64px;
  padding-bottom: 56px;
}

/* Pages whose body is a centred column line their header up with it (`column` in the layout). */
.page-header.is-narrow {
  max-width: var(--column);
}

.page-header.is-wide {
  max-width: var(--column-wide);
}

.page-header h1 {
  max-width: 880px;
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
}

.page-header .lead {
  max-width: 680px;
  color: var(--gray);
  font-size: var(--text-lead);
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  color: var(--disabled);
  font-size: var(--text-meta);
}

.breadcrumbs li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.breadcrumbs li + li::before {
  content: '/';
  color: rgba(255, 255, 255, 0.2);
}

.breadcrumbs a {
  color: var(--gray);
  transition: color var(--ease);
}

.breadcrumbs a:hover {
  color: var(--light);
}

.breadcrumbs [aria-current] {
  overflow: hidden;
  color: var(--contrast);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Post tags and meta, shared by post cards and article headers. */

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.post-tags span {
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  background: var(--fill-hover);
  color: var(--gray);
  font: 700 11px/1.2 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  color: var(--gray);
  font-size: var(--text-meta);
}

.post-meta > * + *::before {
  content: '·';
  margin: 0 10px;
  color: var(--disabled);
}

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

.site-nav a[aria-current] {
  color: var(--light);
}

/* 404 */

.not-found {
  display: grid;
  justify-items: start;
  align-content: center;
  gap: 24px;
  min-height: calc(100svh - var(--header-height) - 140px);
  padding-top: 64px;
  padding-bottom: 64px;
}

.not-found h1 {
  max-width: 820px;
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 1.05;
}

.not-found .lead {
  max-width: 560px;
  color: var(--gray);
}

.not-found-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* CTA */

.section-cta {
  padding-bottom: var(--section-space);
}

.cta-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 80px 32px;
  text-align: center;
}

.cta-sub {
  color: var(--text);
  font-size: var(--text-lead);
}

.cta-actions,
.cta-note {
  margin-top: 24px;
}

.cta-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px 28px;
}

.cta-note {
  max-width: 520px;
  color: var(--gray);
  font-size: var(--text-small);
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--hairline-faint);
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px 40px;
  padding-top: 40px;
  padding-bottom: 40px;
}

.site-footer .site-logo svg {
  height: 28px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
}

.footer-links a {
  color: var(--gray);
  font-size: var(--text-small);
  transition: color var(--ease);
}

.footer-links a:hover {
  color: var(--light);
}

.copyright {
  margin-left: auto;
  color: var(--disabled);
  font-size: var(--text-meta);
}

/* Responsive */

@media (max-width: 1080px) {
  .site-nav {
    gap: 24px;
  }

  .copyright {
    width: 100%;
    margin-left: 0;
  }
}

@media (max-width: 960px) {
  :root {
    --section-space: 88px;
  }

  .site-nav,
  .site-actions > .icon-button {
    display: none;
  }

  .mobile-menu {
    display: block;
  }

  /* Touch-sized targets. */
  .button-small {
    height: var(--tap);
  }

  .footer-links a {
    padding: 10px 0;
  }
}

/* Phones: a compact scale, 15px body text and 22px section headings. The hero sets its own sizes, and form fields
   stay at 16px (forms.css). */
@media (max-width: 560px) {
  :root {
    --gutter: 16px;
    --section-space: 72px;
    --text-body: 0.9375rem;
    --leading-body: 1.6;
    --text-lead: 1rem;
    --text-small: 0.875rem;
    --text-meta: 0.8125rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.375rem;
  }

  h3 {
    font-size: 1.0625rem;
  }

  .page-header h1 {
    font-size: 1.625rem;
  }

  .not-found h1 {
    font-size: 1.5rem;
  }

  .site-header-inner {
    gap: 16px;
  }

  .site-logo svg {
    height: 28px;
  }

  .page-header {
    padding-top: 40px;
    padding-bottom: 40px;
  }

  .cta-card {
    padding: 56px 20px;
  }
}

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

  .reveal-ready [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
