/* aiindustrytracker.com: a ship's log kept at night. Bottle-green ground, bone ink,
   one red double rule down the margin. Dates and headings left of it, entries right. */
@font-face { font-family: "Instrument Serif"; src: url("/fonts/instrument-serif-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("/fonts/newsreader-latin-wght-normal.woff2") format("woff2"); font-weight: 400 600; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: "Newsreader"; src: url("/fonts/newsreader-latin-ext-wght-normal.woff2") format("woff2"); font-weight: 400 600; font-display: swap; unicode-range: U+0100-02BA, U+1E00-1E9F, U+2020, U+20A0-20AB, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --ground: #0c1917;
  --deep: #07110f;
  --ink: #ebe4d2;
  --ink-2: #b9b5a3;
  --ink-3: #8f9285;
  --rule: rgba(235, 228, 210, 0.13);
  --rule-2: rgba(235, 228, 210, 0.3);
  --band: rgba(235, 228, 210, 0.06);
  --red: #f26a4b;
  --display: "Instrument Serif", "Newsreader", Georgia, serif;
  --text: "Newsreader", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --m: 248px;
  --gap: 56px;
  --pad: 40px;
}

* { box-sizing: border-box; }
html { background: var(--ground); color-scheme: dark; -webkit-text-size-adjust: 100%; scrollbar-color: #3d4f49 var(--deep); caret-color: var(--red); accent-color: var(--red); }
body { margin: 0; font: 400 17px/1.55 var(--text); color: var(--ink); background: var(--ground); overflow-x: clip; min-height: 100vh; display: flex; flex-direction: column; }
::selection { background: var(--red); color: var(--deep); }
a { color: inherit; text-decoration-line: underline; text-decoration-thickness: 1px; text-decoration-color: var(--rule-2); text-underline-offset: 0.2em; transition: text-decoration-color 140ms var(--ease), color 140ms var(--ease); }
a:hover { text-decoration-color: var(--red); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 1px; }
h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
h1, h2 { font-family: var(--display); font-weight: 400; text-wrap: balance; }
time, .fields, table, output { font-variant-numeric: tabular-nums; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; background: var(--ink); color: var(--deep); padding: 8px 12px; z-index: 5; }

/* Masthead: the cover label of the book */
.mast { border-bottom: 3px double var(--rule-2); }
.in { max-width: 1400px; margin: 0 auto; padding: 0 20px 0 30px; }
.mast .in { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 16px; padding-top: 14px; }
.name { display: contents; }
.name a:first-child { font: 400 25px/1.2 var(--display); text-decoration: none; }
.by { font-size: 14px; color: var(--ink-2); text-decoration: none; display: inline-flex; align-items: center; gap: 7px; }
.by:hover { color: var(--ink); }
.mast nav { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 0 18px; margin-top: 4px; }
.mast nav a { font-size: 16px; color: var(--ink-2); text-decoration: none; padding: 10px 0 11px; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color 140ms var(--ease); }
.mast nav a:hover { color: var(--ink); }
.mast nav a[aria-current] { color: var(--ink); border-bottom-color: var(--red); }

/* The page: one margin, one double rule */
main { position: relative; flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 36px 20px 72px 30px; min-width: 0; }
main::before { content: ""; position: absolute; top: 0; bottom: 0; left: 11px; width: 6px; border-left: 2px solid var(--red); border-right: 1px solid var(--red); pointer-events: none; }
article > * + * { margin-top: 56px; }
.sec:not(.top) { border-top: 1px solid var(--rule-2); padding-top: 20px; }
.mg h2 { font-size: 30px; line-height: 1.08; }
.mg .note { margin-top: 8px; font-size: 15px; line-height: 1.45; color: var(--ink-3); }
.col { min-width: 0; margin-top: 16px; }

/* Page opening */
.top { display: flex; flex-direction: column; }
.top .mg { order: 2; margin-top: 24px; }
.top .col { margin-top: 0; }
h1 { font-size: clamp(46px, 13vw, 104px); line-height: 0.96; letter-spacing: -0.012em; }
h1.long { font-size: clamp(36px, 6.4vw, 64px); line-height: 1.02; }
.open { margin-top: 24px; display: grid; gap: 24px; }
.answer { font-size: 20px; line-height: 1.45; max-width: 38rem; }
.side { max-width: 38rem; }
.summary { color: var(--ink-2); }
.status { margin-top: 20px; padding-top: 12px; max-width: 38rem; border-top: 1px solid var(--rule); font-size: 15px; line-height: 1.45; color: var(--ink-3); }
.when { font: 400 14px/1.5 var(--mono); color: var(--ink); }
.when span { display: block; color: var(--red); }
.stamp { font-size: 15px; line-height: 1.5; color: var(--ink-3); }
.when + .stamp { margin-top: 10px; }
.stamp > span { display: block; }
.stamp .sl { display: none; }

/* The count sheet */
.sheet { --cell: 26px; --row: 28px; }
.fields { display: flex; flex-wrap: wrap; gap: 4px 0; font: 400 13px/20px var(--mono); color: var(--ink-2); padding-bottom: 10px; }
.fields span:not(.readout) { padding-right: 14px; margin-right: 14px; border-right: 1px solid var(--rule-2); }
.fields span:nth-last-child(2) { border-right: 0; }
.fields .readout { flex: 1 1 220px; min-height: 20px; text-align: right; color: var(--red); }
.scroll { overflow-x: auto; scrollbar-width: thin; border-top: 1px solid var(--rule-2); }
.plot { position: relative; min-width: 700px; }
.scan { position: absolute; left: 0; width: 2px; margin-left: -1px; background: var(--red); pointer-events: none; opacity: 0; will-change: transform; }
table { border-collapse: collapse; width: 100%; font: 400 13px/28px var(--mono); }
caption { caption-side: bottom; text-align: left; padding: 12px 0 0; font: 400 15px/1.45 var(--text); color: var(--ink-3); }
th, td { padding: 4px 10px 4px 6px; text-align: right; white-space: nowrap; border-left: 1px solid var(--rule); transition: background-color 120ms var(--ease); }
thead th { font: 400 15px/1.2 var(--text); color: var(--ink-2); padding-top: 12px; padding-bottom: 10px; vertical-align: bottom; }
th[scope="row"], .corner { text-align: left; font: 400 15px/1.2 var(--text); color: var(--ink); padding-left: 0; border-left: 0; position: sticky; left: 0; background: var(--ground); z-index: 1; }
.corner { color: var(--ink-3); }
tbody tr { border-top: 1px solid var(--rule); }
tbody tr:first-child { border-top-color: var(--rule-2); }
td.z { color: var(--ink-3); }
.mk { float: left; --d: calc(var(--s) * var(--cell)); width: var(--d); height: var(--d); margin: calc((var(--row) - var(--d)) / 2); background: var(--ink); }
.mk.pk { background: var(--red); }
.bar { float: left; width: calc(var(--w) * 64px); height: 8px; margin: 10px 0 10px 4px; background: var(--ink); transform-origin: 0 50%; }
.sum { border-left: 3px double var(--rule-2); min-width: 116px; }
tfoot tr { border-top: 1px solid var(--rule-2); border-bottom: 1px solid var(--rule-2); }
tfoot td, tfoot th { color: var(--ink-2); }
/* Crosshair: the row and the column light up and meet on the cell */
tr.hx > * { background: var(--band); box-shadow: inset 0 1px 0 var(--red), inset 0 -1px 0 var(--red); }
.hy { background: var(--band); box-shadow: inset 1px 0 0 var(--red), inset -1px 0 0 var(--red); }
tr.hx > th { background: #1a2623; }
tr.hx > .hy { background: rgba(235, 228, 210, 0.14); box-shadow: inset 0 0 0 1px var(--red); color: var(--ink); }
tr.hx > th, thead .hy { color: var(--ink); }
.totals .plot, .totals table { min-width: 0; }
.totals { max-width: 46rem; }
.totals .bar { width: calc(var(--w) * 96px); }

/* The log */
.filters { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: end; margin-bottom: 20px; }
.filters label { display: grid; gap: 2px; font-size: 14px; color: var(--ink-3); }
.filters select { font: 400 16px/1 var(--text); color: var(--ink); background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23b9b5a3' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 2px center; border: 0; border-bottom: 1px solid var(--rule-2); border-radius: 0; height: 40px; min-width: 150px; padding: 0 24px 0 0; appearance: none; transition: border-color 140ms var(--ease); }
.filters select:hover { border-bottom-color: var(--ink-2); }
.filters option { background: var(--deep); color: var(--ink); }
.filters output { font: 400 13px/40px var(--mono); color: var(--ink-3); }

.log { border-top: 1px solid var(--rule); }
.line { padding: 18px 0 20px; border-bottom: 1px solid var(--rule); scroll-margin-top: 16px; }
.line[hidden] { display: none; }
.line:target { background: var(--band); }
.line .mg { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; }
.perma { text-decoration: none; }
.perma:hover time { color: var(--red); }
.line time { font: 400 13px/22px var(--mono); color: var(--ink-2); transition: color 140ms var(--ease); }
.tags { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 15px; line-height: 22px; color: var(--ink-3); }
.tags .kind { color: var(--ink); font-weight: 500; }
.what { margin-top: 6px; }
.what h3 { font: 500 20px/1.28 var(--text); max-width: 40rem; text-wrap: pretty; }
.what p { margin-top: 6px; color: var(--ink-2); max-width: 40rem; }
.src { margin-top: 8px; font-size: 15px; line-height: 1.45; color: var(--ink-3); }
.src a { color: var(--ink-2); }
.src a:hover { color: var(--ink); }
.none, .readnote { margin-top: 16px; font-size: 15px; color: var(--ink-3); max-width: 40rem; }

/* The Ulsa slip: a loose sheet of paper laid in the book */
.slipsec { border-top: 0 !important; padding-top: 0 !important; }
.slip { background: var(--ink); color: var(--deep); padding: 24px; border-radius: 2px; display: grid; gap: 20px; max-width: 62rem; }
.slip h2 { font-size: 30px; line-height: 1.08; }
.slip p { margin-top: 8px; color: #2f3d38; max-width: 36rem; }
.go { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 0 !important; }
.go span { font-size: 15px; color: #3d4a45; }
.btn { display: inline-flex; align-items: center; min-height: 46px; padding: 0 20px; border-radius: 3px; background: var(--deep); color: var(--ink); font-weight: 500; text-decoration: none; transition: background-color 140ms var(--ease); }
.btn:hover { background: #1c2f2a; }
.slip :focus-visible { outline-color: var(--deep); }
.top .go { margin-top: 24px !important; }
.top .btn { background: var(--ink); color: var(--deep); }
.top .btn:hover { background: #fff; }

.weeks { max-width: 40rem; border-top: 1px solid var(--rule); }
.weeks li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0 16px; padding: 11px 0; border-bottom: 1px solid var(--rule); }
.weeks a { font-size: 19px; }
.weeks span { font: 400 13px/22px var(--mono); color: var(--ink-3); }

.faq { display: grid; gap: 28px 56px; }
.qa { max-width: 40rem; }
.qa h3 { font: 500 20px/1.28 var(--text); }
.qa p { margin-top: 6px; color: var(--ink-2); }
.qa p a { color: var(--ink); }

.prose .col > * { max-width: 40rem; }
.prose p + p { margin-top: 12px; }
.prose p { color: var(--ink-2); }
.prose p a { color: var(--ink); }
.kinds { border-top: 1px solid var(--rule); }
.kinds div { display: grid; grid-template-columns: 96px 1fr; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.kinds dt { font-weight: 500; }
.kinds dd { color: var(--ink-2); }
.pages > * + * { margin-top: 56px; }
.kept { border-top: 1px solid var(--rule-2); padding-top: 20px; }
.kept h2 { font-size: 30px; line-height: 1.08; margin-bottom: 16px; }

.foot { border-top: 3px double var(--rule-2); font-size: 15px; color: var(--ink-3); }
.foot .in { padding-top: 20px; padding-bottom: 40px; }
.colophon { font: 400 22px/1.2 var(--display); color: var(--ink-2); margin-bottom: 8px; }
.foot p + p { margin-top: 2px; }
.foot a { margin-left: 12px; color: var(--ink-2); }

@media (max-width: 699px) {
  .mast nav a { font-size: 15px; }
  [data-scan] { --cell: 18px; }
  [data-scan] .plot { min-width: 0; }
  [data-scan] table { table-layout: fixed; font-size: 12px; line-height: 16px; }
  [data-scan] th, [data-scan] td { padding: 4px 0 3px; text-align: center; white-space: normal; }
  [data-scan] thead th { writing-mode: vertical-rl; transform: rotate(180deg); text-align: left; white-space: nowrap; font-size: 14px; padding: 8px 0; vertical-align: middle; }
  [data-scan] .corner, [data-scan] th[scope="row"] { width: 106px; font-size: 14px; text-align: left; padding-right: 6px; }
  [data-scan] thead .corner { writing-mode: horizontal-tb; transform: none; vertical-align: bottom; }
  [data-scan] .mk { float: none; display: block; margin: calc((20px - var(--d)) / 2) auto; }
  [data-scan] td.z { padding-top: 24px; }
  [data-scan] .sum { width: 34px; min-width: 0; border-left: 1px solid var(--rule-2); }
  [data-scan] .bar { display: none; }
  .totals th, .totals td { padding: 4px 6px 4px 4px; }
  .totals th[scope="row"] { white-space: normal; font-size: 14px; }
  .totals thead th { font-size: 13px; }
  .totals .bar { width: calc(var(--w) * 30px); margin-left: 0; }
}

@media (min-width: 720px) {
  .faq { grid-template-columns: 1fr 1fr; }
  .slip { grid-template-columns: 1fr auto; align-items: end; padding: 28px 32px; }
  .slip .go { flex-direction: column; align-items: flex-start; }
}

@media (min-width: 1040px) {
  .in { padding: 0 var(--pad); }
  .mast .in { display: grid; grid-template-columns: var(--m) 1fr auto; column-gap: var(--gap); padding-top: 0; }
  .name a:first-child { grid-column: 1; grid-row: 1; padding: 12px 0; }
  .mast nav { grid-column: 2; grid-row: 1; margin-top: 0; gap: 0 28px; }
  .mast nav a { padding: 18px 0 17px; }
  .by { grid-column: 3; grid-row: 1; }

  main { padding: 0 var(--pad) 104px; }
  main::before { left: calc(var(--pad) + var(--m) + var(--gap) / 2 - 3px); }
  article { padding-top: 56px; }
  article > * + * { margin-top: 64px; }
  .sec { display: grid; grid-template-columns: var(--m) minmax(0, 1fr); column-gap: var(--gap); }
  .sec:not(.top) { padding-top: 24px; }
  .col { margin-top: 0; }
  .mg h2 { font-size: 32px; padding-right: 8px; }

  .top { display: grid; }
  .top .mg { order: 0; margin-top: 0; padding-top: 14px; }
  .open { margin-top: 32px; }
  .side { max-width: 24rem; }
  .side .weeks a { font-size: 18px; }

  .sheet { --cell: 32px; --row: 32px; }
  [data-scan] table { line-height: 32px; }
  [data-scan] .bar { margin-top: 12px; }
  th, td { padding: 4px 14px 4px 8px; }
  th[scope="row"], .corner { font-size: 16px; }

  /* Log lines reach back across the rule: date and kind in the margin */
  .logsec > .col { display: contents; }
  .logsec .filters, .logsec .none, .logsec .readnote { grid-column: 2; }
  .logsec .filters { margin-bottom: 0; align-self: start; }
  .logsec .log { grid-column: 1 / -1; margin-top: 28px; }
  .logsec .mg { padding-bottom: 0; }
  .line { display: grid; grid-template-columns: var(--m) minmax(0, 1fr) 240px; column-gap: var(--gap); padding: 20px 0 24px; }
  .line .mg { display: block; }
  .line time { color: var(--ink); }
  .tags { display: block; margin-top: 2px; }
  .tags span { display: block; }
  .what { margin-top: 0; }
  .src { margin-top: 3px; }

  .pages { position: relative; }
  .kept { position: absolute; top: 0; right: 0; bottom: 0; width: 332px; margin-top: 0; padding-left: 32px; background: var(--ground); z-index: 1; }
  .kept .weeks a { font-size: 18px; }
  .foot .in { display: grid; grid-template-columns: var(--m) 1fr; column-gap: var(--gap); padding-top: 24px; padding-bottom: 48px; }
}

/* The side note only sits beside the answer when it has room to read */
@media (min-width: 1320px) {
  .open { grid-template-columns: minmax(0, 38rem) minmax(16rem, 1fr); gap: var(--gap); }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
