/* =========================================
   ENIA RECHERCHES — Design System
   =========================================
   Tokens → Base → Buttons → Nav
   → Panel System → Landing → Library
   → Ticker → Responsive
   ========================================= */

/* =========================================
   TOKENS
   ========================================= */
:root {
  /* Dark / Landing */
  --bg-dark:            #0C0C0C;
  --text-light:         #F5F2EC;
  --text-light-2:       rgba(245,242,236,0.55);
  --text-light-3:       rgba(245,242,236,0.28);
  --border-dark:        rgba(255,255,255,0.07);

  /* Light / Library */
  --bg-light:           #F6F4EF;
  --bg-surface:         #FFFFFF;
  --text-dark:          #1A1916;
  --text-dark-2:        #5A5750;
  --text-dark-3:        #999690;
  --border-light:       rgba(0,0,0,0.07);

  /* Axis colours */
  --ia:                 #7C6BF5;
  --ia-bg:              rgba(124,107,245,0.1);
  --construire:         #2D9142;
  --construire-bg:      rgba(45,145,66,0.1);
  --quantifier:         #2B6CB0;
  --quantifier-bg:      rgba(43,108,176,0.1);
  --transformer:        #C05621;
  --transformer-bg:     rgba(192,86,33,0.1);

  /* Chrome */
  --nav-h:              52px;
  --ticker-h:           36px;
  --px:                 clamp(28px, 5vw, 72px);

  /* Shape */
  --r-pill:             100px;
  --r-card:             10px;

  /* Pan transition */
  --pan-dur:            0.72s;
  --pan-ease:           cubic-bezier(0.76, 0, 0.24, 1);
  --grad-h:             80vh;   /* height of gradient strip between floors */

  /* Motion */
  --ease:               cubic-bezier(0.2, 0, 0, 1);
  --dur:                0.18s;
  --dur-slow:           0.36s;

  /* Font */
  --font:               'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}


/* =========================================
   RESET
   ========================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  font-size: 16px;
  overflow: hidden;  /* prevent scroll on html */
  height: 100%;
}
body {
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  height: 100%;
}
a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }
button { font-family: var(--font); background: none; border: none; cursor: pointer; padding: 0; }


/* =========================================
   BUTTONS — pill-shaped system
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r-pill);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  transition: all var(--dur) var(--ease);
  -webkit-user-select: none;
  user-select: none;
  letter-spacing: 0.01em;
}

/* On dark background */
.btn-primary-light {
  background: var(--text-light);
  color: var(--bg-dark);
  padding: 13px 26px;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0;
}
.btn-primary-light:hover { background: #fff; gap: 9px; }

.btn-outline-dark {
  background: transparent;
  color: var(--text-light-2);
  border: 1px solid var(--border-dark);
  letter-spacing: 0.02em;
}
.btn-outline-dark:hover {
  border-color: rgba(245,242,236,0.22);
  color: var(--text-light);
  background: rgba(245,242,236,0.04);
}

.btn-ghost-dark {
  background: transparent;
  color: var(--text-light-2);
  padding: 10px 14px;
}
.btn-ghost-dark:hover { color: var(--text-light); gap: 8px; }

/* On light background */
.btn-primary-dark {
  background: var(--text-dark);
  color: var(--bg-light);
  padding: 11px 22px;
  font-weight: 600;
}
.btn-primary-dark:hover { background: #000; gap: 8px; }

.btn-outline-light {
  background: transparent;
  color: var(--text-dark);
  border: 1px solid var(--border-light);
  padding: 9px 18px;
}
.btn-outline-light:hover {
  border-color: rgba(0,0,0,0.18);
  background: rgba(0,0,0,0.02);
}

.btn-ghost-light {
  background: transparent;
  color: var(--text-dark-3);
  padding: 10px 14px;
  font-size: 0.85rem;
}
.btn-ghost-light:hover { color: var(--text-dark); }


/* =========================================
   NAV — fixed within panel-wrap
   ========================================= */
.nav {
  position: absolute;  /* fixed within its panel, not the viewport */
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 20px;
  background: transparent;
}

.nav-right, .nav-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Library nav — space-between, left logo + right buttons */
.panel-library .nav {
  justify-content: space-between;
}

/* Library nav logo */
.lib-nav-logo {
  display: flex;
  align-items: center;
  opacity: 0.85;
  transition: opacity var(--dur);
}
.lib-nav-logo:hover { opacity: 1; }
.lib-nav-logo-img {
  height: 34px;
  width: auto;
  filter: brightness(0);  /* dark logo on light bg */
}

.nav-sep {
  width: 1px;
  height: 16px;
  background: var(--border-light);
  margin: 0 8px;
  flex-shrink: 0;
}


/* =========================================
   PAGE BODIES — background fallback for
   the area revealed during pan transitions
   ========================================= */
/* =========================================
   FIXED NAV — stays pinned to viewport
   during pan transitions (outside .stage)
   ========================================= */
.nav-fixed {
  position: fixed;
  top: 0;
  right: 0;
  height: var(--nav-h);
  z-index: 300;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 6px;
}

.nav-fixed-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r-pill);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  letter-spacing: 0.02em;
  background: transparent;
  border: 1px solid;
  transition: color var(--pan-dur) var(--pan-ease),
              border-color var(--pan-dur) var(--pan-ease),
              background var(--pan-dur) var(--pan-ease);
}
.page-landing .nav-fixed-btn {
  color: var(--text-light-2);
  border-color: var(--border-dark);
}
.page-landing .nav-fixed-btn:hover {
  color: var(--text-light);
  border-color: rgba(245,242,236,0.22);
  background: rgba(245,242,236,0.04);
}
.page-library .nav-fixed-btn {
  color: var(--text-dark-2);
  border-color: var(--border-light);
}
.page-library .nav-fixed-btn:hover {
  color: var(--text-dark);
  border-color: rgba(0,0,0,0.18);
  background: rgba(0,0,0,0.02);
}
body.axis-open .nav-fixed {
  filter: blur(2px);
  opacity: 0.2;
  transition: filter 0.7s cubic-bezier(0.4,0,0.2,1), opacity 0.7s cubic-bezier(0.4,0,0.2,1);
}


