/* Courier Sort privacy policy. Brand colors from scripts/ui/palette.gd. */

:root {
  --blue: #1677FF;
  --deep-blue: #0D47A1;
  --sky-blue: #58B7FF;
  --yellow: #FFC928;
  --green: #31C95B;

  --bg: #F4F8FF;
  --surface: #FFFFFF;
  --surface-alt: #EAF2FF;
  --text: #182033;
  --muted: #5E687B;
  --border: #D9E4F5;
  --link: #0F5FD6;
  --link-hover: #0D47A1;
  --code-bg: #EEF3FB;
  --placeholder-bg: #FFF1BF;
  --placeholder-text: #6B4B00;
  --hero-from: #0D47A1;
  --hero-to: #1677FF;
  --shadow: 0 1px 2px rgba(13, 71, 161, 0.06), 0 8px 24px rgba(13, 71, 161, 0.08);

  --radius: 16px;
  --gutter: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C1322;
    --surface: #141E33;
    --surface-alt: #1B2844;
    --text: #E6ECF7;
    --muted: #A3AEC3;
    --border: #26355A;
    --link: #7CC4FF;
    --link-hover: #A8D8FF;
    --code-bg: #1D2A47;
    --placeholder-bg: #4A3A0A;
    --placeholder-text: #FFE08A;
    --hero-from: #0A2C73;
    --hero-to: #1259C9;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0C1322;
  --surface: #141E33;
  --surface-alt: #1B2844;
  --text: #E6ECF7;
  --muted: #A3AEC3;
  --border: #26355A;
  --link: #7CC4FF;
  --link-hover: #A8D8FF;
  --code-bg: #1D2A47;
  --placeholder-bg: #4A3A0A;
  --placeholder-text: #FFE08A;
  --hero-from: #0A2C73;
  --hero-to: #1259C9;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  color-scheme: dark;
}

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

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  overflow-x: hidden;
}

a {
  color: var(--link);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:hover {
  color: var(--link-hover);
  text-decoration-thickness: 2px;
}

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

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--code-bg);
  border-radius: 6px;
  padding: 0.1em 0.4em;
  overflow-wrap: anywhere;
}

/* Skip link and placeholder banner ------------------------------------- */

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 10;
  background: var(--surface);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-weight: 600;
}

.skip-link:focus {
  top: 12px;
}

.placeholder-banner {
  background: var(--yellow);
  color: #3A2A00;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  padding: 10px var(--gutter);
}

.placeholder-banner a {
  color: inherit;
}

.placeholder-banner[hidden] {
  display: none;
}

/* Hero ------------------------------------------------------------------ */

.hero {
  background:
    radial-gradient(circle at 85% -20%, rgba(88, 183, 255, 0.45), transparent 55%),
    linear-gradient(135deg, var(--hero-from), var(--hero-to));
  color: #FFFFFF;
  padding: 40px var(--gutter) 72px;
}

.hero-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
}

.app-icon {
  flex: none;
  width: 84px;
  height: 84px;
  filter: drop-shadow(0 6px 14px rgba(5, 20, 60, 0.35));
}

.hero-text {
  flex: 1;
  min-width: 0;
}

.eyebrow {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--yellow);
}

.hero h1 {
  margin: 2px 0 4px;
  font-size: clamp(30px, 6vw, 46px);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.updated {
  margin: 0;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.82);
}

.theme-toggle {
  flex: none;
  align-self: flex-start;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  cursor: pointer;
  transition: background 0.15s ease;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.22);
}

