/*
 * Wubeno site styles.
 * Built on the Radix Themes tokens in radix.css (space 1 to 9, radius "medium", type 1 to 9,
 * shadows, panel colours). Components follow Radix Themes' anatomy and states, rebuilt here.
 * Gray scale: slate. Accent: jade (see tools/vendor_radix.py to change either).
 */

/* Fonts: Geist and Geist Mono (OFL), subset to Latin, weights 400 to 600. The only typeface family. */
@font-face {
  font-family: "Geist";
  src: url("/assets/fonts/Geist-latin.woff2") format("woff2");
  font-weight: 400 600;
  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+2190-2193, U+2197, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/assets/fonts/GeistMono-latin.woff2") format("woff2");
  font-weight: 400 600;
  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+2190-2193, U+2197, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light dark;
  --default-font-family: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --code-font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Motion: one curve for things that respond, one for things that move. */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --duration-press: 140ms;
  --duration-hover: 160ms;

  /* Layout: Radix Themes Container size 4. */
  --container: 1136px;
  --gutter: var(--space-4);
}

@media (min-width: 520px) {
  :root { --gutter: var(--space-5); }
}
@media (min-width: 1024px) {
  :root { --gutter: var(--space-6); }
}

/* ---------- Base ---------- */

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

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background-color: var(--color-background);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
  margin: 0;
  background-color: var(--color-background);
  color: var(--gray-12);
  font-family: var(--default-font-family);
  font-size: var(--font-size-3);
  line-height: var(--line-height-3);
  font-weight: var(--font-weight-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, ul, ol, figure, blockquote, dl, dd { margin: 0; }
main { flex: 1 0 auto; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
img { height: auto; }

::selection { background-color: var(--focus-a5); }

a { color: inherit; text-decoration: none; }
a, button, [role="button"] { touch-action: manipulation; }

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

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: calc(var(--space-2) + env(safe-area-inset-top, 0px));
  z-index: 10;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-3);
  background-color: var(--gray-12);
  color: var(--gray-1);
  font-size: var(--font-size-2);
  font-weight: var(--font-weight-medium);
  transform: translateY(-200%);
}
.skip-link:focus-visible { transform: none; }

.mono {
  font-family: var(--code-font-family);
  font-feature-settings: "tnum";
}

.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left, 0px)) max(var(--gutter), env(safe-area-inset-right, 0px));
}

/* ---------- Text ---------- */

.heading {
  font-weight: var(--font-weight-medium);
  text-wrap: balance;
}
.heading-9 {
  font-size: var(--font-size-8);
  line-height: var(--heading-line-height-8);
  letter-spacing: var(--letter-spacing-8);
}
.heading-7 {
  font-size: var(--font-size-6);
  line-height: var(--heading-line-height-6);
  letter-spacing: var(--letter-spacing-6);
}
@media (min-width: 768px) {
  .heading-9 {
    font-size: var(--font-size-9);
    line-height: var(--heading-line-height-9);
    letter-spacing: var(--letter-spacing-9);
  }
  .heading-7 {
    font-size: var(--font-size-7);
    line-height: var(--heading-line-height-7);
    letter-spacing: var(--letter-spacing-7);
  }
}

.text-4 { font-size: var(--font-size-4); line-height: var(--line-height-4); letter-spacing: var(--letter-spacing-4); }
.text-2 { font-size: var(--font-size-2); line-height: var(--line-height-2); }
.text-1 { font-size: var(--font-size-1); line-height: var(--line-height-1); letter-spacing: var(--letter-spacing-1); }
@media (min-width: 768px) {
  .text-5-md { font-size: var(--font-size-5); line-height: var(--line-height-5); letter-spacing: var(--letter-spacing-5); }
}
.low { color: var(--gray-11); }

/* ---------- Button (Radix Themes Button, solid high-contrast variant) ---------- */

.button {
  --button-height: var(--space-7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: var(--space-2);
  height: var(--button-height);
  padding-inline: var(--space-4);
  border: 0;
  border-radius: var(--radius-3);
  font-family: inherit;
  font-size: var(--font-size-3);
  line-height: var(--line-height-3);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: transform var(--duration-press) var(--ease-out), background-color var(--duration-hover) ease, filter var(--duration-hover) ease;
}
.button svg { width: 16px; height: 16px; flex-shrink: 0; }
.button:active { transform: scale(0.97); }

.button-solid-hc {
  background-color: var(--gray-12);
  color: var(--gray-1);
}
@media (hover: hover) and (pointer: fine) {
  .button-solid-hc:hover { filter: contrast(0.88) saturate(1.1) brightness(1.1); }
}
@media (hover: hover) and (pointer: fine) and (prefers-color-scheme: dark) {
  .button-solid-hc:hover { filter: contrast(0.88) saturate(1.3) brightness(1.14); }
}
@media (pointer: coarse) {
  .button-solid-hc:active { outline: 0.5em solid var(--gray-a4); outline-offset: 0; }
}

/* ---------- Status label (no badge: a dot and quiet mono text) ---------- */

.status {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--space-2);
  min-width: 0;
  font-family: var(--code-font-family);
  font-size: var(--font-size-1);
  line-height: var(--line-height-1);
  letter-spacing: var(--letter-spacing-1);
  color: var(--gray-11);
}
.status::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: 4.5px;
  flex-shrink: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--gray-9);
}
.status[data-status="beta"]::before { box-shadow: inset 0 0 0 1.5px var(--accent-9); }
.status[data-status="live"]::before { background-color: var(--accent-9); box-shadow: none; }

