:root {
  color-scheme: dark;
  --bg: #050505;
  --ink: #f4efe6;
  --muted: #aaa399;
  --line: rgba(244, 239, 230, 0.18);
  --panel: rgba(6, 6, 6, 0.74);
  --panel-strong: rgba(6, 6, 6, 0.9);
  --accent: #d8d0c4;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 clamp(18px, 4vw, 64px);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.72), transparent);
}

.nav-logo {
  font-size: 20px;
  font-weight: 850;
  text-transform: uppercase;
}

.main-nav {
  display: flex;
  gap: clamp(16px, 3vw, 42px);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.main-nav a:hover {
  color: var(--ink);
}

.hero {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  align-items: end;
  gap: clamp(24px, 5vw, 72px);
  padding: 120px clamp(18px, 5vw, 78px) clamp(28px, 6vw, 84px);
}

.hero-image,
.hero-shade {
  position: absolute;
  inset: 0;
}

.hero-image {
  z-index: 0;
  background-image: url("codex-bg.jpg");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center 18%;
  filter: grayscale(1);
  opacity: 0.54;
  transform: scale(1.02);
}

.hero-shade {
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.18) 52%, rgba(0, 0, 0, 0.72)),
    linear-gradient(180deg, rgba(0, 0, 0, 0.2), #050505 96%);
}

.hero-content,
.next-card {
  position: relative;
  z-index: 2;
}

.hero-content {
  max-width: 760px;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

h1 {
  font-size: clamp(76px, 16vw, 210px);
  line-height: 0.82;
  font-weight: 900;
  text-transform: uppercase;
}

.glitch-logo {
  position: relative;
  width: min(100%, clamp(280px, 43vw, 760px));
  aspect-ratio: 1774 / 887;
  isolation: isolate;
  filter: drop-shadow(0 0 18px rgba(244, 239, 230, 0.12));
}

.glitch-logo::before,
.glitch-logo::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: url("codex-logo-transparent.png") center / contain no-repeat;
  opacity: 0;
  pointer-events: none;
}

.glitch-logo::before {
  filter: sepia(1) hue-rotate(145deg) saturate(2.2);
  animation: logo-glitch-before 4.8s steps(1, end) infinite;
}

.glitch-logo::after {
  filter: sepia(1) hue-rotate(290deg) saturate(2.4);
  animation: logo-glitch-after 5.6s steps(1, end) infinite;
}

.hero-logo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  animation: logo-pulse 7s ease-in-out infinite;
}

.genre-line {
  margin-top: 18px;
  color: var(--accent);
  font-size: clamp(16px, 2vw, 26px);
  font-weight: 800;
  text-transform: uppercase;
}

@keyframes logo-pulse {
  0%,
  100% {
    filter: brightness(1);
  }

  49% {
    filter: brightness(1);
  }

  50% {
    filter: brightness(1.32) contrast(1.08);
  }

  51% {
    filter: brightness(0.96);
  }
}

@keyframes logo-glitch-before {
  0%,
  42%,
  44%,
  68%,
  70%,
  100% {
    opacity: 0;
    transform: translate3d(0, 0, 0);
    clip-path: inset(0 0 0 0);
  }

  43% {
    opacity: 0.58;
    transform: translate3d(-8px, -2px, 0);
    clip-path: inset(17% 0 62% 0);
  }

  69% {
    opacity: 0.46;
    transform: translate3d(7px, 3px, 0);
    clip-path: inset(61% 0 22% 0);
  }
}

@keyframes logo-glitch-after {
  0%,
  28%,
  30%,
  76%,
  78%,
  100% {
    opacity: 0;
    transform: translate3d(0, 0, 0);
    clip-path: inset(0 0 0 0);
  }

  29% {
    opacity: 0.52;
    transform: translate3d(6px, 2px, 0);
    clip-path: inset(42% 0 39% 0);
  }

  77% {
    opacity: 0.5;
    transform: translate3d(-6px, -3px, 0);
    clip-path: inset(9% 0 76% 0);
  }
}

.next-card,
.feature-panel,
.contact-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(14px);
}

.next-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 22px;
}

.next-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: cover;
  overflow: hidden;
  border: 1px solid rgba(244, 239, 230, 0.16);
  border-radius: 8px;
  filter: grayscale(0.25) saturate(0.72) brightness(0.82);
  opacity: 0.9;
}

.next-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.next-card h2 {
  overflow-wrap: anywhere;
  font-size: clamp(26px, 3vw, 34px);
  line-height: 1.05;
}

.next-card p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

