/* Thicket website: one stylesheet for every page.
   Colours are the app's own (src/wildlife/ui/theme/tokens.py), so the site and the app match. */

@font-face {
  /* Scientific names, as in the app: a small copy of the app's bundled font, one weight and
     the characters the site needs (OFL, see fonts/; made by scripts/site_assets.py font). */
  font-family: "Source Serif 4";
  src: url("fonts/SourceSerif4-Italic-400-latin.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --bg: #f3f5f1;
  --surface: #ffffff;
  --surface-2: #f0f2ed;
  --border: #dfe3dc;
  --border-strong: #c7cec4;
  --text: #17201a;
  --text-2: #556058;
  --text-3: #687069;
  --accent: #2e7d4f;
  --accent-hover: #256a42;
  --accent-fg: #ffffff;
  --accent-subtle: #e2f0e7;
  --accent-subtle-text: #1d5a37;
  --shadow: 0 1px 2px rgb(23 32 26 / 0.06), 0 12px 32px rgb(23 32 26 / 0.10);

  --font-ui: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-sci: "Source Serif 4", Georgia, serif;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --page: 1120px;
  --gutter: 24px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1210;
    --surface: #181c19;
    --surface-2: #1f2420;
    --border: #2b322d;
    --border-strong: #3b443d;
    --text: #e6ebe6;
    --text-2: #a9b3aa;
    --text-3: #8d978e;
    --accent: #5fbf85;
    --accent-hover: #78cc99;
    --accent-fg: #0d1a12;
    --accent-subtle: #1b3125;
    --accent-subtle-text: #9edcb5;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 12px 32px rgb(0 0 0 / 0.45);
  }
}

/* ---------- Basics ---------- */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
}

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

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

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

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

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.2;
  margin: 0 0 0.5em;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 650;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1.125rem;
  font-weight: 650;
}

p {
  margin: 0 0 1em;
}

.sci {
  font-family: var(--font-sci);
  font-style: italic;
}

.wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Read by screen readers, not shown. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  padding: 8px 12px;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: var(--radius-sm);
  z-index: 10;
}

.skip-link:focus {
  top: 8px;
}

/* ---------- Buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

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

.button-primary:hover {
  background: var(--accent-hover);
  color: var(--accent-fg);
}

.button-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

.button-secondary:hover {
  background: var(--surface-2);
  color: var(--text);
}

.button-large {
  padding: 14px 24px;
  font-size: 1.0625rem;
}

.button svg {
  width: 18px;
  height: 18px;
  flex: none;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg); /* for browsers without color-mix() */
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: blur(10px); /* Safari before 18 */
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
}

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

.brand img {
  width: 32px;
  height: 32px;
}

.site-nav ul {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: block;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 500;
  text-decoration: none;
}

.site-nav a:hover {
  background: var(--surface-2);
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  background: var(--accent-subtle);
  color: var(--accent-subtle-text);
}

.site-header .button {
  margin-left: auto;
}

/* ---------- Home: hero ---------- */

.hero {
  padding: 72px 0 0;
  text-align: center;
}

.hero .lede {
  max-width: 40rem;
  margin: 0 auto 32px;
  color: var(--text-2);
  font-size: 1.1875rem;
}

.field-note {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding: 4px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.9375rem;
}

