/* MedAdvocate guide design system — shared stylesheet.
   Linked from every /guides/ page. Design tokens live in :root below.
   Only the article body changes per guide; this file does not. */

/* ─────────────────────────────────────────────────────────
 Tokens (shared with index.html)
 ───────────────────────────────────────────────────────── */
:root {
  --bg: #f4efe5;
  --bg-deep: #ebe3d2;
  --ink: #1b2c3d;
  --ink-soft: #4a5968;
  --navy: #153b62;
  --yellow: #ffde39;
  --blue: #268beb;
  --rule: rgba(27, 44, 61, 0.14);
  --white: #ffffff;

  --font-sans: "Source Sans 3", -apple-system, BlinkMacSystemFont,
    "Segoe UI", system-ui, sans-serif;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;

  --max: 1280px;
  --gutter: clamp(20px, 5vw, 80px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}

img {
  max-width: 100%;
  display: block;
}
a {
  color: inherit;
}
button {
  font-family: inherit;
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0;
}

/* ─────────────────────────────────────────────────────────
 Header / Nav (shared with index.html)
 ───────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(244, 239, 229, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}
.site-header.scrolled {
  border-bottom-color: var(--rule);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px clamp(24px, 5vw, 80px);
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}
.brand-logo {
  width: auto;
  height: 28px;
  aspect-ratio: 160 / 24;
  flex-shrink: 0;
}
.nav-links {
  display: none;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 36px;
}
.nav-links a {
  text-decoration: none;
  color: var(--ink-soft);
  font-size: 15px;
  padding: 8px 0;
  transition: color 0.15s;
}
.nav-links a:hover {
  color: var(--ink);
}
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--rule);
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: var(--ink);
}
.nav-toggle svg {
  width: 20px;
  height: 20px;
}
.nav-toggle .icon-close {
  display: none;
}
.nav-toggle[aria-expanded="true"] .icon-open {
  display: none;
}
.nav-toggle[aria-expanded="true"] .icon-close {
  display: block;
}
.nav-drawer {
  position: fixed;
  inset: 64px 0 0 0;
  background: var(--bg);
  padding: 24px var(--gutter);
  transform: translateY(-100%);
  visibility: hidden;
  transition: transform 0.3s ease, visibility 0s linear 0.3s;
  z-index: 49;
  overflow-y: auto;
}
.nav-drawer[data-open="true"] {
  transform: translateY(0);
  visibility: visible;
  transition: transform 0.3s ease, visibility 0s;
}
.nav-drawer ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 4px;
}
.nav-drawer a {
  display: block;
  padding: 18px 8px;
  font-family: var(--font-serif);
  font-size: 26px;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
  min-height: 44px;
}
@media (min-width: 768px) {
  .nav-links {
    display: flex;
  }
  .nav-toggle {
    display: none;
  }
  .nav-drawer {
    display: none;
  }
}

/* ─────────────────────────────────────────────────────────
 Store badges (shared with index.html)
 ───────────────────────────────────────────────────────── */
.store-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 4px 16px 12px;
  min-height: 56px;
  background: #000;
  color: #fff;
  border-radius: 12px;
  border: 1px solid #000;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
  min-width: 180px;
}
.store-badge:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}
.store-badge svg {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.sb-eyebrow {
  font-size: 10px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.04em;
  opacity: 0.9;
  margin-bottom: 2px;
}
.sb-label {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0em;
  margin-top: -2px;
}

/* ─────────────────────────────────────────────────────────
 Guide page: article layout
 ───────────────────────────────────────────────────────── */
.guide-hero {
  padding: 56px 0 8px;
}
.guide-hero .eyebrow {
  margin-bottom: 16px;
}
.article {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px var(--gutter) 40px;
}
.article h1 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
}
.article .lede {
  font-size: clamp(18px, 2.2vw, 21px);
  color: var(--ink-soft);
  margin: 0 0 8px;
}
.article h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(24px, 3.4vw, 32px);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 48px 0 14px;
}
.article h3 {
  font-size: 18px;
  font-weight: 700;
  margin: 28px 0 8px;
}
.article p {
  margin: 0 0 16px;
  font-size: 18px;
}
.article ul,
.article ol {
  margin: 0 0 16px;
  padding-left: 22px;
}
.article li {
  margin: 0 0 8px;
}
.article strong {
  font-weight: 700;
}
.article a.inline {
  color: var(--navy);
  text-underline-offset: 2px;
}

/* Callout for the legal note */
.callout {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 20px 22px;
  margin: 24px 0;
  font-size: 15px;
  color: var(--ink-soft);
}
.callout strong {
  color: var(--ink);
}

/* Note card: white callout with icon + title (e.g. "Good to know") */
.note {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 16px 16px;
  margin: 24px 0;
}
.note-head {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}
.note-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.note-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
}
.note .note-body {
  margin: 0;
  font-size: 15px;
  color: var(--ink-soft);
}

/* Red flag list */
/* More specific than ".article ul" so padding-left:22px does not indent
   the cards; two columns on wider screens, one column when narrow. */
.article ul.flags {
  list-style: none;
  padding: 0;
  margin: 8px 0 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 768px) {
  .article ul.flags {
    grid-template-columns: 1fr;
  }
}
.flags li {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 16px 18px;
  margin: 0;
}
.flags .flag-name {
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
}

/* ─────────────────────────────────────────────────────────
 Letter generator
 ───────────────────────────────────────────────────────── */
