/* ══════════════════════════════════════════════════════════════
   Portfolio Monitor — showcase site

   Shares its design system with the report email (src/emailer.py):
   cool paper rather than cream, a humanist serif for voice, the system
   sans for utility text, and a monospace reserved for figures. The
   stacked thick/thin rule is the masthead device carried across both.
   ══════════════════════════════════════════════════════════════ */

:root {
  --canvas:      #EDEEF0;
  --sheet:       #FFFFFF;
  --ink:         #16191E;
  --ink-2:       #4A525E;
  --ink-3:       #858D99;
  --rule:        #E2E5E9;
  --accent:      #17457A;
  --accent-soft: #9FB6CE;
  --up:          #0B6E4F;
  --down:        #A32C22;
  --up-bg:       #E8F2ED;

  /* Matched to the email so the site and the message it advertises use
     literally the same faces on the same machine. */
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: 'SF Mono', 'IBM Plex Mono', Menlo, Consolas, 'Liberation Mono', monospace;

  --gutter: 40px;
  --measure: 1080px;
}

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

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.container { width: 100%; max-width: var(--measure); margin: 0 auto; padding: 0 var(--gutter); }

/* The sheet: one continuous page the whole site sits on, like the email. */
.sheet {
  max-width: 1180px;
  margin: 0 auto;
  background: var(--sheet);
}

/* ── Masthead device ─────────────────────────────────────────── */
.rule-double { border-top: 2px solid var(--ink); }
.rule-double::after {
  content: ''; display: block;
  border-top: 1px solid var(--rule); margin-top: 2px;
}

.eyebrow {
  font-size: 10px; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--ink-3);
  margin: 0 0 10px;
}
.eyebrow-accent { color: var(--accent); }

/* ── Navigation ──────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--sheet);
  border-bottom: 1px solid var(--rule);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; padding: 16px var(--gutter);
  max-width: var(--measure); margin: 0 auto;
}
.nav-logo {
  font-size: 11px; font-weight: 700; letter-spacing: 1.4px;
  text-transform: uppercase; color: var(--accent);
  text-decoration: none; white-space: nowrap;
}
.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a {
  font-size: 13px; color: var(--ink-2); text-decoration: none;
}
.nav-links a:hover { color: var(--ink); text-decoration: underline; }
.nav-github { display: inline-flex; align-items: center; gap: 7px; }

/* ── Hero ────────────────────────────────────────────────────── */
.hero { padding: 76px var(--gutter) 0; max-width: var(--measure); margin: 0 auto; }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 56px; align-items: start;
}

