/* Manual de Ferry. Mismos colores y tipografía que la landing (site/index.html). */
:root {
  --bg: #fbfbfd;
  --bg-alt: #f5f5f7;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, .08);
  --accent: #0a72ff;
  --card: #ffffff;
  --code: #f3f3f6;
  --shadow-sm: 0 22px 50px -14px rgba(16, 40, 90, .22), 0 6px 16px -6px rgba(16, 40, 90, .1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0d;
    --bg-alt: #141417;
    --text: #f5f5f7;
    --muted: #a1a1a6;
    --line: rgba(255, 255, 255, .1);
    --card: #1c1c1f;
    --code: #17171a;
    --shadow-sm: 0 22px 50px -14px rgba(0, 0, 0, .7), 0 6px 16px -6px rgba(0, 0, 0, .45);
  }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
h1, h2, h3 { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", system-ui, sans-serif; letter-spacing: -.022em; }

/* ---------- Barra superior ---------- */
nav.top {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--line);
}
nav.top .wrap { display: flex; align-items: center; height: 68px; gap: 18px; }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 600; font-size: 23px; letter-spacing: -.01em; }
.brand img { width: 40px; height: 40px; }
nav.top .here { font-size: 15px; font-weight: 600; color: var(--accent); padding: 4px 12px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 12%, transparent); }
nav.top .links { display: flex; gap: 22px; font-size: 15px; color: var(--muted); margin-left: auto; }
nav.top .links a:hover { color: var(--text); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 22px; border-radius: 999px;
  font-weight: 600; font-size: 16px; white-space: nowrap; transition: transform .15s ease, background .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 8px 22px -8px rgba(10, 114, 255, .7); }
.btn-primary:hover { background: #0866e6; }
.btn-sm { height: 32px; padding: 0 14px; font-size: 13px; }
.lang { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); padding: 6px 10px; border-radius: 999px; }
.lang:hover { color: var(--text); background: color-mix(in srgb, var(--text) 6%, transparent); }
.lang svg { width: 14px; height: 14px; }

/* ---------- Buscador ---------- */
.search { position: relative; display: flex; align-items: center; flex: 0 1 300px; height: 36px; padding: 0 10px; gap: 8px;
  border-radius: 10px; background: color-mix(in srgb, var(--text) 6%, transparent); border: 1px solid transparent; color: var(--muted); }
.search:focus-within { background: var(--card); border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.search svg { width: 15px; height: 15px; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: 15px/1 inherit; font-family: inherit; }
.search input::-webkit-search-cancel-button { display: none; }
.search > kbd { font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--line); background: var(--card); color: var(--muted); }
.search:focus-within > kbd { display: none; }
#results { position: absolute; top: 44px; left: 0; width: min(520px, 92vw); max-height: 70vh; overflow: auto; z-index: 60;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); padding: 6px; color: var(--text); }
#results a { display: block; padding: 9px 12px; border-radius: 9px; }
#results a[aria-selected="true"], #results a:hover { background: var(--accent); color: #fff; }
#results b { display: block; font-size: 14px; font-weight: 600; }
#results span { display: block; font-size: 13px; color: var(--muted); line-height: 1.4; margin-top: 2px; }
#results a[aria-selected="true"] span, #results a:hover span { color: rgba(255, 255, 255, .85); }
#results mark { background: color-mix(in srgb, #ffcc00 45%, transparent); color: inherit; border-radius: 3px; }
#results .none { padding: 14px 12px; color: var(--muted); font-size: 14px; }

/* ---------- Estructura ---------- */
.docs { display: grid; grid-template-columns: 250px minmax(0, 1fr) 210px; gap: 48px; align-items: start; padding-top: 36px; padding-bottom: 80px; }
body.index .docs { grid-template-columns: 250px minmax(0, 1fr); }
.side { position: sticky; top: 92px; max-height: calc(100vh - 112px); overflow: auto; padding-right: 8px; font-size: 14.5px; }
.side summary { display: none; }
.side .sg { margin-bottom: 20px; }
.side .sl { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 0 10px 6px; }
.side a { display: block; padding: 6px 10px; border-radius: 8px; color: color-mix(in srgb, var(--text) 82%, transparent); }
.side a:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.side a[aria-current] { background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent); font-weight: 600; }
main { min-width: 0; max-width: 780px; }
.crumbs { display: flex; gap: 8px; font-size: 13.5px; color: var(--muted); margin-bottom: 14px; }
.crumbs a:hover { color: var(--accent); }
main h1 { font-size: clamp(34px, 4.6vw, 46px); line-height: 1.1; font-weight: 700; }
.lead { font-size: 20px; line-height: 1.5; color: var(--muted); margin: 14px 0 6px; }

