/* Colours come from the app icon (design/icons/AppIcon.svg in mmalvik/tannlaus).
   Two themes: blue (the default, the icon's own blue) and light. site.js sets
   data-theme on <html> from the visitor's choice; without JavaScript it stays blue.
   Contrast is checked against WCAG 2.2 AA in both themes; keep it that way. */
:root {
  --blue: #1B58C8;
  --blue-deep: #0E3A97;
  --blue-dark: #0B2C74;
  --blue-night: #0A2460;
  --blue-light: #4DA8FF;
  --blue-rim: #BFE0FF;
}

:root,
:root[data-theme="blue"] {
  color-scheme: dark;
  /* Shown past the page edges (iOS overscroll, landscape notch bars): a middle blue,
     so neither the bright top nor the dark bottom clashes much. */
  --page: var(--blue-deep);
  /* The glow is kept faint enough that white text on it stays above 4.5:1.
     Muted text is not: keep it out of the top-left corner (about 3.6:1 at the peak). */
  --page-image:
    radial-gradient(60rem 40rem at 10% 0%, rgba(77, 168, 255, 0.3), rgba(47, 127, 234, 0) 70%),
    linear-gradient(180deg, var(--blue) 0, var(--blue-deep) 40rem, var(--blue-dark) 80rem, var(--blue-night) 100%);
  --text: #FFFFFF;
  --muted: #D2E2FA;
  --accent: #FFFFFF;
  --code-bg: rgba(2, 10, 36, 0.55);
  --code-text: #EAF3FF;
  --button-bg: #FFFFFF;
  --button-hover: #E3EEFF;
  --button-text: var(--blue-deep);
  --card: var(--blue-dark);
  --line: rgba(191, 224, 255, 0.24);
  --menubar: rgba(255, 255, 255, 0.14);
  --glow: rgba(2, 10, 36, 0.45);
  --focus: #FFFFFF;
  --copy-focus: var(--blue-rim);
}

:root[data-theme="light"] {
  color-scheme: light;
  --page: #F5F8FD;
  --page-image: none;
  --text: #0B1A33;
  --muted: #4A5872;
  --accent: var(--blue);
  --code-bg: var(--blue-night);
  --code-text: #EAF3FF;
  --button-bg: var(--blue);
  --button-hover: var(--blue-deep);
  --button-text: #FFFFFF;
  --card: #FFFFFF;
  --line: #D9E2F0;
  --menubar: #D9E2F0;
  --glow: rgba(14, 58, 151, 0.25);
  --focus: var(--blue-deep);
  /* The Copy button sits on the dark install box, where the dark ring would vanish. */
  --copy-focus: var(--blue-light);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--page);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-image), var(--page);
  color: var(--text);
  /* rem, not px, so the visitor's default font size setting is respected. */
  font: 1.0625rem/1.6 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }

button { -webkit-tap-highlight-color: transparent; }

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

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

.top, main, footer {
  max-width: 40rem;
  margin: 0 auto;
  padding: 0 1rem;
}