.page-landing {
  background-color: var(--bg-dark);
  color: var(--text-light);
}
.page-library {
  background-color: var(--bg-light);
  color: var(--text-dark);
}


/* =========================================
   PANEL SYSTEM
   =========================================
   .panel-wrap  — slides up/down on transition
   .panel-bg    — dot-grid bg, receives filter:invert on exit
   .page-wrap   — UI content layer (nav, main, ticker)
   ========================================= */

/* Ghost logo — absolute inside page-wrap, z-index:-1 → behind all content, above panel-bg */
.hero-bg-logo {
  position: absolute;
  top: 0;
  left: 0;
  width: 26vw;
  max-width: 340px;
  pointer-events: none;
  user-select: none;
  z-index: -1;
}
.hero-bg-logo-img {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0.06;
  filter: brightness(0) invert(1);   /* white ghost on dark bg */
  transition: filter var(--pan-dur) var(--pan-ease),
              opacity var(--pan-dur) var(--pan-ease);
}
.page-library .hero-bg-logo-img {
  filter: brightness(0);              /* dark ghost on light bg */
  opacity: 0.05;
}

/* Stage — viewport-sized clip that holds the scrolling world */
.stage {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}

/* Stage inner — the full scrollable canvas; animated as one unit */
.stage-inner {
  display: flex;
  flex-direction: column;
  width: 100%;
  /* height auto → grows to fit stacked panels + gradient */
  will-change: transform;
  transition: transform var(--pan-dur) var(--pan-ease);
}

/* Gradient strip between the two floors */
.stage-gradient {
  flex-shrink: 0;
  height: var(--grad-h);
  position: relative;
  margin-top: -2px;    /* close sub-pixel seam against library panel above */
  margin-bottom: -2px; /* close sub-pixel seam against landing panel below */
  /* Light (library) at top → Dark (landing) at bottom */
  background: linear-gradient(to bottom, var(--bg-light) 0%, var(--bg-dark) 100%);
}
/* White dot-grid fading in from the dark (bottom) side */
.stage-gradient::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.18) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,1) 0%, transparent 55%);
  mask-image:         linear-gradient(to top, rgba(0,0,0,1) 0%, transparent 55%);
  animation: dot-breathe 5s ease-in-out infinite;
}
/* Dark dot-grid fading in from the light (top) side */
.stage-gradient::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(0,0,0,0.18) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 0%, transparent 55%);
  mask-image:         linear-gradient(to bottom, rgba(0,0,0,1) 0%, transparent 55%);
  animation: dot-breathe 5s ease-in-out infinite;
}

