/* =========================================================
   freightbill.org — design tokens + base styles
   Light, professional palette inspired by logistics/maritime.
   ========================================================= */

:root {
  --c-ink: #1f2a44;
  --c-ink-soft: #475069;
  --c-muted: #6b7896;
  --c-bg: #fbfaf7;
  --c-bg-card: #ffffff;
  --c-bg-sunken: #f1ede4;
  --c-rule: #e3dcc9;
  --c-primary: #0b5394;
  --c-primary-soft: #e6effa;
  --c-primary-ink: #073968;
  --c-accent: #f5a623;
  --c-accent-soft: #fcefd6;
  --c-success: #2e8b57;
  --c-success-soft: #e3f3ea;
  --c-danger: #b3261e;
  --c-code-bg: #f6f2e7;
  --c-inline-code-bg: #efeadb;
  --c-inline-code-ink: #5a3b0e;
  --c-link: #0b5394;
  --c-link-hover: #f5a623;

  --shadow-sm: 0 1px 2px rgba(31, 42, 68, 0.06);
  --shadow-md: 0 6px 18px rgba(31, 42, 68, 0.08);
  --shadow-lg: 0 18px 40px rgba(31, 42, 68, 0.12);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --header-h: 72px;

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

  --page-max: clamp(72ch, 94vw, 1700px);
  --content-max: clamp(60ch, 88vw, 1320px);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--c-link);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 160ms ease, border-color 160ms ease;
}
a:hover, a:focus-visible {
  color: var(--c-link-hover);
  border-bottom-color: currentColor;
}

img, svg { max-width: 100%; }

::selection { background: var(--c-accent-soft); color: var(--c-primary-ink); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--c-primary);
  color: #fff;
  padding: 12px 18px;
  z-index: 1000;
}
.skip-link:focus { left: 8px; top: 8px; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 250, 247, 0.92);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--c-rule);
}

.header-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: var(--header-h);
}

.brand {
  display: flex; align-items: center; gap: 12px;
  color: var(--c-ink);
  border-bottom: none;
  font-weight: 600;
}
.brand:hover { color: var(--c-primary); border-bottom: none; }
.brand-logo svg { width: 40px; height: 40px; display: block;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.05)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-title { font-size: 1.05rem; letter-spacing: 0.01em; }
.brand-sub { font-size: 0.78rem; color: var(--c-muted); }

.primary-nav { margin-left: auto; }
.primary-nav ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; gap: 4px; flex-wrap: wrap;
}
.primary-nav a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  color: var(--c-ink-soft);
  font-weight: 500; font-size: 0.95rem;
  border-bottom: none;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}
.primary-nav a:hover, .primary-nav a:focus-visible {
  background: var(--c-primary-soft);
  color: var(--c-primary-ink);
  transform: translateY(-1px);
}
.primary-nav a[aria-current="page"] {
  background: var(--c-primary);
  color: #fff;
}
.primary-nav a[aria-current="page"] .nav-icon { fill: #fff; }
.nav-icon { width: 18px; height: 18px; fill: currentColor; flex: 0 0 18px; }

.nav-toggle {
  display: none;
  margin-left: auto;
  width: 42px; height: 42px;
  border: 1px solid var(--c-rule);
  background: var(--c-bg-card);
  border-radius: var(--radius-md);
  cursor: pointer;
  padding: 0;
  align-items: center; justify-content: center;
  gap: 4px; flex-direction: column;
}
.nav-toggle-bar {
  display: block; width: 20px; height: 2px;
  background: var(--c-ink); border-radius: 2px;
}

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .primary-nav {
    position: absolute; left: 12px; right: 12px; top: calc(var(--header-h) + 6px);
    background: var(--c-bg-card);
    border: 1px solid var(--c-rule);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 12px;
    display: none;
  }
  .primary-nav.open { display: block; }
  .primary-nav ul { flex-direction: column; gap: 2px; }
  .primary-nav a { width: 100%; }
}

/* ---------- Main / layout ---------- */