/* ── Run log: the seven steps, as you actually see them ──────── */
.run-log { border: 1px solid var(--rule); background: var(--sheet); }
.run-log-bar {
  padding: 10px 14px; border-bottom: 1px solid var(--rule); background: var(--canvas);
}
.run-log-cmd { font-family: var(--mono); font-size: 12px; color: var(--ink); }
.run-log-cmd::before { content: '$ '; color: var(--accent-soft); }
.run-log-body {
  margin: 0; padding: 14px; background: var(--sheet);
  overflow-x: auto;
}
.run-log-body code {
  font-family: var(--mono); font-size: 10.5px; line-height: 1.9;
  color: var(--ink-2); background: none; padding: 0;
  white-space: pre;
}
.run-log-body .t { color: var(--ink-3); }
.run-log-body .i { color: var(--accent-soft); }
.run-log-body .w { color: #B8860B; }
.run-log-body .d { color: var(--accent); }
.run-log-body .g { color: var(--up); font-weight: 600; }
.hero-title {
  margin: 0;
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(38px, 6vw, 62px); line-height: 1.06;
  letter-spacing: -1px; color: var(--ink);
}
.hero-title em { font-style: italic; color: var(--accent); }
.hero-subtitle {
  margin: 20px 0 0; max-width: 54ch;
  font-size: 17px; line-height: 1.6;
}
.hero-subtitle strong { color: var(--ink); font-weight: 600; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.btn {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 11px 20px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.3px;
  text-decoration: none; border: 1px solid var(--ink);
  transition: background .15s, color .15s;
}
.btn-primary { background: var(--ink); color: var(--sheet); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn-secondary:hover { border-color: var(--ink); }

/* Stats read as a ledger strip, not as cards. */
.hero-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  margin-top: 54px; border-top: 1px solid var(--ink);
}
.stat { padding: 18px 20px 22px; border-right: 1px solid var(--rule); }
.stat:first-child { padding-left: 0; }
.stat:last-child { border-right: none; }
.stat-value {
  display: block;
  font-family: var(--serif); font-size: 32px; line-height: 1.1; color: var(--ink);
}
.stat-label {
  display: block; margin-top: 6px;
  font-size: 10px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--ink-3);
}

/* ── Sections ────────────────────────────────────────────────── */
.section { padding: 76px 0; max-width: var(--measure); margin: 0 auto; }
.section > .container { padding-left: var(--gutter); padding-right: var(--gutter); }
.section-head { padding-top: 16px; margin-bottom: 40px; }
.section-title {
  margin: 0;
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(28px, 3.6vw, 38px); line-height: 1.14;
  letter-spacing: -0.5px; color: var(--ink);
}
.section-subtitle { margin: 12px 0 0; max-width: 62ch; font-size: 16px; }

/* ── Features ────────────────────────────────────────────────── */
.features-grid {
  display: grid; gap: 0;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  border-top: 1px solid var(--ink);
}
.feature-card {
  padding: 24px 24px 28px 0;
  border-bottom: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
}
.feature-card h3 {
  margin: 0 0 8px;
  font-size: 15px; font-weight: 600; color: var(--ink);
}
.feature-card p { margin: 0; font-size: 14px; }
.feature-card code {
  font-family: var(--mono); font-size: 12px;
  background: var(--canvas); padding: 1px 5px; color: var(--ink);
}

/* ── Pipeline: genuinely a sequence, so it is numbered. ──────── */
.pipeline { border-top: 1px solid var(--ink); }
.pipeline-step {
  display: grid; grid-template-columns: 56px 190px 1fr;
  gap: 24px; align-items: baseline;
  padding: 22px 0;
  border-bottom: 1px solid var(--rule);
}
.pipeline-num {
  font-family: var(--mono); font-size: 12px; color: var(--accent-soft);
}
.pipeline-file {
  font-family: var(--mono); font-size: 13px; color: var(--accent);
}
.pipeline-body h3 {
  margin: 0 0 5px; font-size: 15px; font-weight: 600; color: var(--ink);
}
.pipeline-body p { margin: 0; font-size: 14px; max-width: 78ch; }
.pipeline-body code {
  font-family: var(--mono); font-size: 12px;
  background: var(--canvas); padding: 1px 5px; color: var(--ink);
}

/* ── Report preview ──────────────────────────────────────────── */
.report-shots {
  display: grid; gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  margin-bottom: 44px;
}
.report-shot { margin: 0; }
.report-shot img {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--rule);
}
.report-shot figcaption {
  margin-top: 9px;
  font-size: 11px; font-weight: 700; letter-spacing: 1.1px;
  text-transform: uppercase; color: var(--ink-3);
}

.report-sections { border-top: 1px solid var(--ink); }
.report-item {
  display: grid; grid-template-columns: 56px 1fr;
  gap: 24px; align-items: baseline;
  padding: 18px 0;
  border-bottom: 1px solid var(--rule);
}
.report-num { font-family: var(--mono); font-size: 12px; color: var(--accent-soft); }
.report-item h4 { margin: 0 0 4px; font-size: 15px; font-weight: 600; color: var(--ink); }
.report-item p { margin: 0; font-size: 14px; max-width: 78ch; }