.field-note .sci {
  color: var(--text);
  font-size: 1.0625rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.hero-small {
  margin-top: 14px;
  color: var(--text-3);
  font-size: 0.875rem;
}

.screenshot {
  position: relative;
  margin: 56px auto 0;
  max-width: 1040px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

/* Each screenshot is a link to its full-size image: one link per theme, so it opens
   the picture you're looking at (no script needed). */
.zoom {
  position: absolute;
  inset: 0;
  cursor: zoom-in;
}

.zoom:focus-visible {
  outline-offset: -4px; /* inside, as the frame clips anything outside */
}

.only-dark {
  display: none;
}

@media (prefers-color-scheme: dark) {
  .only-light {
    display: none;
  }

  .only-dark {
    display: block;
  }
}

/* ---------- Home: reasons ---------- */

.reasons {
  padding: 88px 0;
}

.reasons ul {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.card p {
  margin: 0;
  color: var(--text-2);
}

.card-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 16px;
  border-radius: var(--radius-md);
  background: var(--accent-subtle);
  color: var(--accent-subtle-text);
}

.card-icon svg {
  width: 22px;
  height: 22px;
}

/* ---------- Home: the video tour ---------- */

.tour {
  padding: 0 0 88px;
  text-align: center;
  scroll-margin-top: 80px; /* clear of the sticky header when linked to */
}

.tour-lede {
  color: var(--text-2);
}

.tour-video {
  max-width: 960px;
  margin: 24px auto 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tour-video video {
  display: block;
  width: 100%;
  height: auto;
}

.tour-shows {
  max-width: 960px;
  margin: 16px auto 0;
  text-align: left;
  color: var(--text-2);
}

.tour-shows summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
}

.tour-shows ol {
  margin: 12px 0 0;
  padding-left: 1.4em;
}

.tour-shows li + li {
  margin-top: 6px;
}

/* ---------- Home: closing call to action ---------- */

.cta {
  margin-bottom: 88px;
  padding: 48px var(--gutter);
  border-radius: var(--radius-lg);
  background: var(--accent-subtle);
  text-align: center;
}

.cta p {
  max-width: 34rem;
  margin: 0 auto 24px;
  color: var(--text-2);
}

/* ---------- Inner pages ---------- */

.page-intro {
  padding: 64px 0 24px;
}

.page-intro .lede {
  max-width: 42rem;
  color: var(--text-2);
  font-size: 1.1875rem;
}

/* ---------- Page not found ---------- */

.not-found {
  padding-bottom: 120px;
}

.not-found .hero-actions {
  justify-content: flex-start;
}

/* ---------- Features: text beside a screenshot, swapping sides each row ---------- */

.feature {
  display: grid;
  grid-template-columns: 5fr 7fr;
  align-items: center;
  gap: 48px;
  padding: 48px 0;
}

.feature + .feature {
  border-top: 1px solid var(--border);
}

.feature:nth-of-type(even) {
  grid-template-columns: 7fr 5fr;
}

.feature:nth-of-type(even) .feature-text {
  order: 2;
}

.feature-text p {
  color: var(--text-2);
  font-size: 1.0625rem;
}

.feature-shot {
  position: relative;
  margin: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.feature-shot-dialog {
  justify-self: center;
  max-width: 480px;
}

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

.ticks li {
  position: relative;
  margin-top: 10px;
  padding-left: 30px;
}

.ticks li::before {
  /* A tick in the accent colour */
  content: "";
  position: absolute;
  left: 2px;
  top: 0.2em;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-subtle)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232e7d4f' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12 4 4 8-8'/%3E%3C/svg%3E")
    center / 12px no-repeat;
}

@media (prefers-color-scheme: dark) {
  .ticks li::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235fbf85' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12 4 4 8-8'/%3E%3C/svg%3E");
  }
}

.more {
  padding: 64px 0 88px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

/* ---------- Text pages (help, privacy, changelog): contents on the left, text on the right ---------- */

.prose-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: start;
  gap: 56px;
  padding-bottom: 88px;
}

.prose-only {
  grid-template-columns: minmax(0, 1fr);
}

.toc {
  position: sticky;
  top: 88px;
  font-size: 0.9375rem;
}

.toc h2 {
  margin-bottom: 8px;
  color: var(--text-3);
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

.toc a {
  display: block;
  padding: 4px 0;
  color: var(--text-2);
  text-decoration: none;
}

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

.prose {
  max-width: 44rem;
}

.prose section {
  /* Leaves room for the sticky header when jumping to a section */
  scroll-margin-top: 88px;
}

.prose section + section {
  margin-top: 40px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
}

.prose h2 {
  font-size: 1.5rem;
}

.prose ul,
.prose ol {
  margin: 0 0 1em;
  padding-left: 1.4em;
}

.prose h3 {
  margin-top: 28px;
}

.prose .feature-shot {
  margin: 8px 0 24px;
}

.prose li + li {
  margin-top: 6px;
}

.prose code {
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-family: "Cascadia Mono", Consolas, ui-monospace, monospace;
  font-size: 0.875em;
  overflow-wrap: anywhere;
}

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-family: inherit;
  font-size: 0.8125em;
  font-weight: 600;
  line-height: 1.7;
  text-align: center;
}

.prose table {
  width: 100%;
  margin: 0 0 1em;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.prose th,
.prose td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.prose th {
  color: var(--text-2);
  font-weight: 600;
}

/* The changelog: each version is a section with its number as the heading */
.version-tag {
  display: inline-block;
  margin-left: 10px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-subtle);
  color: var(--accent-subtle-text);
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 600;
  vertical-align: middle;
}

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

.site-footer {
  padding: 32px 0 48px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 0.875rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 32px;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--text-2);
}

