/* ============================================
 * Empire OS, proposal layout
 * Pulls tokens from colors_and_type.css (must be imported first).
 * Screen view: wide floating card on void.
 * Print view: deliberate page breaks, dense letter-friendly layout.
 * ============================================ */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--empire-void);
  color: var(--fg-1);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Floating paper card holding the proposal */
.proposal {
  max-width: 1080px;
  margin: 56px auto;
  background: var(--empire-bone);
  color: var(--fg-1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
  overflow: hidden;
}

.proposal-section {
  padding: 80px 96px;
}

.proposal-section + .proposal-section {
  border-top: 1px solid var(--border-1);
}

/* Header bar inside the cover, hairline orange rule below */
.proposal-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 64px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-1);
  position: relative;
}
.proposal-header::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 64px;
  height: 1px;
  background: var(--empire-orange);
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-1);
}
.wordmark .dot { color: var(--empire-orange); }
.header-date {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-4);
}

/* Hero */
.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--empire-orange);
  margin-bottom: 20px;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-style: italic;
  font-size: 56px;
  line-height: 1.02;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  color: var(--fg-1);
  margin: 0 0 16px;
  max-width: 18ch;
}
.hero-client {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: var(--text-2xl);
  color: var(--fg-2);
  margin: 0 0 40px;
}
.hero-meta {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-4);
}
.hero-meta strong { color: var(--fg-2); font-weight: 500; }

/* Section heading, keep with following content on print */
.section-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--empire-orange);
  margin: 0 0 14px;
  page-break-after: avoid;
  break-after: avoid;
}
.section-title {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: var(--text-2xl);
  line-height: var(--leading-snug);
  color: var(--fg-1);
  margin: 0 0 28px;
  letter-spacing: -0.01em;
  page-break-after: avoid;
  break-after: avoid;
}

.understanding-body {
  font-size: var(--text-lg);
  line-height: 1.65;
  color: var(--fg-2);
  max-width: 62ch;
  margin: 0;
}

/* Scope bullets */
.scope-list {
  list-style: none;
  padding: 0;
  margin: 0;
  columns: 1;
}
.scope-list li {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  font-size: var(--text-base);
  color: var(--fg-2);
  line-height: 1.5;
  page-break-inside: avoid;
  break-inside: avoid;
}
.scope-list li::before {
  content: "";
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  background: var(--empire-orange);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/contain no-repeat;
}

.timeline-block {
  margin-top: 36px;
  padding: 18px 24px;
  background: var(--empire-orange-3);
  border-left: 3px solid var(--empire-orange);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  color: var(--fg-2);
}
.timeline-block strong { color: var(--fg-1); font-weight: 600; }

/* Tier cards, keep group together for print */
.tiers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 32px;
  page-break-inside: avoid;
  break-inside: avoid;
}
.tier-card {
  position: relative;
  background: var(--empire-paper);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-md);
  padding: 28px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  page-break-inside: avoid;
  break-inside: avoid;
}
.tier-card.recommended {
  border-color: var(--empire-orange);
  box-shadow: 0 0 0 1px var(--empire-orange) inset, var(--shadow-2);
}
.tier-card .chip-recommended {
  position: absolute;
  top: -11px;
  left: 22px;
  display: inline-block;
  padding: 4px 12px;
  background: var(--empire-orange);
  color: var(--empire-void);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
}
.tier-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-style: italic;
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  color: var(--fg-1);
  margin: 0;
}
.tier-tagline {
  font-family: var(--font-ui);
  font-style: italic;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--fg-3);
  margin: 8px 0 12px;
}
.tier-price {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 18px;
  color: var(--fg-1);
  letter-spacing: -0.01em;
  padding-top: 8px;
  border-top: 1px solid var(--border-1);
}
.tier-includes {
  list-style: none;
  padding: 0;
  margin: 0;
  flex-grow: 1;
}
.tier-includes li {
  font-size: 13px;
  color: var(--fg-3);
  padding: 5px 0;
  line-height: 1.5;
  display: flex;
  gap: 8px;
}
.tier-includes li::before {
  content: "→";
  color: var(--empire-orange);
  font-weight: 600;
  flex-shrink: 0;
}
.tier-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--empire-orange);
  color: var(--empire-void);
  border: 0;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  box-shadow: var(--shadow-orange);
  text-decoration: none;
  cursor: pointer;
  margin-top: 8px;
}
.tier-cta:hover { background: var(--empire-orange-2); }

/* Next steps */
.next-steps {
  font-size: var(--text-lg);
  color: var(--fg-2);
  line-height: 1.6;
  max-width: 62ch;
  margin: 0;
}
.signature {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--border-1);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--fg-4);
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.signature strong { color: var(--fg-1); font-weight: 600; }

