/* Evabob website — document pages (product guide, user manual) and their PDF print layout. */

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

.doc-hero {
  position: relative;
  margin: 12px;
  padding: clamp(40px, 7vw, 88px) 0 clamp(40px, 6vw, 72px);
  border-radius: var(--r-xl);
  overflow: hidden;
  isolation: isolate;
  background: var(--sky-soft) var(--photo-above) center 65% / cover no-repeat;
}
.doc-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(100deg, rgba(240, 250, 255, 0.95) 0%, rgba(240, 250, 255, 0.82) 42%, rgba(240, 250, 255, 0.1) 75%);
}
.doc-hero--ink { color: var(--white); background-color: var(--ink); }
.doc-hero--ink::before {
  background: linear-gradient(100deg, rgba(11, 22, 32, 0.94) 0%, rgba(11, 22, 32, 0.8) 42%, rgba(11, 22, 32, 0.15) 78%);
}
.doc-hero__inner { display: grid; gap: 20px; }
.doc-hero__inner > * { max-width: 700px; }
.doc-kind {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  font-size: 13px;
}
.doc-kind img { width: 22px; height: 22px; border-radius: 6px; }
.doc-hero h1 {
  font-size: clamp(40px, 6vw, 76px);
  line-height: 1;
  letter-spacing: -0.055em;
  text-wrap: balance;
}
.doc-hero .lede { max-width: 34em; color: var(--slate); font-size: clamp(16px, 1.5vw, 19px); }
.doc-hero--ink .lede { color: rgba(255, 255, 255, 0.78); }
.doc-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.doc-meta span {
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--slate);
  font-size: 13px;
}
.doc-hero--ink .doc-meta span { background: rgba(255, 255, 255, 0.12); color: rgba(255, 255, 255, 0.8); }

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

.doc-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: clamp(32px, 6vw, 88px);
  align-items: start;
  padding-block: clamp(40px, 6vw, 72px) clamp(64px, 8vw, 112px);
}

.toc {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 110px);
  overflow: auto;
  font-size: 14px;
}
.toc__title { margin-bottom: 12px; color: var(--mist); font-size: 13px; }
.toc ol { margin: 0; padding: 0; list-style: none; border-left: 1px solid var(--line); }
.toc ol a {
  display: block;
  margin-left: -1px;
  padding: 7px 0 7px 16px;
  border-left: 2px solid transparent;
  color: var(--slate);
  line-height: 1.35;
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s;
}
.toc ol a:hover { color: var(--ink); }
.toc ol a.is-current { border-left-color: var(--sky); color: var(--ink); }
.toc__pdf { margin-top: 24px; }

@media (max-width: 960px) {
  .doc-layout { grid-template-columns: 1fr; }
  .toc {
    position: static;
    max-height: none;
    padding: 20px;
    border-radius: var(--r-m);
    background: var(--cloud);
  }
  .toc ol { columns: 2; column-gap: 24px; border: 0; }
  .toc ol a { padding-left: 0; border: 0; break-inside: avoid; }
}
@media (max-width: 520px) {
  .toc ol { columns: 1; }
}

/* ---------- Prose ---------- */

.prose { max-width: 740px; }
.prose > section + section { margin-top: clamp(56px, 7vw, 88px); }
.prose h2 {
  margin-bottom: 18px;
  font-size: clamp(30px, 3.6vw, 42px);
  line-height: 1.08;
  letter-spacing: -0.045em;
  text-wrap: balance;
}
.prose h3 {
  margin: 36px 0 10px;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.03em;
}
.prose h4 { margin: 24px 0 6px; font-size: 17px; letter-spacing: -0.01em; }
.prose p,
.prose li { color: #33424e; line-height: 1.7; }
.prose p + p { margin-top: 14px; }
.prose ul,
.prose ol { margin: 14px 0; padding-left: 22px; }
.prose li + li { margin-top: 6px; }
.prose li::marker { color: var(--sky-deep); }
.prose a { color: var(--sky-deep); text-underline-offset: 3px; }
.prose strong { color: var(--ink); }
.prose .intro { color: var(--slate); font-size: 19px; line-height: 1.6; }
.prose code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--cloud);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.86em;
  overflow-wrap: anywhere;
}

