/* ==========================================================================
   ThetaRev — "Research Memo" theme: typography and layout
   A premium quantitative research note. Colors live in themes.css; every
   rule here applies only with <html data-theme="research-memo">.

   Fonts: Fraunces (human / editorial), Inter (interface),
   IBM Plex Mono (data). Load them when making this theme the default —
   see the note in DEPLOY.md.
   ========================================================================== */

html[data-theme="research-memo"] {
  --font-serif: "Fraunces", Georgia, "Times New Roman", serif;
  --font-sans:  "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:  "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-serif-weight: 400;

  --text-display:  clamp(2.6rem, 6.2vw, 5rem);
  --field-ratio: 3 / 1;  /* wider, shorter field so the hero fits one screen */
  --text-headline: clamp(2rem, 4.6vw, 3.5rem);
  --tracking-label: 0.16em;
  --grain-opacity: 0.05;
}

/* ---- Shared editorial pieces --------------------------------------------- */

html[data-theme="research-memo"] .eyebrow {
  margin-bottom: var(--space-4);
}

html[data-theme="research-memo"] .theta {
  color: var(--color-accent);
}

html[data-theme="research-memo"] h1,
html[data-theme="research-memo"] h2 {
  letter-spacing: -0.015em;
}

/* ---- Header -------------------------------------------------------------- */

html[data-theme="research-memo"] .site-header {
  padding: var(--space-4) 0;
}

html[data-theme="research-memo"] .brand {
  gap: var(--space-3);
}

html[data-theme="research-memo"] .brand-mark {
  width: 30px;
  height: 30px;
}

html[data-theme="research-memo"] .brand-name {
  font-family: var(--font-sans);
  font-size: var(--text-micro);
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

html[data-theme="research-memo"] .site-nav {
  display: flex;
  gap: var(--space-5);
}

html[data-theme="research-memo"] .site-nav a {
  font-size: var(--text-micro);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-mist);
  text-decoration: none;
  padding-bottom: 3px;
  background: linear-gradient(var(--color-ink), var(--color-ink)) left bottom / 0 1px no-repeat;
  transition:
    color var(--duration-quick) var(--ease-calm),
    background-size var(--duration-quick) var(--ease-calm);
}

html[data-theme="research-memo"] .site-nav a:hover {
  color: var(--color-ink);
  background-size: 100% 1px;
}

/* ---- Hero ---------------------------------------------------------------- */

html[data-theme="research-memo"] .intrigue {
  gap: var(--space-5);
}

html[data-theme="research-memo"] .intrigue .lead {
  margin-top: var(--space-3);
  font-size: var(--text-lead);
  line-height: 1.5;
  color: var(--color-mist);
}

/* Coordinate field: a scientific illustration, not a dashboard. */
html[data-theme="research-memo"] .field-plot {
  border-left-color: var(--color-rule);
  border-bottom-color: var(--color-rule);
  background-image: none;  /* no gridlines */
}

/* Faint tick marks along the time axis. */
html[data-theme="research-memo"] .field-plot::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 6px;
  background: repeating-linear-gradient(
    to right,
    var(--color-rule) 0 1px,
    transparent 1px 10%
  );
  pointer-events: none;
}

html[data-theme="research-memo"] .field-y {
  position: absolute;
  top: 0;
  left: calc(-1 * var(--space-4));
  letter-spacing: 0;
  color: var(--color-accent);
}

/* Bubbles in gold, slate and ink, all soft and translucent. */
html[data-theme="research-memo"] .bubble {
  --bubble-rgb: var(--accent-rgb);
  --color-accent-faint: rgba(var(--bubble-rgb), 0.09);
  --color-accent-glow:  rgba(var(--bubble-rgb), 0.2);
  --color-accent:       rgba(var(--bubble-rgb), 0.85);
}

html[data-theme="research-memo"] .bubble:nth-of-type(2),
html[data-theme="research-memo"] .bubble:nth-of-type(5) {
  --bubble-rgb: 113, 128, 140;  /* slate */
}