.top {
  display: flex;
  align-items: center;
  gap: 1rem;
  /* Reserves the toggle's height before site.js shows it, so the page doesn't shift. */
  min-height: 4.75rem;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: auto;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.top nav a { color: var(--text); text-decoration: none; }

/* Sun in the blue theme (switch to light), moon in the light theme (switch to blue). */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.theme-toggle[hidden] { display: none; }
.theme-toggle svg { width: 1.15rem; height: 1.15rem; }
.theme-toggle .moon,
:root[data-theme="light"] .theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .moon { display: block; }

/* Hover styles only where there is a real pointer, so they don't stick after a tap. */
@media (hover: hover) {
  .top nav a:hover { text-decoration: underline; }
  .theme-toggle:hover { background: var(--menubar); }
  .copy:hover { background: var(--button-hover); }
}

.hero { text-align: center; padding: 2.5rem 0 1rem; }

.hero-icon {
  width: 168px;
  height: 168px;
  filter: drop-shadow(0 18px 40px var(--glow));
}

h1 {
  font-size: clamp(2rem, 6vw, 2.9rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 1.5rem 0 1rem;
  text-wrap: balance;
}

h2 { font-size: 1.35rem; margin: 2.75rem 0 0.75rem; letter-spacing: -0.01em; }

.lead {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 36rem;
  margin: 0 auto 2rem;
  text-wrap: pretty;
}

.install {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 34rem;
  margin: 0 auto;
  padding: 0.5rem 0.5rem 0.5rem 1.1rem;
  background: var(--code-bg);
  border-radius: 12px;
  text-align: left;
}

.install code {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  white-space: nowrap;
  color: var(--code-text);
  font: 0.95rem/1.5 ui-monospace, "SF Mono", Menlo, monospace;
  padding: 0.35rem 0;
}

.install code::before {
  content: "$ ";
  opacity: 0.7;
  -webkit-user-select: none;
  user-select: none;
}

.copy {
  flex: none;
  min-width: 6.5em;
  border: 0;
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  background: var(--button-bg);
  color: var(--button-text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.copy:focus-visible { outline-color: var(--copy-focus); }

/* Forced colours drop the background, so give the button a visible edge. */
@media (forced-colors: active) {
  .copy { border: 1px solid ButtonText; }
}

/* Narrow windows: the command gets the full width and the button goes below it.
   In rem so it also switches when text is zoomed. The font shrinks with the window
   so the whole command fits down to 320 px. */
@media (max-width: 35rem) {
  .install { flex-wrap: wrap; padding: 0.6rem 0.75rem; }
  .install code {
    flex-basis: 100%;
    font-size: clamp(0.65rem, 3.4vw, 0.78rem);
    text-align: center;
  }
  .install code::before { content: none; }
  .install .copy { flex: 1; }
  .hero { padding-top: 1rem; }
  .hero-icon { width: 120px; height: 120px; }
}

.meta { color: var(--muted); font-size: 0.9rem; margin-top: 1rem; text-wrap: balance; }

/* A drawing of the app's menu, built from the real menu titles in StatusMenu.swift.
   Like macOS near the screen edge, the menu lines up with the right end of the bar. */
.menu-demo {
  margin: 3rem auto 0;
  max-width: 22rem;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.menu-bar {
  width: 100%;
  height: 24px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.75rem;
  border-radius: 6px 6px 0 0;
  background: var(--menubar);
  color: var(--text);
  font-size: 0.8125rem;
}

.menu-bar-icon {
  display: block;
  width: 22px;
  height: 20px;
  padding: 1px 2px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--text) 18%, transparent);
}

.menu-bar-icon::before {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: url("/icons/menu-bar-icon.svg") center / contain no-repeat;
  mask: url("/icons/menu-bar-icon.svg") center / contain no-repeat;
}

/* Windows high contrast and similar: keep the icon visible in the system text colour. */
@media (forced-colors: active) {
  .menu-bar-icon::before { forced-color-adjust: none; background: CanvasText; }
}

.menu-clock { font-weight: 500; white-space: nowrap; }

.menu {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 5px;
  width: min(16.5rem, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(2, 10, 36, 0.25);
  font-size: 0.8125rem;
}

.menu li { display: flex; align-items: baseline; padding: 3px 8px; border-radius: 4px; }
.menu .menu-status { color: var(--muted); padding-left: calc(8px + 1.1rem); }
.menu .check { width: 1.1rem; flex: none; }
.menu kbd { margin-left: auto; padding-left: 1rem; font: inherit; color: var(--muted); }
.menu .menu-sep { height: 1px; padding: 0; margin: 4px 8px; background: var(--line); }

/* Forced colours drop backgrounds, which would hide the separators. */
@media (forced-colors: active) {
  .menu .menu-sep { background: CanvasText; }
}

.points { padding-left: 1.2rem; }
.points li { margin-bottom: 0.4rem; }

/* The rule sits on the text column, not the padded footer box, so it lines up with the text. */
footer {
  margin-top: 4rem;
  padding-bottom: 2.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

footer p { margin: 0.3rem 0; }
footer p:first-child { margin-top: 0; padding-top: 1.5rem; border-top: 1px solid var(--line); }

.not-found {
  min-height: calc(80vh - 4.75rem);
  display: grid;
  place-content: center;
  text-align: center;
  padding-bottom: 4rem;
}

.not-found .hero-icon { width: 96px; height: 96px; margin: 0 auto; }
