/*
 * The project site, wearing the same clothes as the panel.
 *
 * The token names and values below are the ones in
 * apps/manager-panel/src/styles.css, copied rather than imported: the panel is
 * a Tailwind build and this is four static pages that must stay servable from
 * a bucket with no build output to keep in step. Copying costs a review when
 * the palette changes; importing would cost a bundler on a site whose whole
 * point is that it is files.
 *
 * Everything else here is written for prose and for a wide screen, which the
 * panel never has to be.
 */

@font-face {
  font-family: "Noto Sans Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/assets/noto-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Noto Sans Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("/assets/noto-sans-vietnamese.woff2") format("woff2");
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

:root {
  color-scheme: light;

  --background: #f7f9fc;
  --card: #ffffff;
  --foreground: #101828;
  --muted: #eef1f6;
  --accent: #e8eef7;
  --muted-foreground: #5a6678;
  --border: #dfe5ee;
  --primary: #2563eb;
  --primary-foreground: #ffffff;
  --ring: #2563eb;
  --success: #067647;
  --success-background: #e6f6ee;
  --attention: #b54708;
  --attention-background: #fdf0e3;
  --link: #133a9e;
  --link-hover: #0d2870;

  --elevation-1: 0 1px 2px rgb(16 24 40 / 0.05);
  --elevation-2: 0 4px 12px -2px rgb(16 24 40 / 0.10), 0 2px 4px -2px rgb(16 24 40 / 0.06);
  --elevation-3: 0 16px 40px -12px rgb(16 24 40 / 0.20), 0 4px 10px -4px rgb(16 24 40 / 0.10);

  --page-width: 72rem;
  --prose-width: 46rem;
  --gutter: 1.25rem;
  --radius: 0.75rem;
  --header-height: 3.5rem;
}

html.dark {
  color-scheme: dark;
  --background: #0f141b;
  --card: #171d26;
  --foreground: #e8edf4;
  --muted: #1f2732;
  --accent: #1f2937;
  --muted-foreground: #94a2b6;
  --border: #2a3442;
  --primary: #5b8def;
  --primary-foreground: #0b1220;
  --ring: #5b8def;
  --success: #4ec48b;
  --success-background: #12291f;
  --attention: #f0b264;
  --attention-background: #2c2113;
  --link: #86adf0;
  --link-hover: #b4cffa;

  --elevation-1: 0 1px 2px rgb(0 0 0 / 0.30);
  --elevation-2: 0 4px 12px -2px rgb(0 0 0 / 0.45), 0 2px 4px -2px rgb(0 0 0 / 0.30);
  --elevation-3: 0 16px 40px -12px rgb(0 0 0 / 0.60), 0 4px 10px -4px rgb(0 0 0 / 0.40);
}

@media (min-width: 640px) { :root { --gutter: 2rem; } }

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

html { min-width: 320px; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 1rem); background: var(--background); }

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: "Noto Sans Variable", "Segoe UI Variable", "Segoe UI", Tahoma, system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  font-synthesis: none;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; border-radius: 4px; }
img { max-width: 100%; height: auto; }
code, kbd, pre { font-family: Consolas, "SFMono-Regular", "Cascadia Mono", ui-monospace, monospace; }
code { font-size: 0.9em; }

.shell { width: 100%; max-width: var(--page-width); margin-inline: auto; padding-inline: var(--gutter); }
.prose-shell { max-width: var(--prose-width); }
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 60; padding: 10px 16px; border-radius: 0 0 var(--radius) 0; background: var(--card); }
.skip-link:focus { left: 0; }

/* ---- header ---------------------------------------------------------- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--background) 86%, transparent);
  backdrop-filter: blur(10px);
}
.site-head .shell { display: flex; align-items: center; gap: 10px; height: var(--header-height); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--foreground); font-weight: 650; text-decoration: none; letter-spacing: -0.01em; white-space: nowrap; }
.brand img { width: 26px; height: 26px; }
/* The full name needs more room than a phone's bar has once the two switches
   have taken theirs, and a wordmark that wraps onto a second line takes the
   whole bar with it. Below that width the short name says the same thing. */
.brand-short { display: none; }
@media (max-width: 560px) {
  .brand-full { display: none; }
  .brand-short { display: inline; }
}
.head-nav { display: none; margin-inline-start: 14px; gap: 2px; }
.head-nav a { padding: 6px 10px; border-radius: 8px; color: var(--muted-foreground); font-size: 14px; font-weight: 500; text-decoration: none; }
.head-nav a:hover { background: var(--accent); color: var(--foreground); }
.head-nav a[aria-current="page"] { color: var(--foreground); background: var(--accent); }
.head-tools { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }
@media (min-width: 860px) { .head-nav { display: flex; } }