/* ---------- Medium screens ---------- */

@media (max-width: 1000px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .feature {
    gap: 32px;
  }
}

/* ---------- Narrow screens ---------- */

@media (max-width: 760px) {
  :root {
    --gutter: 16px;
  }

  /* On a phone the header scrolls away with the page instead of taking up the screen. */
  .site-header {
    position: static;
  }

  .site-header .wrap {
    flex-wrap: wrap;
    gap: 0 12px;
    padding-top: 10px;
  }

  /* The page links move to their own row under the logo and Download button,
     and wrap rather than hide when the text is large. */
  .site-nav {
    order: 3;
    width: 100%;
    margin: 6px 0 4px;
  }

  .site-nav ul {
    flex-wrap: wrap;
  }

  .site-nav a {
    padding: 6px 10px;
  }

  .prose section {
    scroll-margin-top: 16px;
  }

  .hero {
    padding-top: 48px;
  }

  .field-note {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0 8px;
    border-radius: var(--radius-lg);
  }

  .field-note .sci,
  .field-note span {
    white-space: nowrap;
  }

  .field-note [aria-hidden="true"] {
    display: none;
  }

  .hero-actions .button {
    justify-content: center;
    width: 100%;
    max-width: 320px;
  }

  .reasons {
    padding: 56px 0;
  }

  .tour {
    padding-bottom: 56px;
  }

  .tour-video {
    border-radius: var(--radius-md);
  }

  .reasons ul,
  .card-grid {
    grid-template-columns: 1fr;
  }

  .page-intro {
    padding-top: 40px;
  }

  /* One column: text first, then its screenshot. */
  .feature {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 40px 0;
  }

  .feature:nth-of-type(even) {
    grid-template-columns: 1fr;
  }

  .feature:nth-of-type(even) .feature-text {
    order: 0;
  }

  .more {
    padding: 40px 0 56px;
  }

  /* The contents list goes above the text and stops sticking. */
  .prose-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding-bottom: 56px;
  }

  .toc {
    position: static;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
  }

  /* A three-column table is too tight on a phone: each row becomes a small block. */
  .prose thead {
    display: none;
  }

  .prose tr,
  .prose td {
    display: block;
  }

  .prose tr {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
  }

  .prose td {
    padding: 2px 0;
    border: 0;
  }

  .prose td:first-child {
    font-weight: 600;
  }

  /* The column headings are hidden here, so each value says what it is. */
  .prose td[data-label]::before {
    content: attr(data-label) ": ";
    color: var(--text-2);
    font-weight: 600;
  }

  .screenshot {
    margin-top: 40px;
    border-radius: var(--radius-md);
  }
}

/* ---------- The smallest phones ---------- */

@media (max-width: 359px) {
  /* Tighter page links, so all four still fit on one row at 320 px */
  .site-nav ul {
    gap: 2px;
  }

  .site-nav a {
    padding: 6px 6px;
  }
}
