:root {
  --bg: #f6f5fb;
  --surface: #ffffff;
  --text: #111113;
  --muted: #6b6b76;
  --border: #e8e8ec;
  --accent: #4f46e5;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.06), 0 16px 40px rgba(0, 0, 0, 0.08);
  --radius: 28px;
  /* Fonts are loaded from Google Fonts in the <head> of each page */
  --font-body: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Unbounded", var(--font-body);
  --dot: 30, 30, 60;
  /* Liquid glass surfaces */
  --glass: linear-gradient(135deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.06) 45%, rgba(255, 255, 255, 0.24));
  --glass-hover: linear-gradient(135deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.16) 45%, rgba(255, 255, 255, 0.38));
  --glass-border: rgba(20, 20, 50, 0.05);
  --glass-shadow: inset 1px 1px 0 rgba(255, 255, 255, 1), inset -1px -1px 0 rgba(255, 255, 255, 0.7),
    inset 0 0 14px rgba(255, 255, 255, 0.35), 0 1px 2px rgba(20, 20, 50, 0.05), 0 12px 32px rgba(20, 20, 50, 0.08);
  --glass-shadow-hover: inset 1px 1px 0 rgba(255, 255, 255, 1), inset -1px -1px 0 rgba(255, 255, 255, 0.85),
    inset 0 0 20px rgba(255, 255, 255, 0.5), 0 2px 4px rgba(20, 20, 50, 0.05), 0 22px 50px rgba(60, 50, 160, 0.16);
  --rim: rgba(255, 255, 255, 1);
  --rim-far: rgba(255, 255, 255, 0.7);
  --shine: rgba(99, 102, 241, 0.13);
  --blob-1: rgba(124, 92, 255, 0.3);
  --blob-2: rgba(34, 211, 238, 0.24);
  --blob-3: rgba(244, 114, 182, 0.24);
  --blob-4: rgba(251, 176, 59, 0.18);
  color-scheme: light;
}

/* The theme is set on <html data-theme> by site.js */
:root[data-theme="dark"] {
  color-scheme: dark;
  --dot: 200, 200, 255;
  --glass: linear-gradient(135deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.015) 45%, rgba(255, 255, 255, 0.06));
  --glass-hover: linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.03) 45%, rgba(255, 255, 255, 0.09));
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.32), inset -1px -1px 0 rgba(255, 255, 255, 0.1),
    inset 0 0 16px rgba(255, 255, 255, 0.045), 0 12px 32px rgba(0, 0, 0, 0.4);
  --glass-shadow-hover: inset 1px 1px 0 rgba(255, 255, 255, 0.45), inset -1px -1px 0 rgba(255, 255, 255, 0.16),
    inset 0 0 22px rgba(255, 255, 255, 0.07), 0 22px 50px rgba(0, 0, 0, 0.55);
  --rim: rgba(255, 255, 255, 0.55);
  --rim-far: rgba(255, 255, 255, 0.2);
  --shine: rgba(160, 155, 255, 0.2);
  --blob-1: rgba(124, 92, 255, 0.4);
  --blob-2: rgba(34, 211, 238, 0.2);
  --blob-3: rgba(236, 72, 153, 0.24);
  --blob-4: rgba(251, 146, 60, 0.13);
  --bg: #07070d;
  --surface: #16161a;
  --text: #f4f4f6;
  --muted: #9a9aa6;
  --border: #26262c;
  --accent: #8b85ff;
  --shadow: none;
  --shadow-hover: 0 16px 40px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

h1,
h2 {
  font-family: var(--font-display);
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
}

main {
  flex: 1;
}

/* Slowly drifting aurora of color behind the page, so the glass has something to refract */
body::before {
  content: "";
  position: fixed;
  inset: -25%;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(38% 34% at 22% 24%, var(--blob-1), transparent 70%),
    radial-gradient(34% 30% at 78% 34%, var(--blob-2), transparent 70%),
    radial-gradient(36% 32% at 62% 72%, var(--blob-3), transparent 70%),
    radial-gradient(30% 28% at 26% 76%, var(--blob-4), transparent 70%);
  animation: aurora 36s ease-in-out infinite alternate;
}

@keyframes aurora {
  0% {
    transform: translate3d(-4%, -3%, 0) rotate(0deg) scale(1);
  }
  50% {
    transform: translate3d(5%, 3%, 0) rotate(8deg) scale(1.08);
  }
  100% {
    transform: translate3d(-2%, 6%, 0) rotate(-6deg) scale(1.02);
  }
}

/* Liquid glass: translucent, blurred, with a bright top edge */
.card,
.control,
.panel,
.footer a {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  /* Light blur: what is behind stays recognisable, like real glass */
  -webkit-backdrop-filter: blur(4px) saturate(190%);
  backdrop-filter: blur(4px) saturate(190%);
}

.control:hover,
.footer a:hover {
  background: var(--glass-hover);
  box-shadow: var(--glass-shadow-hover);
}

