:root {
  --brand-orange: #e85d04;
  --ink: #1c1917;
  --muted: #57534e;
  --rule: #d6d3d1;
  --bg: #f5f5f4;
  --paper: #fff;
  --tap: 44px;
  --gap: 12px;
  --max: 40rem;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font);
  background: var(--bg);
}

body {
  line-height: 1.4;
  min-height: 100dvh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.11;
  background-image:
    url("orange_wave.png"),
    url("orange_excited.png"),
    url("orange_deflated.png"),
    url("orange_happy_cry.png"),
    url("orange_new_idea.png");
  background-repeat: no-repeat;
  background-size:
    min(42vw, 240px) auto,
    min(38vw, 260px) auto,
    min(36vw, 220px) auto,
    min(40vw, 250px) auto,
    min(32vw, 200px) auto;
  background-position:
    left -8% top 12%,
    right -6% top 8%,
    left -4% bottom -4%,
    right -8% bottom 6%,
    center 58%;
}

.site-header,
.wrap,
.viewer-bar,
.viewer-stage {
  position: relative;
  z-index: 1;
}

a {
  color: inherit;
}

.site-header,
.site-footer {
  padding: 12px 16px;
}

.site-header {
  background: var(--paper);
  border-bottom: 2px solid var(--brand-orange);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  font-weight: 700;
  color: var(--brand-orange);
  text-decoration: none;
  letter-spacing: 0.02em;
  min-height: var(--tap);
}

.wrap {
  width: min(100% - 32px, var(--max));
  margin: 24px auto 48px;
  padding: 24px 20px 28px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.08);
}

.hero {
  display: block;
  width: min(100%, 18rem);
  height: auto;
  margin: 0 auto 16px;
}

h1 {
  margin: 0 0 8px;
  font-size: 1.75rem;
  font-weight: 700;
}

.lede {
  margin: 0 0 20px;
  color: var(--brand-orange);
  font-size: 1.1rem;
  font-weight: 600;
}

.back {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  margin-bottom: 8px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

.back:focus-visible,
.wordmark:focus-visible,
.btn:focus-visible,
.bar-action:focus-visible {
  outline: 3px solid var(--brand-orange);
  outline-offset: 2px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 12px 14px;
  text-align: center;
  text-decoration: none;
  font-weight: 650;
  font-size: 1.05rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
  color: var(--brand-orange);
  background: var(--paper);
  border: 2px solid var(--brand-orange);
  border-radius: 4px;
}

.btn:hover {
  background: var(--brand-orange);
  color: #fff;
}

.btn:active {
  background: #c24e03;
  border-color: #c24e03;
  color: #fff;
}

.doc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
}

@media (min-width: 640px) {
  .doc-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 400px) {
  .wrap {
    width: min(100% - 24px, var(--max));
    margin-top: 16px;
    padding: 16px 14px 20px;
  }

  h1 { font-size: 1.5rem; }

  .hero { width: min(100%, 14rem); }
}

.quiet {
  color: var(--muted);
  margin: 0 0 16px;
}

.site-footer {
  color: var(--muted);
  font-size: 0.85rem;
}

.viewer-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.viewer-page::before {
  opacity: 0.05;
}

.viewer-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--paper);
  border-bottom: 2px solid var(--brand-orange);
}

.viewer-bar .title {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  color: var(--brand-orange);
  overflow-wrap: anywhere;
}

.bar-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  min-width: var(--tap);
  padding: 0 12px;
  border-radius: 4px;
  border: 1px solid var(--brand-orange);
  background: var(--paper);
  color: var(--brand-orange);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
}

.bar-action:hover {
  background: var(--brand-orange);
  color: #fff;
}

.viewer-stage {
  flex: 1;
  overflow: auto;
  touch-action: pan-x pan-y pinch-zoom;
  padding: 8px;
}

.sheet-scale {
  transform-origin: top left;
  overflow: hidden;
}

.sheet-frame {
  display: block;
  border: 0;
  background: var(--paper);
  width: 210mm;
  height: 297mm;
  transform-origin: top left;
}
