/* ===========================================================================
   FreelancePayouts — main stylesheet
   Light, trustworthy fintech aesthetic. Mobile-first. Theme via CSS variables.
   A small critical subset of this file is inlined in each page <head>; this
   external file is loaded with a non-blocking pattern for the rest.
   =========================================================================== */

:root {
  /* Brand / theme — change these to re-skin the whole site */
  --accent: #1d4ed8;
  --accent-dark: #1733a8;
  --accent-light: #e8efff;
  --accent-contrast: #ffffff;

  /* Neutrals */
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-alt: #f1f5fb;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #475569;
  --text-faint: #64748b;

  /* Feedback */
  --ok: #15803d;
  --ok-bg: #e7f6ec;
  --warn: #b45309;
  --warn-bg: #fef3e2;

  /* Type */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  --fs-base: 1.0625rem;
  --lh: 1.65;

  /* Spacing / shape */
  --maxw: 72rem;
  --maxw-prose: 44rem;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .08);
  --gap: clamp(1rem, 3vw, 2rem);
}

/* ----- Reset / base ------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-dark); }

h1, h2, h3, h4 { line-height: 1.2; font-weight: 800; color: var(--text); margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 5vw, 2.85rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.45rem, 3.5vw, 2rem); letter-spacing: -.01em; margin-top: 1.5em; }
h3 { font-size: 1.2rem; margin-top: 1.6em; }
p { margin: 0 0 1rem; }
ul, ol { padding-left: 1.25rem; }
li { margin: .3rem 0; }
small { font-size: .85rem; }

/* ----- Accessibility helpers --------------------------------------------- */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: .65rem 1rem;
  z-index: 200;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ----- Layout ------------------------------------------------------------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 1.25rem; }
.prose { max-width: var(--maxw-prose); }
.section { padding-block: clamp(1.75rem, 4vw, 3.25rem); }
.section--alt { background: var(--surface-alt); }
/* Kill the leading margin on the first element of a section/prose block so it
   doesn't add to the section's own top padding (was causing large gaps). */
.section > .container > :first-child,
.prose > :first-child { margin-top: 0; }
.lead { font-size: 1.2rem; color: var(--text-muted); }
.center { text-align: center; }
.mt-0 { margin-top: 0; }

/* ----- Header / nav ------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: saturate(150%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex; align-items: center; gap: 1rem;
  min-height: 64px;
}
.brand {
  display: inline-flex; align-items: center; gap: .55rem;
  font-weight: 800; font-size: 1.1rem; color: var(--text);
  text-decoration: none; letter-spacing: -.01em;
}
.brand img { width: 28px; height: 28px; }
.primary-nav { margin-left: auto; }
.primary-nav ul {
  list-style: none; display: flex; gap: .25rem; margin: 0; padding: 0;
  flex-wrap: wrap;
}
.primary-nav a {
  display: inline-block; padding: .5rem .7rem; border-radius: var(--radius-sm);
  color: var(--text-muted); text-decoration: none; font-weight: 600; font-size: .95rem;
}
.primary-nav a:hover, .primary-nav a[aria-current="page"] {
  color: var(--accent); background: var(--accent-light);
}

/* Language switcher */
.lang-switcher { position: relative; }
.lang-switcher > button {
  display: inline-flex; align-items: center; gap: .4rem;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .45rem .7rem; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--text-muted);
}
.lang-switcher > button:hover { border-color: var(--accent); color: var(--accent); }
.lang-switcher__menu {
  position: absolute; right: 0; top: calc(100% + .4rem);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  min-width: 11rem; padding: .35rem; margin: 0; list-style: none;
  display: none;
}
.lang-switcher__menu[data-open="true"] { display: block; }
.lang-switcher__menu a {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .5rem .65rem; border-radius: 7px; text-decoration: none;
  color: var(--text); font-weight: 600;
}
.lang-switcher__menu a:hover { background: var(--accent-light); }
.lang-switcher__menu a[aria-current="true"] { color: var(--accent); }
.lang-switcher__menu a span { color: var(--text-faint); font-weight: 500; }

