/*
 * RE:Search Lab marketing site — "The Preprint" (the design's Main board).
 *
 * The page is written as a preprint: masthead, a paper on a desk, numbered sections, red-pen
 * marginalia. Its markup carries the board's own inline styles (index.html), but every colour
 * in them is one of the tokens below, so the page follows the visitor's theme exactly as the
 * app does: theme.js copies the app's stored choice onto <html data-theme>, and without JS the
 * prefers-color-scheme block applies. Fonts are self-hosted: the site runs under the app's CSP
 * (font-src 'self'), so Google Fonts would be blocked.
 */

@font-face {
  font-family: 'Public Sans';
  src: url('/fonts/public-sans-latin-wght-normal.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('/fonts/source-serif-4-latin-wght-normal.woff2') format('woff2-variations');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('/fonts/source-serif-4-latin-wght-italic.woff2') format('woff2-variations');
  font-weight: 200 900;
  font-style: italic;
  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;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('/fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Caveat';
  src: url('/fonts/caveat-latin-wght-normal.woff2') format('woff2-variations');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --desk: #e4e8ee;
  --paper: #ffffff;
  --ink: #1b2433;
  --ink-2: #3a4659;
  --ink-body: #2a3446;
  --dim: #5a6678;
  --faint: #8c99ad;
  --rule: #dce3ec;
  --line: #c9d3e1;
  --wm: #cdd5e1;
  --tint: #f3f6fa;
  --accent: #1f3a68;
  --on-accent: #ffffff;
  --pen: #c8322b;
  --memo-bg: #1b2433;
  --memo-fg: #c9d3e1;
  --memo-key: #8fb0e8;
  --paper-shadow: rgba(27, 36, 51, 0.14);
}

/* Dark: the app's dark Preprint palette. Stated twice (OS preference unless the visitor chose
   light; an explicit dark choice) so the two cannot drift apart in meaning. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --desk: #0f141c;
    --paper: #172030;
    --ink: #e8ecf2;
    --ink-2: #b9c3d2;
    --ink-body: #cdd5e1;
    --dim: #93a0b4;
    --faint: #6b7890;
    --rule: #2a3547;
    --line: #33405a;
    --wm: #222d40;
    --tint: #1c273a;
    --accent: #8fb0e8;
    --on-accent: #0f141c;
    --pen: #ff8a7e;
    --memo-bg: #0a0e14;
    --paper-shadow: rgba(0, 0, 0, 0.45);
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --desk: #0f141c;
  --paper: #172030;
  --ink: #e8ecf2;
  --ink-2: #b9c3d2;
  --ink-body: #cdd5e1;
  --dim: #93a0b4;
  --faint: #6b7890;
  --rule: #2a3547;
  --line: #33405a;
  --wm: #222d40;
  --tint: #1c273a;
  --accent: #8fb0e8;
  --on-accent: #0f141c;
  --pen: #ff8a7e;
  --memo-bg: #0a0e14;
  --paper-shadow: rgba(0, 0, 0, 0.45);
}

html {
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: 'Public Sans', system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a {
  color: var(--ink);
  text-decoration: none;
}
a:hover {
  color: var(--accent);
  text-decoration: underline;
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
del {
  text-decoration-thickness: 2px;
}
input::placeholder {
  color: var(--faint);
}
/* iOS zooms the page for any input under 16px; the board's are 16px already — keep it so. */
input {
  font-size: 16px;
}

.masthead {
  background: var(--memo-bg);
  color: var(--memo-fg);
}

/* Light/dark switcher in the nav. theme.js unhides it, so without JS it never shows. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
}
.theme-toggle[hidden] {
  display: none;
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.theme-toggle[data-next='light'] .theme-icon-moon,
.theme-toggle[data-next='dark'] .theme-icon-sun {
  display: none;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 10;
  padding: 8px 14px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--ink);
}
.skip:focus {
  left: 8px;
}

details > summary {
  list-style: none;
}
details > summary::-webkit-details-marker {
  display: none;
}
details > summary::before {
  content: '+';
  display: inline-block;
  width: 1.2em;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--accent);
}
details[open] > summary::before {
  content: '−';
}

/* Phone: the board's 62px title and 150px wordmark are desktop numbers. */
@media (max-width: 640px) {
  h1 {
    font-size: 40px !important;
  }
  #submit > div:nth-of-type(1) {
    font-size: 38px !important;
  }
  footer [aria-hidden='true'] {
    font-size: 72px !important;
  }
  footer [aria-hidden='true'] i {
    width: 11px !important;
    height: 11px !important;
  }
  footer [aria-hidden='true'] > span {
    gap: 7px !important;
    margin: 0 4px !important;
  }
}

/* ---- The 404 page (server/src/app.ts NOT_FOUND_PAGE) shares this stylesheet. ---- */
.notfound main {
  max-width: 560px;
  margin: 18vh auto 0;
  padding: 40px;
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 6px 6px 0 var(--accent);
}
.notfound h1 {
  font-family: 'Source Serif 4', serif;
  font-size: 36px;
  margin: 0 0 8px;
}
.btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}
.btn:hover {
  color: var(--on-accent);
}
.btn-quiet {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
}
.btn-quiet:hover {
  color: var(--accent);
}

