/*
 * Copyright (C) 2026 Chris Laprade (chris@rootiest.com)
 * SPDX-License-Identifier: AGPL-3.0-or-later
 *
 * rootiest.fyi styles, shared by the hub and the Rootiest Mail guide.
 * Catppuccin Latte (light) and Mocha (dark), following the system setting,
 * the same palette as rootiest.com, status.rootiest.dev and support.rootiest.dev.
 * site/email/assets/site.css is a generated copy of this file.
 */
:root {
  --brand: #ff004c;
  --base: #eff1f5;
  --mantle: #e6e9ef;
  --crust: #dce0e8;
  --surface0: #ccd0da;
  --surface1: #bcc0cc;
  --text: #4c4f69;
  --subtext: #5c5f77;
  --muted: #6c6f85;
  --accent: #d20f39;
  --link: #1e66f5;
  --green: #40a02b;
  --yellow: #df8e1d;
  --blue: #1e66f5;
  --mauve: #8839ef;
  --peach: #fe640b;
  --sky: #04a5e5;
  --lavender: #7287fd;
  --name: #a85d63; /* dusty rose (Latte flamingo hue, darkened for legibility) */
  --shadow: rgb(76 79 105 / 12%);
  --mono: "Rootiest Iosevka", "Iosevka", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --base: #1e1e2e;
    --mantle: #181825;
    --crust: #11111b;
    --surface0: #313244;
    --surface1: #45475a;
    --text: #cdd6f4;
    --subtext: #bac2de;
    --muted: #a6adc8;
    --accent: #f38ba8;
    --link: #89b4fa;
    --green: #a6e3a1;
    --yellow: #f9e2af;
    --blue: #89b4fa;
    --mauve: #cba6f7;
    --peach: #fab387;
    --sky: #89dceb;
    --lavender: #b4befe;
    --name: #cba6f7; /* Mocha mauve */
    --shadow: rgb(0 0 0 / 35%);
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--base);
  color: var(--text);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
}

img {
  max-width: 100%;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 20;
  padding: 0.5rem 0.9rem;
  border-radius: 0.5rem;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
}

.skip-link:focus {
  top: 0.5rem;
}

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

.wrap {
  width: 100%;
  max-width: 68rem;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--base) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--surface0);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand img {
  width: 1.75rem;
  height: 1.75rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.nav a {
  color: var(--muted);
  font-size: 0.925rem;
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: 0.5rem;
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--text);
  background: var(--mantle);
}

/* Hero */
.hero {
  padding: 4.5rem 0 3rem;
  text-align: center;
}

.hero.compact {
  padding: 3rem 0 1.5rem;
}

.hero-logo {
  width: 7rem;
  height: 7rem;
  margin-bottom: 1.25rem;
  filter: drop-shadow(0 12px 32px rgb(255 0 76 / 25%));
}

.hero.compact .hero-logo {
  width: 4.5rem;
  height: 4.5rem;
  margin-bottom: 1rem;
}

.hero h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.hero.compact h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
}

.hero h1 .accent {
  color: var(--brand);
}

.lede {
  max-width: 36rem;
  margin: 0 auto;
  color: var(--subtext);
  font-size: 1.1rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--surface0);
  border-radius: 0.6rem;
  background: var(--mantle);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.btn:hover {
  border-color: var(--surface1);
  transform: translateY(-1px);
}

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

.btn.primary:hover {
  filter: brightness(1.08);
}

