/*
 * Typewritten technical-report theme.
 */

:root {
  --page: #ECF8F4;        /* page background, around the report sheet */
  --ground: #ECF8F4;      /* light tint (chart gridlines) */
  --paper: #FFFFFF;       /* report sheet */
  --ink: #051610;         /* body text and rules */
  --muted: #3D5048;       /* labels, captions */
  --rule-soft: #9DB5AB;   /* dashed and footnote rules */
  --edge: #C9DDD5;        /* sheet border */
  --accent: #125740;
  --accent-dark: #00291C;

  --mono: 'Roboto Mono', ui-monospace, 'Courier New', monospace;
  --serif: 'Roboto Serif', Georgia, serif;
}

/**************/
/* BASE RULES */
/**************/

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

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--mono);
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-dark);
}

img {
  max-width: 100%;
}

::selection {
  background: #CFE7DE;
  color: var(--ink);
}

.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;
}

/* Only shown once report.js is running */
.js-only {
  display: none !important;
}

.js .js-only {
  display: flex !important;
}

sup.accent {
  color: var(--accent);
  font-family: var(--mono);
}

/*********************/
/* LAYOUT / SECTIONS */
/*********************/

.ground {
  min-height: 100vh;
  padding: clamp(16px, 4vw, 56px) clamp(12px, 3vw, 40px);
  /* clip, not hidden: hidden would make this a scroll container and break
     the sticky Fig. 2. */
  overflow-x: clip;
}

.sheet {
  max-width: 1200px;
  margin: 0 auto;
  background: var(--paper);
  border: 1px solid var(--edge);
  box-shadow: 0 1px 0 var(--edge), 0 18px 40px -24px rgba(5, 22, 16, 0.35);
  padding: clamp(24px, 5vw, 72px);
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.rule-double {
  border-top: 3px double var(--ink);
}

.eyebrow {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--accent);
}

.sprite-layer {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 50;
}

/* Header */