/* ---- Hero with Mark (task 459, 2026-11-20) ---- */
.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px 48px;
}
.hero-mark {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0 auto;
}
.hero-mark .mark {
  width: clamp(150px, 22vw, 230px);
  height: auto;
}
.hero-hand {
  font-family: 'Caveat', cursive;
  font-size: 24px;
  color: var(--pen);
  transform: rotate(-3deg);
  text-align: center;
  max-width: 220px;
  line-height: 1.1;
}
.hero-copy {
  flex: 1 1 420px;
  min-width: 0;
}
.mark-eq {
  width: 64px;
  height: 64px;
}

/* Mark blinks now and then and re-draws the red tick. */
.mark .mark-eyes {
  transform-box: fill-box;
  transform-origin: center;
  animation: mark-blink 5s infinite;
}
.mark .mark-tick {
  stroke-dasharray: 40;
  animation: mark-tick 5s infinite;
}
@keyframes mark-blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.1); }
}
@keyframes mark-tick {
  0% { stroke-dashoffset: 40; }
  12%, 100% { stroke-dashoffset: 0; }
}

/* ---- Results: feature tiles that play their automation on hover/focus ---- */
.feats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.feat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 20px 20px 16px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.feat:hover,
.feat:focus-visible,
.feat:hover *,
.feat:focus-visible * {
  text-decoration: none;
}
.feat:hover,
.feat:focus-visible {
  transform: translate(-3px, -3px);
  box-shadow: 6px 6px 0 var(--accent);
}
.feat-ico {
  width: 52px;
  height: 52px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  margin-bottom: 6px;
  transition: transform 0.3s ease;
}
.feat-ico .feat-pen {
  stroke: var(--pen);
  stroke-width: 2.6;
  stroke-dasharray: 60;
  stroke-dashoffset: 0;
}
.feat:hover .feat-ico,
.feat:focus-visible .feat-ico {
  transform: rotate(-6deg) scale(1.08);
}
.feat:hover .feat-pen,
.feat:focus-visible .feat-pen {
  animation: feat-draw 0.7s ease both;
}
@keyframes feat-draw {
  from { stroke-dashoffset: 60; }
  to { stroke-dashoffset: 0; }
}
.feat-name {
  font-family: 'Source Serif 4', serif;
  font-size: 21px;
  font-weight: 700;
}
.feat-sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--accent);
}
/* The label and the automation share ONE grid cell, so the tile is as tall as the taller of the
   two and swapping them on hover moves nothing. */
.feat-body {
  display: grid;
}
.feat-label,
.feat .auto {
  grid-area: 1 / 1;
  transition: opacity 0.25s ease;
}
.feat-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.feat .auto {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
  opacity: 0;
}
.feat .auto li {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.feat .auto li::before {
  content: '✓ ';
  color: var(--pen);
}
.feat:hover .feat-label,
.feat:focus-visible .feat-label {
  opacity: 0;
}
.feat:hover .auto,
.feat:focus-visible .auto {
  opacity: 1;
}
.feat:hover .auto li,
.feat:focus-visible .auto li {
  opacity: 1;
  transform: none;
}
.feat:hover .auto li:nth-child(2),
.feat:focus-visible .auto li:nth-child(2) { transition-delay: 0.3s; }
.feat:hover .auto li:nth-child(3),
.feat:focus-visible .auto li:nth-child(3) { transition-delay: 0.6s; }

/* ---- University logos (not indexed: robots.txt disallows /logos/) ---- */
.logos {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 28px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}
/* A quiet caption above the slideshow, not a heading. */
.logos-cap {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  text-align: center;
}
/* A slow, endless slideshow: two identical sets side by side, the track slides by one set. */
.logo-marquee {
  min-width: 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.logo-track {
  display: flex;
  width: max-content;
  animation: logo-slide 28s linear infinite;
}
.logo-marquee:hover .logo-track {
  animation-play-state: paused;
}
.logo-set {
  display: flex;
  align-items: center;
  gap: 56px;
  padding-right: 56px;
}
@keyframes logo-slide {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .logo-track { animation: none; width: auto; }
  .logo-set { flex-wrap: wrap; gap: 16px 32px; }
  .logo-set[aria-hidden='true'] { display: none; }
}
.logos img {
  width: auto;
  filter: grayscale(1);
  opacity: 0.7;
  transition: filter 0.2s ease, opacity 0.2s ease;
}
.logos img:hover {
  filter: none;
  opacity: 1;
}
:root[data-theme='dark'] .logos img {
  filter: grayscale(1) invert(1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .logos img {
    filter: grayscale(1) invert(1);
  }
}

/* ---- Comparison table: ticks, not sentences ---- */
.cmp-wrap {
  overflow-x: auto;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
}
.cmp {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 16px;
}
.cmp th,
.cmp td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--rule);
  text-align: center;
}
.cmp tbody tr:last-child > * {
  border-bottom: 0;
}
.cmp tbody th {
  text-align: left;
  font-weight: 500;
  color: var(--ink);
}
.cmp thead th {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--dim);
  border-bottom: 1px solid var(--ink);
}
.cmp .us {
  background: var(--tint);
  width: 16%;
}
.cmp thead .us {
  color: var(--accent);
}
.cmp td .y,
.cmp td .n,
.cmp td .p {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
}
.cmp .y { color: var(--accent); }
.cmp .n { color: var(--faint); }
.cmp .p { color: var(--dim); }
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (prefers-reduced-motion: reduce) {
  .mark .mark-eyes,
  .mark .mark-tick,
  .feat:hover .feat-pen,
  .feat:focus-visible .feat-pen {
    animation: none;
  }
  .feat,
  .feat-ico,
  .feat-label,
  .feat .auto,
  .feat .auto li {
    transition: none;
  }
}