/* Animated dots behind the page (background.js) */
#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

/* Top bar: language and theme */

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 20px;
}

.topbar .back {
  margin-right: auto;
}

.control {
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.control:hover {
  border-color: var(--accent);
}

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

.icon-button {
  width: 38px;
  padding: 0;
  display: grid;
  place-items: center;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Show the icon of the theme the button switches to */
.icon-sun,
:root[data-theme="dark"] .icon-moon {
  display: none;
}

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

/* Hero */

.hero {
  padding: 64px 0 56px;
}

.hero h1 {
  margin: 0 0 20px;
  font-size: clamp(2.25rem, 6vw, 3.75rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.hero p {
  margin: 0;
  max-width: 760px;
  font-size: clamp(1.1875rem, 2.4vw, 1.5rem);
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--muted);
}

.hero p strong {
  font-weight: 600;
  color: var(--text);
}

/* Cards */

.apps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 20px;
  padding-bottom: 96px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.35s ease, background 0.35s ease;
}

/* Highlight that follows the cursor (--mx/--my are set in apps.js) */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 0%), var(--shine), transparent 70%);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

/* Bright rim catching the light on opposite corners */
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--rim), transparent 30%, transparent 70%, var(--rim-far));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}

.card > * {
  position: relative;
}

.card:hover {
  transform: translateY(-4px) scale(1.012);
  background: var(--glass-hover);
  box-shadow: var(--glass-shadow-hover);
}

.card:hover::before {
  opacity: 1;
}

.card:hover .card-icon {
  transform: scale(1.06) rotate(-3deg);
}

a.card:focus-visible,
.footer a:focus-visible,
.back:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.card-icon {
  width: 64px;
  height: 64px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  font-size: 1.625rem;
  font-weight: 700;
  color: #fff;
  object-fit: cover;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 16px rgba(0, 0, 0, 0.12);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.card h2 {
  margin: 0 0 4px;
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.card p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--muted);
}

.card-meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--muted);
}

.card-link {
  font-weight: 600;
  color: var(--accent);
}

/* App page: replaces the home view when an app is opened (built in apps.js) */

[hidden] {
  display: none !important;
}

.app-page {
  max-width: 780px;
  padding: 36px 0 96px;
}

.app-page > .back {
  display: inline-block;
  margin-bottom: 36px;
}

.app-head {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 32px;
}

.app-head .card-icon {
  flex-shrink: 0;
  width: 104px;
  height: 104px;
  border-radius: 24px;
  font-size: 2.75rem;
}

.app-head > div {
  min-width: 0;
}

.app-head h1 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: clamp(2rem, 7vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.app-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.app-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.app-actions .control {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.app-actions .primary {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
}

.tabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 20px;
  padding: 4px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: var(--glass);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(4px) saturate(190%);
  backdrop-filter: blur(4px) saturate(190%);
}

.tab {
  padding: 8px 18px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  transition: color 0.2s ease, background 0.2s ease;
}

.tab:hover {
  color: var(--text);
}

.tab[aria-current] {
  background: var(--glass-hover);
  box-shadow: var(--glass-shadow);
  color: var(--text);
}

.tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.panel {
  padding: 32px;
  border-radius: var(--radius);
}

.panel > :last-child {
  margin-bottom: 0;
}

.panel p {
  margin: 0 0 14px;
  color: var(--muted);
}

.panel > p:first-child:not(.note) {
  color: var(--text);
  font-size: 1.1875rem;
  line-height: 1.5;
}

.panel h3 {
  margin: 28px 0 8px;
  font-size: 1.0625rem;
  font-weight: 700;
}

.panel a {
  color: var(--accent);
}

.panel .note {
  margin-bottom: 6px;
  font-size: 0.8125rem;
}

@media (max-width: 520px) {
  .app-head {
    gap: 16px;
  }

  .app-head .card-icon {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    font-size: 2rem;
  }

  .panel {
    padding: 22px;
  }
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.35s;
}

/* Footer */

.footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
}

.footer .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer small {
  color: var(--muted);
  font-size: 0.875rem;
}

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

.footer a {
  padding: 9px 16px;
  border-radius: 999px;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.footer a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Privacy page */

.prose {
  max-width: 680px;
  padding: 40px 0 96px;
}

.prose h1 {
  margin: 24px 0 8px;
  font-size: clamp(1.875rem, 5vw, 2.5rem);
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.prose h2 {
  margin: 40px 0 8px;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.prose ul {
  padding-left: 1.25em;
}

.prose p,
.prose li {
  color: var(--muted);
}

.prose a {
  color: var(--accent);
}

.back {
  color: var(--muted);
  font-size: 0.9375rem;
  text-decoration: none;
}

.back:hover {
  color: var(--text);
}

@media (max-width: 520px) {
  .hero {
    padding: 40px 0 40px;
  }
}

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