/* ThirtyFile website: shared styles for the home page and the guides */

:root {
  --bg: #ffffff;
  --bg-soft: #f5f7fb;
  --bg-tint: #eef3ff;
  --text: #10204a;
  --text-soft: #4a5878;
  --text-faint: #7b88a6;
  --line: #e1e7f2;
  --brand: #2563eb;
  --brand-strong: #1d4fd0;
  --brand-soft: #dbe7ff;
  --on-brand: #ffffff;
  --code-bg: #0f1b3d;
  --code-text: #e6ecff;
  --code-dim: #8fa3d8;
  --warn-bg: #fff7e6;
  --warn-line: #f2c46b;
  --warn-text: #6b4a05;
  --shadow: 0 24px 60px -24px rgba(16, 32, 74, 0.35);
  --radius: 14px;
  --font: "Geist", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1226;
    --bg-soft: #111a33;
    --bg-tint: #14224a;
    --text: #eef2ff;
    --text-soft: #b3bfdd;
    --text-faint: #7f8db3;
    --line: #22305a;
    --brand: #5b93ff;
    --brand-strong: #7aa8ff;
    --brand-soft: #1b2d63;
    --on-brand: #06102b;
    --code-bg: #070d1f;
    --warn-bg: #2b2210;
    --warn-line: #7a5a16;
    --warn-text: #f5d99a;
    --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0b1226;
  --bg-soft: #111a33;
  --bg-tint: #14224a;
  --text: #eef2ff;
  --text-soft: #b3bfdd;
  --text-faint: #7f8db3;
  --line: #22305a;
  --brand: #5b93ff;
  --brand-strong: #7aa8ff;
  --brand-soft: #1b2d63;
  --on-brand: #06102b;
  --code-bg: #070d1f;
  --warn-bg: #2b2210;
  --warn-line: #7a5a16;
  --warn-text: #f5d99a;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

/* Screenshots that follow the theme */
.only-dark {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .only-dark {
    display: block;
  }

  :root:not([data-theme="light"]) .only-light {
    display: none;
  }
}

:root[data-theme="dark"] .only-dark {
  display: block;
}

:root[data-theme="dark"] .only-light {
  display: none;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  -webkit-text-size-adjust: 100%;
}

/* Chinese and Japanese share characters drawn differently: each language gets fonts with its own glyphs. An element
   in another language than its page (a name in the language switch) picks its own fonts too */
:lang(zh-TW) {
  --font: "Geist", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, -apple-system, "Segoe UI", sans-serif;
}

:lang(zh-CN) {
  --font: "Geist", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
}

:lang(ja) {
  --font: "Geist", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, -apple-system, "Segoe UI", sans-serif;
}

[lang] {
  font-family: var(--font);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--brand-strong);
}

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

.wrap {
  width: min(1120px, 100% - 32px);
  margin-inline: auto;
}

/* ── Link past the header and menu, shown when it has the focus ── */

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 30;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 0 0 2px var(--brand);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* ── Header ── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 650;
  font-size: 18px;
  letter-spacing: -0.01em;
  text-decoration: none;
}

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

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.site-nav a,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--text-soft);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
}

.site-nav a:hover,
.theme-toggle:hover {
  background: var(--bg-soft);
  color: var(--text);
}

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

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 560px) {
  .site-nav .hide-small {
    display: none;
  }
}

/* ── Language switch: a list of links in a <details>, so it works without JavaScript ── */

.lang-menu {
  position: relative;
}

.lang-menu summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  color: var(--text-soft);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}

.lang-menu summary::-webkit-details-marker {
  display: none;
}

.lang-menu summary:hover,
.lang-menu[open] summary {
  background: var(--bg-soft);
  color: var(--text);
}

.lang-menu summary svg {
  width: 18px;
  height: 18px;
}

.lang-menu ul {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 25;
  min-width: 168px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.site-nav .lang-menu a {
  display: flex;
}

.site-nav .lang-menu a[aria-current="true"] {
  color: var(--brand);
  font-weight: 600;
}

@media (max-width: 560px) {
  .lang-menu .lang-name {
    display: none;
  }

  /* Room for the language and theme switches next to the links on a phone */
  .site-header .wrap {
    gap: 8px;
  }

  .site-nav a,
  .theme-toggle,
  .lang-menu summary {
    padding: 8px;
  }
}

.site-nav a,
.lang-menu summary {
  white-space: nowrap;
}

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

/* The browser's language, offered once under the header (assets/site.js) */
.lang-offer {
  background: var(--bg-tint);
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

.lang-offer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
  padding: 10px 0;
}

.lang-offer p {
  margin: 0;
  color: var(--text-soft);
}

.lang-offer a {
  font-weight: 600;
}

.lang-offer button {
  display: inline-grid;
  place-items: center;
  margin-left: auto;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text-soft);
  cursor: pointer;
}

