/*
 * The Refficks help center. Colours are the product's own tokens
 * (apps/web/src/app/globals.css), light and dark; the typeface is the
 * product's Figtree, copied in at build time.
 */

@font-face {
  font-family: "Figtree";
  src: url("figtree.26ad3db9b3.ttf") format("truetype");
  font-weight: 300 900;
  font-display: swap;
}

:root {
  --canvas: #f4f8f5;
  --surface: #ffffff;
  --surface-muted: #ebf0ec;
  --border: #dbe1dd;
  --border-strong: #c9d0cb;
  --border-control: #7e8580;
  --ink: #12291f;
  --ink-secondary: #4b524d;
  --ink-muted: #646b66;
  --accent: #00611e;
  --accent-soft: #e9fdea;
  --mark: #56d66b;
  --rail: #12291f;
  --rail-ink: #f2f8f5;
  --rail-muted: #a4bfb1;
  --focus: #00611e;
  --code-bg: #ebf0ec;
  --shadow: 0 1px 2px rgb(18 41 31 / 0.06), 0 4px 12px rgb(18 41 31 / 0.06);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #0a1b14;
    --surface: #12291f;
    --surface-muted: #183428;
    --border: #234234;
    --border-strong: #355948;
    --border-control: #87a797;
    --ink: #f2f8f5;
    --ink-secondary: #bed4c9;
    --ink-muted: #a4bfb1;
    --accent: #88e892;
    --accent-soft: #234234;
    --rail: #0a1b14;
    --focus: #88e892;
    --code-bg: #183428;
    --shadow: none;
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink-secondary);
  font-family: "Figtree", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  /* The footer stays at the bottom of a short page, such as the 404. */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body > main,
body > .layout {
  flex: 1 0 auto;
  width: 100%;
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--surface);
  color: var(--accent);
  border-radius: 6px;
}

.skip:focus {
  top: 0.75rem;
}

/* Header: the product's forest rail, with the Spring mark. */

.site-header {
  background: var(--rail);
  color: var(--rail-ink);
}

.site-header-inner,
.site-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--rail-ink);
  text-decoration: none;
  font-weight: 650;
  font-size: 1.125rem;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--mark);
}

.brand-help {
  color: var(--rail-muted);
  font-weight: 500;
  padding-left: 0.5rem;
  border-left: 1px solid rgb(164 191 177 / 0.4);
}

/* Search */

.search {
  display: flex;
  gap: 0.5rem;
  flex: 1 1 18rem;
  max-width: 26rem;
}

.search input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 0.9375rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border-control);
  background: var(--surface);
  color: var(--ink);
}

.site-header .search input {
  border-color: transparent;
}

.search button {
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--surface);
  cursor: pointer;
}

.site-header .search button {
  background: var(--mark);
  color: #12291f;
}

.search-big {
  max-width: 36rem;
  margin-top: 1.25rem;
}

.search-big input,
.search-big button {
  font-size: 1.0625rem;
  padding: 0.75rem 1rem;
}

/* The home page */

.hero {
  background: var(--rail);
  color: var(--rail-ink);
  padding: 2.5rem 1rem 3rem;
}

.hero > * {
  max-width: 1080px;
  margin-left: auto;
  margin-right: auto;
}

.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.15;
  margin-top: 0;
  margin-bottom: 0.75rem;
  color: var(--rail-ink);
  letter-spacing: -0.02em;
}

.hero p {
  color: var(--rail-muted);
  font-size: 1.0625rem;
  margin-top: 0;
}

.hero a {
  color: var(--mark);
}

.hero .search {
  margin-left: auto;
  margin-right: auto;
}

.hero-small {
  padding-bottom: 2rem;
}

.home-body {
  max-width: calc(1080px + 2rem);
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.home-lede {
  font-size: 0.9375rem;
  color: var(--ink-muted);
  margin-bottom: 1.5rem;
}

.home-lede hr {
  display: none;
}

/* A small box for each of README's sections. The heading's link covers the
   whole box, so the box is one target and is read by its name. */
.home-boxes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
  gap: 1rem;
}

.home-box {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.125rem 1.25rem 1rem;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease;
}

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

