/* Unpursued.ai showcase. Dark only. Palette: Nigredo (black), Albedo (white), Rubedo (#991b1b). */

:root {
  --nigredo: #000000;
  --albedo: #fafafa;
  --rubedo: #991b1b;
  /* Rubedo for text and indicators: 3.74:1 on black, 3.25:1 at worst on the grain (WCAG 3:1 for large text and non-text contrast). #991b1b stays for decorative graphics only. */
  --rubedo-text: #c62828;
  --ash: #a1a1a1;
  --smoke: #737373;
  --hairline: rgba(255, 255, 255, 0.1);
  --sans: ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --gutter: clamp(1.25rem, 6vw, 6rem);
  --glow: 340px;
  --hdr: 0;
}

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

html {
  background: var(--nigredo);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  /* Keyboard focus and in-page jumps land below the fixed header, never under it. */
  scroll-padding-top: 5.5rem;
}

/* Keyboard: a visible outline on every focused link. */
a:focus-visible {
  outline: 2px solid var(--albedo);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Keyboard: the first stop on every page, shown only while it has focus. */
.skip-link {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  padding: 0.6rem 1rem;
  border-radius: 6px;
  background: var(--albedo);
  color: var(--nigredo);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-300%);
}

.skip-link:focus {
  transform: none;
  outline: 2px solid var(--rubedo-text);
  outline-offset: 2px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(120% 80% at 72% 32%, #0d0d0d 0%, var(--nigredo) 62%) fixed;
  color: var(--albedo);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Film grain: inline noise, no request leaves the page. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* Header: transparent at the top, near-opaque after 100 px of scroll (main.js sets --hdr). */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 4.5rem;
  padding: 0 clamp(1rem, 4vw, 2.5rem);
  background: rgba(0, 0, 0, calc(var(--hdr) * 0.82));
  border-bottom: 1px solid rgba(255, 255, 255, calc(var(--hdr) * 0.08));
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  display: block;
  width: auto;
  height: 40px;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ash);
  animation: badge-pulse 2s ease-in-out 2;
}

.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--rubedo);
  box-shadow: 0 0 10px 2px rgba(153, 27, 27, 0.7);
  animation: ember 1.5s ease-in-out 3;
}

/* Hero */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
  max-width: 1400px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: 6.5rem var(--gutter) 4.5rem;
}

.hero-copy {
  max-width: 46rem;
}

.headline {
  margin: 0;
  font-size: clamp(2.6rem, 6.2vw, 5.6rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.04em;
  color: var(--albedo);
  animation: rise-30 0.7s var(--ease-out) 0.15s both;
}

/* Rubedo glow inside the letters, following the pointer (main.js sets --mx / --my; it rests at the center). */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .headline {
    color: transparent;
    background-image: radial-gradient(circle var(--glow) at var(--mx, 50%) var(--my, 50%), var(--rubedo-text) 0%, var(--rubedo-text) 5%, #e5e5e5 28%, var(--albedo) 62%);
    -webkit-background-clip: text;
    background-clip: text;
  }
}

/* Selected text stays readable inside the glowing letters. */
.headline::selection {
  color: var(--nigredo);
  background: var(--albedo);
}

.subline {
  max-width: 38ch;
  margin: 1.75rem 0 0;
  font-size: clamp(1.05rem, 1.5vw, 1.3rem);
  line-height: 1.55;
  color: var(--ash);
  animation: rise-20 0.6s var(--ease-out) 0.35s both;
}

.signals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
  margin: clamp(2.5rem, 7vh, 4.5rem) 0 0;
  padding: 1.5rem 0 0;
  border-top: 1px solid var(--hairline);
  list-style: none;
  animation: fade 0.6s ease 0.7s both;
}

.signals li {
  animation: rise-15 0.4s var(--ease-out) calc(0.8s + var(--i, 0) * 0.08s) both;
}

.signals li:nth-child(2) { --i: 1; }
.signals li:nth-child(3) { --i: 2; }
.signals li:nth-child(4) { --i: 3; }

.signal-value {
  display: block;
  font-size: clamp(1.3rem, 1.85vw, 1.75rem);
  white-space: nowrap;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums lining-nums;
}

