/* ==========================================================================
   Urban Economics (UEI) — case study document
   A US Letter sheet on a desk, printable to PDF. Replaces the prototype's
   <doc-page> custom element: same 8.5in sheet, 0.85in margin, running
   header/footer, and window.print() export.
   ========================================================================== */

:root {
  --doc-page-w: 8.5in;
  --doc-margin: 0.85in;
  --doc-green: #0b6e50;
  --doc-ink: #1d1d1f;
  --doc-body: #333b38;
  --doc-muted: #8a938e;
  --doc-rule: #e2e7e4;
  --doc-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

body {
  margin: 0;
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--doc-ink);
  background: #33403b;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

h1,
h2,
h3 {
  letter-spacing: -0.02em;
}

.mono {
  font-family: var(--doc-mono);
}

/* The desk the sheet rests on. min-width keeps the desk under the full
   sheet width when the viewport is narrower than the paper. */
.doc-desk {
  min-height: 100vh;
  min-width: max-content;
  background: #f5f5f4;
  padding: 48px 24px;
}

.doc-sheet {
  width: var(--doc-page-w);
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 2px 10px rgba(20, 20, 19, 0.12);
  border-radius: 7px;
  padding: var(--doc-margin);
}

/* A single-column table so the header repeats on every printed page
   (browsers repeat <thead> across page breaks; a plain div would not). */
.doc-frame {
  width: 100%;
  border-collapse: collapse;
}

.doc-frame th,
.doc-frame td {
  padding: 0;
  text-align: left;
  font-weight: inherit;
}

/* 0.35in is the gap <doc-page> reserved between a running header/footer and
   the body on the printed page. */
.doc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--doc-rule);
  margin-bottom: 0.35in;
}

.doc-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--doc-rule);
  margin-top: 0.35in;
}

.doc-header__brand {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: -0.01em;
}

.doc-header__tag {
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--doc-green);
}

.doc-footer span {
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--doc-muted);
}

/* --------------------------------------------------------------------------
   Document body
   -------------------------------------------------------------------------- */
.doc-eyebrow {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--doc-green);
  margin-bottom: 10px;
}

.doc-title {
  font-size: 34px;
  line-height: 1.08;
  margin: 0 0 12px;
  text-wrap: balance;
}

.doc-standfirst {
  font-size: 15px;
  line-height: 1.55;
  color: #4b524e;
  margin: 0 0 26px;
  max-width: 60ch;
}

.doc-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 30px;
  padding: 18px;
  background: #f2f5f4;
  border-radius: 12px;
  break-inside: avoid;
}

.doc-facts__label {
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--doc-muted);
  margin-bottom: 4px;
}

.doc-facts__value {
  font-size: 14px;
  font-weight: 600;
}

.doc-h2 {
  font-size: 19px;
  margin: 0 0 8px;
  color: var(--doc-green);
}

.doc-p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--doc-body);
  margin: 0 0 22px;
}

.doc-p--tight {
  margin-bottom: 12px;
}

.doc-p--close {
  margin-bottom: 8px;
}

.doc-list {
  font-size: 14px;
  line-height: 1.6;
  color: var(--doc-body);
  margin: 0 0 22px;
  padding-left: 20px;
}

.doc-list li {
  margin-bottom: 6px;
}

.doc-list li:last-child {
  margin-bottom: 0;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 0 0 18px;
  break-inside: avoid;
}

.doc-table thead tr {
  text-align: left;
  border-bottom: 2px solid var(--doc-green);
}

.doc-table th {
  padding: 8px 6px;
  font-weight: 600;
}

.doc-table td {
  padding: 8px 6px;
}

.doc-table tbody tr {
  border-bottom: 1px solid var(--doc-rule);
}

.doc-table tbody tr:last-child {
  border-bottom: 0;
}

.doc-table .is-muted {
  color: var(--doc-muted);
}

.doc-table .is-result {
  font-weight: 600;
  color: var(--doc-green);
}

.doc-note {
  font-size: 10px;
  color: var(--doc-muted);
  line-height: 1.5;
  margin: 18px 0 0;
}

/* --------------------------------------------------------------------------
   Export button
   -------------------------------------------------------------------------- */
/* Holds the fixed buttons; collapses to zero height on wide screens because
   both children are taken out of flow. */
.doc-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.doc-print {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 50;
  background: var(--doc-green);
  color: #fff;
  border: none;
  border-radius: 980px;
  padding: 11px 20px;
  font-family: "Manrope", sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.doc-print:hover {
  background: #0f7e5c;
}

.doc-back,
.doc-back:hover {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  color: var(--doc-green);
  border-radius: 980px;
  padding: 11px 18px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

/* --------------------------------------------------------------------------
   Print
   -------------------------------------------------------------------------- */
@page {
  size: letter;
  margin: 0.85in;
}

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

  body {
    background: #fff;
  }

  .doc-desk {
    background: none;
    padding: 0;
    min-height: 0;
    min-width: 0;
  }

  .doc-sheet {
    width: auto;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
  }

  .doc-facts,
  .doc-table {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

/* --------------------------------------------------------------------------
   Narrow viewports — the sheet metaphor breaks below paper width, so the
   document reflows to fit the screen instead of scrolling sideways.
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
  .doc-desk {
    min-width: 0;
    padding: 24px 14px;
  }

  .doc-sheet {
    width: 100%;
    padding: 32px 24px;
  }

  .doc-title {
    font-size: 28px;
  }

  .doc-facts {
    grid-template-columns: 1fr;
  }

  .doc-print,
  .doc-back {
    position: static;
    display: inline-block;
    margin: 0 8px 16px 0;
  }
}