/* Panel — one "floor" of the stage */
.panel-wrap {
  position: relative;
  height: 100vh;
  width: 100%;
  flex-shrink: 0;
  overflow: hidden;
}

/* Dot-grid background layer */
.panel-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  will-change: filter;
  transition: filter var(--pan-dur) var(--pan-ease);
}

.panel-landing .panel-bg {
  background-color: var(--bg-dark);
}
.panel-landing .panel-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.18) 1px, transparent 1px);
  background-size: 26px 26px;
  animation: dot-breathe 5s ease-in-out infinite;
}

.panel-library .panel-bg {
  background-color: var(--bg-light);
}
.panel-library .panel-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(0,0,0,0.18) 1px, transparent 1px);
  background-size: 26px 26px;
  animation: dot-breathe 5s ease-in-out infinite;
}

/* Dot-grid breathing keyframe */
@keyframes dot-breathe {
  0%, 100% { opacity: 0.25; }
  50%       { opacity: 0.85; }
}

/* Content layer — sits above panel-bg */
.page-wrap {
  position: absolute;
  inset: 0;
  z-index: 1;
}




/* =========================================
   LANDING — hero layout
   ========================================= */
.hero {
  height: 100vh;
  padding: calc(var(--nav-h) + 56px) var(--px) calc(var(--ticker-h) + 56px);
  display: flex;
  align-items: center;
  gap: clamp(48px, 6vw, 96px);
  max-width: 1360px;
  margin: 0 auto;
  width: 100%;
  position: relative;
}

/* Left column */
.hero-left {
  flex: 1.05;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  position: relative;
  z-index: 1;
  transition: filter 0.7s cubic-bezier(0.4,0,0.2,1), opacity 0.7s cubic-bezier(0.4,0,0.2,1);
}

.hero-title {
  font-size: clamp(2.6rem, 4.8vw, 4.6rem);
  font-weight: 700;
  line-height: 0.96;
  letter-spacing: -0.04em;
  margin-bottom: 24px;
}
.hero-title-dim {
  font-weight: 200;
  color: var(--text-light-3);
}

.hero-body {
  font-size: clamp(0.8rem, 1.2vw, 0.9rem);
  color: var(--text-light-2);
  line-height: 1.75;
  margin-bottom: 40px;
  font-weight: 300;
  max-width: 340px;
  letter-spacing: 0.01em;
}

/* Right column */
.hero-right {
  flex: 0.88;
  min-width: 0;
  position: relative;
  z-index: 1;
}


/* =========================================
   AXES PANEL — dark (landing)
   ========================================= */
.axes-panel {
  border: 1px solid var(--border-dark);
  border-radius: var(--r-card);
  background: rgba(18,18,18,0.72);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  overflow: hidden;
  position: relative;
  z-index: 2;
}

.axes-panel-hd {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 500;
  color: var(--text-light-3);
  padding: 16px 22px 14px;
  border-bottom: 1px solid var(--border-dark);
  cursor: grab;
  user-select: none;
}
.axes-panel-hd:active { cursor: grabbing; }