html[data-theme="research-memo"] .bubble:nth-of-type(3) {
  --bubble-rgb: 23, 35, 51;  /* ink */
}

html[data-theme="research-memo"] .bubble-signal {
  color: var(--color-accent-strong);
}

/* ---- Section 02 ---------------------------------------------------------- */

html[data-theme="research-memo"] .pillars {
  gap: var(--space-5);
}

html[data-theme="research-memo"] .pillars li {
  padding-top: var(--space-4);
}

html[data-theme="research-memo"] .pillars .label {
  margin-bottom: var(--space-4);
  color: var(--color-ink);
}

html[data-theme="research-memo"] .pillar-text {
  font-family: var(--font-serif);
  font-size: clamp(1.1rem, 1.45vw, 1.3rem);
  line-height: 1.4;
  color: var(--color-ink-soft);
}

/* ---- Calls to action ----------------------------------------------------- */
/* The hero link is an editorial link; screen 3 keeps the regular button. */

html[data-theme="research-memo"] main .link-quiet {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 0 6px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(var(--color-rule), var(--color-rule)) left bottom / 100% 1px no-repeat;
  color: var(--color-ink);
  font-size: var(--text-small);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-image var(--duration-quick) var(--ease-calm);
}

html[data-theme="research-memo"] main .link-quiet:hover {
  background-image: linear-gradient(var(--color-ink), var(--color-ink));
  color: var(--color-ink);
}

html[data-theme="research-memo"] main .link-quiet::after {
  content: "→";
  transition: transform var(--duration-quick) var(--ease-calm);
}

html[data-theme="research-memo"] main .link-quiet:hover::after {
  transform: translateX(4px);
}

/* ---- Research note (closing page) ----------------------------------------- */

html[data-theme="research-memo"] .research {
  position: relative;
  align-items: center;
  text-align: center;
  gap: var(--space-5);
  isolation: isolate;
}

/* Barely-there coordinate grid, fading out from the center. */
html[data-theme="research-memo"] .research::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--color-rule-faint) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-rule-faint) 1px, transparent 1px);
  background-size: 4.5rem 4.5rem;
  background-position: center;
  -webkit-mask-image: radial-gradient(closest-side, #000, transparent);
  mask-image: radial-gradient(closest-side, #000, transparent);
  opacity: 0.8;
}

/* Registration crosshair at the center. */
html[data-theme="research-memo"] .research::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2.25rem;
  height: 2.25rem;
  z-index: -1;
  transform: translate(-50%, -50%);
  background:
    linear-gradient(var(--color-rule), var(--color-rule)) center / 1px 100% no-repeat,
    linear-gradient(var(--color-rule), var(--color-rule)) center / 100% 1px no-repeat;
  opacity: 0.6;
}

html[data-theme="research-memo"] .research-meta {
  display: flex;
  gap: var(--space-4);
}

html[data-theme="research-memo"] .research-quote {
  margin: 0;
  max-width: 40ch;
  font-family: var(--font-serif);
  font-size: var(--text-headline);
  line-height: 1.15;
  color: var(--color-ink);
}

/* The closing section replaces the footer's Research Note link. */
html[data-theme="research-memo"] .site-footer .research-link {
  display: none;
}

html[data-theme="research-memo"] .research-sign {
  color: var(--color-mist);
}

/* ---- Phones -------------------------------------------------------------- */

@media (max-width: 40rem) {
  html[data-theme="research-memo"] .site-nav {
    gap: var(--space-4);
  }

  html[data-theme="research-memo"] .brand-name {
    display: none;  /* the θ mark alone, so the nav fits */
  }

  html[data-theme="research-memo"] .intrigue {
    gap: var(--space-5);
  }

  html[data-theme="research-memo"] .pillars {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  html[data-theme="research-memo"] .field-y {
    left: calc(-1 * var(--space-3));
  }

  html[data-theme="research-memo"] .research-quote br {
    display: none;
  }
}