/* ---------- Header ---------- */

.site-header {
  padding-top: env(safe-area-inset-top, 0px);
  border-bottom: 1px solid var(--gray-a4);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 64px;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: var(--font-size-4);
  line-height: var(--line-height-4);
  font-weight: var(--font-weight-medium);
  letter-spacing: -0.01em;
  color: var(--gray-12);
}
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-right: calc(-1 * var(--space-3));
}
.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: var(--space-3);
  border-radius: var(--radius-3);
  font-size: var(--font-size-2);
  line-height: var(--line-height-2);
  font-weight: var(--font-weight-medium);
  color: var(--gray-11);
  transition: color var(--duration-hover) ease, background-color var(--duration-hover) ease;
}
.nav-link[aria-current="page"] { color: var(--gray-12); }
.nav-link:active { background-color: var(--gray-a4); }
@media (hover: hover) and (pointer: fine) {
  .nav-link:hover { color: var(--gray-12); background-color: var(--gray-a3); }
}
/* ---------- Home hero ---------- */

/* Type only: the app list right below is the picture. */
.hero { padding-block: var(--space-8) var(--space-6); }
.hero-text {
  display: grid;
  gap: var(--space-5);
  max-width: 760px;
}
.hero-lede { max-width: 34em; }
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  padding-top: var(--space-2);
}
@media (min-width: 900px) {
  .hero { padding-block: calc(var(--space-9) * 1.5) var(--space-8); }
}

/* ---------- Sections ---------- */

.section { padding-block: var(--space-7) var(--space-9); }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding-bottom: var(--space-5);
  margin-bottom: var(--space-6);
  border-bottom: 1px solid var(--gray-a6);
}
.section-count { color: var(--gray-11); white-space: nowrap; }

/* ---------- App list (Radix Themes Card, surface variant) ---------- */

.app-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: var(--space-5);
}

.card {
  position: relative;
  display: block;
  border-radius: var(--radius-5);
  background-color: var(--color-panel-solid);
  box-shadow: 0 0 0 1px var(--gray-a5);
  transition: box-shadow var(--duration-hover) ease;
}
@supports (color: color-mix(in oklab, white, black)) {
  .card { box-shadow: 0 0 0 1px color-mix(in oklab, var(--gray-a5), var(--gray-5) 25%); }
}

.app-card {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100%;
  overflow: hidden;
}
/* The app name is the link; it stretches over the whole card, so the card is one
   tap target with a short, clear name for screen readers. */
.app-name a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: var(--radius-5);
}
.app-name a:focus-visible { outline: none; }
.app-name a:focus-visible::after {
  outline: 2px solid var(--focus-8);
  outline-offset: 3px;
}
@media (hover: hover) and (pointer: fine) {
  .app-card:hover { box-shadow: 0 0 0 1px var(--gray-a7); }
}
.app-card:active { box-shadow: 0 0 0 1px var(--gray-a8); }

.app-info {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "icon no"
    "name name"
    "subtitle subtitle"
    "line line"
    "meta meta";
  align-items: start;
  column-gap: var(--space-4);
  row-gap: var(--space-2);
  padding: var(--space-5);
}
.app-subtitle {
  grid-area: subtitle;
  color: var(--gray-11);
  font-size: var(--font-size-2);
  line-height: var(--line-height-2);
}
.app-icon {
  grid-area: icon;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 22.5%;
  box-shadow: 0 0 0 1px var(--gray-a4);
  object-fit: cover;
  background-color: var(--gray-3);
}
.app-no {
  grid-area: no;
  justify-self: end;
  font-size: var(--font-size-1);
  line-height: var(--line-height-1);
  color: var(--gray-10);
}
.app-name {
  grid-area: name;
  padding-top: var(--space-2);
  font-size: var(--font-size-6);
  line-height: var(--heading-line-height-6);
  letter-spacing: var(--letter-spacing-6);
  font-weight: var(--font-weight-medium);
  overflow-wrap: break-word;
  hyphens: auto;
}
.app-line {
  grid-area: line;
  padding-top: var(--space-2);
  color: var(--gray-12);
  max-width: 34em;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.app-meta {
  grid-area: meta;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-4);
  padding-top: var(--space-2);
}
.app-more {
  min-width: 0;
  font-size: var(--font-size-2);
  line-height: var(--line-height-2);
  font-weight: var(--font-weight-medium);
  color: var(--accent-11);
  overflow-wrap: anywhere;
}
.app-more svg {
  display: inline-block;
  vertical-align: -3px;
  width: 16px;
  height: 16px;
  transition: transform var(--duration-hover) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .app-card:hover .app-more svg { transform: translateX(2px); }
}