/* Spring-back transition — applied only on release, not during drag */
.axes-panel.is-springing {
  transition: transform 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Accordion item */
.axis-item {
  border-bottom: 1px solid var(--border-dark);
}
.axis-item:last-child { border-bottom: none; }

.axis-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 17px 22px;
  width: 100%;
  color: var(--text-light-2);
  text-align: left;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.axis-row:hover {
  color: var(--text-light);
  background: rgba(255,255,255,0.025);
}
.axis-row[aria-expanded="true"] {
  color: var(--text-light);
  background: rgba(255,255,255,0.03);
}
.axis-row[aria-expanded="true"] .axis-chevron {
  transform: rotate(90deg);
  opacity: 0.65;
}

.axis-pip {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #4ADE80;
  box-shadow: 0 0 4px 1px rgba(74,222,128,0.7);
}
.axis-row[aria-expanded="true"] .axis-pip {
  animation: live-pulse 2.2s ease-in-out infinite;
}
.axis-name {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 400;
  letter-spacing: -0.005em;
}
.axis-ct {
  font-size: 0.67rem;
  color: var(--text-light-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}
.axis-chevron {
  flex-shrink: 0;
  opacity: 0.2;
  transition: transform var(--dur-slow) var(--ease), opacity var(--dur) var(--ease);
}
.axis-row:hover .axis-chevron { opacity: 0.5; }

.axis-body {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.4s var(--ease), opacity 0.3s var(--ease);
}
.axis-body.open {
  max-height: 200px;
  opacity: 1;
}
.axis-body p {
  font-size: 0.78rem;
  font-weight: 300;
  color: var(--text-light-2);
  line-height: 1.78;
  padding: 4px 22px 20px 40px;
  letter-spacing: 0.01em;
}

/* Focus blur when accordion is open */
body.axis-open .hero-left {
  filter: blur(3px);
  opacity: 0.25;
}
body.axis-open .hero-bg-logo {
  opacity: 0 !important;
}
body.axis-open .nav {
  filter: blur(2px);
  opacity: 0.2;
}
body.axis-open .ticker-bar {
  filter: blur(2px);
  opacity: 0.2;
}


/* =========================================
   TICKER
   ========================================= */
.ticker-bar {
  position: absolute;  /* pinned to bottom of its panel */
  bottom: 0; left: 0; right: 0;
  height: var(--ticker-h);
  overflow: hidden;
  z-index: 100;
  background: rgba(10,10,10,0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: filter 0.7s cubic-bezier(0.4,0,0.2,1), opacity 0.7s cubic-bezier(0.4,0,0.2,1);
}

.ticker-inner {
  height: 100%;
  display: flex;
  align-items: center;
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent 0%, black 4%, black 96%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 4%, black 96%, transparent 100%);
}

@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-track {
  display: flex;
  align-items: center;
  white-space: nowrap;
  animation: ticker-scroll 60s linear infinite;
  /* No will-change here — avoids a competing GPU compositor layer
     that fights .stage-inner's transform during page transitions. */
}
.ticker-track:hover { animation-play-state: paused; }

.ticker-item {
  font-size: 0.67rem;
  letter-spacing: 0.03em;
  font-weight: 400;
  padding: 0 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-light-3);
}

.ticker-sep {
  color: var(--text-light-3);
  opacity: 0.15;
  font-size: 0.65rem;
  flex-shrink: 0;
}

.ticker-live {
  color: #4ADE80;
  font-size: 0.4rem;
  animation: live-pulse 2.2s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.2; }
}

/* Ticker item — interactive when data is loaded */
.ticker-item.is-interactive {
  cursor: pointer;
  transition: color var(--dur) var(--ease);
}
.ticker-item.is-interactive:hover {
  color: var(--text-light);
}

/* =========================================
   TICKER POPUP
   Glassmorphism card that rises above the
   ticker bar on hover, following the item.
   ========================================= */
.ticker-popup {
  /* Positioned by JS — fixed so it escapes any overflow:hidden ancestors */
  position: fixed;
  z-index: 500;
  pointer-events: none;

  /* Vertical layout: image on top, text below */
  display: flex;
  flex-direction: column;
  gap: 12px;

  /* Glass card — dark, matching axes-panel DNA */
  background  : rgba(14, 14, 14, 0.92);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border      : 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--r-card);
  padding     : 14px 16px 16px;
  width       : 360px;

  /* Entrance animation */
  opacity   : 0;
  transform : translateY(8px);
  transition: opacity  0.18s var(--ease),
              transform 0.18s var(--ease);

  white-space: normal;
}

.ticker-popup.is-visible {
  opacity  : 1;
  transform: translateY(0);
}

/* Thumbnail — full-width, ~2.5× the original size */
.ticker-popup-img {
  width        : 100%;
  height       : 200px;
  object-fit   : cover;
  border-radius: 6px;
  flex-shrink  : 0;
  display      : block;
  background   : rgba(255,255,255,0.05);  /* placeholder while loading */
}

/* Text column */
.ticker-popup-content {
  display       : flex;
  flex-direction: column;
  gap           : 5px;
  min-width     : 0;
}

.ticker-popup-date {
  font-size     : 0.58rem;
  font-weight   : 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color         : rgba(245, 242, 236, 0.38);
  white-space   : nowrap;
}

.ticker-popup-title {
  font-size     : 0.8rem;
  font-weight   : 500;
  line-height   : 1.35;
  letter-spacing: -0.01em;
  color         : var(--text-light);
  /* Allow two lines max */
  display              : -webkit-box;
  -webkit-line-clamp   : 2;
  -webkit-box-orient   : vertical;
  overflow             : hidden;
}

.ticker-popup-text {
  font-size  : 0.7rem;
  font-weight: 300;
  line-height: 1.6;
  color      : var(--text-light-2);
}


