/* herbiearmy.com. One stylesheet for every page: no scripts, and nothing loaded from other sites.
   The look is a field notebook: parchment, typewriter labels, notes in red ink, and the
   palette from the brand boards. */

@font-face {
  font-family: "Special Elite";
  src: url("/fonts/special-elite.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Homemade Apple";
  src: url("/fonts/homemade-apple.woff2") format("woff2");
  font-display: swap;
}

:root {
  color-scheme: light;
  --parchment: #e8dbc4;
  --paper: #f2e9d5;
  --fossil: #1b1b16;
  --jungle: #1e3326;
  --olive: #687f4e;
  --olive-ink: #46553a;
  --blood: #7a2d2d;
  --gold: #c9a962;
  --rule: rgba(27, 27, 22, 0.34);
  --rule-soft: rgba(27, 27, 22, 0.16);
  --on-dark: #e8dbc4;
  --on-dark-dim: #b8b199;
  --rule-dark: rgba(232, 219, 196, 0.26);
  --type: "Special Elite", "American Typewriter", "Courier New", Courier, monospace;
  --hand: "Homemade Apple", "Segoe Script", "Bradley Hand", cursive;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", P052, Georgia, serif;
  --gutter: clamp(20px, 5vw, 72px);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

/* Parchment, with the stains old paper picks up at its edges. */
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--parchment);
  background-image:
    radial-gradient(64vw 44vw at 104% 0%, rgba(122, 88, 38, 0.24), transparent 62%),
    radial-gradient(52vw 60vw at -12% 38%, rgba(122, 88, 38, 0.15), transparent 62%),
    radial-gradient(70vw 46vw at 62% 104%, rgba(94, 68, 28, 0.2), transparent 62%);
  color: var(--fossil);
  font: 400 1.125rem/1.6 var(--serif);
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

/* Paper grain over everything. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background: url("/img/grain.svg");
  opacity: 0.55;
  mix-blend-mode: multiply;
}

main {
  flex: 1;
}

img,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

a {
  color: inherit;
  text-decoration-color: var(--blood);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--blood);
}

:focus-visible {
  outline: 2px solid var(--blood);
  outline-offset: 4px;
  border-radius: 2px;
}

::selection {
  background: var(--jungle);
  color: var(--parchment);
}

code {
  font-family: var(--type);
  font-size: 0.95em;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -80px;
  z-index: 20;
  padding: 10px 16px;
  background: var(--fossil);
  color: var(--parchment);
  font: 0.85rem var(--type);
}

.skip:focus {
  top: 12px;
}

/* Typewriter caption, as on a specimen label. */
.label {
  margin: 0;
  color: var(--olive-ink);
  font: 400 0.8rem/1.5 var(--type);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

/* A note in red ink. */
.hand {
  margin: 0;
  color: var(--blood);
  font: 400 0.98rem/1.9 var(--hand);
}

/* --- Dark bands with torn edges ------------------------------------------------------------ */

.masthead,
.band,
.colophon {
  position: relative;
  background: var(--jungle);
  color: var(--on-dark);
}

.masthead::after,
.band::before,
.band::after,
.colophon::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 16px;
  background: url("/img/tear.svg") repeat-x;
  background-size: 760px 16px;
  pointer-events: none;
}

.band::before,
.colophon::before {
  bottom: calc(100% - 1px);
}

.masthead::after,
.band::after {
  top: calc(100% - 1px);
  background-position-x: 310px;
  transform: scaleY(-1);
}

.masthead a:hover,
.band a:hover,
.colophon a:hover {
  color: var(--gold);
}

.masthead :focus-visible,
.band :focus-visible,
.colophon :focus-visible {
  outline-color: var(--gold);
}

/* --- Masthead ------------------------------------------------------------------------------- */

.masthead {
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
  padding: 14px var(--gutter) 12px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.wordmark .seal {
  width: 38px;
  height: 38px;
}

.wordmark .name {
  width: auto;
  height: 26px;
}

.masthead nav {
  display: flex;
  gap: clamp(16px, 3vw, 36px);
  font: 0.8rem/1 var(--type);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.masthead nav a {
  padding: 8px 0 5px;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s, color 0.2s;
}

.masthead nav a:hover,
.masthead nav a[aria-current="page"] {
  border-bottom-color: var(--gold);
}

/* --- Landing: the crest ---------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas:
    "notes emblem specimen"
    "title title title";
  align-items: center;
  gap: clamp(20px, 3vw, 44px) clamp(24px, 4vw, 64px);
  padding: clamp(44px, 4.4vw, 64px) var(--gutter) clamp(72px, 9vw, 130px);
}

.field-notes {
  grid-area: notes;
  justify-self: end;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--olive-ink);
  font: 400 1.02rem/2.1 var(--hand);
  transform: rotate(-5deg);
}

.emblem {
  grid-area: emblem;
  position: relative;
  width: clamp(240px, 26vw, 380px);
  aspect-ratio: 1;
  animation: settle 1.2s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.emblem img {
  position: absolute;
  inset: 13%;
  width: 74%;
  height: 74%;
  filter: drop-shadow(0 14px 18px rgba(52, 38, 14, 0.4));
}

.ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.ring circle,
.ring line {
  fill: none;
  stroke: var(--rule);
}

/* Only the lettering turns, inside the drawing, so the page never gains a scrollbar from it. */
.ring text {
  fill: var(--fossil);
  font: 400 14.5px var(--type);
  text-transform: uppercase;
  transform-box: view-box;
  transform-origin: center;
  animation: turn 140s linear infinite;
}

/* A specimen label, taped to the page. */
.specimen {
  grid-area: specimen;
  justify-self: start;
  position: relative;
  width: min(100%, 300px);
  padding: 22px 22px 16px;
  background: var(--paper);
  border: 1px solid var(--rule);
  outline: 1px solid var(--rule-soft);
  outline-offset: -6px;
  box-shadow: 0 10px 22px rgba(52, 38, 14, 0.22);
  transform: rotate(2.4deg);
}

.specimen::before,
.sheet::before,
.sheet::after {
  content: "";
  position: absolute;
  top: -13px;
  left: 50%;
  width: 92px;
  height: 26px;
  margin-left: -46px;
  background: rgba(201, 169, 98, 0.5);
  box-shadow: 0 1px 2px rgba(52, 38, 14, 0.2);
  transform: rotate(-3deg);
}

.specimen .tag {
  position: absolute;
  top: 12px;
  right: 16px;
}

.tag {
  margin: 0;
  color: var(--blood);
  font: 0.78rem/1 var(--type);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.specimen dl {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
}

.specimen dt {
  color: var(--olive-ink);
  font: 0.7rem/1.3 var(--type);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.specimen dd {
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 1px dotted var(--rule);
  font-size: 1.05rem;
  line-height: 1.3;
}

.title {
  grid-area: title;
  display: grid;
  justify-items: center;
  text-align: center;
}

/* The wordmark is a drawing (scripts/make-logo.ts), not type. */
.title h1 {
  width: min(100%, 1120px);
  margin: clamp(10px, 1.4vw, 20px) 0 clamp(18px, 2.4vw, 32px);
}

.title h1 img {
  width: 100%;
}

.lede {
  max-width: 35em;
  margin: 0;
  font-size: clamp(1.14rem, 1.6vw, 1.36rem);
  line-height: 1.55;
}

/* --- Landing: three commands, on labels pinned to a dark board ------------------------------ */

.band {
  padding: clamp(56px, 7vw, 100px) var(--gutter) clamp(60px, 7vw, 104px);
}

.band-head {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: end;
  gap: 16px clamp(24px, 5vw, 80px);
  margin-bottom: clamp(36px, 5vw, 64px);
}

.band .label {
  color: var(--gold);
}

.band h2,
.keep h2 {
  margin: 12px 0 0;
  font: 400 clamp(1.8rem, 3.6vw, 2.9rem) / 1.12 var(--type);
}

.band-head .lede {
  color: var(--on-dark-dim);
  font-size: 1.12rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(18px, 2.6vw, 36px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 24px 24px 20px;
  background: var(--paper);
  color: var(--fossil);
  outline: 1px solid var(--rule);
  outline-offset: -7px;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.42);
  transform: rotate(-1.1deg);
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.card:nth-child(2) {
  transform: rotate(0.8deg) translateY(10px);
}

.card:nth-child(3) {
  transform: rotate(-0.4deg);
}

.card:hover {
  transform: rotate(0deg) translateY(-6px);
}

.card code {
  display: block;
  margin: 20px 0 12px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--rule);
  font-size: clamp(2.1rem, 4vw, 3.2rem);
  line-height: 1;
}

.card h3 {
  margin: 0 0 8px;
  font: italic 400 1.4rem/1.2 var(--serif);
}

.card .body {
  margin: 0 0 14px;
  font-size: 1.02rem;
  line-height: 1.55;
}

.card .hand {
  margin-top: auto;
  transform: rotate(-1.5deg);
  transform-origin: left;
}

.also {
  margin: clamp(36px, 4vw, 56px) 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--rule-dark);
  color: var(--on-dark-dim);
  font-size: 1rem;
}

.also code {
  color: var(--on-dark);
}

/* --- Landing: what we keep, and the two documents ------------------------------------------- */

.keep {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 32px clamp(24px, 5vw, 80px);
  padding: clamp(72px, 9vw, 130px) var(--gutter) clamp(72px, 9vw, 130px);
}

.keep .lede {
  margin-top: 18px;
  max-width: 30em;
  font-size: 1.12rem;
}

.keep .hand {
  margin-top: 16px;
  transform: rotate(-2deg);
  transform-origin: left;
}

.docs {
  display: grid;
  align-content: start;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 4px double var(--fossil);
}

.docs a {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 8px 22px;
  padding: 26px 0 22px;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
}

.docs strong {
  font: 400 clamp(1.45rem, 2.7vw, 2.1rem) / 1.15 var(--type);
}

.docs .arrow {
  color: var(--blood);
  font: 1.5rem var(--type);
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.docs a:hover .arrow {
  transform: translateX(10px);
}

.docs small {
  grid-column: 2 / -1;
  color: var(--olive-ink);
  font-size: 1rem;
}

/* --- Legal pages ---------------------------------------------------------------------------- */

.doc-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px clamp(24px, 5vw, 80px);
  padding: clamp(56px, 7vw, 96px) var(--gutter) clamp(36px, 5vw, 60px);
}

.doc-head h1 {
  margin: 0.16em 0 0.3em;
  font: 400 clamp(2rem, 6.4vw, 5rem) / 1.05 var(--type);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.doc-head .lede {
  max-width: 36em;
}

/* The date, stamped. */
.stamp {
  margin: 0 clamp(0px, 3vw, 48px) 0 0;
  padding: 14px 20px 10px;
  border: 3px double var(--blood);
  border-radius: 6px;
  color: var(--blood);
  font: 0.76rem/1.5 var(--type);
  letter-spacing: 0.24em;
  text-align: center;
  text-transform: uppercase;
  transform: rotate(-7deg);
  animation: thunk 0.5s cubic-bezier(0.3, 1.4, 0.5, 1) 0.55s both;
}

.stamp strong {
  display: block;
  font-size: 1.4rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.sheet {
  position: relative;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: clamp(28px, 5vw, 80px);
  margin: 0 var(--gutter) clamp(72px, 9vw, 130px);
  padding: clamp(28px, 4.5vw, 68px) clamp(22px, 4.5vw, 68px);
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  box-shadow: 0 20px 44px rgba(52, 38, 14, 0.26);
}

.sheet::before {
  left: 12%;
}

.sheet::after {
  left: 88%;
  transform: rotate(4deg);
}

.toc {
  position: sticky;
  top: 24px;
  align-self: start;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  font: 0.86rem/1.4 var(--type);
}

.toc .label {
  padding-bottom: 12px;
  border-bottom: 4px double var(--fossil);
}

.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc;
}

.toc li {
  counter-increment: toc;
}

.toc a {
  display: grid;
  grid-template-columns: 2.4em 1fr;
  padding: 9px 0 6px;
  border-bottom: 1px dotted var(--rule);
  text-decoration: none;
}

.toc a::before {
  content: counter(toc, decimal-leading-zero);
  color: var(--blood);
}

.article {
  max-width: 44em;
  counter-reset: section;
}

.article h2 {
  counter-increment: section;
  margin: 2.3em 0 0.6em;
  padding-top: 1em;
  border-top: 1px solid var(--fossil);
  font: 400 clamp(1.4rem, 2.2vw, 1.75rem) / 1.2 var(--type);
}

.article h2::before {
  content: "§ " counter(section, decimal-leading-zero);
  display: block;
  margin-bottom: 10px;
  color: var(--blood);
  font: 0.8rem var(--type);
  letter-spacing: 0.22em;
}

.article h3 {
  margin: 1.7em 0 0.4em;
  font: italic 400 1.3rem/1.25 var(--serif);
}

.article p,
.article ul {
  margin: 0 0 1em;
}

.article ul {
  padding-left: 1.3em;
  list-style: none;
}

.article li {
  position: relative;
  margin-bottom: 0.45em;
}

.article li::before {
  content: "";
  position: absolute;
  left: -1.3em;
  top: 0.72em;
  width: 0.7em;
  height: 2px;
  background: var(--blood);
}

.article strong {
  font-weight: 700;
}

/* The short version, as a note clipped to the first page. */
.summary {
  margin: 0 0 2.6em;
  padding: 18px 24px 20px;
  background: rgba(104, 127, 78, 0.16);
  border-left: 4px solid var(--jungle);
}

.summary .hand {
  margin-bottom: 6px;
  font-size: 1.1rem;
}

.summary ul:last-child {
  margin-bottom: 0;
}

.scroll {
  margin: 0 0 1.2em;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.98rem;
  line-height: 1.45;
}

th,
td {
  padding: 12px 16px 12px 0;
  border-bottom: 1px dotted var(--rule);
  text-align: left;
  vertical-align: top;
}

thead th {
  border-bottom: 1px solid var(--fossil);
  color: var(--olive-ink);
  font: 400 0.74rem var(--type);
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

tbody th {
  width: 30%;
  font-weight: 700;
}

/* --- Not found ------------------------------------------------------------------------------ */

.lost {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: clamp(64px, 9vw, 120px) var(--gutter);
  text-align: center;
}

.lost img {
  width: min(52vw, 250px);
  margin-bottom: 18px;
  filter: drop-shadow(0 14px 18px rgba(52, 38, 14, 0.4));
}

.lost h1 {
  margin: 0;
  font: 400 clamp(1.8rem, 6vw, 4rem) / 1.1 var(--type);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.lost .lede {
  margin-top: 8px;
}

/* --- Footer --------------------------------------------------------------------------------- */

.colophon {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px 40px;
  padding: 40px var(--gutter) 40px;
  color: var(--on-dark-dim);
  font-size: 0.92rem;
  line-height: 1.5;
}

.motto {
  grid-column: 1 / -1;
  margin: 0 0 14px;
  color: var(--on-dark);
  font: 400 clamp(1.15rem, 2.4vw, 1.7rem) / 1.8 var(--hand);
  transform: rotate(-1.5deg);
  transform-origin: left;
}

.small-print {
  margin: 0;
  max-width: 46em;
}

.colophon nav {
  display: flex;
  gap: 24px;
  font: 0.8rem/1.9 var(--type);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.colophon a {
  text-decoration-color: var(--gold);
}

/* --- Motion ---------------------------------------------------------------------------------- */

.rise {
  animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.rise-2 {
  animation-delay: 0.12s;
}

.rise-3 {
  animation-delay: 0.24s;
}

.rise-4 {
  animation-delay: 0.36s;
}

@keyframes rise {
  from {
    opacity: 0;
    translate: 0 24px;
  }
}

@keyframes settle {
  from {
    opacity: 0;
    transform: scale(0.9) rotate(-8deg);
  }
}

@keyframes turn {
  to {
    transform: rotate(360deg);
  }
}

@keyframes thunk {
  from {
    opacity: 0;
    scale: 1.8;
  }
}

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

@media (max-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "emblem"
      "title"
      "notes"
      "specimen";
    justify-items: center;
  }

  .field-notes {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0 18px;
    justify-self: center;
    transform: rotate(-2deg);
  }

  .specimen {
    justify-self: center;
    margin-top: 14px;
  }

  .band-head,
  .keep,
  .sheet,
  .doc-head {
    grid-template-columns: minmax(0, 1fr);
  }

  .cards {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .card:nth-child(2) {
    transform: rotate(0.8deg);
  }

  .stamp {
    justify-self: start;
    margin-left: 6px;
  }

  .toc {
    position: static;
    max-height: none;
  }

  .colophon {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  body {
    font-size: 1.0625rem;
  }

  .title .label {
    font-size: 0.7rem;
    letter-spacing: 0.12em;
  }

  .docs a {
    grid-template-columns: 1fr auto;
  }

  .docs .label,
  .docs small {
    grid-column: 1 / -1;
  }
}

/* Tables become stacked entries: each cell on its own line, under its column's name. */
@media (max-width: 640px) {
  table {
    min-width: 0;
  }

  table,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  thead {
    display: none;
  }

  tbody tr {
    padding: 14px 0;
    border-bottom: 1px dotted var(--rule);
  }

  tbody tr:first-child {
    border-top: 1px solid var(--fossil);
  }

  tbody th,
  td {
    width: auto;
    padding: 0;
    border: 0;
  }

  td {
    margin-top: 10px;
  }

  td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--olive-ink);
    font: 400 0.7rem var(--type);
    letter-spacing: 0.2em;
    text-transform: uppercase;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* --- Print: the documents, plainly ----------------------------------------------------------- */

@media print {
  body {
    background: #fff;
    font-size: 11pt;
  }

  body::before,
  .masthead,
  .toc,
  .colophon nav,
  .motto,
  .sheet::before,
  .sheet::after,
  .skip {
    display: none;
  }

  .colophon {
    background: none;
    color: #000;
  }

  .colophon::before {
    display: none;
  }

  .doc-head,
  .sheet {
    margin: 0;
    padding: 0 0 16pt;
  }

  .sheet {
    display: block;
    border: 0;
    box-shadow: none;
    background: #fff;
  }
}