.generator {
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: clamp(20px, 4vw, 32px);
  margin: 20px 0 8px;
}
.gen-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
@media (min-width: 560px) {
  .gen-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  font: inherit;
  color: var(--ink);
  background: #fffcf7;
}
.field input:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 1px;
}
.letter {
  font-family: var(--font-serif);
  white-space: pre-wrap;
  background: #fffcf7;
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 22px 24px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  margin: 0 0 18px;
  overflow-x: auto;
}
.btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 22px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--navy);
  color: var(--white);
}
.btn-primary:hover {
  background: #0f2a47;
}
.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule);
}
.btn-secondary:hover {
  border-color: var(--ink-soft);
}
.copy-status {
  font-size: 14px;
  color: var(--ink-soft);
  align-self: center;
}

/* ─────────────────────────────────────────────────────────
 CTA block
 ───────────────────────────────────────────────────────── */
.cta {
  background: var(--navy);
  color: var(--white);
  border-radius: 12px;
  padding: clamp(28px, 5vw, 48px);
  margin: 40px 0;
  text-align: center;
}
.cta h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}
.cta p {
  color: rgba(255, 255, 255, 0.8);
  margin: 0 auto 24px;
  max-width: 64ch;
}
.cta .store-row {
  justify-content: center;
}

/* Feature CTA: left-aligned text with a diagonal phone on the right. Not
   clipped, so the phone's drop shadow renders fully. */
.cta-feature {
  position: relative;
  overflow: hidden;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.cta-feature .cta-content {
  max-width: 60%;
}
.cta-feature .cta-content p {
  margin: 0 0 24px;
  max-width: 80ch;
}
.cta-feature .store-row {
  justify-content: flex-start;
}
.cta-phone {
  /* Uses the padded asset (transparent margin) so the drop shadow hugs
     the phone; width scaled up to compensate for that margin. */
  position: absolute;
  right: clamp(40px, -1vw, -8px);
  bottom: -250px;
  width: clamp(300px, 34vw, 400px);
  height: auto;
  transform: rotate(8deg);
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.4));
  pointer-events: none;
  user-select: none;
}
@media (max-width: 820px) {
  .cta-feature {
    text-align: center;
    min-height: 0;
  }
  .cta-feature .cta-content {
    max-width: none;
  }
  .cta-feature .cta-content p {
    margin: 0 auto 24px;
    max-width: 48ch;
  }
  .cta-feature .store-row {
    justify-content: center;
  }
  .cta-phone {
    display: none;
  }
}

/* Media CTA: centered text with a diagonal phone bleeding off the left
   edge; reserve left space on desktop so the text clears the phone. */
.cta-media {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.cta-phone-left {
  /* Mirror of .cta-phone on the left: CSS rotation for the diagonal,
     drop shadow, bleeding off the bottom edge. Expects a full upright
     phone image. */
  position: absolute;
  left: clamp(0px, 2vw, 32px);
  bottom: -206px;
  width: clamp(240px, 32vw, 480px);
  height: auto;
  transform: rotate(0deg);
  filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.4));
  pointer-events: none;
  user-select: none;
}
@media (min-width: 821px) {
  .cta-media {
    padding-left: clamp(0px, 40vw, 400px);
  }
}
@media (max-width: 820px) {
  .cta-phone-left {
    display: none;
  }
}

/* ─────────────────────────────────────────────────────────
 FAQ
 ───────────────────────────────────────────────────────── */
.faq {
  max-width: var(--max);
  margin: 0 auto;
  padding: 8px var(--gutter) 24px;
}
.faq details {
  border-bottom: 1px solid var(--rule);
  padding: 6px 0;
}
.faq summary {
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 20px;
  padding: 16px 40px 16px 0;
  position: relative;
  min-height: 44px;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::after {
  content: "+";
  position: absolute;
  right: 4px;
  top: 14px;
  font-weight: 400;
  font-size: 26px;
  color: var(--ink-soft);
  transition: transform 0.2s;
}
.faq details[open] summary::after {
  content: "\2212";
}
.faq details p {
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-size: 18px;
}

/* ─────────────────────────────────────────────────────────
 Footer (shared with index.html)
 ───────────────────────────────────────────────────────── */
.footer {
  padding: 32px 0 32px;
  border-top: 1px solid var(--rule);
  margin-top: 60px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  align-items: center;
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.footer-links {
  display: flex;
  gap: 20px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-links a {
  text-decoration: none;
}
.footer-links a:hover {
  color: var(--ink);
}
@media (min-width: 768px) {
  .footer {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: left;
  }
}

/* ─────────────────────────────────────────────────────────
 Print: show only the generated letter
 ───────────────────────────────────────────────────────── */
@media print {
  /* Hide everything except the ancestor chain down to the letter, using
     display:none so hidden content takes no layout space (visibility:hidden
     would keep the full page height and spill onto blank extra pages). */
  body > *:not(#main) {
    display: none !important;
  }
  #main > *:not(.article) {
    display: none !important;
  }
  .article > *:not(.generator) {
    display: none !important;
  }
  .generator > *:not(#letter-output) {
    display: none !important;
  }
  /* Strip surrounding chrome so the letter prints clean */
  #main,
  .article,
  .generator {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    border: none !important;
    background: none !important;
  }
  #letter-output {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: none !important;
    overflow: visible !important;
  }
}

/* ─────────────────────────────────────────────────────────
 Guides index (guides/index.html)
 ───────────────────────────────────────────────────────── */
.guide-list {
  max-width: var(--max);
  margin: 0 auto;
  padding: 8px var(--gutter) 48px;
  display: grid;
  gap: 16px;
}
.guide-card {
  display: block;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 24px 26px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s, box-shadow 0.15s;
}
.guide-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(27, 44, 61, 0.1);
}
.guide-card h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 22px;
  line-height: 1.2;
  margin: 0 0 6px;
  color: var(--navy);
}
.guide-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
}
