/* Halis Technology
   One idea: old code printed on green-bar listing paper, next to the new code
   that replaces it. The green bands carry through the page as its only color. */

@font-face {
  font-family: "IBM Plex Serif";
  src: url("/fonts/ibm-plex-serif-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --band: #e1eee3;        /* green-bar band */
  --band-edge: #bfd6c4;   /* perforations and rules on the listing */
  --ink: #17251f;         /* body text */
  --green: #14342b;       /* headings and the contact block */
  --link: #0b6b43;
  --muted: #4b5f56;
  --rule: #cdd9d1;
  --on-green: #d9e8dd;
  --miss: #a1260d;        /* a failed test, and nothing else */

  --serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --line: 1.5rem;         /* one line of listing; bands are two lines tall */
}

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

/* Controls that need JavaScript stay out of the page until the script turns them on. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}

h1, h2, h3, dt {
  font-family: var(--serif);
  font-weight: 500;
  color: var(--green);
  margin: 0;
}
h1 { font-size: clamp(2.25rem, 5.6vw, 3.75rem); line-height: 1.08; letter-spacing: -0.015em; max-width: 17ch; }
h2 { font-size: clamp(1.625rem, 3.2vw, 2rem); line-height: 1.15; letter-spacing: -0.005em; }
h3, dt { font-size: 1.375rem; line-height: 1.25; }

p { margin: 0 0 1rem; max-width: 38rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--link); text-decoration-thickness: 0.07em; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 0.14em; }
a:focus-visible { outline: 3px solid var(--link); outline-offset: 3px; border-radius: 2px; }

.wrap { max-width: 68rem; margin-inline: auto; padding-inline: 1.5rem; }

.skip { position: absolute; left: -999rem; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--paper); padding: 0.5rem 0.75rem; }

/* Heading on the left, text on the right. Used by services, terms, about, contact. */
.split { display: grid; grid-template-columns: minmax(0, 19rem) minmax(0, 1fr); gap: 0.75rem 3rem; align-items: start; }

/* ---------- Top ---------- */

.top .wrap { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding-block: 1.25rem; }
.name { font-family: var(--serif); font-weight: 500; font-size: 1.25rem; color: var(--green); text-decoration: none; }
.top-mail { font-size: 1rem; }

/* ---------- Hero ---------- */

.hero { padding-block: 3.5rem 4.5rem; }
.lead { font-size: 1.25rem; line-height: 1.5; margin-top: 1.5rem; max-width: 36rem; }

.button {
  display: inline-block;
  margin-top: 0.75rem;
  font-weight: 600;
  color: #fff;
  background: var(--green);
  padding: 0.8rem 1.25rem;
  border-radius: 0.25rem;
  text-decoration: none;
}
.button:hover { background: #0e2720; }
.button:focus-visible { outline-offset: 4px; }

/* ---------- Old code, new code ---------- */

.pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas: "old new" "check run";
  gap: 2rem;
  align-items: start;
  margin-top: 3.5rem;
}
.listing { margin: 0; min-width: 0; }
.old { grid-area: old; }
.new { grid-area: new; align-self: stretch; display: flex; flex-direction: column; }
.check { grid-area: check; }

.listing figcaption { font-size: 0.9375rem; font-weight: 600; color: var(--muted); margin-bottom: 0.5rem; }

.listing pre {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.875rem;
  line-height: var(--line);
  color: var(--ink);
  overflow-x: auto;
  tab-size: 2;
}
.listing code { font-family: inherit; }
.listing .c { color: var(--muted); }

/* New code and its test: a plain editor pane. */
.new pre, .check pre {
  padding: var(--line) 1.25rem;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 0.375rem;
}
/* Tall enough for the longer rushed rewrite, so nothing below moves when the code is swapped. */
.new pre { flex: 1; min-height: calc(var(--line) * 13 + 2px); }

/* Old code: continuous-feed listing paper. Square corners, feed holes down both
   edges, and bands two lines tall so the eye can follow a line across. */
.sheet {
  position: relative;
  padding-inline: 1.75rem;
  background: var(--paper);
  border: 1px solid var(--band-edge);
}
.sheet::before, .sheet::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1.75rem;
  background: radial-gradient(circle, var(--paper) 0 0.26rem, var(--band-edge) 0.27rem 0.34rem, transparent 0.36rem) center top / 1.75rem var(--line) repeat-y;
}
.sheet::before { left: 0; border-right: 1px dashed var(--band-edge); }
.sheet::after { right: 0; border-left: 1px dashed var(--band-edge); }
.sheet pre {
  padding: var(--line) 1rem;
  background: repeating-linear-gradient(to bottom, var(--band) 0 calc(var(--line) * 2), var(--paper) calc(var(--line) * 2) calc(var(--line) * 4));
}