/* Where to tap: Home › Send */
.tap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 10px;
  border-radius: 999px;
  background: var(--sky-wash);
  color: var(--sky-deep);
  font-size: 0.88em;
  white-space: nowrap;
}

/* Callouts */
.callout {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 14px;
  margin: 24px 0;
  padding: 18px 20px;
  border-radius: var(--r-m);
  background: var(--cloud);
  border: 1px solid var(--line);
}
.callout svg { margin-top: 3px; color: var(--sky-deep); }
.callout p { margin: 0; font-size: 15px; line-height: 1.6; }
.callout p + p { margin-top: 8px; }
.callout .callout__title { margin-bottom: 2px; color: var(--ink); font-size: 16px; }
.callout--mint { background: #e6fff5; border-color: #b8f5dc; }
.callout--mint svg { color: var(--mint-deep); }
.callout--ink { background: var(--ink); border-color: var(--ink); }
.callout--ink p { color: rgba(255, 255, 255, 0.76); }
.callout--ink .callout__title { color: var(--white); }
.callout--ink a { color: var(--mint); }
.callout--ink svg { color: var(--mint); }

/* Numbered procedures (only for real sequences) */
.procedure { margin: 20px 0; padding: 0; list-style: none; counter-reset: proc; }
.procedure > li {
  position: relative;
  padding: 0 0 22px 52px;
  counter-increment: proc;
}
.procedure > li + li { margin-top: 0; }
.procedure > li::before {
  content: counter(proc);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--mint);
  font-size: 14px;
}
.procedure > li::after {
  content: "";
  position: absolute;
  left: 16.5px;
  top: 40px;
  bottom: 6px;
  width: 1px;
  background: var(--line);
}
.procedure > li:last-child::after { display: none; }
.procedure b { display: block; color: var(--ink); font-size: 17px; letter-spacing: -0.015em; }

/* Feature grid within docs */
.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 24px 0;
}
.cards > div {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-m);
}
.cards h4 { margin: 0 0 6px; }
.cards p { font-size: 15px; line-height: 1.55; }
@media (max-width: 600px) { .cards { grid-template-columns: 1fr; } }