.lang-offer button:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.lang-offer button svg {
  width: 18px;
  height: 18px;
}

/* ── Buttons ── */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.primary {
  background: var(--brand);
  color: var(--on-brand);
}

.button.primary:hover {
  background: var(--brand-strong);
  color: var(--on-brand);
}

.button.ghost {
  border-color: var(--line);
  color: var(--text);
  background: var(--bg);
}

.button.ghost:hover {
  background: var(--bg-soft);
}

/* ── Hero ── */

.hero {
  position: relative;
  overflow: hidden;
  padding: 72px 0 0;
  background:
    radial-gradient(900px 420px at 85% -10%, var(--brand-soft), transparent 70%),
    radial-gradient(700px 380px at 0% 0%, var(--bg-tint), transparent 70%);
}

.hero-text {
  max-width: 760px;
}

.eyebrow {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

h1 {
  margin: 18px 0 16px;
  font-size: clamp(38px, 6.4vw, 66px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 700;
  text-wrap: balance;
}

/* The tight spacing of the Latin headings would crowd Chinese and Japanese characters; Japanese headings break
   between phrases rather than inside words */
:root:is(:lang(zh), :lang(ja)) :is(h1, h2, h3) {
  letter-spacing: 0;
}

:root:is(:lang(zh), :lang(ja)) h1 {
  line-height: 1.2;
}

:root:lang(ja) :is(h1, h2, h3) {
  word-break: auto-phrase;
}

h1 em {
  font-style: normal;
  color: var(--brand);
}

.lead {
  margin: 0 0 28px;
  font-size: clamp(18px, 2.1vw, 21px);
  color: var(--text-soft);
  max-width: 620px;
  text-wrap: pretty;
}

/* On a translated page: the other guides are in English */
.lang-note {
  margin: -8px 0 24px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--text-soft);
  font-size: 15px;
}

.cta .lang-note {
  margin: 28px auto 0;
  max-width: 620px;
  background: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-shot {
  margin-top: 56px;
  border-radius: 18px 18px 0 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  box-shadow: var(--shadow);
  overflow: hidden;
  background: var(--bg);
}

.window-bar {
  display: flex;
  gap: 7px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
}

.window-bar span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--line);
}

/* ── Sections ── */

section {
  padding: 88px 0;
}

section.soft {
  background: var(--bg-soft);
}

.section-head {
  max-width: 640px;
  margin-bottom: 44px;
}

h2 {
  margin: 0 0 12px;
  font-size: clamp(28px, 3.8vw, 40px);
  line-height: 1.12;
  letter-spacing: -0.025em;
  font-weight: 700;
  text-wrap: balance;
}

.section-head p {
  margin: 0;
  color: var(--text-soft);
  font-size: 18px;
}

.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}

.card {
  padding: 26px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg);
}

.card h3 {
  margin: 14px 0 6px;
  font-size: 19px;
  letter-spacing: -0.01em;
}

.card p {
  margin: 0;
  color: var(--text-soft);
  font-size: 16px;
}

.icon {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-strong);
}

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

/* ── Feature rows with a screenshot ── */

.feature {
  display: grid;
  gap: 40px;
  align-items: center;
  grid-template-columns: 1fr;
}

.feature + .feature {
  margin-top: 88px;
}

@media (min-width: 900px) {
  .feature {
    grid-template-columns: 5fr 7fr;
    gap: 64px;
  }

  .feature.flip .feature-text {
    order: 2;
  }
}

.feature-text h3 {
  margin: 0 0 12px;
  font-size: clamp(24px, 3vw, 30px);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.feature-text p {
  margin: 0 0 16px;
  color: var(--text-soft);
}

.ticks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.ticks li {
  position: relative;
  padding-left: 30px;
  color: var(--text-soft);
}

.ticks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.32em;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--brand-soft)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232563eb' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.2 4.2L19 7'/%3E%3C/svg%3E")
    center / 12px no-repeat;
}

.shot {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
  background: var(--bg);
}

.shot.narrow {
  max-width: 560px;
  margin-inline: auto;
}

.shot.phone {
  max-width: 300px;
  margin-inline: auto;
  border-radius: 34px;
  border-width: 8px;
  border-color: var(--text);
}

/* ── Code blocks ── */

pre {
  margin: 0;
  padding: 20px 22px;
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-text);
  font-family: var(--mono);
  font-size: 14.5px;
  line-height: 1.7;
  overflow-x: auto;
  tab-size: 2;
}

code {
  font-family: var(--mono);
  font-size: 0.9em;
}

:not(pre) > code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.code {
  position: relative;
}

.copy {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: var(--code-dim);
  font: 500 12.5px var(--font);
  cursor: pointer;
}

.copy:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
}

.dim {
  color: var(--code-dim);
}