/* The stamp the test result puts on the old listing. */
.stamp {
  position: absolute;
  right: 2.75rem;
  bottom: 1rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.25rem;
  line-height: 1.2;
  padding: 0.3rem 0.8rem;
  border: 3px double currentColor;
  border-radius: 0.25rem;
  transform: rotate(-6deg);
  color: var(--link);
  background: rgb(255 255 255 / 0.7);
}
.stamp.fail { color: var(--miss); }

/* Run the test. The button sits beside the test it runs, with the result under it. */
.runner { grid-area: run; padding-top: 2rem; }
.run {
  font: inherit;
  font-weight: 600;
  display: block;
  width: 100%;
  max-width: 22.5rem;
  color: var(--green);
  background: var(--paper);
  border: 2px solid var(--green);
  border-radius: 0.25rem;
  padding: 0.7rem 1.1rem;
  cursor: pointer;
}
.run:hover { background: var(--band); }
.run:focus-visible { outline: 3px solid var(--link); outline-offset: 3px; }

.result { margin-top: 1.25rem; padding-left: 1rem; border-left: 4px solid transparent; }
.result p { margin: 0 0 0.4rem; }
.result .verdict { font-weight: 600; color: var(--green); }
.result .why { color: var(--muted); font-size: 1rem; }
.result.pass { border-left-color: var(--link); }
.result.fail { border-left-color: var(--miss); }
.result.fail .verdict { color: var(--miss); }

.pair-note { margin-top: 1.5rem; color: var(--muted); font-size: 1rem; max-width: 44rem; }

/* ---------- Services: the bands again ---------- */

.services h2 { margin-bottom: 2rem; }
.service { padding-block: 2.5rem; }
.on-band { background: var(--band); }
.past { color: var(--muted); font-size: 1rem; }

/* ---------- Plain sections ---------- */

.plain { padding-block: 4rem 0; }
.plain:last-child { padding-bottom: 4.5rem; }

.terms { margin: 1.5rem 0 0; border-top: 2px solid var(--green); }
.terms .split { padding-block: 1.25rem; border-bottom: 1px solid var(--rule); }
.terms dd { margin: 0; max-width: 38rem; }

/* The one photograph on the page, with the name it belongs to. */
.byline { margin: 1.5rem 0 0; }
.portrait { display: block; width: 9rem; height: 9rem; object-fit: cover; border-radius: 0.375rem; }
.byline figcaption { margin-top: 0.875rem; color: var(--muted); font-size: 1rem; line-height: 1.5; }
.byline-name { display: block; font-family: var(--serif); font-weight: 500; font-size: 1.25rem; line-height: 1.3; color: var(--green); }

/* ---------- Contact ---------- */

.contact { background: var(--green); color: var(--on-green); padding-block: 3.5rem; }
.contact h2 { color: #fff; }
.contact a { color: #fff; }
.contact a:focus-visible { outline-color: #fff; }
.fine { font-size: 0.9375rem; margin-top: 2rem; }

/* ---------- Narrow screens ---------- */

@media (max-width: 52rem) {
  .split { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .pair { grid-template-columns: minmax(0, 1fr); grid-template-areas: "old" "new" "check" "run"; gap: 2.5rem; margin-top: 3rem; }
  .runner { padding-top: 0; }
  .run { max-width: none; }
  .hero { padding-block: 2.5rem 4rem; }
  .lead { margin-top: 1.75rem; }
  .button { margin-top: 1rem; }
  .pair-note { margin-top: 2.5rem; }
  .services h2 { margin-bottom: 2.5rem; }
  .service { padding-block: 3rem; }
  .past { margin-top: 1.25rem; }
  .plain { padding-top: 4.5rem; }
  .plain:last-child { padding-bottom: 5rem; }
  .terms { margin-top: 2rem; }
  .terms .split { padding-block: 1.75rem; gap: 0.5rem; }
  .contact { padding-block: 4rem; }
  .contact .split, .plain .split { gap: 1.5rem; }
  .byline { display: flex; align-items: center; gap: 1.25rem; margin-top: 1.5rem; }
  .portrait { width: 7.5rem; height: 7.5rem; flex: none; }
  .byline figcaption { margin-top: 0; }
  .terms .split { gap: 0.5rem; }
}

@media (max-width: 30rem) {
  .wrap { padding-inline: 1.5rem; }
  .top-mail { display: none; }
  .top .wrap { padding-block: 1.5rem; }
  .button { display: block; text-align: center; }
  p { margin-bottom: 1.25rem; }
  .listing pre { font-size: 0.75rem; }
  .sheet { padding-inline: 1.25rem; }
  .sheet::before, .sheet::after { width: 1.25rem; background-size: 1.25rem var(--line); }
  .sheet pre { padding-inline: 0.625rem; }
  .stamp { right: 1.75rem; font-size: 1.0625rem; }
  .new pre, .check pre { padding-inline: 0.75rem; }
}

@media print {
  .button, .top-mail, .runner { display: none; }
  .contact { background: none; color: var(--ink); }
  .contact h2, .contact a { color: var(--ink); }
}
