/*-----------------------------------*\
  #paper.css — light academic theme for project / paper pages
  Standalone. Deliberately inverted from the dark v2 home page:
  research artifacts read as paper, not as marketing.
\*-----------------------------------*/

:root {
  color-scheme: light;

  /* Set --accent to match main site primary color */
  --accent: #e94f37;

  --bg: #ffffff;
  --bg-soft: #fafafa;
  --bg-muted: #f4f4f4;
  --border: #e6e6e6;
  --border-strong: #cfcfcf;
  --text: #111111;
  --text-muted: #4a4a4a;
  --text-faint: #8a8a8a;

  --font-sans: 'Space Grotesk', 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;

  --fs-title: clamp(2rem, 1.35rem + 2.8vw, 3.5rem);
  --fs-h2: clamp(1.35rem, 1.15rem + 0.9vw, 1.85rem);
  --fs-body: clamp(1rem, 0.96rem + 0.18vw, 1.0625rem);
  --fs-caption: 0.72rem;

  --measure: 96ch;
  --container: min(94vw, 1280px);
  --content: min(94vw, 1080px);

  --radius: 6px;
  --radius-lg: 10px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 18px rgba(0, 0, 0, 0.06);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

::selection {
  background: var(--accent);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.content {
  width: var(--content);
  margin-inline: auto;
}

.wide {
  width: var(--container);
  margin-inline: auto;
}

/*-----------------------------------*\
  #TOP BAR
\*-----------------------------------*/

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, #ffffff 92%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.85rem;
}

.back-link,
.header-name {
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  transition: color 0.25s var(--ease), gap 0.25s var(--ease);
}

.back-link:hover {
  color: var(--accent);
  gap: 0.85rem;
}

.header-name {
  color: var(--text);
}

@media (max-width: 640px) {
  .header-name {
    display: none;
  }
}

/*-----------------------------------*\
  #PROJECT HEADER
\*-----------------------------------*/

.project-header {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-top: clamp(2.5rem, 1.8rem + 3vw, 4.5rem);
  padding-bottom: 0.75rem;
}

/* faint blueprint grid, radially masked */
.project-header::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    repeating-linear-gradient(0deg, rgba(17, 17, 17, 0.045) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg, rgba(17, 17, 17, 0.045) 0 1px, transparent 1px 44px);
  -webkit-mask-image: radial-gradient(ellipse 75% 90% at 50% 45%, #000 25%, transparent 82%);
  mask-image: radial-gradient(ellipse 75% 90% at 50% 45%, #000 25%, transparent 82%);
  pointer-events: none;
}

.project-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1.4rem;
}

.project-eyebrow::before {
  content: '';
  width: 28px;
  height: 1px;
  background: var(--accent);
  flex-shrink: 0;
}

.project-title {
  font-size: var(--fs-title);
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.03em;
  max-width: 20ch;
  text-wrap: balance;
}

.project-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1.5rem;
}

.project-badge {
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.35rem 0.8rem;
}

.project-badge.is-live {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}

.project-tagline {
  font-size: clamp(1.05rem, 0.98rem + 0.35vw, 1.3rem);
  line-height: 1.5;
  color: var(--text-muted);
  max-width: 62ch;
  margin-top: 1.75rem;
}

.project-authors {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-faint);
  max-width: 62ch;
  margin-top: 1.5rem;
}

.project-authors strong {
  color: var(--text);
  font-weight: 600;
}

.project-authors .affil {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  letter-spacing: 0.08em;
  margin-top: 0.4rem;
}

/*-----------------------------------*\
  #ACTIONS
\*-----------------------------------*/

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.75rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  color: var(--text);
  background: #fff;
  transition: all 0.25s var(--ease);
}

.btn:hover {
  border-color: var(--text);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--text);
  border-color: var(--text);
  color: #fff;
}

.btn-primary:hover {
  background: #000;
  border-color: #000;
  box-shadow: var(--shadow-md);
}

.btn[aria-disabled='true'] {
  opacity: 0.5;
  pointer-events: none;
}

.btn svg {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

/*-----------------------------------*\
  #STAT BAND
\*-----------------------------------*/

.numbers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-block: clamp(2rem, 1.5rem + 2vw, 3.5rem);
}

.stat {
  background: var(--bg);
  padding: 1.6rem 1.4rem;
  transition: background 0.25s var(--ease);
}

.stat:hover {
  background: var(--bg-soft);
}

.stat .num {
  font-family: var(--font-mono);
  font-size: clamp(1.55rem, 1.15rem + 1.8vw, 2.2rem);
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.03em;
  line-height: 1;
}

.stat .lbl {
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 0.65rem;
}

/*-----------------------------------*\
  #FIGURE
\*-----------------------------------*/

.fig {
  margin-top: 0.75rem;
  margin-bottom: clamp(1.8rem, 1.2rem + 1.5vw, 3rem);
}

.fig img {
  width: 100%;
  max-height: 380px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
  object-fit: cover;
  object-position: center;
}

/* Aspect ratio modifiers */
.fig img.aspect-16-9 {
  aspect-ratio: 16 / 9;
}

.fig img.aspect-21-9 {
  aspect-ratio: 21 / 9;
}

.fig img.aspect-16-10 {
  aspect-ratio: 16 / 10;
}

.fig img.aspect-4-3 {
  aspect-ratio: 4 / 3;
}

.fig figcaption {
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-top: 0.85rem;
  line-height: 1.55;
}

.fig figcaption b {
  color: var(--text-muted);
  font-weight: 600;
}