/* Sections */
.section {
  padding: 2rem 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section h2 {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-head a {
  font-size: 0.9rem;
  text-decoration: none;
}

.section-head a:hover {
  text-decoration: underline;
}

/* Cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr));
  gap: 0.75rem;
}

.card {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  padding: 1rem;
  border: 1px solid var(--surface0);
  border-radius: 0.75rem;
  background: var(--mantle);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  border-color: color-mix(in srgb, var(--hue, var(--brand)) 55%, var(--surface0));
  box-shadow: 0 8px 24px var(--shadow);
  transform: translateY(-2px);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  flex: 1;
}

.card h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
}

.card p {
  margin: 0;
  color: var(--subtext);
  font-size: 0.9rem;
  line-height: 1.5;
}

.card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  margin-top: 0.35rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
}

/* Category hues (Catppuccin) */
.grid,
.hue-red { --hue: var(--accent); }
.hue-yellow { --hue: var(--yellow); }
.hue-blue { --hue: var(--blue); }
.hue-green { --hue: var(--green); }
.hue-mauve { --hue: var(--mauve); }
.hue-peach { --hue: var(--peach); }
.hue-sky { --hue: var(--sky); }
.hue-lavender { --hue: var(--lavender); }

.pill {
  --hue: var(--green);
  display: inline-block;
  padding: 0.05rem 0.55rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: var(--green);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.pill.members {
  color: var(--muted);
}

.section-blurb {
  margin: -0.25rem 0 1rem;
  color: var(--muted);
  font-size: 0.925rem;
}

.jump {
  max-width: 40rem;
  margin: 1.25rem auto 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.jump a {
  text-decoration: none;
  white-space: nowrap;
}

.jump a:hover {
  text-decoration: underline;
}

.section {
  scroll-margin-top: 3.5rem;
}

/* Footer */
.site-footer {
  margin-top: 2.5rem;
  padding: 2rem 0 2.5rem;
  border-top: 1px solid var(--surface0);
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 1.25rem;
  margin: 1.25rem 0 0.5rem;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
}

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

.footer-links + .footer-links {
  margin-top: 0.25rem;
  font-size: 0.85rem;
}

.footer-donate {
  margin: 1rem 0 0.25rem;
}

.site-footer p {
  margin: 0.4rem 0;
}

/* Hub cards: the title link covers the whole card; source and extra links sit above it */
.card {
  position: relative;
}

.card-link {
  color: inherit;
  text-decoration: none;
}

.card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 0.75rem;
}

.card-link:focus-visible {
  outline: none;
}

.card:has(.card-link:focus-visible) {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

.site-icon {
  flex: none;
  width: 3rem;
  height: 3rem;
  padding: 0.35rem;
  border-radius: 0.8rem;
  background: color-mix(in srgb, var(--hue) 12%, var(--base));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hue) 28%, transparent);
}

.card .meta {
  overflow-wrap: anywhere;
}

.card-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.9rem;
  margin-top: 0.35rem !important;
  font-size: 0.85rem !important;
}

.card-links a {
  position: relative;
  z-index: 1;
}

/* Guide: page list beside the text on wide screens, above it on phones */
.guide-layout {
  display: grid;
  gap: 1.5rem;
  max-width: 64rem;
  padding-top: 2rem;
}

.guide-nav {
  padding: 1rem 1.25rem;
  border: 1px solid var(--surface0);
  border-radius: 0.75rem;
  background: var(--mantle);
  font-size: 0.925rem;
}

.guide-nav h2 {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.guide-nav ol {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--muted);
}

.guide-nav li {
  margin: 0.2rem 0;
}

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

.guide-nav a:hover {
  color: var(--link);
  text-decoration: underline;
}

.guide-nav a[aria-current="page"] {
  color: var(--text);
  font-weight: 700;
}

.guide {
  min-width: 0;
  overflow-wrap: anywhere;
}

.guide h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.guide h2 {
  margin: 2.25rem 0 0.6rem;
  font-size: 1.35rem;
  scroll-margin-top: 4.5rem;
}

.guide h3 {
  margin: 1.75rem 0 0.4rem;
  font-size: 1.1rem;
  scroll-margin-top: 4.5rem;
}

.guide p,
.guide li {
  line-height: 1.7;
}

.guide ul,
.guide ol {
  padding-left: 1.4rem;
}

.guide li + li {
  margin-top: 0.3rem;
}

.guide code,
.guide kbd {
  padding: 0.1rem 0.35rem;
  border-radius: 0.3rem;
  background: var(--mantle);
  font-family: var(--mono);
  font-size: 0.9em;
}

.guide kbd {
  border: 1px solid var(--surface1);
  border-bottom-width: 2px;
}

.guide pre {
  overflow-x: auto;
  padding: 0.9rem 1rem;
  border: 1px solid var(--surface0);
  border-radius: 0.6rem;
  background: var(--mantle);
  font-size: 0.9rem;
}

.guide pre code {
  padding: 0;
  background: none;
}

.guide table {
  display: block;
  overflow-x: auto;
  width: 100%;
  border-collapse: collapse;
  font-size: 0.925rem;
}

.guide th,
.guide td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--surface0);
  text-align: left;
  vertical-align: top;
}

.guide thead th {
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.guide aside,
.guide .note {
  max-width: none;
  margin: 1.25rem 0;
  padding: 0.9rem 1.1rem;
  border-left: 0.3rem solid var(--brand);
  border-radius: 0.5rem;
  background: var(--mantle);
  color: var(--subtext);
  text-align: left;
}

/* Guide screenshots */
.shot {
  margin: 1.5rem 0;
}

.shot img {
  display: block;
  height: auto;
  border: 1px solid var(--surface0);
  border-radius: 0.6rem;
  box-shadow: 0 8px 24px var(--shadow);
}

.shot figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.875rem;
}

/* A screenshot that is not there yet: its alt text and id, never a broken image */
.shot-placeholder {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.4rem;
  min-height: 9rem;
  padding: 1.25rem;
  border: 2px dashed var(--surface1);
  border-radius: 0.6rem;
  background: var(--mantle);
  color: var(--subtext);
  text-align: center;
}

.shot-alt {
  font-size: 0.95rem;
}

.shot-id {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
}

/* Guide: previous and next page */
.pager {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 0.75rem;
  margin-top: 2.5rem;
}

.pager a {
  display: flex;
  flex-direction: column;
  padding: 0.8rem 1rem;
  border: 1px solid var(--surface0);
  border-radius: 0.75rem;
  background: var(--mantle);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.pager a:hover {
  border-color: var(--surface1);
}

.pager span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
}

.pager .next {
  grid-column: -2;
  text-align: right;
}

@media (min-width: 60rem) {
  .guide-layout {
    grid-template-columns: 15rem minmax(0, 1fr);
    align-items: start;
  }

  .guide-nav {
    position: sticky;
    top: 4.5rem;
  }
}

@media (max-width: 40rem) {
  .site-header .wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .nav {
    margin-left: -0.65rem;
  }

  .site-header {
    position: static;
  }

  .hero {
    padding: 3rem 0 2rem;
  }
}

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

  .card,
  .btn {
    transition: none;
  }

  .card:hover,
  .btn:hover {
    transform: none;
  }
}