.menu-toggle { display: none; }

/* ----- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .8rem 1.3rem; border-radius: var(--radius-sm);
  font-weight: 700; font-size: 1rem; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: transform .04s ease, background .15s ease;
  line-height: 1.2;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: var(--accent-contrast); }
.btn--primary:hover { background: var(--accent-dark); color: #fff; }
.btn--ghost { background: var(--surface); color: var(--accent); border-color: var(--border); }
.btn--ghost:hover { border-color: var(--accent); background: var(--accent-light); }
.btn--block { width: 100%; }
.btn--sm { padding: .55rem .85rem; font-size: .9rem; }

/* ----- Hero --------------------------------------------------------------- */
/* The hero already sits inside a .section, so it adds no extra vertical padding
   (the section provides it). Prevents the hero block from doubling the gap. */
.hero { padding-block: 0; }
.hero p.lead { max-width: 40rem; }
.hero__cta { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.5rem; }
.hero__note { margin-top: 1rem; color: var(--text-faint); font-size: .9rem; }

/* ----- Cards / grids ------------------------------------------------------ */
.grid { display: grid; gap: var(--gap); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow-sm);
}
.card h3 { margin-top: 0; }

/* Steps */
.steps { counter-reset: step; }
.steps .card { position: relative; }
.steps .card::before {
  counter-increment: step; content: counter(step);
  display: grid; place-items: center;
  width: 2.1rem; height: 2.1rem; margin-bottom: .8rem;
  background: var(--accent); color: #fff; border-radius: 50%; font-weight: 800;
}

/* ----- Comparison table --------------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
table.compare {
  width: 100%; border-collapse: collapse; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  min-width: 640px;
}
table.compare caption { text-align: left; color: var(--text-faint); font-size: .9rem; padding: .5rem .25rem; }
table.compare th, table.compare td {
  padding: .9rem 1rem; text-align: left; border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.compare thead th { background: var(--surface-alt); font-size: .9rem; color: var(--text-muted); }
table.compare tbody tr:last-child td { border-bottom: 0; }
table.compare .svc { font-weight: 700; }
table.compare td .btn { white-space: nowrap; }

/* Stack the comparison table into cards on small screens */
@media (max-width: 600px) {
  table.compare { min-width: 0; border: 0; background: transparent; }
  table.compare thead { position: absolute; left: -9999px; }
  table.compare tbody tr {
    display: block; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); margin-bottom: 1rem; padding: .35rem .9rem .9rem;
    box-shadow: var(--shadow-sm);
  }
  table.compare td {
    display: flex; justify-content: space-between; gap: 1rem;
    padding: .6rem 0; border-bottom: 1px dashed var(--border); text-align: right;
  }
  table.compare td:last-child { border-bottom: 0; }
  table.compare td::before {
    content: attr(data-label); font-weight: 700; color: var(--text-muted);
    text-align: left; flex: 0 0 8.5rem;
  }
}

/* ----- Badges / notes ----------------------------------------------------- */
.badge {
  display: inline-block; padding: .12rem .5rem; border-radius: 999px;
  font-size: .78rem; font-weight: 700; background: var(--accent-light); color: var(--accent-dark);
}
.verify {
  display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .02em;
  color: var(--warn); background: var(--warn-bg); border: 1px dashed var(--warn);
  padding: 0 .35rem; border-radius: 5px; vertical-align: middle;
}
.note {
  border-left: 4px solid var(--accent); background: var(--accent-light);
  padding: 1rem 1.1rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 1.25rem 0;
}
.note--warn { border-color: var(--warn); background: var(--warn-bg); }
.note p:last-child { margin-bottom: 0; }

/* pros / cons */
.proscons { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.proscons ul { list-style: none; padding: 0; }
.proscons li { padding-left: 1.6rem; position: relative; }
.pros li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 800; }
.cons li::before { content: "–"; position: absolute; left: 0; color: var(--warn); font-weight: 800; }

