/*
 * The Refficks blog. Colours are the product's own tokens
 * (apps/web/src/app/globals.css), light and dark, as the help center uses
 * them (apps/help/assets/help.css); 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;
  --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;
    --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: 1.0625rem;
  line-height: 1.65;
  /* 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;
}

.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: 1180px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 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-blog {
  color: var(--rail-muted);
  font-weight: 500;
  padding-left: 0.5rem;
  border-left: 1px solid rgb(164 191 177 / 0.4);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9375rem;
}

.header-link {
  color: var(--rail-ink);
  text-decoration: none;
  font-weight: 500;
}

.header-link:hover {
  text-decoration: underline;
}

.button {
  display: inline-block;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  background: var(--mark);
  color: #12291f;
  font-weight: 650;
  text-decoration: none;
}

.button:hover {
  background: #88e892;
}

/* The front page */

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

/* Lined up with the header's words and the cards below it. */
.hero-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1rem;
}

.hero h1 {
  font-size: clamp(1.875rem, 4.5vw, 2.75rem);
  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.125rem;
  margin: 0;
  max-width: 44rem;
}

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

.cards {
  list-style: none;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
  max-width: 1180px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: 1rem;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.25rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card:hover {
  border-color: var(--border-strong);
}

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

.card h2,
.card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.1875rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.card h3 {
  font-size: 1.0625rem;
}

.card h2 a,
.card h3 a {
  color: var(--ink);
  text-decoration: none;
}

/* The whole card opens the article; the link is the heading, so a screen reader reads the card by its name. */
.card h2 a::after,
.card h3 a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
}

.card h2 a:focus-visible,
.card h3 a:focus-visible {
  outline: none;
}

.card:hover h2 a,
.card:hover h3 a {
  color: var(--accent);
}

.card p {
  margin: 0 0 0.75rem;
  font-size: 0.9875rem;
}

.card .card-meta {
  margin: auto 0 0;
  font-size: 0.875rem;
  color: var(--ink-muted);
}

/* An article */

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

@media (min-width: 1100px) {
  .layout {
    grid-template-columns: minmax(0, 44rem) 15rem;
    justify-content: center;
  }
}

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

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

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

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

.toc li a {
  display: block;
  padding: 0.3rem 0 0.3rem 0.75rem;
  border-left: 2px solid var(--border);
  color: var(--ink-secondary);
  text-decoration: none;
  line-height: 1.35;
}

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

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

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

.article-header {
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

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

.related {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.related h2 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  color: var(--ink);
}

.cards-small {
  padding: 0;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));
}

/* An article's words */

.prose {
  max-width: 44rem;
}

.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.875rem, 4vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
}

.prose h2 {
  font-size: 1.5rem;
  margin: 2.5rem 0 0.75rem;
}

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

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

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

.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;
}

/* The 404 */

.not-found .hero {
  padding-bottom: 3.5rem;
}

/* 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,
  .toc,
  .related,
  .skip {
    display: none;
  }

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