/* ---------- Contenido ---------- */
.prose { margin-top: 30px; }
.prose > * + * { margin-top: 16px; }
.prose h2 { font-size: 28px; line-height: 1.2; font-weight: 700; margin-top: 52px; padding-top: 26px; border-top: 1px solid var(--line); scroll-margin-top: 90px; }
.prose h2:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.prose h3 { font-size: 20px; font-weight: 650; margin-top: 32px; scroll-margin-top: 90px; }
.prose h2 + *, .prose h3 + * { margin-top: 12px; }
.anchor { margin-left: .4em; color: var(--accent); opacity: 0; font-weight: 400; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: .7; }
.prose a { color: var(--accent); }
.prose a:hover { text-decoration: underline; text-underline-offset: 3px; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin-top: 6px; padding-left: .2em; }
.prose li > ul, .prose li > ol { margin-top: 6px; }
.prose strong { font-weight: 650; }
code { font: .86em ui-monospace, "SF Mono", Menlo, monospace; padding: .12em .38em; border-radius: 6px; background: color-mix(in srgb, var(--text) 7%, transparent); }
pre { background: var(--code); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; overflow-x: auto; font-size: 14px; line-height: 1.55; }
pre code { padding: 0; background: none; font-size: inherit; }
kbd { font: 600 .82em -apple-system, "SF Pro Text", system-ui, sans-serif; letter-spacing: .06em; white-space: nowrap; padding: .12em .5em; border-radius: 6px;
  background: var(--card); border: 1px solid var(--line); border-bottom-width: 2px; color: var(--text); }
.tw { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: 15px; line-height: 1.5; }
th, td { text-align: left; padding: 10px 14px; vertical-align: top; border-bottom: 1px solid var(--line); }
th { font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: color-mix(in srgb, var(--text) 3%, transparent); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.a-right { text-align: right; } .a-center { text-align: center; }
.callout { border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); border-radius: 0 12px 12px 0; padding: 12px 16px 12px 16px; font-size: 16px; }
.callout .ct { display: block; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); margin-bottom: 2px; }
.callout p + p { margin-top: 8px; }
.callout.tip { border-color: #1fa463; background: color-mix(in srgb, #1fa463 10%, transparent); }
.callout.tip .ct { color: #1fa463; }
.callout.warning { border-color: #e8890c; background: color-mix(in srgb, #e8890c 11%, transparent); }
.callout.warning .ct { color: #e8890c; }

/* ---------- Anterior / siguiente ---------- */
.pn { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 64px; }
.pn a { display: block; padding: 14px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); font-weight: 600; transition: border-color .15s, transform .15s; }
.pn a:hover { border-color: var(--accent); transform: translateY(-1px); }
.pn a span { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted); }
.pn .next { text-align: right; grid-column: 2; }

/* ---------- En esta página ---------- */
.toc { position: sticky; top: 92px; font-size: 13.5px; border-left: 1px solid var(--line); padding-left: 16px; max-height: calc(100vh - 112px); overflow: auto; }
.toc .tl { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.toc a { display: block; padding: 4px 0; color: var(--muted); line-height: 1.35; }
.toc a.l3 { padding-left: 12px; font-size: 13px; }
.toc a:hover { color: var(--text); }
.toc a.on { color: var(--accent); font-weight: 600; }

/* ---------- Índice ---------- */
.grp { margin-top: 46px; scroll-margin-top: 90px; }
.grp h2 { font-size: 24px; margin-bottom: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.card { display: block; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); transition: border-color .15s, transform .15s, box-shadow .15s; }
.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.card strong { display: block; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.card span { display: block; margin-top: 4px; font-size: 14.5px; line-height: 1.45; color: var(--muted); }

/* ---------- Pie ---------- */
footer { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: 13px; }
footer .wrap { display: flex; gap: 20px; flex-wrap: wrap; align-items: center; }
footer .links { margin-left: auto; display: flex; gap: 20px; }
footer .links a:hover { color: var(--text); }
footer .legal { flex-basis: 100%; font-size: 11.5px; line-height: 1.55; color: color-mix(in srgb, var(--muted) 85%, transparent); margin-top: 6px; }

/* ---------- Pantallas pequeñas ---------- */
@media (max-width: 1100px) {
  .docs { grid-template-columns: 230px minmax(0, 1fr); gap: 36px; }
  .toc { display: none; }
}
@media (max-width: 860px) {
  nav.top .links, nav.top .here { display: none; }
  .search { flex: 1 1 auto; }
  .search > kbd { display: none; }
  .docs, body.index .docs { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 20px; }
  .side { position: static; max-height: none; border: 1px solid var(--line); border-radius: 14px; padding: 4px 10px; background: var(--card); }
  .side summary { display: block; cursor: pointer; padding: 10px 6px; font-weight: 600; font-size: 15px; list-style: none; }
  .side summary::-webkit-details-marker { display: none; }
  .side summary::after { content: "▾"; float: right; color: var(--muted); }
  .side[open] summary::after { content: "▴"; }
  .pn { grid-template-columns: 1fr; }
  .pn .next { grid-column: 1; }
}
@media (max-width: 560px) {
  nav.top .wrap { gap: 10px; }
  .brand { font-size: 20px; gap: 8px; } .brand img { width: 32px; height: 32px; }
  .lang { font-size: 0; gap: 0; padding: 6px; } .lang svg { width: 18px; height: 18px; }
  nav.top .btn { display: none; }
  .lead { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .card, .pn a, .btn { transition: none; } }

/* Sin palabras sueltas en la última línea. */
p, li, td { text-wrap: pretty; }
h1, h2, h3 { text-wrap: balance; }