/* ----- Trust strip -------------------------------------------------------- */
.trust { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.trust .card { text-align: center; }
.trust .icon { font-size: 1.6rem; }

/* ----- FAQ (native details) ---------------------------------------------- */
.faq details {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: .7rem; overflow: hidden;
}
.faq summary {
  cursor: pointer; list-style: none; padding: 1rem 1.1rem; font-weight: 700;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.4rem; color: var(--accent); line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq details > div { padding: 0 1.1rem 1.1rem; color: var(--text-muted); }

/* ----- Breadcrumbs -------------------------------------------------------- */
.breadcrumbs { font-size: .88rem; color: var(--text-faint); padding-block: 1rem; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; padding: 0; margin: 0; }
.breadcrumbs li::after { content: "›"; margin-left: .35rem; color: var(--border); }
.breadcrumbs li:last-child::after { content: ""; }
.breadcrumbs a { color: var(--text-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); }

/* ----- Article / blog ----------------------------------------------------- */
.article-meta { color: var(--text-faint); font-size: .9rem; margin-bottom: 1.5rem; }
.article-meta time { font-weight: 600; }
.prose h2 { margin-top: 2em; }
.prose img { border-radius: var(--radius); margin: 1.5rem 0; }
.tag { font-size: .8rem; background: var(--surface-alt); border: 1px solid var(--border);
  padding: .15rem .55rem; border-radius: 999px; color: var(--text-muted); text-decoration: none; }

.post-list { list-style: none; padding: 0; display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
.post-list article { height: 100%; display: flex; flex-direction: column; }
.post-list h3 { margin-top: 0; }
.post-list a.cover { display: block; }
.post-list .meta { margin-top: auto; color: var(--text-faint); font-size: .85rem; }

/* ----- Email capture ------------------------------------------------------ */
.capture { background: linear-gradient(180deg, var(--accent-light), var(--surface)); }
.capture form { display: flex; flex-wrap: wrap; gap: .6rem; max-width: 30rem; }
.capture input[type="email"] {
  flex: 1 1 14rem; padding: .8rem 1rem; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font: inherit; background: #fff;
}
.capture label.consent { display: flex; gap: .55rem; align-items: flex-start;
  font-size: .85rem; color: var(--text-muted); margin-top: .6rem; }

/* ----- Footer ------------------------------------------------------------- */
.site-footer {
  background: #0b1220; color: #cbd5e1; margin-top: 3rem;
  padding-block: clamp(2.5rem, 6vw, 4rem); font-size: .95rem;
}
.site-footer a { color: #cbd5e1; }
.site-footer a:hover { color: #fff; }
.site-footer h2, .site-footer h3 { color: #fff; }
.footer-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
.footer-grid ul { list-style: none; padding: 0; }
.footer-grid li { margin: .35rem 0; }
.footer-disclosure {
  margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid #1e293b;
  color: #94a3b8; font-size: .85rem; line-height: 1.6;
}

/* ----- Cookie / consent banner -------------------------------------------
   NOTE: class is `cookie-consent`, distinct from the email opt-in label
   `.capture label.consent`, so the two never share the fixed-position styles. */
.cookie-consent {
  position: fixed; inset: auto 1rem 1rem 1rem; z-index: 300;
  max-width: 38rem; margin-inline: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.1rem 1.2rem; display: none;
}
.cookie-consent[data-show="true"] { display: block; }
.cookie-consent p { font-size: .9rem; color: var(--text-muted); }
.cookie-consent .row { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .6rem; }

/* ----- Mobile nav --------------------------------------------------------- */
@media (max-width: 860px) {
  .menu-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 42px; height: 42px; margin-left: auto;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); cursor: pointer; font-size: 1.3rem;
  }
  .primary-nav {
    flex-basis: 100%; margin-left: 0; display: none; order: 3;
  }
  .primary-nav[data-open="true"] { display: block; }
  .primary-nav ul { flex-direction: column; gap: .15rem; padding-bottom: .75rem; }
  .primary-nav a { display: block; }
  .lang-switcher { order: 2; }
}

/* Print: hide chrome */
@media print {
  .site-header, .site-footer, .cookie-consent, .hero__cta, .btn { display: none !important; }
}
