/* ============================================================
   abiome — a typeset title page over a dithered sea-glass field
   ============================================================ */

:root {
  --ink: #1d1b18;
  --ink-soft: #4d463c;
  --ink-faint: #837a6c;
  --paper: #ffffff;
  --brand: #006e59;
  --field: #a8d0bd;
  --on-field: rgba(9, 55, 43, 0.68);
  --line: rgba(29, 27, 24, 0.16);
  --seaglass: #a5d6c2;
  --mint: #cfe9db;
  --butter: #f0dfa2;

  --serif: "Alegreya", "Iowan Old Style", Georgia, serif;
  --sans: "Alegreya", "Iowan Old Style", Georgia, serif;
  --sc: "Alegreya SC", "Alegreya", Georgia, serif;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  --gutter: clamp(1rem, 4vw, 3rem);
  --gap: 0.6rem;
  --measure: 72rem;
  --rhythm: 1.5rem;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--field);
  line-height: var(--rhythm);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection {
  background: var(--mint);
  color: var(--ink);
}

/* ============ Background layers ============ */

#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  display: block;
  image-rendering: pixelated;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.13 0 0 0 0 0.12 0 0 0 0 0.10 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ============ The cycling square (house motif) ============ */

.cycle {
  width: 0.8em;
  height: 0.8em;
  background: var(--ink);
  display: inline-block;
  flex: none;
  animation: cycle 12s var(--ease-in-out) infinite;
  animation-delay: var(--cd, 0s);
}

@keyframes cycle {
  0%, 18%   { background: var(--ink);      transform: rotate(0deg); }
  25%, 43%  { background: var(--brand);    transform: rotate(90deg); }
  50%, 68%  { background: var(--seaglass); transform: rotate(180deg); }
  75%, 93%  { background: var(--mint);     transform: rotate(270deg); }
  100%      { background: var(--ink);      transform: rotate(360deg); }
}

/* ============ White squares ============ */

.panel {
  background: var(--paper);
}

/* ============ Hero ============ */

.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2.5rem var(--gutter);
  max-width: var(--measure);
  margin: 0 auto;
  width: 100%;
}

.hero-panel {
  padding: clamp(2rem, 5vw, 4.5rem);
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(13rem, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: end;
}

.hero-statement {
  font-family: var(--sans);
  font-weight: 400;
  font-size: clamp(1.9rem, 4.4vw, 3.5rem);
  line-height: 1.28;
  letter-spacing: -0.005em;
  max-width: 24ch;
  color: var(--ink);
  text-align: justify;
}

.inline-icon {
  width: 0.74em;
  height: 0.74em;
  vertical-align: -0.04em;
  margin: 0 0.06em;
  color: var(--ink);
}

.hero-statement .w {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.45em);
  filter: blur(6px);
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out),
    filter 700ms var(--ease-out);
  transition-delay: var(--d, 0ms);
  will-change: transform, filter;
}

.hero-statement.in .w {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

/* ============ In brief (front-matter column) ============ */

.contents {
  font-size: 1.05rem;
}

.contents ol {
  list-style: none;
}

.contents a,
.contents .c-row {
  display: flex;
  align-items: baseline;
  gap: 0.6ch;
  text-decoration: none;
  color: var(--ink-soft);
  padding: 0.2rem 0;
  transition: color 200ms var(--ease-out);
}

.c-dots {
  flex: 1;
  min-width: 1.5ch;
  border-bottom: 1px dotted rgba(29, 27, 24, 0.4);
  transform: translateY(-0.28em);
}

.c-num {
  color: var(--ink-faint);
  transition: color 200ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .contents a:hover {
    color: var(--ink);
  }
  .contents a:hover .c-num {
    color: var(--brand);
  }
}

/* ============ Footer ============ */

.footer {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(3rem, 6vw, 5rem);
}

.footer-panel {
  padding: 0;
}

/* The logomark cut out of the panel: the swirl is a hole in the
   white, opening straight onto the field behind the page. */
.footer-cut {
  height: clamp(11rem, 26vw, 18rem);
  background: var(--paper);
  -webkit-mask-image: url("assets/abiome_mark.svg"), linear-gradient(#000, #000);
  -webkit-mask-repeat: no-repeat, no-repeat;
  -webkit-mask-position: center, center;
  -webkit-mask-size: auto 68%, 100% 100%;
  -webkit-mask-composite: xor;
  mask-image: url("assets/abiome_mark.svg"), linear-gradient(#000, #000);
  mask-repeat: no-repeat, no-repeat;
  mask-position: center, center;
  mask-size: auto 68%, 100% 100%;
  mask-composite: exclude;
}

.footer-cols {
  padding: 2.5rem clamp(1.5rem, 4vw, 3rem) 2rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.footer-label {
  font-family: var(--sc);
  color: var(--ink-faint);
  margin-bottom: 0.8rem;
}

.footer-col a {
  display: block;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.2rem 0;
  background-image: linear-gradient(var(--ink), var(--ink));
  background-repeat: no-repeat;
  background-size: 0% 1px;
  background-position: 0 100%;
  transition: background-size 250ms var(--ease-out), color 250ms var(--ease-out);
  width: fit-content;
}

@media (hover: hover) and (pointer: fine) {
  .footer-col a:hover {
    color: var(--ink);
    background-size: 100% 1px;
  }
}

.footer-fine p {
  color: var(--ink-faint);
  font-size: 0.85rem;
  line-height: 1.7;
}

.footer-strip {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  padding: 0 0 2.2rem;
  font-size: 0.8rem;
}

/* ============ Reveal on scroll ============ */

.reveal {
  opacity: 0;
  transform: translateY(1.2rem);
  transition: opacity 800ms var(--ease-out), transform 800ms var(--ease-out);
  transition-delay: var(--d, 0ms);
}

.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

/* ============ Responsive ============ */

@media (max-width: 900px) {
  .hero-panel {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .footer-cols {
    grid-template-columns: 1fr 1fr;
  }
}

/* ============ Reduced motion ============ */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .reveal,
  .hero-statement .w {
    opacity: 1;
    transform: none;
    filter: none;
    transition: opacity 200ms ease;
  }
  .cycle {
    animation: none;
  }
}
