/* ==========================================================================
   Makefaster — blueprint / technical-drawing aesthetic
   Implemented from the DiffUI design renders (see README).
   ========================================================================== */

:root {
  --paper: #e8e6e0;
  --ink: #17395e;
  --ink-deep: #12304f;
  --red: #c2402a;
  --green: #3e8e41;
  --slate: #a7b3c1;
  --muted: #5d6874;
  --cream: #f0eee8;

  --line-strong: rgba(23, 57, 94, 0.62);
  --line: rgba(23, 57, 94, 0.38);
  --hairline: rgba(23, 57, 94, 0.22);

  --font-sans: "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Inter Tight", "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --font-serif: "IBM Plex Serif", Georgia, serif;

  --texture-image: url("../assets/textures/concrete-01.webp");
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  position: relative;
}

/* Site-wide repeating concrete ground. Press C to cycle the five tiles. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: var(--texture-image);
  background-size: 512px 512px;
  background-repeat: repeat;
  opacity: 0.55;
  pointer-events: none;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

::selection { background: rgba(23, 57, 94, 0.85); color: var(--cream); }

/* ------------------------------------------------------------- utilities */

.mono-label {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink);
}

.plus { font-family: var(--font-mono); font-weight: 500; color: var(--red); }

.dots {
  background-image: radial-gradient(circle, rgba(23, 57, 94, 0.5) 1.05px, transparent 1.15px);
  background-size: 11px 11px;
}

.icon { display: inline-block; vertical-align: middle; flex: none; }

/* ------------------------------------------------------- custom elements */

/* Every component renders into light DOM so the rules below keep applying to
   its markup. That makes each host element an extra box in the tree, and an
   unstyled custom element is inline, so the structural ones are declared
   blocks. See also `site-header` in the masthead section. */
app-root,
landing-page,
site-leaderboard-page,
improvement-leaderboard-page,
geo-row,
spec-footer {
  display: block;
}

/* ---------------------------------------------------------------- sheet */

.sheet {
  max-width: 1320px;
  margin: 16px auto 0;
  position: relative;
  padding: 0 34px;
}

.sheet--framed {
  border: 1px solid var(--line-strong);
  padding: 0;
}

.sheet--framed .sheet-inner { padding: 0 34px; }

/* red registration plusses hugging the frame */
.corner-plus {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--red);
  line-height: 1;
  user-select: none;
}
.corner-plus.tl { top: 12px; left: -22px; }
.corner-plus.tr { top: 12px; right: -22px; }
.corner-plus.ml { top: 118px; left: -22px; }
.corner-plus.mr { top: 118px; right: -22px; }

/* -------------------------------------------------------------- masthead */

/* <site-header> is a light-DOM wrapper around .masthead, so it needs to be a
   block for the header's grid to lay out at full width. */
site-header { display: block; }

.masthead {
  display: grid;
  grid-template-columns: 1fr 88px;
  align-items: stretch;
  position: relative;
}

.sheet--framed .masthead { border-bottom: 1px solid var(--line-strong); }

.sheet--open .masthead { border: 1px solid var(--line-strong); }

.masthead-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 16px 28px;
}

.brand { display: flex; align-items: center; gap: 13px; }
.brand img { width: 42px; height: 42px; }
.brand-word {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.site-nav { display: flex; align-items: center; gap: 34px; }
.site-nav a {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  padding-bottom: 5px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.site-nav a:hover { border-bottom-color: rgba(194, 64, 42, 0.45); }
.site-nav a.active { border-bottom-color: var(--red); }

.masthead-cell {
  border-left: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
}

/* dotted compartment that continues below the crosshair cell */
.rail-dots {
  position: absolute;
  top: 100%;
  right: 0;
  width: 88px;
  height: 66px;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
}
.rail-dots .dots { width: 100%; height: 100%; }

/* --------------------------------------------------------------- georow */

.georow {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 18px 0 6px;
  min-height: 74px;
}

.ref-tab {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--red);
  border: 1px solid var(--line);
  padding: 5px 12px;
  margin-top: 44px;
}
.sheet--framed .ref-tab { border-right: none; margin-right: -34px; }
.sheet--open .ref-tab { margin-top: 4px; }

/* -------------------------------------------------------------- eyebrow */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--ink);
  position: relative;
  margin: 10px 0 0;
}
.eyebrow .plus { font-size: 15px; }
.eyebrow-dots {
  position: absolute;
  right: 0;
  top: -6px;
  width: 140px;
  height: 44px;
}