.site-main {
  flex: 1 0 auto;
  max-width: var(--page-max);
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* Anchor-target scroll offset accounting for sticky header */
:where(h1, h2, h3, h4, h5, h6, [id]) { scroll-margin-top: calc(var(--header-h) + 16px); }

/* ---------- Typography ---------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  color: var(--c-ink);
  line-height: 1.25;
  margin: 1.8em 0 0.6em;
  letter-spacing: -0.005em;
}

.content-body h1, .hero-title {
  font-size: clamp(2rem, 1.4rem + 2.2vw, 2.9rem);
  margin-top: 0.2em;
  background: linear-gradient(120deg, var(--c-primary) 0%, var(--c-accent) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.content-body h2 {
  font-size: clamp(1.4rem, 1.05rem + 1.2vw, 1.85rem);
  padding-bottom: 0.25em;
  border-bottom: 2px solid var(--c-rule);
  color: var(--c-primary-ink);
}

.content-body h3 {
  font-size: clamp(1.15rem, 1rem + 0.5vw, 1.35rem);
  color: var(--c-primary);
}

.content-body h4 { color: var(--c-ink); font-size: 1.05rem; }

.content-body p, .content-body li {
  color: var(--c-ink-soft);
  font-size: 1.02rem;
}

.content-body p { margin: 0 0 1.1em; }

.content-body strong { color: var(--c-ink); }

.heading-link { color: inherit; border-bottom: none; }
.heading-link:hover { color: var(--c-link-hover); }

/* ---------- Links inside prose ---------- */

.content-body a, .hero a, .related-list a, .footer-inner a {
  color: var(--c-link);
  border-bottom: 1px solid rgba(11, 83, 148, 0.25);
}
.content-body a:hover, .hero a:hover, .related-list a:hover, .footer-inner a:hover {
  color: var(--c-link-hover);
  border-bottom-color: var(--c-link-hover);
}

/* ---------- Inline code ---------- */

:not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  background: var(--c-inline-code-bg);
  color: var(--c-inline-code-ink);
  padding: 0.05em 0.4em;
  border-radius: 4px;
  border: none;
}

/* ---------- Code blocks ---------- */

pre[class*="language-"], pre {
  background: var(--c-code-bg);
  color: #2b2b2b;
  border-radius: var(--radius-md);
  padding: 18px 20px;
  overflow-x: auto;
  font-size: 0.92rem;
  line-height: 1.55;
  box-shadow: var(--shadow-sm) inset;
  border: 1px solid var(--c-rule);
  font-family: var(--font-mono);
  position: relative;
}

pre code { background: transparent; color: inherit; padding: 0; font-size: inherit; }