/*-----------------------------------*\
  #BODY PROSE
\*-----------------------------------*/

.project-body {
  padding-bottom: clamp(3rem, 2rem + 4vw, 6rem);
}

.project-body h2 {
  position: relative;
  font-size: var(--fs-h2);
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.15;
  margin-top: 4rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.project-body h2:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.project-body h2::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  width: 48px;
  height: 1px;
  background: var(--accent);
}

.project-body h2:first-child::before {
  display: none;
}

.project-body h3 {
  font-size: var(--fs-body);
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 2rem 0 0.7rem;
}

.project-body p {
  margin-top: 1rem;
  max-width: var(--measure);
  color: var(--text-muted);
}

.project-body h2 + p,
.project-body h3 + p {
  margin-top: 0.85rem;
}

.project-body strong {
  color: var(--text);
  font-weight: 600;
}

.project-body a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.25s var(--ease);
}

.project-body a:hover {
  text-decoration-color: var(--accent);
}

.bullets {
  list-style: none;
  margin-top: 1.1rem;
  max-width: var(--measure);
  display: grid;
  gap: 0.65rem;
}

.bullets li {
  position: relative;
  padding-left: 1.35rem;
  color: var(--text-muted);
}

.bullets li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 7px;
  height: 1px;
  background: var(--accent);
}

.bullets.check-bullets li {
  padding-left: 1.6rem;
}

.bullets.check-bullets li::before {
  content: '✓';
  position: absolute;
  left: 0;
  top: -0.1em;
  width: auto;
  height: auto;
  background: none;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.1rem;
}

.bullets.arrow-bullets li {
  padding-left: 1.4rem;
}

.bullets.arrow-bullets li::before {
  content: '›';
  position: absolute;
  left: 0;
  top: -0.1em;
  width: auto;
  height: auto;
  background: none;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.3rem;
  line-height: 1.2;
}

.publication-details-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.6rem;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.publication-details-card p {
  margin-top: 0;
  font-size: 1.02rem;
  color: var(--text-muted);
}

.publication-details-card strong {
  color: var(--text);
}

.publication-details-card a {
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 600;
}

/*-----------------------------------*\
  #CALLOUT
\*-----------------------------------*/

.callout {
  background: color-mix(in srgb, var(--accent) 6%, var(--bg-soft));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 1.2rem 1.5rem;
  margin-block: 1.6rem;
  max-width: var(--measure);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
}

.callout p {
  margin-top: 0;
  color: var(--text);
  font-size: 1.02rem;
  line-height: 1.6;
}

.callout strong {
  color: var(--accent);
  font-weight: 700;
}

/*-----------------------------------*\
  #ROLE / SPEC CARDS
\*-----------------------------------*/

.roles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-block: 2rem;
}

.role {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
  padding: 1.4rem 1.3rem;
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.role::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 40px;
  height: 1px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

.role:hover {
  border-color: var(--border-strong);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.role .tag-id {
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.65rem;
}

.role h4 {
  font-size: var(--fs-body);
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 0.45rem;
}

.role p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.55;
  font-size: 0.95rem;
}

/*-----------------------------------*\
  #TABLE
\*-----------------------------------*/

.table-wrap {
  overflow-x: auto;
  margin-block: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

thead th {
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  font-weight: 500;
  padding: 0.9rem 1.1rem;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--bg-muted);
}

td.num {
  font-family: var(--font-mono);
  color: var(--text);
  white-space: nowrap;
}

td.best {
  color: var(--text);
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

/*-----------------------------------*\
  #CITATION
\*-----------------------------------*/

.citation {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.7;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  color: var(--text-muted);
  margin-top: 1.1rem;
  max-width: var(--measure);
  overflow-wrap: anywhere;
}

.note {
  font-size: 0.88rem;
  color: var(--text-faint);
  margin-top: 1rem;
  max-width: var(--measure);
}

/*-----------------------------------*\
  #PREV / NEXT
\*-----------------------------------*/

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-top: clamp(3rem, 2rem + 3vw, 5rem);
}

.pager-item {
  background: var(--bg);
  padding: 1.6rem 1.4rem;
  text-decoration: none;
  color: var(--text);
  transition: background 0.25s var(--ease);
}

.pager-item:hover {
  background: var(--bg-soft);
}

.pager-item.is-next {
  text-align: right;
}

.pager-item .lbl {
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 0.5rem;
}

.pager-item .ttl {
  font-size: 0.98rem;
  font-weight: 500;
  line-height: 1.3;
}

.pager-item.is-empty {
  pointer-events: none;
  opacity: 0.4;
}

@media (max-width: 560px) {
  .pager {
    grid-template-columns: 1fr;
  }

  .pager-item.is-next {
    text-align: left;
  }
}

/*-----------------------------------*\
  #FOOTER
\*-----------------------------------*/

.paper-footer {
  padding-block: 2rem;
}

.paper-footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--font-mono);
  font-size: var(--fs-caption);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.paper-footer a {
  color: var(--text-faint);
  text-decoration: none;
  transition: color 0.25s var(--ease);
}

.paper-footer a:hover {
  color: var(--text);
}

.paper-footer-links {
  display: flex;
  gap: 1.2rem;
}

/*-----------------------------------*\
  #MOTION
\*-----------------------------------*/

[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  transition-delay: calc(var(--i, 0) * 55ms);
}

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

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

@media print {
  .site-header,
  .pager,
  .actions,
  .paper-footer {
    display: none;
  }

  body {
    font-size: 11pt;
  }

  .project-header::before {
    display: none;
  }
}