/* ── Tech stack ──────────────────────────────────────────────── */
.tech-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  border-top: 1px solid var(--ink);
}
.tech-item {
  padding: 16px 20px 18px 0;
  border-bottom: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
}
.tech-name {
  display: block; font-family: var(--mono); font-size: 14px; color: var(--ink);
}
.tech-role {
  display: block; margin-top: 4px;
  font-size: 10px; font-weight: 700; letter-spacing: 1.1px;
  text-transform: uppercase; color: var(--ink-3);
}

/* ── Setup ───────────────────────────────────────────────────── */
.setup-steps { border-top: 1px solid var(--ink); }
.setup-step {
  display: grid; grid-template-columns: 56px 1fr;
  gap: 24px; padding: 24px 0;
  border-bottom: 1px solid var(--rule);
}
.setup-num { font-family: var(--mono); font-size: 12px; color: var(--accent-soft); }
.setup-body h4 { margin: 0 0 10px; font-size: 15px; font-weight: 600; color: var(--ink); }
.setup-body p { margin: 0; font-size: 14px; max-width: 78ch; }
.setup-body code {
  font-family: var(--mono); font-size: 12px;
  background: var(--canvas); padding: 1px 5px; color: var(--ink);
}
pre {
  margin: 0; padding: 16px 18px;
  background: var(--canvas);
  overflow-x: auto;
}
pre code {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7;
  background: none; padding: 0; color: var(--ink);
}

/* ── Cost table: same ruled treatment as the email's tables. ─── */
.cost-table-wrapper { overflow-x: auto; }
.cost-table {
  width: 100%; border-collapse: collapse;
  font-size: 14px; font-variant-numeric: tabular-nums;
}
.cost-table th {
  padding: 0 12px 8px; text-align: left;
  border-bottom: 1px solid var(--ink);
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--ink-3);
}
.cost-table td { padding: 12px; border-bottom: 1px solid var(--rule); }
.cost-table th:first-child, .cost-table td:first-child { padding-left: 0; }
.cost-table th:last-child, .cost-table td:last-child { padding-right: 0; text-align: right; }
.cost-table tfoot td {
  border-bottom: none; border-top: 2px solid var(--ink);
  padding-top: 14px; color: var(--ink); font-weight: 600;
}
.cost-total { color: var(--up); font-family: var(--serif); font-size: 20px; }

/* ── Footer ──────────────────────────────────────────────────── */
.footer { max-width: var(--measure); margin: 0 auto; padding: 0 var(--gutter) 60px; }
.footer-cta { padding: 60px 0; text-align: left; }
.footer-cta h2 {
  margin: 0 0 10px;
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(26px, 3.4vw, 36px); letter-spacing: -0.5px; color: var(--ink);
}
.footer-cta p { margin: 0 0 26px; font-size: 16px; }
.footer-bottom {
  display: flex; flex-wrap: wrap; gap: 8px 28px;
  justify-content: space-between;
  padding-top: 18px; border-top: 1px solid var(--rule);
  font-size: 12px; color: var(--ink-3);
}
.footer-bottom p { margin: 0; }
.footer-disclaimer { font-family: var(--serif); font-style: italic; font-size: 13px; }

/* ── Small screens ───────────────────────────────────────────── */
@media (max-width: 860px) {
  :root { --gutter: 22px; }
  .hero { padding-top: 52px; }
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .stat { padding-left: 0; }
  .stat:nth-child(2) { border-right: none; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--rule); }
  .section { padding: 54px 0; }
  .pipeline-step { grid-template-columns: 36px 1fr; gap: 14px; }
  .pipeline-file { grid-column: 2; margin-bottom: 2px; }
  .pipeline-body { grid-column: 2; }
  .report-item, .setup-step { grid-template-columns: 36px 1fr; gap: 14px; }
  .nav-links { gap: 16px; }
  .nav-links a:not(.nav-github) { display: none; }
  .feature-card, .tech-item { padding-right: 0; border-right: none; }
}