/* ================================================================ LANDING */

.hero {
  position: relative;
  padding: 34px 56px 0;
}

.hero-tick {
  position: absolute;
  left: 22px;
  top: 44px;
  height: 66px;
  border-left: 1px solid var(--line-strong);
}
.hero-tick + .hero-tick { left: 28px; }

.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(40px, 6vw, 76px);
  line-height: 1.06;
  letter-spacing: -0.018em;
  color: var(--ink);
  max-width: 28ch;
}

.hero-rule {
  position: absolute;
  right: 0;
  top: 128px;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(24%, 300px);
}
.hero-rule::before { content: ""; flex: 1; border-top: 1px solid var(--red); }
.hero-rule .plus { font-size: 15px; }

.lede {
  margin: 34px 0 0;
  max-width: 560px;
  font-size: 16.5px;
  line-height: 1.68;
  color: #3d4a58;
}

/* command block ---------------------------------------------------------- */

.cmd-wrap { padding: 44px 56px 0; }

.cmd-shell {
  border: 1px solid var(--line-strong);
  padding: 7px;
  max-width: 980px;
  margin: 0 auto;
}

.cmd {
  width: 100%;
  background: var(--ink);
  position: relative;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 27px 34px;
  text-align: left;
}
.cmd::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(240, 238, 232, 0.45);
  pointer-events: none;
}
.cmd-chevron {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 26px;
  color: var(--red);
  line-height: 1;
}
.cmd-text {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: clamp(19px, 2.4vw, 28px);
  letter-spacing: 0.1em;
  color: var(--cream);
  flex: 1;
}
.cmd-copy {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(240, 238, 232, 0.78);
}
.cmd:hover .cmd-copy { color: var(--cream); }

.specimen-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 56px;
  margin: 26px 0 0;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--red);
}

/* metric band ------------------------------------------------------------ */

.band {
  margin-top: 44px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  position: relative;
}

.band-xhair {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--ink);
  background: transparent;
}
.band-xhair.bottom { top: 100%; }

.band-grid {
  display: grid;
  grid-template-columns: 250px repeat(4, 1fr);
}

.band-info {
  padding: 30px 26px 30px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.band-info .dash { color: var(--ink); font-weight: 600; }
.band-info p { font-size: 13px; line-height: 1.6; color: var(--muted); max-width: 21ch; }
.band-meta {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.18em;
  line-height: 2;
  text-transform: uppercase;
  color: var(--ink);
}
.band-info .dots { width: 104px; height: 40px; margin-top: auto; }

.metric {
  border-left: 1px solid var(--line);
  padding: 26px 20px 22px;
  text-align: center;
}
.metric-abbr {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.14em;
  color: var(--ink);
}
.metric-sub {
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.4;
  margin: 4px auto 0;
  max-width: 14ch;
  min-height: 30px;
}

.metric-chart {
  position: relative;
  height: 132px;
  margin-top: 12px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 14px;
  border-bottom: 1px solid var(--line-strong);
  padding: 0 6px;
}
.metric-chart .bar { width: 36px; }
.bar--before { background: var(--slate); height: 104px; }
.bar--after { background: var(--ink); }

.metric-anno {
  position: absolute;
  right: 2px;
  top: 6px;
  text-align: right;
}
.metric-anno .pct {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--red);
  letter-spacing: 0.02em;
}
.metric-anno svg { display: block; margin: 2px 8px 0 auto; }