.icon-button, .lang-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  min-width: 34px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--card);
  color: var(--muted-foreground);
  font: inherit;
  font-size: 12.5px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
.icon-button { border-color: transparent; background: transparent; }
.icon-button:hover, .lang-button:hover { background: var(--accent); color: var(--foreground); }
.icon-button svg, .lang-button svg { width: 17px; height: 17px; }
[data-theme-icon="dark"] { display: none; }
html.dark [data-theme-icon="dark"] { display: block; }
html.dark [data-theme-icon="light"] { display: none; }

/* ---- buttons --------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 14.5px;
  font-weight: 620;
  text-decoration: none;
  white-space: nowrap;
}
.button:hover { background: color-mix(in srgb, var(--primary) 88%, black); color: var(--primary-foreground); }
.button svg { width: 17px; height: 17px; }
.button-quiet { border-color: var(--border); background: var(--card); color: var(--foreground); }
.button-quiet:hover { background: var(--accent); color: var(--foreground); }

/* ---- sections -------------------------------------------------------- */

/* The landing page's bands. Scoped to `main >` so the documentation and the
   legal documents, whose sections are nested inside an article, do not each
   pick up 76px of padding and a rule above them. */
main > section { padding-block: 56px; }
main > section + section { border-top: 1px solid var(--border); }
@media (min-width: 640px) { main > section { padding-block: 76px; } }

.section-head { max-width: 42rem; margin-bottom: 30px; }
.eyebrow { margin: 0 0 8px; color: var(--primary); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
h1, h2, h3, h4 { letter-spacing: -0.02em; text-wrap: balance; }
h2 { margin: 0 0 10px; font-size: clamp(24px, 3.4vw, 32px); line-height: 1.2; }
h3 { margin: 0 0 6px; font-size: 17px; }
.section-head p, .lede { margin: 0; color: var(--muted-foreground); font-size: 16px; }

/* ---- hero ------------------------------------------------------------ */

.hero { position: relative; isolation: isolate; padding-block: 64px 44px; text-align: center; border-top: 0; }
.hero::before {
  content: "";
  position: absolute;
  inset: -1px 0 auto;
  z-index: -1;
  height: 32rem;
  background:
    radial-gradient(42rem 24rem at 50% -4rem, color-mix(in srgb, var(--primary) 16%, transparent), transparent 70%),
    radial-gradient(32rem 20rem at 50% 105%, color-mix(in srgb, var(--primary) 8%, transparent), transparent 70%);
}
.hero img.hero-mark { width: 78px; height: 78px; filter: drop-shadow(0 .5rem 1.25rem color-mix(in srgb, var(--primary) 30%, transparent)); }
.hero h1 { margin: 20px 0 14px; font-size: clamp(30px, 5.6vw, 50px); line-height: 1.08; }
.hero p.lede { max-width: 40rem; margin-inline: auto; font-size: clamp(16px, 2vw, 18px); }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 26px; }
.hero-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; margin-top: 18px; color: var(--muted-foreground); font-size: 13px; }
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta svg { width: 15px; height: 15px; }

/*
 * A screenshot frame that shows one of its copies.
 *
 * Four are in the markup - light and dark, wide and narrow - and exactly one
 * is displayed. The hidden ones are lazy, so a browser does not fetch the
 * three it will never paint.
 */
.shot { margin: 42px 0 0; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--card); box-shadow: var(--elevation-3); }
.shot img { display: none; width: 100%; }
.shot img.wide.light { display: block; }
html.dark .shot img.wide.light { display: none; }
html.dark .shot img.wide.dark { display: block; }

@media (max-width: 639px) {
  /* A desktop panel at 390px is a grey rectangle. Where the same page was
     photographed on a phone, that is the honest picture to show. */
  .shot.has-narrow { border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .shot.has-narrow img { max-width: 19rem; margin-inline: auto; border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--elevation-3); }
  .shot.has-narrow img.wide { display: none; }
  .shot.has-narrow img.narrow.light { display: block; }
  html.dark .shot.has-narrow img.narrow.light { display: none; }
  html.dark .shot.has-narrow img.narrow.dark { display: block; }
}

/* ---- cards ----------------------------------------------------------- */

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
@media (min-width: 620px) { .grid-2, .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.card { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); box-shadow: var(--elevation-1); }
.card p { margin: 0; color: var(--muted-foreground); font-size: 14px; }
.card-icon { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 14px; border-radius: 10px; background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }
.card-icon svg { width: 19px; height: 19px; }

