/* ============================================================
   SmawPaw — handbook.css
   The generated handbook: screen preview + print/PDF output.
   Themes are CSS-variable swaps on #handbook.
   ============================================================ */

#handbook {
  --hb-accent: #E0662F;
  --hb-accent-deep: #C4531D;
  --hb-soft: #FBEADD;
  --hb-ink: #2B2521;
  --hb-muted: #6E6156;
  --hb-paper: #FFFFFF;
  --hb-line: #EFE4D4;
  font-family: "Nunito", "Segoe UI", system-ui, sans-serif;
  color: var(--hb-ink);
  font-size: 14px;
  line-height: 1.55;
}
#handbook.theme-meadow {
  --hb-accent: #3E7C4F; --hb-accent-deep: #2E6540; --hb-soft: #E7F2E4; --hb-line: #DCEAD8;
}
#handbook.theme-dusk {
  --hb-accent: #39466F; --hb-accent-deep: #2A3557; --hb-soft: #E8ECF7; --hb-line: #DCE2F0;
}
#handbook.theme-bubblegum {
  --hb-accent: #D64F8E; --hb-accent-deep: #B93A75; --hb-soft: #FBE4EF; --hb-line: #F3D7E4;
}

#handbook h1, #handbook h2, #handbook h3, #handbook h4 {
  font-family: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
}

.hb-page {
  background: var(--hb-paper);
  width: 100%;
  max-width: 794px;
  margin: 0 auto 20px;
  padding: 44px 48px;
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(43, 37, 33, 0.1);
  position: relative;
  overflow: hidden;
}

/* ---------- Cover ---------- */

.hb-cover {
  text-align: center;
  padding-top: 60px;
  padding-bottom: 56px;
}
.hb-cover-band {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 16px;
  background: var(--hb-accent);
}
.hb-paw-row {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-bottom: 26px;
  opacity: 0.9;
}
.hb-paw-row svg { width: 22px; height: 22px; transform: rotate(-12deg); }
.hb-paw-row svg:nth-child(2n) { transform: rotate(10deg) translateY(-6px); }
.hb-photo {
  width: 168px; height: 168px;
  border-radius: 50%;
  margin: 0 auto 22px;
  background: var(--hb-soft);
  border: 5px solid var(--hb-accent);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.hb-photo img { width: 100%; height: 100%; object-fit: cover; }
.hb-photo svg { width: 84px; height: 84px; }
.hb-cover h1 { font-size: 40px; margin-bottom: 6px; }
.hb-cover .hb-tagline {
  color: var(--hb-muted);
  font-size: 16px;
  margin-bottom: 26px;
}
.hb-cover .hb-dates {
  display: inline-block;
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--hb-accent-deep);
  background: var(--hb-soft);
  border-radius: 999px;
  padding: 9px 24px;
  margin-bottom: 34px;
}
.hb-cover-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  text-align: left;
  max-width: 520px;
  margin: 0 auto;
}
.hb-cover-cell {
  border: 1.5px solid var(--hb-line);
  border-radius: 12px;
  padding: 12px 16px;
}
.hb-cover-cell .k {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--hb-muted);
  margin-bottom: 2px;
}
.hb-cover-cell .v { font-weight: 700; font-size: 15px; }
.hb-cover-foot {
  margin-top: 34px;
  color: var(--hb-muted);
  font-size: 12px;
}

/* ---------- Section pages ---------- */

.hb-h2 {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 25px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--hb-accent);
  margin-bottom: 20px;
}
.hb-h2 .hb-h2-icon {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--hb-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
  flex: none;
}
.hb-h2 .hb-h2-pet {
  margin-left: auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--hb-muted);
  font-family: "Nunito", system-ui, sans-serif;
}

.hb-box {
  border: 1.5px solid var(--hb-line);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 14px;
  break-inside: avoid;
}
.hb-box h3 {
  font-size: 15px;
  color: var(--hb-accent-deep);
  margin-bottom: 6px;
}
.hb-box p { margin: 0; white-space: pre-wrap; }
.hb-box p + p { margin-top: 6px; }

.hb-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hb-kv .hb-box { margin-bottom: 0; }

.hb-empty { color: var(--hb-muted); font-style: italic; }