.signal-label {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--ash);
}

.hero-art {
  justify-self: center;
  height: min(86vh, 820px);
  height: min(86svh, 820px);
  aspect-ratio: 508 / 836;
  margin: 0;
}

.opus {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* The drawing assembles: brackets, then the forms, then the Rubedo curve draws itself. */
.o-bracket {
  animation: fade 1s ease 0.2s both;
}

.o-form {
  animation: rise-12 1.1s var(--ease-out) 0.45s both;
}

.o-curve {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 2.2s cubic-bezier(0.65, 0, 0.35, 1) 0.7s forwards;
}

.scroll-cue {
  position: absolute;
  bottom: 1.75rem;
  left: 50%;
  color: var(--smoke);
  transform: translateX(-50%);
  animation: bob 2s ease-in-out 2;
}

.scroll-cue svg {
  display: block;
}

/* Sections */
.block {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(5rem, 16vh, 10rem) var(--gutter);
  border-top: 1px solid var(--hairline);
}

.block h2 {
  margin: 0;
  font-size: clamp(1.6rem, 2.6vw, 2.25rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.block h2::before {
  content: '';
  display: block;
  width: 2.25rem;
  height: 2px;
  margin-bottom: 1.25rem;
  background: var(--rubedo);
  box-shadow: 0 0 12px rgba(153, 27, 27, 0.6);
}

.block-body p {
  max-width: 34em;
  margin: 0;
  font-size: clamp(1.15rem, 1.8vw, 1.5rem);
  line-height: 1.5;
  letter-spacing: -0.01em;
}

.block-body p + .writing {
  margin-top: 2rem;
}

.label {
  margin: 3rem 0 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ash);
}

.writing {
  margin: 0;
  padding: 0;
  list-style: none;
}

.writing li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 1.5rem;
  padding: 1.1rem 0;
  border-top: 1px solid var(--hairline);
}

.writing li:last-child {
  border-bottom: 1px solid var(--hairline);
}

.writing-title {
  font-size: 1rem;
  line-height: 1.45;
}

.writing-link {
  color: inherit;
  text-decoration: none;
  background-image: linear-gradient(var(--rubedo-text), var(--rubedo-text));
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0 1px;
  transition: background-size 0.35s var(--ease-out);
}

.writing-link::after {
  content: ' \2197';
  content: ' \2197' / '';
  color: var(--ash);
}

.writing-link:hover,
.writing-link:focus-visible {
  background-size: 100% 1px;
}

.writing-link:focus-visible {
  outline: 2px solid var(--albedo);
  outline-offset: 3px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.writing-date {
  font-size: 0.875rem;
  color: var(--ash);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Reveal on scroll, once (main.js adds .js and .in). */
.js [data-reveal] {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s var(--ease-out);
}

.js [data-reveal].in {
  opacity: 1;
  transform: none;
}

/* Keyboard focus shows its content at once, without waiting for the fade. */
.js [data-reveal]:focus-within {
  opacity: 1;
  transform: none;
  transition: none;
}

.js .writing li:nth-child(2) { transition-delay: 0.15s; }
.js .writing li:nth-child(3) { transition-delay: 0.3s; }
.js .writing li:nth-child(4) { transition-delay: 0.45s; }

/* Footer */
.site-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 3rem;
  border-top: 1px solid var(--hairline);
  font-size: 0.8125rem;
  color: var(--ash);
}

.site-footer p {
  margin: 0;
}

/* Footer links to the three pages: at the right on wide screens, under the copyright on phones. */
.footer-nav {
  display: flex;
  gap: 1.25rem;
  margin-left: auto;
}

.footer-nav a {
  padding: 0.3rem 0;
  color: var(--ash);
  text-decoration: none;
}

.footer-nav a:hover,
.footer-nav a:focus-visible,
.footer-nav a[aria-current="page"] {
  color: var(--albedo);
  text-decoration: underline;
  text-decoration-color: var(--rubedo-text);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.footer-nav a:focus-visible,
.back-link:focus-visible,
.doc a:focus-visible {
  outline: 2px solid var(--albedo);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Pages: Privacy, Terms, Contact */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ash);
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.back-link:hover {
  color: var(--albedo);
  border-color: rgba(255, 255, 255, 0.28);
}

.doc {
  max-width: 46rem;
  margin: 0 auto;
  padding: 8.5rem var(--gutter) 6rem;
}

.doc h1 {
  margin: 0 0 1.75rem;
  font-size: clamp(2rem, 4.6vw, 3.25rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.doc h1::before {
  content: '';
  display: block;
  width: 2.25rem;
  height: 2px;
  margin-bottom: 1.25rem;
  background: var(--rubedo);
  box-shadow: 0 0 12px rgba(153, 27, 27, 0.6);
}

.doc h2 {
  margin: 3rem 0 1rem;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.doc p,
.doc li {
  font-size: 1rem;
  line-height: 1.7;
}

.doc p {
  margin: 0 0 1rem;
}

.doc ul {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.doc li {
  margin: 0.35rem 0;
}

.doc li::marker {
  color: var(--rubedo-text);
}

.doc .doc-meta {
  margin: 0 0 0.35rem;
  color: var(--ash);
}

.doc strong {
  font-weight: 600;
  color: var(--albedo);
}

.doc code {
  padding: 0.1em 0.35em;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.doc a {
  color: var(--albedo);
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-color: var(--rubedo-text);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.doc a:hover {
  text-decoration-thickness: 2px;
}

.footer-mark {
  display: block;
  width: auto;
  height: 24px;
}

/* 404 */
.not-found {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  min-height: 100vh;
  min-height: 100svh;
  padding: 3rem var(--gutter);
  text-align: center;
}

.not-found-mark {
  width: auto;
  height: 120px;
  margin-bottom: 1.5rem;
  animation: fade 1s ease 0.1s both;
}

.not-found-code {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--ash);
  animation: fade 0.6s ease 0.25s both;
}

.not-found-title {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  animation: rise-20 0.6s var(--ease-out) 0.35s both;
}

.not-found-home {
  margin-top: 1.5rem;
  font-size: 1rem;
  color: var(--ash);
  animation: fade 0.6s ease 0.6s both;
}

.not-found-home::after {
  content: none;
}

/* Medium windows: the four signals in two rows. */
@media (max-width: 1180px) {
  .signals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem 1rem;
  }
}

/* Phones and narrow windows: the drawing above the headline. */
@media (max-width: 900px) {
  :root {
    --glow: 190px;
  }

  .site-header {
    height: 4rem;
  }

  .brand-mark {
    height: 32px;
  }

  .brand-name {
    font-size: 1.1rem;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
    padding-top: 5.5rem;
    padding-bottom: 5rem;
  }

  .hero-art {
    order: -1;
    height: min(46vh, 440px);
    height: min(46svh, 440px);
  }

  .br-wide {
    display: none;
  }

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

  .writing li {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.3rem;
  }

  .site-footer {
    flex-wrap: wrap;
  }

  .footer-nav {
    flex-basis: 100%;
    margin-left: 0;
  }

  .doc {
    padding-top: 7rem;
  }
}

@media (max-width: 420px) {
  .status {
    padding: 0.3rem 0.65rem;
    font-size: 0.6875rem;
  }
}

/* Motion */
@keyframes rise-30 {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: none; }
}

@keyframes rise-20 {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: none; }
}

@keyframes rise-15 {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: none; }
}

@keyframes rise-12 {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

@keyframes badge-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

@keyframes ember {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 8px); }
}

/* Print: everything visible, no reveal pending. */
@media print {
  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }

  .grain,
  .scroll-cue {
    display: none;
  }
}

/* Less motion: keep the fades, drop the movement. */
@media (prefers-reduced-motion: reduce) {
  .headline,
  .subline,
  .signals li,
  .o-form {
    animation-name: fade;
  }

  .status,
  .status-dot,
  .scroll-cue {
    animation: none;
  }

  .o-curve {
    stroke-dasharray: none;
    stroke-dashoffset: 0;
    animation: none;
  }

  .js [data-reveal] {
    transform: none;
  }
}