.card-link,
.feature-panel a,
.contact-panel a {
  width: fit-content;
  margin-top: 6px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.section-block {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(220px, 0.42fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(24px, 5vw, 72px);
  padding: clamp(56px, 8vw, 108px) clamp(18px, 5vw, 78px);
  border-top: 1px solid rgba(244, 239, 230, 0.12);
  background:
    radial-gradient(circle at 12% 22%, rgba(255, 255, 255, 0.06), transparent 26rem),
    #050505;
}

.section-heading h2 {
  font-size: clamp(48px, 9vw, 132px);
  line-height: 0.86;
  text-transform: uppercase;
}

.events-block {
  grid-template-columns: minmax(220px, 0.38fr) minmax(360px, 860px);
  justify-content: space-between;
}

.event-list {
  width: min(100%, 860px);
  display: grid;
  gap: 12px;
  min-width: 0;
  justify-self: end;
}

.event-row {
  width: 100%;
  min-height: clamp(108px, 8vw, 138px);
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) minmax(190px, 260px);
  align-items: center;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.event-row:hover {
  border-color: rgba(244, 239, 230, 0.38);
}

.event-row.is-past {
  opacity: 0.68;
}

.event-date {
  width: 58px;
  height: 58px;
  border: 1px solid rgba(244, 239, 230, 0.24);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  text-transform: uppercase;
}

.event-copy b,
.event-copy small {
  display: block;
  min-width: 0;
}

.event-copy b {
  font-size: clamp(22px, 2.4vw, 34px);
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.event-copy small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.event-media {
  height: clamp(96px, 7vw, 126px);
  overflow: hidden;
  border: 1px solid rgba(244, 239, 230, 0.16);
  border-radius: 8px;
  background: #0a0a0a;
}

.event-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: grayscale(0.25) saturate(0.72) brightness(0.82);
  opacity: 0.86;
  transition: transform 180ms ease, opacity 180ms ease;
}

.event-row:hover .event-media img {
  opacity: 1;
  transform: scale(1.04);
}

.empty-state,
.admin-note,
.archive-count {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.admin-note {
  max-width: 300px;
  margin-top: 14px;
}

.admin-note code {
  color: var(--accent);
}

.archive-count {
  margin: 0 0 14px;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-archive {
  background:
    radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.05), transparent 26rem),
    #030303;
}

.feature-panel,
.contact-panel {
  max-width: 760px;
  display: grid;
  gap: 22px;
  padding: clamp(24px, 4vw, 42px);
}

.feature-panel p,
.contact-panel p {
  color: var(--ink);
  font-size: clamp(24px, 4vw, 48px);
  line-height: 1.05;
  font-weight: 780;
}

@media (max-width: 1100px) {
  .events-block {
    grid-template-columns: minmax(190px, 0.34fr) minmax(0, 1fr);
  }

  .event-list {
    width: 100%;
  }

  .event-row {
    grid-template-columns: 64px minmax(0, 1fr) minmax(160px, 220px);
    min-height: 104px;
  }

  .event-media {
    height: 96px;
  }
}

@media (max-width: 820px) {
  .site-header {
    height: 64px;
  }

  .main-nav {
    gap: 14px;
    font-size: 11px;
  }

  .hero,
  .section-block {
    grid-template-columns: 1fr;
  }

  .events-block {
    align-items: start;
  }

  .events-block .section-heading,
  .event-list {
    width: 100%;
    justify-self: stretch;
  }

  .hero {
    min-height: 100svh;
    padding-top: 96px;
  }

  .hero-image {
    background-size: cover;
    background-position: center top;
  }

  .hero-shade {
    background:
      linear-gradient(180deg, rgba(0, 0, 0, 0.12), rgba(0, 0, 0, 0.5) 42%, #050505 88%),
      linear-gradient(90deg, rgba(0, 0, 0, 0.42), transparent, rgba(0, 0, 0, 0.42));
  }

  .hero-content {
    min-height: 48svh;
    display: grid;
    align-content: end;
  }

  .section-block {
    padding-block: 58px;
  }

  .next-card {
    width: min(100%, 520px);
  }

  .event-row {
    grid-template-columns: 64px minmax(0, 1fr) minmax(150px, 220px);
    min-height: 100px;
  }
}

@media (max-width: 640px) {
  .hero {
    gap: 22px;
    padding-bottom: 28px;
  }

  .next-card {
    padding: 18px;
  }

  .next-card h2 {
    font-size: clamp(24px, 8vw, 34px);
  }

  .event-row {
    grid-template-columns: 56px minmax(0, 1fr);
    min-height: 78px;
    gap: 12px;
    padding: 14px;
  }

  .event-date {
    width: 46px;
    height: 46px;
    font-size: 11px;
  }

  .event-media {
    grid-column: 1 / -1;
    height: auto;
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 520px) {
  .site-header {
    position: absolute;
  }

  .nav-logo {
    font-size: 18px;
  }

  .main-nav a:nth-child(2) {
    display: none;
  }

  h1 {
    font-size: clamp(64px, 22vw, 96px);
  }

  .glitch-logo {
    width: min(100%, 420px);
  }

  .genre-line {
    font-size: 14px;
  }

  .event-copy b {
    font-size: clamp(22px, 7vw, 30px);
  }
}