a.card { display: block; color: inherit; text-decoration: none; transition: border-color .15s ease, transform .15s ease; }
a.card:hover { border-color: color-mix(in srgb, var(--primary) 50%, var(--border)); color: inherit; }
a.card .card-go { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; color: var(--link); font-size: 13px; font-weight: 620; }
a.card .card-go svg { width: 14px; height: 14px; }

/* ---- diagram / table ------------------------------------------------- */

.figure { padding: 22px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.figure svg { display: block; width: 100%; height: auto; }
.figure figcaption { margin-top: 14px; color: var(--muted-foreground); font-size: 13px; text-align: center; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 14px; text-align: start; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { color: var(--muted-foreground); font-size: 12px; font-weight: 650; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }

/* ---- notes ----------------------------------------------------------- */

.note { display: flex; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--muted); font-size: 14px; }
.note svg { flex-shrink: 0; width: 18px; height: 18px; margin-top: 2px; color: var(--muted-foreground); }
.note p { margin: 0; }
.note-warn { border-color: color-mix(in srgb, var(--attention) 35%, var(--border)); background: var(--attention-background); }
.note-warn svg { color: var(--attention); }
.note-good { border-color: color-mix(in srgb, var(--success) 30%, var(--border)); background: var(--success-background); }
.note-good svg { color: var(--success); }

/* ---- footer ---------------------------------------------------------- */

.site-foot { padding-block: 44px; border-top: 1px solid var(--border); background: var(--muted); color: var(--muted-foreground); font-size: 13.5px; }
.foot-grid { display: grid; gap: 28px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .foot-grid { grid-template-columns: 1.6fr repeat(3, 1fr); } }
.foot-grid h2 { margin: 0 0 10px; color: var(--foreground); font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.foot-grid ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.foot-grid a { color: var(--muted-foreground); text-decoration: none; }
.foot-grid a:hover { color: var(--foreground); text-decoration: underline; }
.foot-about p { margin: 12px 0 0; max-width: 28rem; }
.foot-bottom { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--border); font-size: 12.5px; }
.foot-bottom .spacer { margin-inline-start: auto; }

/* ---- documentation --------------------------------------------------- */

/*
 * One page, a contents list beside it.
 *
 * Everything the documentation says fits in one document, so a reader who has
 * just failed to install something can find the half-remembered sentence with
 * one Ctrl+F rather than guessing which of eight pages it was on. The contents
 * list is a column on a wide screen and a block at the top on a narrow one -
 * never a drawer, because a drawer is a thing to open before you can look.
 */
.docs { padding-block: 32px 72px; }
/* The title comes first on every width. The contents list is a column beside
   the text on a wide screen and a block under the title on a narrow one -
   never the first screenful, which is what it became when it shared the
   article with the heading. */
.docs-shell { display: grid; gap: 28px; align-items: start; grid-template-areas: "head" "toc" "body"; }
@media (min-width: 1000px) {
  .docs-shell {
    grid-template-columns: 16rem minmax(0, 1fr);
    grid-template-areas: "head head" "toc body";
    column-gap: 48px;
    row-gap: 34px;
  }
}
.docs-shell > .docs-head { grid-area: head; }
.docs-shell > .docs-toc { grid-area: toc; }
.docs-shell > .docs-body { grid-area: body; }

.docs-toc { font-size: 13.5px; }
@media (min-width: 1000px) {
  .docs-toc { position: sticky; top: calc(var(--header-height) + 20px); max-height: calc(100dvh - var(--header-height) - 40px); overflow-y: auto; }
}
@media (max-width: 999px) {
  /* Capped and scrolling, so a fourteen-entry list is a box to glance at
     rather than a screenful to swipe past on the way to the first sentence. */
  .docs-toc { max-height: 15rem; overflow-y: auto; padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
}
.docs-toc-title { margin: 0 0 12px; color: var(--muted-foreground); font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.docs-toc ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 1px; }
.docs-toc > ul > li > a { display: block; padding: 5px 10px; margin-inline-start: -10px; border-radius: 7px; color: var(--muted-foreground); text-decoration: none; }
.docs-toc a:hover { background: var(--accent); color: var(--foreground); }
.docs-toc ul ul { margin: 2px 0 8px; padding-inline-start: 12px; border-inline-start: 1px solid var(--border); }
.docs-toc ul ul a { display: block; padding: 3px 10px; color: var(--muted-foreground); font-size: 13px; text-decoration: none; border-radius: 7px; }

.docs-body { min-width: 0; max-width: var(--prose-width); }
.docs-head { padding-bottom: 26px; border-bottom: 1px solid var(--border); }
.docs-head h1 { margin: 0 0 10px; font-size: clamp(30px, 5vw, 40px); line-height: 1.1; }

.docs-section { padding-block: 6px 0; border-top: 0; }
.docs-section + .docs-section { padding-top: 34px; }
.docs-section > h2 { display: flex; align-items: center; gap: 11px; margin: 0 0 14px; font-size: 24px; scroll-margin-top: calc(var(--header-height) + 16px); }
.docs-section > h2 svg { width: 21px; height: 21px; flex-shrink: 0; color: var(--primary); }
.docs-sub { margin-top: 30px; padding-top: 4px; }
.docs-sub h3 { position: relative; margin: 0 0 12px; font-size: 18px; scroll-margin-top: calc(var(--header-height) + 16px); }
.docs-sub .anchor { position: absolute; inset-inline-start: -1.1em; color: var(--border); text-decoration: none; opacity: 0; }
.docs-sub h3:hover .anchor, .docs-sub .anchor:focus-visible { opacity: 1; }

.docs-body p { margin: 0 0 14px; }
.docs-body .note { margin-block: 18px; }
.docs-body .table-wrap { margin-block: 18px; }
.docs-list, .docs-steps { margin: 0 0 16px; padding-inline-start: 1.35em; display: grid; gap: 8px; }
.docs-steps { counter-reset: none; }
.docs-list li::marker, .docs-steps li::marker { color: var(--muted-foreground); }
.docs-shot { margin-block: 22px; }

.code { margin: 0 0 18px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.code figcaption { padding: 8px 14px; border-bottom: 1px solid var(--border); background: var(--muted); color: var(--muted-foreground); font-size: 12px; font-weight: 600; }
.code pre { margin: 0; padding: 14px; overflow-x: auto; font-size: 13px; line-height: 1.7; tab-size: 2; }
.code code { font-size: inherit; }

/* ---- the legal documents --------------------------------------------- */

/*
 * Legal prose, set to be read rather than to be scrolled past.
 *
 * Measure first: a 62-character line is the difference between somebody
 * reading a clause and giving up on the page. The numbers are in the markup,
 * not in a counter, so a clause cited as "4.2" in an e-mail can still be found
 * by somebody opening the page a year later.
 */
.legal-page .docs-head .eyebrow { display: inline-flex; align-items: center; gap: 7px; }
.legal-page .docs-head .eyebrow svg { width: 15px; height: 15px; }
.legal-page .docs-body { max-width: 42rem; }
.legal-page .legal-meta { margin: 16px 0 0; color: var(--muted-foreground); font-size: 13px; }
.legal-section { margin-top: 30px; scroll-margin-top: calc(var(--header-height) + 16px); }
.legal-section h2 { display: flex; gap: 10px; margin: 0 0 12px; font-size: 19px; }
.legal-section p { margin: 0 0 12px; }
.legal-number { color: var(--muted-foreground); font-variant-numeric: tabular-nums; }
.docs-toc .legal-number { margin-inline-end: 6px; }
.legal-foot { margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--border); color: var(--muted-foreground); font-size: 13.5px; }
.legal-foot p { margin: 0 0 10px; }
.legal-foot p:last-child { display: flex; flex-wrap: wrap; gap: 8px 12px; margin: 0; }

/* ---- the OAuth relay page -------------------------------------------- */

/*
 * The one page here that is not part of the site: Cloudflare returns a browser
 * to it mid-sign-in, it forwards, and it is gone. It carries the site's mark
 * and colours so the hop does not look like a stranger's page, and nothing
 * else - no bar, no footer, nowhere else to go from here.
 */
.relay-page { display: grid; place-items: center; min-height: 100dvh; padding: 24px; }
.relay-card { width: 100%; max-width: 30rem; padding: 28px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); box-shadow: var(--elevation-2); text-align: center; }
.relay-card h1 { margin: 16px 0 10px; font-size: 20px; }
.relay-card p { margin: 0 0 8px; color: var(--muted-foreground); font-size: 14px; }
.relay-card p[lang="vi"] { opacity: .8; }
.relay-card .destination { margin: 16px 0; }
.relay-card .destination code { font-size: 15px; overflow-wrap: anywhere; }
.relay-card .button { margin-top: 12px; }