/* The app's own App Store screenshots, whole and uncropped, in a quiet panel. */
.app-shots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5);
  background-color: var(--gray-2);
  border-top: 1px solid var(--gray-a4);
  min-height: 0;
}
.app-shots img {
  width: 100%;
  min-width: 0;
  aspect-ratio: 1206 / 2622;
  border-radius: var(--radius-4);
  box-shadow: var(--shadow-2);
  background-color: var(--gray-3);
}
.app-shots img { flex: 1 1 0; max-width: 148px; }
.app-shots img:nth-child(n+3) { display: none; }

/* The newest app gets the full row: stacked on tablets, side by side from 1024 px. */
@media (min-width: 768px) {
  .app-list > li:first-child { grid-column: 1 / -1; }
  .app-list > li:first-child .app-shots img:nth-child(-n+3) { display: block; }
}
@media (min-width: 1024px) {
  .app-list > li:first-child .app-card {
    grid-template-rows: none;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  }
  .app-list > li:first-child .app-card[data-shots="1"] {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  }
  .app-list > li:first-child .app-card[data-shots="2"] {
    grid-template-columns: minmax(0, 6fr) minmax(0, 6fr);
  }
  .app-list > li:first-child .app-info {
    align-content: center;
    padding: var(--space-8) var(--space-7);
  }
  .app-list > li:first-child .app-name {
    font-size: var(--font-size-8);
    line-height: var(--heading-line-height-8);
    letter-spacing: var(--letter-spacing-8);
  }
  .app-list > li:first-child .app-shots {
    border-top: 0;
    border-left: 1px solid var(--gray-a4);
    padding: var(--space-7) var(--space-6);
  }
  .app-list > li:first-child .app-shots img { max-width: 184px; }
}

.app-empty {
  padding: var(--space-6);
  border-radius: var(--radius-5);
  background-color: var(--gray-2);
  color: var(--gray-11);
}

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

.site-footer {
  border-top: 1px solid var(--gray-a4);
  padding-block: var(--space-7) calc(var(--space-7) + env(safe-area-inset-bottom, 0px));
}
.footer-grid {
  display: grid;
  gap: var(--space-5);
}
.footer-brand { display: grid; gap: var(--space-1); }
.footer-brand .wordmark { min-height: 0; }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  margin-left: calc(-1 * var(--space-3));
}
.footer-legal { color: var(--gray-11); }
@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }
  .footer-links { margin-left: 0; margin-right: calc(-1 * var(--space-3)); }
  .footer-legal { grid-column: 1 / -1; }
}

/* ---------- Prose pages (licences, legal, support) ---------- */

.page-head {
  display: grid;
  gap: var(--space-4);
  padding-block: var(--space-8) var(--space-7);
}
@media (min-width: 900px) {
  .page-head { padding-block: calc(var(--space-9) * 1.5) var(--space-8); }
}
.not-found { padding-bottom: var(--space-9); }
.prose {
  max-width: 44em;
  padding-bottom: var(--space-8);
}
.prose > * + * { margin-top: var(--space-4); }
.prose h2 {
  margin-top: var(--space-9);
  font-size: var(--font-size-6);
  line-height: var(--heading-line-height-6);
  letter-spacing: var(--letter-spacing-6);
  font-weight: var(--font-weight-medium);
}
.prose h3 {
  margin-top: var(--space-6);
  font-size: var(--font-size-4);
  line-height: var(--heading-line-height-4);
  font-weight: var(--font-weight-medium);
}
.prose > h2:first-child { margin-top: 0; }
.prose p, .prose li { color: var(--gray-12); }
.prose ul { padding-left: var(--space-5); list-style: disc; }
.prose li + li { margin-top: var(--space-2); }
.prose a:not(.button) {
  color: var(--accent-11);
  text-decoration-line: underline;
  text-decoration-thickness: min(2px, max(1px, 0.05em));
  text-underline-offset: calc(0.025em + 2px);
  text-decoration-color: var(--accent-a5);
}
.licence-text {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-4);
  background-color: var(--gray-2);
  box-shadow: inset 0 0 0 1px var(--gray-a4);
  font-size: var(--font-size-2);
  line-height: var(--line-height-2);
  overflow-wrap: anywhere;
}
.prose .licence-text p { color: var(--gray-11); }
.prose .licence-text p:first-child { color: var(--gray-12); font-weight: var(--font-weight-medium); }
.meta-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: var(--space-2) var(--space-5);
  font-size: var(--font-size-2);
  line-height: var(--line-height-2);
}
.meta-list dt { color: var(--gray-11); }

/* ---------- Reduced motion: no movement, colour changes stay ---------- */

@media (prefers-reduced-motion: reduce) {
  .button,
  .app-more svg {
    transition-property: background-color, color, filter, box-shadow;
  }
  .button:active { transform: none; }
  .app-card:hover .app-more svg { transform: none; }
}