.tr-head {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tr-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Three-part header: equal outer columns keep the middle part fixed in
   place when the revision text on the right changes length. */
.tr-meta-3 {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
}

.tr-meta-3 > :nth-child(2) {
  text-align: center;
}

.tr-meta-3 > :last-child {
  text-align: right;
}

@media (max-width: 640px) {
  .tr-meta-3 {
    grid-template-columns: 1fr;
  }

  .tr-meta-3 > :nth-child(2),
  .tr-meta-3 > :last-child {
    text-align: left;
  }
}

.tr-meta a {
  color: inherit;
}

/* Revision panel: everything inside it changes with the revision slider,
   which runs along its top edge. */

.tr-rev {
  border: 1px solid var(--ink);
}

.tr-rev > .tr-revbar {
  padding: 6px clamp(12px, 2.5vw, 24px);
  background: var(--ground);
  border-bottom: 1px solid var(--ink);
}

.tr-rev-body {
  padding: clamp(16px, 3.5vw, 40px);
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.tr-lead {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 32px;
}

.tr-lead > .tr-abstract {
  flex: 999 1 420px;
  min-width: 0;
}

.tr-lead > .tr-fig {
  flex: 1 1 200px;
  max-width: 280px;
}

.tr-revbar {
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 12px;
}

.tr-revbar label {
  letter-spacing: 0.16em;
  font-weight: 600;
}

.tr-revbar input[type="range"] {
  flex: 1 1 200px;
  max-width: 320px;
  height: 44px;
  margin: 0;
  accent-color: var(--accent);
}

.tr-revbtns {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tr-revbtns button {
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.tr-revbtns button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
}

/* Title block */

.tr-title {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
}

.tr-title-text {
  /* Never narrower than the name itself: the stamp drops below the name
     before the name would wrap. */
  flex: 999 1 max-content;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Typed text sits over an invisible copy of the full text, so the layout
   never shifts while it types. */
.type-grid {
  display: grid;
}

.type-grid > .ghost,
.type-grid > .typed {
  grid-area: 1 / 1;
}

.type-grid > .ghost {
  visibility: hidden;
}

.tr-name {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(44px, 7vw, 84px);
  line-height: 1.02;
  letter-spacing: -0.02em;
}

.tr-sub {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(18px, 2.2vw, 24px);
  line-height: 1.4;
  max-width: 34ch;
}

@keyframes tr-caret {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.tr-caret {
  color: var(--accent);
  font-style: normal;
  animation: tr-caret 1.05s steps(1) infinite;
}

.tr-stamp-wrap {
  flex: 1 1 200px;
  display: flex;
  justify-content: flex-end;
}

.tr-stamp {
  transform: rotate(-7deg);
  border: 3px solid var(--accent);
  color: var(--accent);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-align: center;
  line-height: 1.6;
  opacity: 0.85;
}

.tr-stamp small {
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.1em;
}

/* Front matter table */

.tr-facts {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  border-top: 1px solid var(--ink);
  border-left: 1px solid var(--ink);
  font-size: 13px;
}

.tr-facts > div {
  border-right: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  padding: 12px 14px;
}

.tr-facts dt {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.tr-facts dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

/* Contents */

.tr-toc {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tr-toc p {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.tr-toc div {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 28px;
  font-size: 15px;
}

.tr-toc a {
  padding: 10px 0;
}

/* Body columns */

.tr-body {
  display: flex;
  flex-wrap: wrap;
  gap: 48px;
}

.tr-main {
  flex: 999 1 560px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 48px;
}

.tr-main > section {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.tr-h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 8px;
}

.tr-abstract {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ink);
  padding: 24px 28px;
  gap: 12px;
}

.tr-abstract h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-align: center;
}

.tr-abstract p {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
}

.tr-topic {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tr-topic h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.tr-topic p {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.65;
}

.tr-pubs {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 14px;
  line-height: 1.6;
}

.tr-pubs li {
  display: flex;
  gap: 14px;
}

.tr-pubs li > span:first-child {
  color: var(--accent);
  font-weight: 600;
}

.tr-note {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.tr-table-wrap {
  overflow-x: auto;
}

.tr-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.5;
}

.tr-table th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--muted);
  font-weight: 500;
  padding: 8px 12px;
  border-bottom: 1px solid var(--ink);
}

.tr-table td {
  padding: 10px 12px;
  border-bottom: 1px dashed var(--rule-soft);
  vertical-align: top;
}

.tr-table th:first-child,
.tr-table td:first-child {
  padding-left: 0;
}

.tr-table th:last-child,
.tr-table td:last-child {
  padding-right: 0;
}

.tr-table td:last-child {
  font-family: var(--serif);
}

/* Sidebar */

.tr-aside {
  flex: 1 1 260px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* Figures */

.tr-fig {
  margin: 0;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.tr-fig:not(.js-only) {
  display: flex;
}

.tr-fig figcaption b {
  color: var(--ink);
}

/* Fig. 2 rides down the sidebar so it stays on screen while reading. */
.tr-aside .tr-depth {
  position: sticky;
  top: 24px;
}

.tr-portrait {
  aspect-ratio: 4 / 5;
  border: 1px solid var(--ink);
  overflow: hidden;
}

.tr-portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
}

.tr-chart {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px;
  font-size: 10px;
  color: var(--muted);
}

.tr-chart-y {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: right;
  height: 120px;
}

.tr-chart-plot {
  height: 120px;
  border-left: 1px solid var(--ink);
  border-top: 1px solid var(--ink);
  display: flex;
  align-items: flex-start;
  gap: 1px;
  padding-left: 1px;
  background: repeating-linear-gradient(180deg, transparent 0 29px, var(--ground) 29px 30px);
}

.tr-chart-plot > div {
  flex: 1 1 0;
  height: 0;
  background: var(--accent);
}

.tr-chart-plot > div:last-child {
  background: var(--ink);
}

.tr-chart-x {
  display: flex;
  justify-content: space-between;
}

.tr-footnote {
  border-top: 1px solid var(--rule-soft);
  padding-top: 12px;
}

/* Footer */

.tr-foot {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-align: center;
}

.tr-foot .rule-double {
  align-self: stretch;
}

.tr-foot span + span {
  color: var(--muted);
}

/*******************/
/* SECONDARY PAGES */
/*******************/

.doc {
  display: flex;
  flex-direction: column;
  gap: 32px;
  min-width: 0;
}

.doc-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.015em;
}

.entry {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  max-width: 72ch;
}

.entry p {
  margin: 0 0 1em;
}
