/* Diabetic Dog Companion: site styles.
   Phone first: the base rules are for a phone; wider screens are added below. */

:root {
  --ink: #1f2a30;
  --muted: #56636c;
  --bg: #faf7f2;
  --card: #ffffff;
  --line: #e4ddd1;
  --brand: #1d4e63;
  --brand-dark: #143847;
  --brand-soft: #e8f0f3;
  --accent: #b5532f;
  --ok: #2f7a55;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 40, 50, .06), 0 6px 24px rgba(20, 40, 50, .07);
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --header-h: 60px;
}

*, *::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;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--sans);
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; color: var(--brand-dark); margin: 0 0 .5em; }
h1 { font-size: clamp(34px, 8vw, 56px); letter-spacing: -.01em; }
h2 { font-size: clamp(27px, 5.5vw, 38px); }
h3 { font-size: 21px; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.2em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 14px; z-index: 100; border-radius: 8px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }

/* ---------- Header and menu ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250, 247, 242, .94);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.bar {
  max-width: 1080px; margin: 0 auto; padding: 0 12px 0 16px;
  height: var(--header-h); display: flex; align-items: center; gap: 10px;
}
.brand {
  display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1;
  text-decoration: none; color: var(--brand-dark);
  font: 700 16px/1.2 var(--serif);
}
.brand img { border-radius: 7px; flex: none; }
.brand span { overflow: hidden; line-height: 1.1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@media (max-width: 420px) { .brand { font-size: 15px; } .brand span { max-width: 9.5em; } }
.lang-switch {
  flex: none; text-decoration: none; font-weight: 700; font-size: 14px;
  color: #fff; background: var(--brand); padding: 8px 14px; border-radius: 999px;
}
.lang-switch:hover { background: var(--brand-dark); color: #fff; }
.menu-btn {
  flex: none; width: 44px; height: 44px; border: 0; background: transparent;
  border-radius: 10px; cursor: pointer; display: grid; place-items: center;
}
.menu-btn:hover { background: var(--brand-soft); }
.burger, .burger::before, .burger::after {
  display: block; width: 22px; height: 2px; background: var(--brand-dark);
  border-radius: 2px; transition: transform .2s, opacity .2s; content: "";
}
.burger { position: relative; }
.burger::before { position: absolute; top: -7px; }
.burger::after { position: absolute; top: 7px; }
.menu-open .burger { background: transparent; }
.menu-open .burger::before { transform: translateY(7px) rotate(45deg); }
.menu-open .burger::after { transform: translateY(-7px) rotate(-45deg); }

.nav {
  display: none;
  position: absolute; left: 0; right: 0; top: var(--header-h);
  background: var(--bg); border-bottom: 1px solid var(--line);
  box-shadow: 0 12px 24px rgba(20, 40, 50, .12);
}
.menu-open .nav { display: block; }
.nav ul { list-style: none; margin: 0; padding: 8px 0 14px; }
.nav a {
  display: block; padding: 13px 22px; font-size: 18px; font-weight: 600;
  text-decoration: none; color: var(--ink);
}
.nav a:hover { background: var(--brand-soft); color: var(--brand-dark); }
.js-off .nav { display: block; position: static; box-shadow: none; }

@media (min-width: 960px) {
  .menu-btn { display: none; }
  .nav { display: block; position: static; background: none; border: 0; box-shadow: none; }
  .nav ul { display: flex; gap: 2px; padding: 0; }
  .nav a { font-size: 15px; padding: 8px 11px; border-radius: 8px; }
  .brand { flex: 0 1 auto; margin-right: auto; font-size: 18px; }
  .lang-switch { order: 3; margin-left: 8px; }
}

/* ---------- Sections ---------- */
section { padding: 48px 0; scroll-margin-top: var(--header-h); }
.card[id] { scroll-margin-top: calc(var(--header-h) + 16px); }
section.tint { background: #f1ece3; }
section.white { background: var(--card); }
.eyebrow {
  font: 700 13px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 12px;
}
.lead { font-size: 19px; color: var(--muted); }
.small { font-size: 15px; color: var(--muted); }

/* ---------- Hero ---------- */
.hero { padding: 28px 0 40px; }
.hero-grid { display: grid; gap: 24px; }
.hero h1 { margin-bottom: 10px; }
.hero .tagline { font-size: 21px; font-family: var(--serif); color: var(--ink); margin-bottom: 18px; }
.hero-photo { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.hero-photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: 30% 40%; }
.hero-photo figcaption { font-size: 14px; color: var(--muted); padding: 9px 14px; background: var(--card); }
.story { font-size: 18px; border-left: 4px solid var(--accent); padding-left: 14px; margin: 18px 0 22px; }
.btns { display: flex; flex-wrap: wrap; gap: 12px; }
@media (min-width: 820px) {
  .hero { padding: 56px 0 64px; }
  .hero-grid { grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: center; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 12px 22px; border-radius: 12px;
  font: 700 17px/1.2 var(--sans); text-decoration: none; cursor: pointer;
  border: 2px solid var(--brand); background: var(--brand); color: #fff;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); color: var(--brand-dark); }
.btn.small { min-height: 42px; padding: 9px 16px; font-size: 15px; }
.hero .btns .btn { flex: 1 1 180px; }

/* ---------- Cards and grids ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow);
}
.grid { display: grid; gap: 16px; }
@media (min-width: 700px) { .grid.two { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .grid.three { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 700px) and (max-width: 959px) { .grid.three { grid-template-columns: 1fr 1fr; } }

/* Endorsements */
.quote { margin: 0; display: flex; flex-direction: column; }
.quote blockquote {
  margin: 0 0 14px; font: italic 600 20px/1.45 var(--serif); color: var(--brand-dark);
}
.quote blockquote::before { content: "\201C"; color: var(--accent); font-size: 44px; line-height: 0; vertical-align: -18px; margin-right: 4px; }
.quote figcaption { font-size: 15px; color: var(--muted); margin-top: auto; }
.quote figcaption strong { color: var(--ink); display: block; }
.note { font-size: 14px; color: var(--muted); font-style: italic; margin-top: 12px; }

/* "Is this safe?" list */
.checks { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 10px; }
.checks li { position: relative; padding-left: 34px; }
.checks li::before {
  content: ""; position: absolute; left: 0; top: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 15px no-repeat;
}
.callout {
  background: var(--brand-soft); border-radius: var(--radius); padding: 16px 18px;
  font-weight: 600; color: var(--brand-dark);
}

/* Feature list */
.features { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
@media (min-width: 700px) { .features { grid-template-columns: 1fr 1fr; } }
.features li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.features h3 { font-size: 19px; margin-bottom: 6px; }
.features p { margin: 0; color: var(--muted); font-size: 16px; }

/* ---------- App chooser ---------- */
.chooser { border: 0; padding: 0; margin: 0 0 16px; }
.chooser legend { font-weight: 700; margin-bottom: 10px; padding: 0; }
.chips { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips label { position: relative; }
.chips input { position: absolute; opacity: 0; inset: 0; }
.chips span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  min-height: 52px; padding: 8px 10px; border-radius: 12px; cursor: pointer;
  border: 2px solid var(--line); background: var(--card); font-weight: 600; font-size: 16px; line-height: 1.25;
}
.chips input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.chips input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
@media (min-width: 700px) { .chips { grid-template-columns: repeat(4, 1fr); } }
.open-app { width: 100%; }
.spec { font-size: 14px; color: var(--muted); margin-top: 10px; }

/* ---------- Folding panels ---------- */
details {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  margin-top: 12px;
}
summary {
  cursor: pointer; padding: 14px 44px 14px 18px; font-weight: 700; color: var(--brand-dark);
  list-style: none; position: relative;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: ""; position: absolute; right: 18px; top: 50%; width: 9px; height: 9px;
  border-right: 2.5px solid var(--brand); border-bottom: 2.5px solid var(--brand);
  transform: translateY(-70%) rotate(45deg); transition: transform .2s;
}
details[open] summary::after { transform: translateY(-30%) rotate(-135deg); }
.details-body { padding: 0 18px 16px; }
.details-body > :last-child { margin-bottom: 0; }
.steps { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 10px; }
.steps strong { display: block; }

/* ---------- Book ---------- */
.book-parts { display: grid; gap: 14px; margin: 20px 0 22px; }
@media (min-width: 700px) { .book-parts { grid-template-columns: 1fr 1fr; } }
.book-parts .card h3 { margin-bottom: 6px; }
.book-parts .card p { margin: 0; color: var(--muted); }
.downloads { display: grid; gap: 14px; }
@media (min-width: 700px) { .downloads { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .downloads { grid-template-columns: repeat(3, 1fr); } }
.downloads h3 { font-size: 18px; margin-bottom: 12px; }
.downloads .card { display: flex; flex-direction: column; }
.downloads .card .btns { margin-top: auto; }
.paperback { border-color: var(--accent); background: #fdf6f1; }
.paperback p { font-size: 15px; color: var(--muted); }
.hero-paper { margin: 14px 0 0; font-size: 16px; color: var(--muted); }

/* Windows app card inside the app section */
.windows-app { margin-top: 34px; display: grid; gap: 18px; }
.windows-app h3 { margin-bottom: 8px; }
.windows-app .checks { margin-bottom: 10px; }
@media (min-width: 820px) { .windows-app { grid-template-columns: 1.5fr 1fr; gap: 32px; align-items: start; } }
.downloads .btns .btn { flex: 1 1 auto; }

/* ---------- Video ---------- */
.video { border-radius: var(--radius); overflow: hidden; background: #000; box-shadow: var(--shadow); }
.video video { width: 100%; aspect-ratio: 16 / 9; }
.video-list { display: grid; gap: 34px; margin-top: 12px; }
@media (min-width: 900px) {
  .video-item { display: grid; grid-template-columns: 1fr 1.2fr; gap: 32px; align-items: center; }
}
.video-item h3 { margin-bottom: 8px; }

/* ---------- About ---------- */
.about-grid { display: grid; gap: 24px; }
@media (min-width: 820px) { .about-grid { grid-template-columns: 220px 1fr; gap: 36px; align-items: start; } }
.portrait { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); max-width: 220px; }
.portrait img { aspect-ratio: 1; object-fit: cover; object-position: 25% 40%; }

/* ---------- Contact ---------- */
.contact-email { font-size: 20px; font-weight: 700; word-break: break-all; }

/* ---------- Footer ---------- */
.site-footer { background: var(--brand-dark); color: #d9e4e8; padding: 34px 0 40px; font-size: 15px; }
.site-footer a { color: #fff; }
.site-footer .foot-main { color: #fff; font-weight: 700; }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 0; }

/* ---------- Plain text pages (terms, privacy, handout) ---------- */
.page { padding: 40px 0 56px; }
.page h1 { font-size: clamp(30px, 6vw, 42px); }
.page h2 { font-size: 24px; margin-top: 1.6em; }

/* ---------- For vets page (/vets) ---------- */
.vets .lead { margin-bottom: 6px; }
.jump { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin: 22px 0 8px; }
.jump-title { font-weight: 700; margin: 0 0 8px; color: var(--brand-dark); }
.jump ol { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; }
.jump a { font-weight: 600; }
.vets-section { padding: 36px 0 8px; border-top: 1px solid var(--line); margin-top: 32px; scroll-margin-top: calc(var(--header-h) + 8px); }
.vets-section h2 { font-size: clamp(25px, 5vw, 32px); }
.vets-section h3 { font-size: 20px; margin-top: 1.5em; }
.facts { padding-left: 1.1em; margin: 0 0 1em; }
.facts li { margin-bottom: 10px; }
.table-wrap { overflow-x: auto; margin: 6px 0 18px; }
.vets table { border-collapse: collapse; width: 100%; max-width: 460px; background: var(--card); font-size: 16px; }
.vets caption { text-align: left; font-weight: 700; padding-bottom: 8px; color: var(--brand-dark); }
.vets th, .vets td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.vets th { background: var(--brand-soft); }
.entry-index { columns: 2; column-gap: 24px; padding-left: 1.1em; font-size: 16px; }
@media (max-width: 520px) { .entry-index { columns: 1; } }
.entry { border-top: 1px dashed var(--line); padding-top: 4px; scroll-margin-top: calc(var(--header-h) + 8px); }
.placeholder { color: var(--accent); font-weight: 700; }
.refs-title { font-weight: 700; margin-bottom: 4px; }
.refs { font-size: 15px; color: var(--muted); padding-left: 1.4em; }
.vets-quote { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 0 0 14px; }
.disclaimer { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 15px; color: var(--muted); font-style: italic; }
.vets-note { font-size: 16px; margin-top: 18px; }

/* ---------- Print (all pages; written for /vets) ---------- */
@media print {
  .site-header, .site-footer, .skip, .jump, .entry-index, .menu-btn { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; line-height: 1.45; }
  .page { padding: 0; }
  .wrap, .narrow { max-width: none; padding: 0; }
  h1 { font-size: 20pt; } h2 { font-size: 15pt; } h3 { font-size: 12pt; }
  .vets-section { border-top: 1px solid #999; margin-top: 18pt; padding-top: 10pt; }
  .vets-quote, .jump, .vets table { box-shadow: none; }
  .vets th { background: #eee; }
  a { color: #000; text-decoration: underline; }
  .vets a[href^="http"]::after, .vets a[href^="/"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #333; word-break: break-all; }
  .vets a[href^="/"]::after { content: " (diabeticdogcompanion.com" attr(href) ")"; }
  .vets a[href^="mailto:"]::after, .vets a.bare::after { content: ""; }
  .entry, .vets-quote, table, li { break-inside: avoid; }
  h2, h3 { break-after: avoid; }
}
.in-short { font-weight: 400; color: var(--ink); margin: 6px 0 22px; }
@media print { .table-wrap, .vets table, .vets caption { break-inside: avoid; page-break-inside: avoid; } .vets h3 { break-after: avoid; page-break-after: avoid; } .in-short { border: 1px solid #999; } }
.chapter-links { margin-top: 6px; } .chapter-links a { font-weight: 600; }