.home-box:has(a:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.home-box h2 {
  margin: 0 0 0.375rem;
  font-size: 1.125rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.home-box h2 a {
  color: var(--ink);
  text-decoration: none;
}

.home-box h2 a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
}

.home-box h2 a:focus-visible {
  outline: none;
}

.home-box:hover h2 a {
  color: var(--accent);
}

.home-box p {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.home-box .home-box-count {
  margin-top: auto;
  padding-top: 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-muted);
}

/* A section's page: the other sections beside it, its articles as rows. */
.layout-section {
  max-width: 1080px;
}

@media (min-width: 1240px) {
  .layout-section {
    grid-template-columns: 15rem minmax(0, 1fr);
  }
}

.section-header {
  max-width: 48rem;
  margin-bottom: 1.5rem;
}

.section-header h1 {
  color: var(--ink);
  font-size: clamp(1.625rem, 3.5vw, 2.125rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

.section-header p {
  margin: 0;
  font-size: 1.0625rem;
}

.section-header .section-count {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.section-body > h2:first-child {
  margin-top: 0;
}

.section-body h2 {
  font-size: 1.125rem;
  margin: 2rem 0 0.75rem;
}

.prose .guides {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  display: grid;
  gap: 0.5rem;
  counter-reset: guide;
}

.prose .guides li + li {
  margin-top: 0;
}

.guide {
  display: block;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-secondary);
  text-decoration: none;
  position: relative;
  transition: border-color 0.15s ease;
}

.guide::after {
  content: "›";
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.25rem;
  color: var(--ink-muted);
}

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

.guide-title {
  display: block;
  color: var(--accent);
  font-weight: 650;
  line-height: 1.35;
}

.guide:hover .guide-title {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.guide-summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  margin-top: 0.25rem;
  font-size: 0.9375rem;
  line-height: 1.5;
}

/* README's numbered path (Get started) keeps its numbers. */
ol.guides > li {
  counter-increment: guide;
}

ol.guides .guide {
  padding-left: 3.25rem;
}

ol.guides .guide::before {
  content: counter(guide);
  position: absolute;
  left: 1rem;
  top: 0.8rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.5rem;
  text-align: center;
}

/* An article: its section beside it, what is on the page on the other side. */

.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: 15rem minmax(0, 1fr);
  }
}

@media (min-width: 1240px) {
  .layout {
    grid-template-columns: 15rem minmax(0, 1fr) 13rem;
  }
}

.sidebar,
.toc {
  display: none;
  font-size: 0.875rem;
  align-self: start;
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

@media (min-width: 900px) {
  .sidebar {
    display: block;
  }
}

@media (min-width: 1240px) {
  .toc {
    display: block;
  }
}

.sidebar ul,
.toc ul,
.section-menu ul {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.sidebar li a,
.toc li a,
.section-menu li a {
  display: block;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  color: var(--ink-secondary);
  text-decoration: none;
  line-height: 1.35;
}

.sidebar li a:hover,
.toc li a:hover,
.section-menu li a:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.sidebar a[aria-current="page"],
.section-menu a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.nav-section {
  margin: 0 0 0.75rem;
  font-weight: 650;
  font-size: 0.9375rem;
}

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

.nav-group {
  margin: 0.75rem 0 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

.section-menu {
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 0.25rem 0.75rem;
  font-size: 0.9375rem;
}

.section-menu summary {
  cursor: pointer;
  padding: 0.5rem 0;
  font-weight: 600;
  color: var(--ink);
}

@media (min-width: 900px) {
  .section-menu {
    display: none;
  }
}

.breadcrumb ol {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  font-size: 0.875rem;
}

.breadcrumb li + li::before {
  content: "›";
  margin-right: 0.25rem;
  color: var(--ink-muted);
}

.breadcrumb a {
  color: var(--ink-muted);
}

.article-meta {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--ink-muted);
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}

.pager a {
  display: block;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  text-decoration: none;
  font-weight: 600;
  line-height: 1.35;
}

.pager a span {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pager-next {
  text-align: right;
}

/* An article's words */

.prose {
  max-width: 48rem;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  color: var(--ink);
  line-height: 1.25;
  letter-spacing: -0.01em;
  scroll-margin-top: 1rem;
}

.prose h1 {
  font-size: clamp(1.625rem, 3.5vw, 2.125rem);
  margin: 0 0 1rem;
}

.prose h2 {
  font-size: 1.375rem;
  margin: 2.25rem 0 0.75rem;
}

.prose h3 {
  font-size: 1.125rem;
  margin: 1.75rem 0 0.5rem;
}

.prose strong {
  color: var(--ink);
}

.prose li + li {
  margin-top: 0.35rem;
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1rem 0 1.25rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  background: var(--surface);
}

.prose blockquote {
  margin: 1.25rem 0;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 10px 10px 0;
  color: var(--ink-secondary);
}

.prose blockquote > :first-child {
  margin-top: 0;
}

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

.prose code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.875em;
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  overflow-wrap: anywhere;
}

.prose pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.875rem 1rem;
  overflow-x: auto;
  line-height: 1.5;
}

.prose pre code {
  background: none;
  padding: 0;
  font-size: 0.875rem;
  overflow-wrap: normal;
}

.table-scroll {
  overflow-x: auto;
  margin: 1.25rem 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

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

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

.prose th {
  color: var(--ink);
  font-weight: 600;
  background: var(--surface-muted);
}

.prose tr:last-child td {
  border-bottom: 0;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* Search results */

.search-results {
  max-width: 48rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

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

.search-results li {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.search-results a {
  font-weight: 650;
  font-size: 1.0625rem;
}

.search-results .result-section {
  display: block;
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

.search-results p {
  margin: 0.25rem 0 0;
}

.search-results mark {
  background: var(--accent-soft);
  color: var(--ink);
  border-radius: 2px;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.875rem;
  color: var(--ink-muted);
}

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

/* A link wraps between the dots, never inside its own words. */
.site-footer a {
  white-space: nowrap;
}

@media print {
  .site-header,
  .site-footer,
  .sidebar,
  .toc,
  .section-menu,
  .pager,
  .skip {
    display: none;
  }

  .layout {
    display: block;
    padding: 0;
  }
}

.search-count {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.search-note {
  color: var(--ink-muted);
}