.theme-toggle[hidden] {
  display: none;
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* Layout ---------------------------------------------------------------- */

.layout {
  max-width: 1080px;
  margin: -44px auto 0;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.toc-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}

.toc li {
  counter-increment: toc;
}

.toc a {
  display: flex;
  gap: 10px;
  padding: 6px 10px;
  margin: 0 -10px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  line-height: 1.4;
}

.toc a::before {
  content: counter(toc);
  flex: none;
  width: 1.4em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.toc a:hover {
  background: var(--surface-alt);
}

.toc a.is-active {
  background: var(--surface-alt);
  color: var(--link);
  font-weight: 600;
}

.toc a.is-active::before {
  color: var(--link);
}

main {
  min-width: 0;
  display: grid;
  gap: 20px;
}

main:focus,
section:focus {
  outline: none;
}

section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 22px;
  scroll-margin-top: 16px;
}

section > :last-child {
  margin-bottom: 0;
}

h2 {
  position: relative;
  margin: 0 0 12px;
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: -0.005em;
}

h3 {
  margin: 24px 0 8px;
  font-size: 18px;
  line-height: 1.3;
}

p {
  margin: 0 0 14px;
}

ul,
ol {
  margin: 0 0 16px;
  padding-left: 1.4em;
}

li {
  margin: 4px 0;
}

li::marker {
  color: var(--blue);
}

/* Copy-link button added by script.js */
.anchor-link {
  margin-left: 8px;
  vertical-align: middle;
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.15s ease;
}

.anchor-link svg {
  width: 16px;
  height: 16px;
}

h2:hover .anchor-link,
.anchor-link:focus-visible {
  opacity: 1;
}

.anchor-link:hover {
  background: var(--surface-alt);
  color: var(--link);
}

@media (hover: none) {
  .anchor-link {
    opacity: 0.6;
  }
}

/* Summary --------------------------------------------------------------- */

.summary {
  border-top: 4px solid var(--blue);
}

.facts {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.facts li {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  background: var(--surface-alt);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.fact-mark {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--green);
  position: relative;
}

.fact-mark::after {
  content: "";
  position: absolute;
  left: 7.5px;
  top: 4px;
  width: 5px;
  height: 10px;
  border: solid #FFFFFF;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

/* Steps ----------------------------------------------------------------- */

.steps {
  list-style: none;
  padding: 0;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 2px 0 2px 42px;
  margin: 0 0 12px;
}

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

/* Contact --------------------------------------------------------------- */

.contact-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 16px;
  margin: 0 0 16px;
  padding: 16px 18px;
  background: var(--surface-alt);
  border-radius: 12px;
}

.contact-list dt {
  font-weight: 700;
  color: var(--muted);
}

.contact-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.placeholder {
  background: var(--placeholder-bg);
  color: var(--placeholder-text);
  border-radius: 6px;
  padding: 0.05em 0.35em;
  font-weight: 600;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* Footer ---------------------------------------------------------------- */

.site-footer {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px var(--gutter) 40px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  color: var(--muted);
  font-size: 14px;
}

.site-footer p {
  margin: 0;
}

/* Toast added by script.js */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  transform: translate(-50%, 12px);
  opacity: 0;
  pointer-events: none;
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  box-shadow: var(--shadow);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Wide screens: sticky contents sidebar -------------------------------- */

@media (min-width: 900px) {
  body {
    font-size: 17.5px;
  }

  .hero {
    padding: 56px var(--gutter) 88px;
  }

  .app-icon {
    width: 104px;
    height: 104px;
  }

  .layout {
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 28px;
    margin-top: -52px;
    padding: 0 24px;
    align-items: start;
  }

  .toc {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow: auto;
  }

  section {
    padding: 32px 36px;
  }

  .site-footer {
    padding-left: 24px;
    padding-right: 24px;
  }
}

/* Small phones ---------------------------------------------------------- */

@media (max-width: 420px) {
  body {
    font-size: 16px;
  }

  .hero {
    padding-top: 28px;
  }

  .hero-inner {
    gap: 14px;
  }

  .app-icon {
    width: 64px;
    height: 64px;
  }

  section {
    padding: 20px 16px;
  }

  h2 {
    font-size: 21px;
  }

  .contact-list {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .contact-list dd + dt {
    margin-top: 8px;
  }
}

/* Print ----------------------------------------------------------------- */

@media print {
  :root {
    --bg: #FFFFFF;
    --surface: #FFFFFF;
    --text: #000000;
    --muted: #444444;
    --link: #000000;
    --border: #BBBBBB;
    --shadow: none;
  }

  body {
    font-size: 11pt;
  }

  .skip-link,
  .placeholder-banner,
  .theme-toggle,
  .toc,
  .anchor-link,
  .to-top,
  .toast {
    display: none !important;
  }

  .hero {
    background: none;
    color: #000000;
    padding: 0 0 12pt;
  }

  .eyebrow,
  .updated {
    color: #000000;
  }

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

  section {
    border: 0;
    padding: 0;
    margin: 0 0 14pt;
    break-inside: avoid-page;
  }

  main a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    overflow-wrap: anywhere;
  }
}