.metric-xlabels {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.metric-xlabels span { width: 36px; text-align: center; }

/* how it works ----------------------------------------------------------- */

.how {
  display: grid;
  grid-template-columns: 250px 1fr;
  margin-top: 0;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.how-info { padding: 44px 26px 40px 22px; }
.how-info p { font-size: 13px; line-height: 1.6; color: var(--muted); max-width: 20ch; margin-top: 12px; }
.how-info .dots { width: 120px; height: 54px; margin-top: 26px; }

.steps {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  gap: 0 10px;
  padding: 44px 0 40px;
  align-items: start;
}

.step { text-align: left; padding: 0 8px; }

.pictoframe {
  width: 104px;
  height: 104px;
  position: relative;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
}
.pictoframe img { width: 52px; height: 52px; }
.pictoframe .c { position: absolute; width: 17px; height: 17px; }
.pictoframe .c.tl { top: 0; left: 0; border-top: 1.5px solid var(--ink); border-left: 1.5px solid var(--ink); }
.pictoframe .c.tr { top: 0; right: 0; border-top: 1.5px solid var(--ink); border-right: 1.5px solid var(--ink); }
.pictoframe .c.bl { bottom: 0; left: 0; border-bottom: 1.5px solid var(--ink); border-left: 1.5px solid var(--ink); }
.pictoframe .c.br { bottom: 0; right: 0; border-bottom: 1.5px solid var(--ink); border-right: 1.5px solid var(--ink); }

.step-arrow { align-self: start; margin-top: 40px; color: var(--red); }

.step-label {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
}
.step-label .num { color: var(--red); margin-right: 10px; }
.step p { font-size: 12.5px; line-height: 1.55; color: var(--muted); margin-top: 10px; max-width: 21ch; }

/* ============================================================ LEADERBOARDS */

.page-head { padding: 6px 0 0; }

.page-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(30px, 3.4vw, 42px);
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-top: 14px;
}

.page-sub {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-top: 10px;
}
.page-sub p { font-size: 14px; color: var(--muted); }

/* stat cards ------------------------------------------------------------- */

.stat-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 18px;
  margin-top: 26px;
}

.stat-card { border: 1px solid var(--line-strong); background: rgba(240, 238, 232, 0.25); }

.stat-card-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 9.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
}
.stat-card-head .icon { color: var(--ink); }

.stat-value {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 30px;
  color: var(--ink);
  text-align: center;
  padding: 16px 10px 2px;
  letter-spacing: -0.01em;
}
.stat-value.small { font-size: 20px; padding-top: 22px; }

.stat-sub {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  padding: 4px 10px 16px;
}
.stat-sub .icon { color: var(--red); }

/* controls --------------------------------------------------------------- */

.controls {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin: 30px 0 0;
  flex-wrap: wrap;
}

.load-type .mono-label { font-size: 9.5px; letter-spacing: 0.22em; display: block; margin-bottom: 8px; }

.segmented {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--line-strong);
  padding: 4px;
  background: rgba(240, 238, 232, 0.35);
}
.segmented button {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--ink);
  padding: 7px 16px;
}
.segmented button.active { background: var(--ink); color: var(--cream); }

.controls-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.search {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line-strong);
  background: rgba(240, 238, 232, 0.45);
  padding: 9px 13px;
  width: 260px;
  color: var(--muted);
}
.search input {
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--ink);
  width: 100%;
}
.search input::placeholder { color: var(--muted); }

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line-strong);
  background: rgba(240, 238, 232, 0.35);
  padding: 9px 15px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}
.btn-outline:hover { background: rgba(23, 57, 94, 0.08); }

/* tables ----------------------------------------------------------------- */

.table-scroll { overflow-x: auto; margin-top: 26px; }

.data-table { width: 100%; border-collapse: collapse; min-width: 860px; }

.data-table thead th {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  text-align: left;
  padding: 12px 16px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  vertical-align: top;
  white-space: nowrap;
}
.data-table thead th .unit {
  display: block;
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: none;
  color: var(--muted);
  margin-top: 3px;
}

.data-table thead th + th,
.data-table tbody td + td { border-left: 1px solid var(--hairline); }

.data-table tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
  white-space: nowrap;
}

.site-cell { display: flex; align-items: center; gap: 13px; min-width: 200px; }
.favicon-box { width: 28px; height: 28px; display: grid; place-items: center; flex: none; }
.favicon-box img { width: 26px; height: 26px; object-fit: contain; }
.favicon-fallback {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
}
.site-name { font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.site-url { font-size: 11.5px; color: var(--muted); }

.num-cell { font-family: var(--font-mono); font-weight: 600; font-size: 16px; color: var(--ink); }
.num-cell .spark { margin-left: 14px; color: var(--ink); opacity: 0.8; vertical-align: baseline; }

.delta-cell {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--red);
}
.delta-cell .icon { margin-right: 9px; color: var(--red); }