/* ── Install tabs on the home page ── */

/* Grid children may shrink below the width of a long line of code */
.install > *,
.feature > *,
.grid > * {
  min-width: 0;
}

.install {
  display: grid;
  gap: 40px;
  grid-template-columns: 1fr;
  align-items: start;
}

@media (min-width: 900px) {
  .install {
    grid-template-columns: 4fr 7fr;
    gap: 64px;
  }
}

.steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: 18px;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 46px;
  color: var(--text-soft);
}

.steps li strong {
  display: block;
  color: var(--text);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 2px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 700;
  font-size: 14px;
}

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 12px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.tabs button {
  padding: 7px 14px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--text-soft);
  font: 600 14.5px var(--font);
  cursor: pointer;
}

.tabs button[aria-selected="true"] {
  background: var(--brand);
  color: var(--on-brand);
}

/* ── Closing call to action ── */

.cta {
  text-align: center;
  padding: 96px 0;
  background:
    radial-gradient(700px 300px at 50% 0%, var(--brand-soft), transparent 70%),
    var(--bg);
}

.cta img {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
}

.cta p {
  margin: 0 auto 28px;
  max-width: 520px;
  color: var(--text-soft);
  font-size: 18px;
}

.cta .actions {
  justify-content: center;
}

/* ── Footer ── */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 32px 0 44px;
  color: var(--text-faint);
  font-size: 15px;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  align-items: center;
}

.site-footer a {
  color: var(--text-soft);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--brand);
}

.site-footer .push {
  margin-left: auto;
}

/* ── Guides ── */

.docs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0 0 80px;
}

@media (min-width: 900px) {
  .docs {
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 56px;
  }
}

.docs-nav {
  padding: 20px 0 8px;
  font-size: 15.5px;
}

@media (min-width: 900px) {
  .docs-nav {
    position: sticky;
    top: 64px;
    align-self: start;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    padding: 36px 0 36px;
  }
}

.docs-nav details {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px 14px;
}

.docs-nav summary {
  padding: 8px 0;
  font-weight: 600;
  cursor: pointer;
}

@media (min-width: 900px) {
  .docs-nav details {
    border: 0;
    padding: 0;
  }

  .docs-nav summary {
    display: none;
  }
}

.docs-nav p {
  margin: 22px 0 6px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.docs-nav p:first-of-type {
  margin-top: 4px;
}

.docs-nav p {
  padding-left: 12px;
}

.docs-nav a {
  display: block;
  padding: 6px 12px;
  border-radius: 9px;
  color: var(--text-soft);
  text-decoration: none;
}

.docs-nav a:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.docs-nav a[aria-current="page"] {
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-weight: 600;
}

.article {
  padding: 28px 0 0;
  min-width: 0;
  max-width: 760px;
}

@media (min-width: 900px) {
  .article {
    padding-top: 44px;
  }
}

.article h1 {
  font-size: clamp(32px, 4.6vw, 44px);
  margin: 0 0 10px;
}

.article .lead {
  margin-bottom: 8px;
  font-size: 19px;
}

.article h2 {
  margin: 56px 0 12px;
  padding-top: 8px;
  font-size: 27px;
  border-top: 1px solid var(--line);
  padding-top: 40px;
}

.article h3 {
  margin: 32px 0 8px;
  font-size: 19.5px;
  letter-spacing: -0.01em;
}

.article p,
.article li {
  color: var(--text-soft);
}

.article strong {
  color: var(--text);
}

.article ul,
.article ol {
  padding-left: 22px;
}

.article li {
  margin: 6px 0;
}

.article .code,
.article .shot {
  margin: 18px 0;
}

.article table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 16px;
}

.table-scroll {
  overflow-x: auto;
}

.article th,
.article td {
  padding: 11px 14px 11px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.article th {
  color: var(--text);
  font-size: 13.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.article td {
  color: var(--text-soft);
}

kbd {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  background: var(--bg-soft);
  font: 500 0.86em var(--mono);
  color: var(--text);
  white-space: nowrap;
}

.note {
  margin: 20px 0;
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid var(--warn-line);
  background: var(--warn-bg);
  color: var(--warn-text);
}

.note strong {
  color: inherit;
}

.next {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.guide-toc {
  margin: 24px 0;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-soft);
}

.guide-toc summary {
  cursor: pointer;
  font-weight: 600;
}

.guide-toc ol {
  display: grid;
  gap: 6px;
  padding-left: 22px;
  margin-bottom: 0;
}

.guide-toc a {
  overflow-wrap: anywhere;
}

.next a {
  display: grid;
  gap: 2px;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  min-width: min(100%, 220px);
}

.next a span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-faint);
}

.next a:hover {
  border-color: var(--brand);
}

.next a.forward {
  margin-left: auto;
  text-align: right;
}

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

  .button {
    transition: none;
  }
}