.code-wrap { position: relative; margin: 1.4em 0; }
.code-copy {
  position: absolute;
  top: 8px; right: 8px;
  background: var(--c-bg-card);
  color: var(--c-primary-ink);
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 10px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 140ms ease, background 140ms ease, color 140ms ease;
}
.code-wrap:hover .code-copy,
.code-copy:focus-visible { opacity: 1; }
.code-copy:hover { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.code-copy.copied { background: var(--c-success); color: #fff; border-color: var(--c-success); opacity: 1; }

/* Prism light palette tuned to site */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #8a7a55; font-style: italic; }
.token.punctuation { color: #555; }
.token.property, .token.tag, .token.boolean, .token.number, .token.constant, .token.symbol { color: #b3261e; }
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin { color: #2e8b57; }
.token.operator, .token.entity, .token.url, .language-css .token.string, .style .token.string { color: #0b5394; }
.token.atrule, .token.attr-value, .token.keyword { color: #6a1b9a; font-weight: 600; }
.token.function, .token.class-name { color: #0b5394; font-weight: 600; }
.token.regex, .token.important, .token.variable { color: #b25f00; }

/* ---------- Blockquotes ---------- */

.content-body blockquote {
  border-left: 4px solid var(--c-primary);
  background: var(--c-primary-soft);
  margin: 1.4em 0;
  padding: 12px 18px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  color: var(--c-primary-ink);
}

/* ---------- Tables ---------- */

.table-wrap { width: 100%; overflow-x: auto; margin: 1.4em 0;
  border-radius: var(--radius-md); border: 1px solid var(--c-rule);
  box-shadow: var(--shadow-sm); }
.content-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  background: var(--c-bg-card);
}
.content-body th, .content-body td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-rule);
}
.content-body th {
  background: var(--c-primary-soft);
  color: var(--c-primary-ink);
  font-weight: 600;
  position: sticky; top: 0;
}
.content-body tbody tr:hover { background: var(--c-bg-sunken); }

/* ---------- Lists ---------- */

.content-body ul, .content-body ol {
  padding-left: 1.4em;
  margin: 0 0 1.2em;
}
.content-body li { margin: 0.25em 0; }

/* Task lists: hide bullet, show checkbox interactively */
.content-body li.task-list-item,
.content-body ul.contains-task-list > li {
  list-style: none;
  margin-left: -1em;
  padding-left: 0;
}
.content-body ul.contains-task-list { padding-left: 0.5em; }
.content-body li.task-list-item > input[type="checkbox"],
.content-body li.task-list-item .task-list-item-checkbox {
  margin: 0 0.55em 0 0;
  transform: translateY(2px);
  width: 1.05em; height: 1.05em;
  accent-color: var(--c-primary);
  cursor: pointer;
}
.content-body li.task-list-item.done > label,
.content-body li.task-list-item.done {
  color: var(--c-muted);
  text-decoration: line-through;
  text-decoration-color: var(--c-muted);
}

/* ---------- FAQ accordions ---------- */

details.faq, .content-body details {
  background: var(--c-bg-card);
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-md);
  padding: 0;
  margin: 0.6em 0;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 160ms ease;
}
details.faq[open], .content-body details[open] {
  box-shadow: var(--shadow-md);
}
details.faq summary, .content-body details summary {
  cursor: pointer;
  padding: 14px 18px;
  font-weight: 600;
  color: var(--c-primary-ink);
  list-style: none;
  position: relative;
}
details.faq summary::-webkit-details-marker,
.content-body details summary::-webkit-details-marker { display: none; }
details.faq summary::after, .content-body details summary::after {
  content: "+";
  position: absolute; right: 18px; top: 50%;
  transform: translateY(-50%); font-size: 1.4rem;
  color: var(--c-accent);
  transition: transform 200ms ease;
}
details.faq[open] summary::after, .content-body details[open] summary::after {
  content: "−";
}
details.faq .faq-body, .content-body details > *:not(summary) {
  padding: 0 18px 14px;
  color: var(--c-ink-soft);
}

/* ---------- Breadcrumbs ---------- */

.breadcrumbs { margin: 0 0 1.4em; font-size: 0.9rem; }
.breadcrumbs ol {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 4px 0;
}
.breadcrumbs li { display: inline-flex; align-items: center; color: var(--c-muted); }
.breadcrumbs li + li::before {
  content: "›";
  margin: 0 8px;
  color: var(--c-muted);
}
.breadcrumbs a { color: var(--c-muted); border-bottom: none; }
.breadcrumbs a:hover { color: var(--c-primary); }
.breadcrumbs [aria-current="page"] { color: var(--c-ink); font-weight: 600; }

/* ---------- Content body container ---------- */

.content-page { display: flex; flex-direction: column; gap: 0; }
.content-body {
  max-width: var(--content-max);
  width: 100%;
  margin: 0;
}

@media (min-width: 1100px) {
  .content-body { font-size: 1.05rem; }
}

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

.hero {
  display: grid;
  gap: 28px;
  padding: 32px 0 12px;
  text-align: center;
  justify-items: center;
  width: 100%;
}

.hero > * { width: 100%; }

.hero-logo {
  margin: 0 0 16px;
  display: flex;
  justify-content: center;
}
.hero-logo svg {
  width: clamp(120px, 18vw, 200px);
  height: auto;
  filter: drop-shadow(0 8px 20px rgba(11,83,148,0.18));
}

.hero-tagline {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-primary);
  background: var(--c-primary-soft);
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  margin-bottom: 6px;
}

.hero-lede {
  font-size: clamp(1.05rem, 0.95rem + 0.4vw, 1.2rem);
  color: var(--c-ink-soft);
  margin-inline: 0;
}

.cta-row {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin: 12px 0 8px;
  width: 100%;
  text-align: left;
}

.section-intro {
  text-align: center;
  max-width: 72ch;
  margin: 32px auto 12px;
}
.section-intro h2 {
  border-bottom: none;
  padding-bottom: 0;
}

.cta {
  display: flex; align-items: center; gap: 14px;
  background: var(--c-bg-card);
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
  color: var(--c-ink);
  border-bottom: 1px solid var(--c-rule);
}
.cta:hover, .cta:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--c-primary);
  color: var(--c-ink);
}
.cta-icon {
  width: 48px; height: 48px;
  flex: 0 0 48px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
}
.cta-icon svg { width: 26px; height: 26px; fill: #fff; }
.cta-1 .cta-icon { background: linear-gradient(135deg, #0b5394, #1f78c1); }
.cta-2 .cta-icon { background: linear-gradient(135deg, #2e8b57, #6ab187); }
.cta-3 .cta-icon { background: linear-gradient(135deg, #f5a623, #e67c00); }
.cta-title { display: block; font-weight: 700; color: var(--c-primary-ink); margin-bottom: 2px; }
.cta-sub { display: block; font-size: 0.92rem; color: var(--c-muted); }

/* Section cards */

.section-grid {
  display: grid;
  gap: 28px;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  margin: 28px 0;
}

.section-card {
  background: var(--c-bg-card);
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 200ms ease, box-shadow 200ms ease;
  display: flex;
  flex-direction: column;
}
.section-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.section-card h2 {
  margin-top: 0;
  font-size: 1.2rem;
  color: var(--c-primary-ink);
  border: none;
  padding: 0;
}
.section-card h2 a { color: inherit; border-bottom: none; }
.section-card h2 a:hover { color: var(--c-link-hover); }
.section-card p { color: var(--c-ink-soft); font-size: 0.97rem; }
.section-card ul { list-style: none; padding: 0; margin: 0 0 8px; }
.section-card li { margin: 4px 0; }
.section-card li a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--c-primary);
  font-size: 0.95rem;
  border-bottom: none;
}
.section-card li a:hover { color: var(--c-link-hover); }
.section-card li a::before { content: "›"; color: var(--c-accent); font-weight: 700; }
.section-card .more {
  margin-top: auto;
  padding-top: 12px;
  font-weight: 600;
  color: var(--c-primary);
}

/* ---------- Related content ---------- */

.related {
  margin-top: 48px;
  padding: 22px 24px;
  background: var(--c-bg-card);
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  max-width: var(--content-max);
}
.related h2 { margin: 0 0 12px; font-size: 1.1rem; color: var(--c-primary-ink); border: none; padding: 0; }
.related-list { list-style: none; padding: 0; margin: 0;
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.related-list a {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--c-bg-sunken);
  border-bottom: none;
  color: var(--c-primary-ink);
  transition: background 160ms ease, transform 160ms ease;
}
.related-list a:hover {
  background: var(--c-primary-soft);
  transform: translateX(2px);
  color: var(--c-primary-ink);
}
.related-arrow { color: var(--c-accent); font-weight: 700; }

/* ---------- Mermaid ---------- */
.mermaid {
  background: var(--c-bg-card);
  border: 1px solid var(--c-rule);
  border-radius: var(--radius-md);
  padding: 18px;
  margin: 1.4em 0;
  text-align: center;
  overflow-x: auto;
}

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

.site-footer {
  background: var(--c-primary-ink);
  color: #dde6f1;
  margin-top: 64px;
}
.site-footer a { color: #cdd9ea; border-bottom: 1px solid transparent; }
.site-footer a:hover { color: var(--c-accent); border-bottom-color: var(--c-accent); }
.footer-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 40px 24px 32px;
  display: grid;
  gap: 28px;
  grid-template-columns: 1.4fr 1fr auto;
  align-items: start;
}
.footer-brand { display: flex; gap: 14px; align-items: flex-start; }
.footer-logo svg { width: 44px; height: 44px; }
.footer-brand p { margin: 0; color: #c0cee0; max-width: 38ch; }
.site-footer nav h2 { margin: 0 0 8px; font-size: 0.95rem; letter-spacing: 0.05em; text-transform: uppercase; color: #f5a623; }
.site-footer nav ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.footer-meta p { margin: 0; color: #95a5c4; font-size: 0.9rem; }

@media (max-width: 720px) {
  .footer-inner { grid-template-columns: 1fr; }
  .header-inner { padding: 10px 16px; }
  .site-main { padding: 20px 16px 48px; }
}