/* =========================================
   LIBRARY PAGE — full viewport hero
   ========================================= */

/* Library nav — transparent, inherits panel-bg */
.panel-library .nav {
  background: transparent;
  border-bottom: none;
}

/* Library hero layout — mirrors landing */
.lib-hero {
  height: 100vh;
  padding: calc(var(--nav-h) + 56px) var(--px) 56px;
  display: flex;
  align-items: center;
  gap: clamp(48px, 6vw, 96px);
  max-width: 1360px;
  margin: 0 auto;
  width: 100%;
  position: relative;
}

.lib-hero-left {
  flex: 1.05;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  z-index: 1;
}

.lib-hero-pretitle {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-dark-3);
  margin-bottom: 20px;
}

.lib-hero-title {
  font-size: clamp(2.6rem, 4.8vw, 4.6rem);
  font-weight: 700;
  line-height: 0.96;
  letter-spacing: -0.04em;
  margin-bottom: 24px;
  color: var(--text-dark);
}

.lib-hero-title-dim {
  font-weight: 200;
  color: var(--text-dark-3);
}

.lib-hero-body {
  font-size: clamp(0.8rem, 1.2vw, 0.9rem);
  color: var(--text-dark-2);
  line-height: 1.75;
  margin-bottom: 40px;
  font-weight: 300;
  max-width: 340px;
  letter-spacing: 0.01em;
}

.lib-hero-stats {
  display: flex;
  gap: 32px;
  margin-top: 4px;
}

.lib-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.lib-stat-num {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text-dark);
}

.lib-stat-lbl {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
  color: var(--text-dark-3);
}

.lib-hero-right {
  flex: 0.88;
  min-width: 0;
  position: relative;
  z-index: 1;
}


/* =========================================
   AXES PANEL — light (library)
   ========================================= */
.axes-panel-light {
  border: 1px solid var(--border-light);
  border-radius: var(--r-card);
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  overflow: hidden;
}

.axes-panel-light .axes-panel-hd {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 500;
  color: var(--text-dark-3);
  padding: 16px 22px 14px;
  border-bottom: 1px solid var(--border-light);
}

.lib-axis-item {
  border-bottom: 1px solid var(--border-light);
}
.lib-axis-item:last-child { border-bottom: none; }

.lib-axis-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 17px 22px;
  width: 100%;
  color: var(--text-dark-2);
  text-align: left;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.lib-axis-row:hover {
  color: var(--text-dark);
  background: rgba(0,0,0,0.018);
}