/* Emergency block */
.hb-emergency {
  border: 3px solid var(--hb-accent);
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 16px;
  break-inside: avoid;
}
.hb-emergency .hb-em-head {
  background: var(--hb-accent);
  color: #fff;
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 600;
  font-size: 16px;
  padding: 9px 16px;
  letter-spacing: 0.03em;
}
.hb-em-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.hb-em-cell {
  padding: 11px 16px;
  border-top: 1px solid var(--hb-line);
}
.hb-em-cell:nth-child(odd) { border-right: 1px solid var(--hb-line); }
.hb-em-cell .k {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--hb-muted);
}
.hb-em-cell .v { font-weight: 800; font-size: 16px; }
.hb-em-cell .v.small { font-size: 13.5px; font-weight: 700; }

/* Tables */
.hb-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 14px;
  break-inside: avoid;
  font-size: 13.5px;
}
.hb-table th {
  background: var(--hb-soft);
  color: var(--hb-accent-deep);
  font-family: "Fredoka", system-ui, sans-serif;
  font-weight: 600;
  text-align: left;
  padding: 8px 12px;
  font-size: 12.5px;
  letter-spacing: 0.04em;
}
.hb-table td {
  border-bottom: 1px solid var(--hb-line);
  padding: 8px 12px;
  vertical-align: top;
}
.hb-table tr:last-child td { border-bottom: none; }
.hb-table .cell-strong { font-weight: 800; }

/* At-a-glance chips */
.hb-glance { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.hb-chip {
  background: var(--hb-soft);
  color: var(--hb-accent-deep);
  border-radius: 999px;
  font-weight: 800;
  font-size: 12.5px;
  padding: 6px 14px;
}

/* Wallet card */
.hb-wallet-wrap { margin-top: 8px; }
.hb-cutline {
  color: var(--hb-muted);
  font-size: 11.5px;
  margin-bottom: 8px;
}
.hb-wallet {
  width: 340px;
  border: 2px dashed var(--hb-muted);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  gap: 14px;
  align-items: center;
  break-inside: avoid;
}
.hb-wallet .hb-wphoto {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--hb-soft);
  border: 2px solid var(--hb-accent);
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.hb-wallet .hb-wphoto img { width: 100%; height: 100%; object-fit: cover; }
.hb-wallet .hb-wphoto svg { width: 32px; height: 32px; }
.hb-wallet h4 { font-size: 17px; margin-bottom: 2px; }
.hb-wallet .wline { font-size: 11.5px; font-weight: 700; color: var(--hb-muted); }
.hb-wallet .wline b { color: var(--hb-ink); }

/* Footer on every content page */
.hb-foot {
  margin-top: 22px;
  padding-top: 10px;
  border-top: 1px solid var(--hb-line);
  display: flex;
  justify-content: space-between;
  color: var(--hb-muted);
  font-size: 10.5px;
}

/* ---------- Premium extras ---------- */

/* Daily report card */
.hb-report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
.hb-report-box {
  border: 1.5px solid var(--hb-line);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 74px;
}
.hb-report-box .k {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--hb-accent-deep);
  margin-bottom: 6px;
}
.hb-mood-row { display: flex; gap: 14px; font-size: 20px; padding: 4px 2px; }
.hb-mood-row span { filter: grayscale(0.15); }
.hb-checks { font-size: 13px; line-height: 2; }
.hb-checks .cb {
  display: inline-block;
  width: 13px; height: 13px;
  border: 1.6px solid var(--hb-muted);
  border-radius: 3px;
  margin-right: 8px;
  vertical-align: -2px;
}
.hb-writein {
  border-bottom: 1.4px solid var(--hb-line);
  height: 26px;
}
.hb-writein + .hb-writein { margin-top: 8px; }

/* Log grids (medication / feeding) */
.hb-log th, .hb-log td { font-size: 12px; }
.hb-log td { height: 30px; }

/* Checklist (travel pack) */
.hb-checklist { columns: 2; column-gap: 28px; font-size: 13.5px; line-height: 2.1; }
.hb-checklist div { break-inside: avoid; }
.hb-checklist .cb {
  display: inline-block;
  width: 14px; height: 14px;
  border: 1.6px solid var(--hb-muted);
  border-radius: 4px;
  margin-right: 9px;
  vertical-align: -2px;
}

/* ============================================================
   PRINT
   ============================================================ */

@page {
  size: A4;
  margin: 12mm;
}

@media print {
  body { background: #fff !important; }
  body * { visibility: hidden; }
  #handbook, #handbook * { visibility: visible; }
  #handbook {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    font-size: 13px;
  }
  .hb-page {
    box-shadow: none;
    border-radius: 0;
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 6mm 4mm;
    break-after: page;
  }
  .hb-page:last-child { break-after: auto; }
  .hb-cover { min-height: 240mm; }
  .hb-cover-band { border-radius: 0; }
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}