/* Tables */
.table-wrap { margin: 24px 0; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-m); }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; }
.prose th,
.prose td { padding: 12px 16px; text-align: left; vertical-align: top; line-height: 1.5; }
.prose th { background: var(--cloud); color: var(--slate); font-size: 13px; }
.prose tr + tr td { border-top: 1px solid var(--line); }
.prose td:first-child { color: var(--ink); }
.prose td { color: #33424e; }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}
.badge--works { background: #dcfff1; color: #00734b; }
.badge--partial { background: #fff3d6; color: #8a5a00; }
.badge--built { background: var(--sky-wash); color: var(--sky-deep); }
.badge--off { background: #eef1f4; color: var(--slate); }

/* Architecture diagram */
.arch {
  display: grid;
  gap: 10px;
  margin: 28px 0;
  padding: 20px;
  border-radius: var(--r-l);
  background: var(--cloud);
}
.arch__row { display: grid; grid-template-columns: repeat(var(--n, 1), 1fr); gap: 10px; }
.arch__box {
  padding: 14px 16px;
  border-radius: var(--r-s);
  background: var(--white);
  border: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.45;
}
.arch__box b { display: block; color: var(--ink); font-size: 15px; }
.arch__box span { color: var(--slate); font-size: 13px; }
.arch__box--ink { background: var(--ink); border-color: var(--ink); color: var(--white); }
.arch__box--ink span { color: rgba(255, 255, 255, 0.66); }
.arch__box--ink b { color: var(--white); }
.arch__box--sky { background: var(--sky); border-color: var(--sky); }
.arch__box--sky b,
.arch__box--sky span { color: var(--white); }
.arch__link { display: grid; place-items: center; color: var(--mist); font-size: 12px; }
@media (max-width: 600px) { .arch__row { grid-template-columns: 1fr; } }

/* Glossary */
.glossary { display: grid; grid-template-columns: 180px 1fr; margin: 20px 0; border-top: 1px solid var(--line); }
.glossary dt,
.glossary dd { margin: 0; padding: 14px 0; border-bottom: 1px solid var(--line); line-height: 1.55; }
.glossary dt { color: var(--ink); }
.glossary dd { color: #33424e; font-size: 15px; }
@media (max-width: 600px) {
  .glossary { grid-template-columns: 1fr; }
  .glossary dt { padding-bottom: 0; border-bottom: 0; }
}

/* FAQ */
.faq { margin: 20px 0; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--cloud);
  color: var(--sky-deep);
  transition: transform 0.3s var(--ease-spring);
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details > div { padding: 0 0 20px; }

/* Phone figure */
.figure {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 28px;
  align-items: center;
  margin: 28px 0;
  padding: 24px;
  border-radius: var(--r-l);
  background: var(--sky-wash) var(--photo-soft) center / cover no-repeat;
}
.figure img { width: 100%; filter: drop-shadow(0 20px 26px rgba(0, 50, 110, 0.3)); }
.figure figcaption {
  padding: 18px;
  border-radius: var(--r-m);
  background: rgba(255, 255, 255, 0.9);
  color: #33424e;
  font-size: 15px;
  line-height: 1.6;
}
.figure figcaption b { display: block; margin-bottom: 4px; color: var(--ink); font-size: 17px; }
@media (max-width: 600px) {
  .figure { grid-template-columns: 1fr; }
  .figure img { width: 60%; margin: 0 auto; }
}

.addr { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; overflow-wrap: anywhere; }

.doc-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 72px;
  padding: 28px;
  border-radius: var(--r-l);
  background: var(--ink);
  color: var(--white);
}
.doc-end p { color: rgba(255, 255, 255, 0.72); font-size: 15px; }
.doc-end h2 { margin: 0 0 4px; font-size: 24px; letter-spacing: -0.03em; }

/* Screen-only / print-only helpers */
.print-only { display: none; }

/* =====================================================================
   PRINT / PDF
   Produces the downloadable A4 documents (see scripts/pdf.mjs).
   ===================================================================== */

@page {
  size: A4;
  margin: 20mm 18mm 22mm;

  /* @bottom-left content is set per page in an inline <style>. */
  @bottom-left {
    font-family: "Numans", sans-serif;
    font-size: 8pt;
    color: #8595a2;
  }
  @bottom-right {
    content: counter(page) " / " counter(pages);
    font-family: "Numans", sans-serif;
    font-size: 8pt;
    color: #8595a2;
  }
}
@page :first {
  margin: 0;
  @bottom-left { content: none; }
  @bottom-right { content: none; }
}

@media print {
  html { scroll-behavior: auto; }
  body {
    font-size: 10.5pt;
    line-height: 1.55;
    background: #fff;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  *,
  *::before,
  *::after { animation: none !important; transition: none !important; }

  .topbar,
  .doc-hero,
  .toc,
  .footer,
  .skip,
  .no-print { display: none !important; }
  .print-only { display: block; }

  .wrap { width: auto; }
  .doc-layout { display: block; padding: 0; }
  .prose { max-width: none; }
  .prose > section + section { margin-top: 11mm; }
  .prose > .print-toc + section { margin-top: 0; }

  /* Cover */
  .print-cover {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 210mm;
    height: 297mm;
    padding: 24mm 20mm;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(172deg, #006fc0 0%, #00a6f2 42%, #9fdcff 72%, #e8f7ff 100%);
    break-after: page;
  }
  .print-cover::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 48%;
    background: var(--photo-above) center 70% / cover no-repeat;
    -webkit-mask-image: linear-gradient(to top, #000 45%, transparent);
    mask-image: linear-gradient(to top, #000 45%, transparent);
  }
  .print-cover--ink { background: linear-gradient(172deg, #0b1620 0%, #12324a 45%, #4bb8e8 76%, #e8f7ff 100%); }
  .print-cover > * { position: relative; z-index: 1; }
  .print-cover__brand { display: flex; align-items: center; gap: 10px; font-size: 16pt; letter-spacing: -0.02em; }
  .print-cover__brand img { width: 12mm; height: 12mm; border-radius: 3mm; }
  .print-cover__kind {
    align-self: flex-start;
    margin-top: 58mm;
    padding: 2mm 5mm;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.4);
    font-size: 10pt;
  }
  .print-cover h1 {
    margin-top: 8mm;
    font-size: 44pt;
    line-height: 1;
    letter-spacing: -0.05em;
  }
  .print-cover p { max-width: 130mm; margin-top: 7mm; font-size: 13pt; line-height: 1.45; color: rgba(255, 255, 255, 0.9); }
  .print-cover__foot {
    position: absolute;
    left: 20mm;
    right: 20mm;
    bottom: 18mm;
    display: flex;
    justify-content: space-between;
    color: #0b1620;
    font-size: 9pt;
  }

  /* Contents page */
  .print-toc { break-after: page; }
  .print-toc h2 { margin-bottom: 8mm; font-size: 26pt; letter-spacing: -0.04em; }
  .print-toc ol { margin: 0; padding: 0; list-style: none; counter-reset: ptoc; }
  .print-toc li {
    display: flex;
    gap: 6mm;
    padding: 1.5mm 0;
    border-bottom: 0.3mm solid #dde9f0;
    font-size: 11pt;
    counter-increment: ptoc;
  }
  .print-toc li::before { content: counter(ptoc, decimal-leading-zero); color: #007ea8; font-size: 10pt; min-width: 8mm; }
  .print-toc .print-toc__note { margin-top: 5mm; color: #5a6b78; font-size: 9.5pt; line-height: 1.5; }

  /* Sections flow; the contents page already ends with a page break. */
  .prose h2 + p,
  .prose h3 + p { break-before: avoid; }
  .prose h2 { font-size: 22pt; margin-bottom: 4mm; break-after: avoid; }
  .prose h3 { font-size: 13.5pt; margin: 7mm 0 2mm; break-after: avoid; }
  .prose h4 { break-after: avoid; }
  .prose .intro { font-size: 12pt; }
  .prose p,
  .prose li { orphans: 3; widows: 3; break-inside: avoid; }
  .prose section.keep { break-inside: avoid; }
  .prose a { color: #007ea8; text-decoration: none; }
  .prose a[data-print-url]::after { content: " (" attr(data-print-url) ")"; color: #5a6b78; font-size: 0.9em; }

  .callout,
  .cards > div,
  .figure,
  .arch,
  .prose tr,
  .procedure > li,
  .faq details,
  .glossary dt,
  .glossary dd { break-inside: avoid; }
  .table-wrap { overflow: visible; }
  .page-start { break-before: page; }
  .prose > section.page-start { margin-top: 0; }
  .prose table { font-size: 9.5pt; }
  .prose th,
  .prose td { padding: 2.2mm 3mm; }
  .figure { grid-template-columns: 38mm 1fr; padding: 5mm; }
  .cards { gap: 3mm; }
  .cards > div { padding: 4mm; }

  /* Show every answer in the PDF (main.js also opens them before printing) */
  .faq details::details-content { content-visibility: visible; display: block; }
  .faq summary::after { display: none; }

  .doc-end { display: none; }
}
