@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root { color-scheme: dark; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: #f3efff;
  font: 15px/1.65 'Manrope', system-ui, sans-serif;
  background:
    radial-gradient(ellipse 68% 38% at 49% 0%, #4b297c65, transparent 75%),
    radial-gradient(ellipse 32% 30% at 95% 75%, #49307a45, transparent),
    #0c0b17;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .32;
  background-image: radial-gradient(#b8a4ff 1px, transparent 1px);
  background-size: 43px 43px;
  mask-image: linear-gradient(to bottom, #000, transparent 80%);
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }

.codex-header {
  position: relative;
  z-index: 2;
  max-width: 1220px;
  margin: auto;
  padding: 25px 24px;
  display: flex;
  align-items: center;
  gap: 25px;
}

.codex-brand {
  font-size: 17px;
  letter-spacing: .1em;
  font-weight: 800;
  white-space: nowrap;
  color: #e7d7ff;
}

.codex-nav {
  display: flex;
  gap: 8px;
  margin: auto;
}

.codex-nav a {
  color: #bab0d0;
  padding: 9px 16px;
  border-radius: 20px;
}

.codex-nav a:hover,
.codex-nav [aria-current="page"] {
  background: #ffffff14;
  color: white;
}

.codex-play {
  border: 1px solid #a67df750;
  color: #dac6ff;
  background: #a57af318;
  padding: 9px 15px;
  border-radius: 14px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}

.codex-container {
  position: relative;
  max-width: 1220px;
  padding: 30px 24px 95px;
  margin: auto;
  min-height: 75vh;
}

.codex-eyebrow {
  color: #bc94fa;
  text-transform: uppercase;
  letter-spacing: .26em;
  font-weight: 800;
  font-size: 11px;
  margin: 0 0 17px;
}

.codex-hero {
  text-align: center;
  padding: 66px 10px 60px;
}

.codex-hero h1 {
  font-size: clamp(42px, 7vw, 82px);
  letter-spacing: -.06em;
  line-height: 1.07;
  margin: 0 0 18px;
  font-weight: 800;
}

.codex-hero p:not(.codex-eyebrow) {
  color: #bdb5d1;
  max-width: 640px;
  margin: 0 auto;
  font-size: clamp(14px, 2vw, 17px);
}

.codex-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 5px 0 24px;
}

.codex-toolbar h2 {
  font-size: 27px;
  letter-spacing: -.04em;
  margin: 0;
}

.codex-search {
  width: min(100%, 325px);
  padding: 13px 18px;
  background: #ffffff0a;
  border: 1px solid #ffffff20;
  color: #fff;
  border-radius: 15px;
  outline: none;
}

.codex-search:focus { border-color: #ba92ff; }

.codex-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.codex-card {
  min-height: 306px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border: 1px solid #ffffff20;
  border-radius: 22px;
  background: radial-gradient(circle at 40% 25%, #6640a9, #171327 72%);
  box-shadow: 0 15px 45px #08050f30;
  transition: transform .2s, border-color .2s;
}

.codex-card:hover {
  transform: translateY(-6px);
  border-color: #b08af5a0;
}

.codex-card img {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  object-fit: cover;
  z-index: -2;
  transition: transform .4s;
}

.codex-card:hover img { transform: scale(1.06); }

.codex-card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    0deg, #0b0916f5 0%, #151024b0 38%, #1d143100 84%
  );
}

.codex-card-body { padding: 27px; }

.codex-number {
  font-size: 11px;
  color: #d0b9ff;
  font-weight: 800;
  letter-spacing: .12em;
}

.codex-card h3 {
  font-size: 29px;
  letter-spacing: -.035em;
  line-height: 1.16;
  margin: 10px 0 9px;
}

.codex-card p {
  color: #d6cfe2;
  margin: 0;
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.codex-arrow {
  position: absolute;
  right: 23px;
  bottom: 26px;
  font-size: 20px;
  color: #d3b6ff;
}

.codex-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 24px 0 30px;
  color: #a69abf;
  font-size: 13px;
}

.codex-breadcrumb a { color: #c6aeff; }

.codex-detail-hero {
  display: grid;
  grid-template-columns: 1fr minmax(240px, 38%);
  align-items: center;
  gap: 38px;
  margin-bottom: 34px;
}

.codex-detail-hero h1 {
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.12;
  letter-spacing: -.05em;
  margin: 0 0 18px;
}

.codex-detail-hero p { color: #c4b9d2; }

.codex-detail-cover {
  width: 100%;
  height: 310px;
  object-fit: cover;
  border: 1px solid #ffffff20;
  border-radius: 22px;
  background: #30204b;
}

.codex-panel {
  border: 1px solid #ffffff17;
  border-radius: 24px;
  background: linear-gradient(140deg, #ffffff0c, #ffffff04);
  padding: clamp(20px, 4vw, 36px);
  margin: 25px 0;
}

.codex-panel h2 {
  font-size: 26px;
  letter-spacing: -.035em;
  margin: 0 0 20px;
}

.codex-copy p {
  white-space: pre-wrap;
  margin: 0 0 16px;
  color: #d7d0e3;
  overflow-wrap: anywhere;
}

.codex-bullets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.codex-bullet {
  background: #ffffff08;
  border: 1px solid #ffffff10;
  border-radius: 14px;
  padding: 16px;
  color: #d9d3e3;
  overflow-wrap: anywhere;
}

.codex-bullet strong { color: #f0e6ff; }

.codex-bullet-index {
  font-size: 10px;
  color: #ba93fb;
  letter-spacing: .14em;
  margin-bottom: 7px;
}

.codex-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.codex-gallery img {
  width: 100%;
  height: 190px;
  object-fit: cover;
  border-radius: 15px;
  border: 1px solid #ffffff1d;
}

.codex-empty, .codex-loading {
  text-align: center;
  padding: 55px 20px;
  color: #bcb0d2;
  border: 1px dashed #ffffff25;
  border-radius: 18px;
}

.codex-footer {
  position: relative;
  border-top: 1px solid #ffffff10;
  text-align: center;
  color: #968da6;
  padding: 28px 15px;
  font-size: 12px;
}

.codex-footer a { color: #c4a6ff; }
.codex-article-img { max-width: 100%; border-radius: 18px; }
.codex-video-link { color: #d8bdff; text-decoration: underline; }

@media(max-width:850px) {
  .codex-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .codex-detail-hero { grid-template-columns: 1fr; }
  .codex-detail-cover { height: 280px; order: -1; }
  .codex-play { display: none; }
}

@media(max-width:560px) {
  .codex-header { padding: 18px 15px; gap: 10px; flex-wrap: wrap; }
  .codex-brand { font-size: 13px; }
  .codex-nav { margin-left: auto; gap: 0; }
  .codex-nav a { font-size: 12px; padding: 7px 9px; }
  .codex-container { padding: 12px 15px 70px; }
  .codex-hero { padding: 48px 3px; }
  .codex-grid, .codex-bullets, .codex-gallery {
    grid-template-columns: 1fr;
  }
  .codex-toolbar { flex-direction: column; align-items: stretch; }
  .codex-card { min-height: 270px; }
  .codex-gallery img { height: 230px; }
}