/* improvement leaderboard specifics */

.rank-cell { font-family: var(--font-mono); font-weight: 600; font-size: 19px; color: var(--ink); width: 46px; }

.cat-cell { display: flex; align-items: center; gap: 14px; min-width: 230px; }
.cat-icon {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  flex: none;
  color: var(--ink);
}
.cat-icon img { width: 21px; height: 21px; }
.cat-name { font-size: 14px; font-weight: 600; color: var(--ink); white-space: normal; }

.desc-cell {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
  white-space: normal !important;
  max-width: 240px;
  line-height: 1.45;
}

.count-cell { font-family: var(--font-mono); font-weight: 600; font-size: 16px; letter-spacing: 0.12em; color: var(--ink); }

.green-cell { font-family: var(--font-mono); font-weight: 700; font-size: 14.5px; letter-spacing: 0.08em; color: var(--green); }

.sparkbars-cell { color: var(--green); }

/* pagination ------------------------------------------------------------- */

.table-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 16px 2px 0;
  flex-wrap: wrap;
}
.table-foot .showing { font-size: 12.5px; color: var(--muted); }

.pagination { display: flex; align-items: center; gap: 6px; }
.pagination button {
  min-width: 30px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  background: rgba(240, 238, 232, 0.35);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
  color: var(--ink);
  display: grid;
  place-items: center;
}
.pagination button:hover:not(:disabled):not(.active) { background: rgba(23, 57, 94, 0.08); }
.pagination button.active { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.pagination button:disabled { opacity: 0.4; cursor: default; }
.pagination .gap {
  border: none;
  background: none;
  font-family: var(--font-mono);
  color: var(--muted);
  min-width: 20px;
  cursor: default;
}

/* --------------------------------------------------------------- footer */

.specfooter {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 52px 0 26px;
  position: relative;
}

.spec-nums {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1.9;
  text-transform: uppercase;
  color: rgba(23, 57, 94, 0.75);
}
.spec-nums.right { text-align: right; }

.spec-center {
  display: flex;
  align-items: center;
  gap: 46px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--ink);
  padding-bottom: 4px;
}

.bracket { position: absolute; width: 16px; height: 16px; }
.bracket.bl { left: -12px; bottom: 10px; border-left: 2px solid var(--red); border-bottom: 2px solid var(--red); }
.bracket.br { right: -12px; bottom: 10px; border-right: 2px solid var(--red); border-bottom: 2px solid var(--red); }
.sheet--framed .bracket.bl { left: -20px; bottom: -6px; }
.sheet--framed .bracket.br { right: -20px; bottom: -6px; }

.page-end {
  height: 12px;
  background: var(--ink-deep);
  margin-top: 10px;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 1100px) {
  .stat-cards { grid-template-columns: repeat(3, 1fr); }
  .band-grid { grid-template-columns: 1fr 1fr; }
  .band-info { grid-column: 1 / -1; border-bottom: 1px solid var(--line); }
  .metric:nth-child(2) { border-left: none; }
  .metric { border-top: 1px solid var(--hairline); }
  .how { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr 1fr; gap: 30px 10px; padding-top: 0; }
  .step-arrow { display: none; }
}

@media (max-width: 720px) {
  .sheet { padding: 0 18px; }
  .sheet--framed .sheet-inner { padding: 0 18px; }
  .masthead { grid-template-columns: 1fr; }
  .masthead-cell, .rail-dots, .eyebrow-dots, .hero-rule, .hero-tick { display: none; }
  .masthead-main { flex-wrap: wrap; padding: 14px 16px; gap: 14px; }
  .site-nav { gap: 20px; flex-wrap: wrap; }
  .hero { padding: 26px 6px 0; }
  .cmd-wrap { padding: 34px 0 0; }
  .cmd { gap: 14px; padding: 20px 18px; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .band-grid { grid-template-columns: 1fr; }
  .metric { border-left: none; }
  .steps { grid-template-columns: 1fr; }
  .specfooter { flex-direction: column; align-items: flex-start; gap: 14px; }
  .georow { flex-direction: column; gap: 10px; min-height: 0; }
  .ref-tab { margin-top: 0; }
  .sheet--framed .ref-tab { margin-right: 0; border-right: 1px solid var(--line); align-self: flex-start; }
}