/* Save as PDF floating button, bold and impossible to miss */
.save-pdf-btn {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 18px 30px;
  background: var(--empire-orange);
  color: var(--empire-void);
  border: 0;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  box-shadow: 0 14px 36px rgba(255,107,53,0.55), 0 0 0 8px rgba(255,107,53,0.12);
  cursor: pointer;
  transition: transform 200ms ease-out, box-shadow 200ms ease-out, background 200ms ease-out;
}
.save-pdf-btn:hover {
  background: var(--empire-orange-2);
  transform: translateY(-2px);
  box-shadow: 0 18px 44px rgba(255,107,53,0.65), 0 0 0 10px rgba(255,107,53,0.16);
}
.save-pdf-btn svg {
  width: 18px;
  height: 18px;
  stroke: var(--empire-void);
  flex-shrink: 0;
}

/* Stat row for "The opportunity" section */
.stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-top: 48px;
  padding-top: 40px;
  border-top: 1px solid var(--border-1);
}
.stat-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-style: italic;
  font-size: 52px;
  line-height: 1;
  color: var(--empire-orange);
  margin-bottom: 14px;
  letter-spacing: 0.005em;
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
  line-height: 1.45;
  max-width: 26ch;
}

/* Phase cards for "How we'll work" section */
.phases {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 36px;
}
.phase-card {
  background: var(--empire-paper);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-md);
  padding: 26px 22px;
  page-break-inside: avoid;
  break-inside: avoid;
}
.phase-tag {
  display: inline-block;
  padding: 4px 12px;
  background: var(--empire-void);
  color: var(--fg-d-1);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.20em;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  margin-bottom: 16px;
}
.phase-title {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 16px;
  color: var(--fg-1);
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}
.phase-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.phase-list li {
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg-3);
  padding: 5px 0;
  display: flex;
  gap: 10px;
}
.phase-list li::before {
  content: "·";
  color: var(--empire-orange);
  font-weight: 700;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

/* ============================================
 * Print: PDF output, dense letter-friendly layout
 * with explicit page boundaries.
 * ============================================ */
@media print {
  @page {
    size: letter;
    margin: 0.5in 0.55in;
  }

  html, body {
    background: var(--empire-paper);
    color: var(--fg-1);
    font-size: 12pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .no-print { display: none !important; }

  .proposal {
    max-width: 100%;
    margin: 0;
    box-shadow: none;
    border-radius: 0;
    background: transparent;
    overflow: visible;
  }

  .proposal-section {
    padding: 0;
    border-top: none !important;
  }
  .proposal-section + .proposal-section {
    border-top: none;
    margin-top: 0;
  }

  /* Force every non-last section onto its own page */
  .proposal-section:nth-of-type(1),
  .proposal-section:nth-of-type(2),
  .proposal-section:nth-of-type(3),
  .proposal-section:nth-of-type(4) {
    page-break-after: always;
    break-after: page;
  }
  /* Cover section gets min-height so the title sits high on page */
  .proposal-section:nth-of-type(1) {
    min-height: 9in;
    display: flex;
    flex-direction: column;
  }

  .proposal-header {
    margin-bottom: 40px;
    padding-bottom: 16px;
  }
  .wordmark { font-size: 14pt; }
  .header-date { font-size: 8pt; }

  .hero-eyebrow {
    font-size: 8pt;
    margin-bottom: 16px;
  }
  .hero-title {
    font-size: 36pt;
    line-height: 1.02;
    margin-bottom: 12px;
    max-width: 100%;
  }
  .hero-client {
    font-size: 16pt;
    margin-bottom: 28px;
  }
  .hero-meta {
    font-size: 9pt;
  }

  .section-eyebrow {
    font-size: 8pt;
    margin-bottom: 10px;
  }
  .section-title {
    font-size: 22pt;
    margin-bottom: 20px;
  }

  .understanding-body {
    font-size: 11.5pt;
    line-height: 1.55;
    max-width: 100%;
  }

  .scope-list li {
    font-size: 10.5pt;
    padding: 7px 0;
  }
  .scope-list li::before {
    width: 14px;
    height: 14px;
    margin-top: 4px;
  }

  .timeline-block {
    margin-top: 20px;
    margin-bottom: 28px;
    padding: 12px 18px;
    font-size: 10pt;
  }

  /* Tiers: compact for letter */
  .tiers {
    gap: 10px;
    margin-top: 18px;
  }
  .tier-card {
    padding: 16px 14px;
    gap: 8px;
    border-radius: 6px;
  }
  .tier-card.recommended {
    box-shadow: 0 0 0 1px var(--empire-orange) inset;
  }
  .tier-card .chip-recommended {
    top: -8px;
    left: 14px;
    font-size: 7pt;
    padding: 2px 8px;
  }
  .tier-name {
    font-size: 13pt;
  }
  .tier-tagline {
    font-size: 8.5pt;
    line-height: 1.4;
    margin: 4px 0 8px;
  }
  .tier-price {
    font-size: 10.5pt;
    padding-top: 6px;
  }
  .tier-includes li {
    font-size: 8.5pt;
    padding: 3px 0;
    gap: 6px;
    line-height: 1.4;
  }
  .tier-cta {
    padding: 8px 14px;
    font-size: 8pt;
    box-shadow: none;
    margin-top: 4px;
  }

  /* Next steps */
  .next-steps {
    font-size: 12pt;
    line-height: 1.55;
    max-width: 100%;
  }
  .signature {
    margin-top: 28px;
    padding-top: 18px;
    font-size: 9pt;
  }

  /* Stat row */
  .stat-row {
    gap: 20px;
    margin-top: 36px;
    padding-top: 30px;
  }
  .stat-num {
    font-size: 36pt;
    margin-bottom: 10px;
  }
  .stat-label {
    font-size: 8.5pt;
    letter-spacing: 0.12em;
  }

  /* Phase cards */
  .phases {
    gap: 10px;
    margin-top: 24px;
  }
  .phase-card {
    padding: 14px 14px;
    border-radius: 4px;
  }
  .phase-tag {
    font-size: 7pt;
    padding: 2px 8px;
    margin-bottom: 10px;
    letter-spacing: 0.18em;
  }
  .phase-title {
    font-size: 11pt;
    margin-bottom: 10px;
  }
  .phase-list li {
    font-size: 9pt;
    padding: 3px 0;
    gap: 8px;
  }
  .phase-list li::before {
    font-size: 14pt;
  }
}

/* ============================================
 * Responsive
 * ============================================ */

/* Tablet and below: stack tiers and phases */
@media (max-width: 900px) {
  .proposal { margin: 24px 16px; max-width: 100%; }
  .proposal-section { padding: 56px 40px; }
  .hero-title { font-size: 44px; max-width: 100%; }
  .hero-client { font-size: var(--text-xl); }
  .tiers { grid-template-columns: 1fr; }
  .phases { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr 1fr; gap: 28px; }
}

/* Mobile: 600px and below */
@media (max-width: 600px) {
  .proposal { margin: 16px 12px; border-radius: 16px; }
  .proposal-section { padding: 40px 24px; }

  /* Header: wordmark and date on separate lines if needed */
  .proposal-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 40px;
    padding-bottom: 18px;
  }
  .wordmark { font-size: 16px; }
  .header-date { font-size: 10px; }

  /* Hero scales down */
  .hero-eyebrow { font-size: 10px; letter-spacing: 0.18em; }
  .hero-title { font-size: 30px; line-height: 1.05; letter-spacing: 0.01em; }
  .hero-client { font-size: var(--text-lg); margin-bottom: 28px; }
  .hero-meta { font-size: 11px; letter-spacing: 0.05em; }
  .hero-meta strong { display: block; margin-top: 4px; }

  /* Section titles tighter */
  .section-eyebrow { font-size: 10px; letter-spacing: 0.18em; }
  .section-title { font-size: 24px; line-height: 1.15; }
  .understanding-body { font-size: 15px; line-height: 1.55; }

  /* Stack stats vertically on smallest, larger numerals */
  .stat-row {
    grid-template-columns: 1fr;
    gap: 24px;
    margin-top: 36px;
    padding-top: 28px;
  }
  .stat-num { font-size: 44px; margin-bottom: 8px; }
  .stat-label { font-size: 10px; letter-spacing: 0.12em; }

  /* Tier cards: tighter padding */
  .tier-card { padding: 24px 18px; }
  .tier-name { font-size: 18px; }
  .tier-price { font-size: 16px; }
  .tier-tagline { font-size: 13px; }
  .tier-includes li { font-size: 13px; }

  /* Phase cards: tighter padding */
  .phase-card { padding: 22px 18px; }
  .phase-title { font-size: 15px; }
  .phase-list li { font-size: 13px; }

  /* Timeline block: tighter */
  .timeline-block { padding: 14px 18px; font-size: 14px; }

  /* Scope list */
  .scope-list li { font-size: 14px; padding: 8px 0; gap: 12px; }
  .scope-list li::before { width: 16px; height: 16px; }

  /* Next steps */
  .next-steps { font-size: 15px; line-height: 1.55; }
  .signature { font-size: 12px; gap: 8px; }

  /* Save as PDF: smaller, tighter, icon stays */
  .save-pdf-btn {
    bottom: 20px;
    right: 20px;
    padding: 14px 22px;
    font-size: 12px;
    letter-spacing: 0.18em;
    gap: 8px;
    box-shadow: 0 10px 28px rgba(255,107,53,0.55), 0 0 0 6px rgba(255,107,53,0.12);
  }
  .save-pdf-btn svg { width: 15px; height: 15px; }
}

/* Very narrow: under 380px */
@media (max-width: 380px) {
  .proposal-section { padding: 36px 20px; }
  .hero-title { font-size: 26px; }
  .section-title { font-size: 22px; }
  .save-pdf-btn { padding: 12px 18px; font-size: 11px; }
  .save-pdf-btn svg { width: 14px; height: 14px; }
}