.lib-axis-ct {
  font-size: 0.67rem;
  color: var(--text-dark-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

.lib-axis-chevron {
  flex-shrink: 0;
  opacity: 0.18;
  transition: transform var(--dur-slow) var(--ease), opacity var(--dur) var(--ease);
}
.lib-axis-row:hover .lib-axis-chevron {
  opacity: 0.45;
  transform: translateX(3px);
}


/* =========================================
   LIBRARY GRID
   ========================================= */

/* lib-main — absolutely positioned below nav, independently scrollable */
.lib-main {
  position: absolute;
  top: var(--nav-h);
  left: 0; right: 0; bottom: 0;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 36px var(--px) 72px;
}
.lib-main::-webkit-scrollbar { display: none; }

/* Grid */
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

/* Card — axes-panel-light DNA, bare (LED only) */
.lib-card {
  position: relative;
  border: 1px solid var(--border-light);
  border-radius: var(--r-card);
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 22px;
  min-height: 160px;
  cursor: pointer;
  /* entrance: starts invisible, JS adds .is-visible */
  opacity: 0;
  transform: translateY(10px);
  transition:
    border-color 0.2s  var(--ease),
    background   0.2s  var(--ease),
    opacity      0.45s var(--ease),
    filter       0.45s var(--ease),
    transform    0.5s  var(--ease);
}
.lib-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.lib-card:not(.is-active):hover {
  border-color: rgba(0,0,0,0.13);
  background: rgba(255,255,255,0.92);
}

/* Green LED — top left, steady */
.lib-card-led {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ADE80;
  box-shadow: 0 0 4px 1px rgba(74,222,128,0.7);
}


/* ─── Focus state — mirrors body.axis-open on landing ─── */

body.lib-item-open .nav-fixed {
  filter: blur(2px);
  opacity: 0.18;
  transition: filter 0.45s var(--ease), opacity 0.45s var(--ease);
}
body.lib-item-open .nav {
  filter: blur(2px);
  opacity: 0.18;
  transition: filter 0.45s var(--ease), opacity 0.45s var(--ease);
}
body.lib-item-open .lib-card:not(.is-active) {
  opacity: 0.08;
  filter: blur(2px);
}
body.lib-item-open .lib-card.is-active {
  opacity: 0;
  transition: opacity 0s;  /* instant hide — expand panel takes over */
}


/* ─── Expand backdrop — transparent click-trap ─── */

.lib-expand-backdrop {
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
}
.lib-expand-backdrop.is-active {
  pointer-events: auto;
}


/* ─── Expanded card — JS animates position & size from card rect ─── */

.lib-card-expanded {
  position: absolute;
  border: 1px solid var(--border-light);
  border-radius: var(--r-card);
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  overflow: hidden;
  /* position/size driven entirely by JS inline styles */
}
.lib-card-expanded .lib-card-led {
  position: absolute;
  top: 16px;
  left: 16px;
}

/* Close button — fades in after expansion settles */
.lib-card-expanded-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-dark-3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.lib-card-expanded.show-ui .lib-card-expanded-close {
  opacity: 1;
  transition: opacity 0.2s var(--ease),
              color var(--dur) var(--ease),
              background var(--dur) var(--ease);
}
.lib-card-expanded-close:hover {
  color: var(--text-dark);
  background: rgba(0,0,0,0.05);
}


/* =========================================
   LIBRARY GHOST GRID — decorative wireframe
   ========================================= */
.lib-ghost-grid {
  position: absolute;
  top: var(--nav-h);
  left: 0; right: 0; bottom: 0;
  padding: 36px var(--px) 72px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
  pointer-events: none;
  overflow: hidden;
  /* sits above DVD logo (z-index:-1), below lib-wip (comes after in DOM) */
}

.lib-ghost-card {
  border: 1px solid rgba(0,0,0,0.3);
  border-radius: var(--r-card);
  min-height: 0;   /* height controlled by JS grid-template-rows: 1fr */
  animation: ghost-breathe 4s ease-in-out infinite;
  /* animation-delay set dynamically by JS */
}

@keyframes ghost-breathe {
  0%, 100% { opacity: 0.12; }
  50%       { opacity: 0.42; }
}


/* =========================================
   LIBRARY WIP — hero-scale centered holding state
   ========================================= */
.lib-wip {
  position: absolute;
  top: var(--nav-h);
  left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--px);
  pointer-events: none;
}
.lib-wip > * { pointer-events: auto; }

.lib-wip-title {
  font-size: clamp(2.6rem, 4.8vw, 4.6rem);
  font-weight: 700;
  line-height: 0.96;
  letter-spacing: -0.04em;
  color: var(--text-dark);
  margin-bottom: 32px;
}
.lib-wip-title-dim {
  font-weight: 200;
  color: var(--text-dark-3);
}

.lib-wip-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 500;
  color: var(--text-dark-3);
  margin-bottom: 14px;
}
.lib-wip-body {
  font-size: clamp(0.78rem, 1.1vw, 0.85rem);
  color: var(--text-dark-2);
  line-height: 1.8;
  font-weight: 300;
  letter-spacing: 0.01em;
  margin-bottom: 28px;
}


/* =========================================
   STATUS BADGES
   ========================================= */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  white-space: nowrap;
  flex-shrink: 0;
}
.badge-ongoing  { background: #EEF7F1; color: #2D9142; }
.badge-done     { background: #F3F2EF; color: #5A5750; }
.badge-patent   { background: #FEF3ED; color: #C05621; }
.badge-prize    { background: #FFF9E8; color: #A36A00; }
.badge-dark     { background: rgba(245,242,236,0.1); color: rgba(245,242,236,0.55); font-size: 0.65rem; }


/* =========================================
   RESPONSIVE
   ========================================= */

/* Stack hero columns on small screens */
@media (max-width: 700px) {
  .hero, .lib-hero {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 40px;
    padding-top: calc(var(--nav-h) + 32px);
    padding-bottom: calc(var(--ticker-h) + 32px);
  }
  .hero-right,
  .lib-hero-right { width: 100%; }
  .hero-title,
  .lib-hero-title { font-size: clamp(2.4rem, 9vw, 3.4rem); }
}

@media (max-width: 540px) {
  :root { --px: 20px; }
}
