@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Cormorant+Garamond:ital,wght@0,300;1,300;1,600&display=swap');

:root {
  --void: #070608;
  --ash: #0e0c10;
  --mist: #1a1520;
  --pale: #c8bfd8;
  --dim: #6b5f78;
  --flicker: #e8dff5;
  --accent-1: #b8f0d8;
  --accent-2: #f0b8d4;
  --accent-3: #b8d8f0;
  --warn: #f0d8b8;
  --mono: 'Share Tech Mono', monospace;
  --serif: 'Cormorant Garamond', Georgia, serif;
}

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

html { background: var(--void); }

body {
  background: var(--void);
  color: var(--pale);
  font-family: var(--mono);
  font-size: 13px;
  min-height: 100vh;
  overflow-x: hidden;
  cursor: crosshair;
}

/* scanlines overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.18) 2px,
    rgba(0,0,0,0.18) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* noise grain */
body::after {
  content: '';
  position: fixed;
  inset: -50%;
  width: 200%;
  height: 200%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.028;
  pointer-events: none;
  z-index: 9998;
  animation: grain 0.4s steps(1) infinite;
}

@keyframes grain {
  0%   { transform: translate(0,0); }
  25%  { transform: translate(-2%, -3%); }
  50%  { transform: translate(1%, 2%); }
  75%  { transform: translate(3%, -1%); }
  100% { transform: translate(-1%, 3%); }
}

/* ─── LAYOUT ─────────────────────────────────────────── */

.page {
  position: relative;
  width: 100%;
  padding: 0 0 120px;
}

/* ─── HEADER ─────────────────────────────────────────── */

.site-header {
  position: relative;
  padding: 3rem 2rem 1rem;
  height: 160px;
  border-bottom: 1px solid rgba(200,191,216,0.06);
}

.title-layer-1 {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: 64px;
  line-height: 1;
  letter-spacing: -3px;
  color: var(--flicker);
  position: absolute;
  top: 28px;
  left: 38px;
  opacity: 0.9;
  animation: flicker-slow 8s ease-in-out infinite;
}

.title-layer-2 {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 6px;
  color: var(--accent-1);
  position: absolute;
  top: 112px;
  left: 42px;
  opacity: 0.55;
}

.title-layer-3 {
  font-family: var(--mono);
  font-size: 48px;
  color: var(--accent-2);
  position: absolute;
  top: 18px;
  left: 36px;
  opacity: 0.04;
  letter-spacing: -2px;
  pointer-events: none;
  transform: skewX(-3deg) translateX(3px);
}

.header-coordinates {
  font-size: 10px;
  color: var(--dim);
  position: absolute;
  top: 36px;
  right: 2rem;
  text-align: right;
  line-height: 1.8;
  letter-spacing: 1px;
}

/* ─── NAV (broken) ───────────────────────────────────── */

.nav-corrupted {
  display: flex;
  gap: 0;
  padding: 0 2rem;
  margin-top: -1px;
  position: relative;
}

.nav-corrupted::after {
  content: 'ERR: navigation.render() — unexpected token at col 7';
  font-size: 9px;
  color: rgba(240,184,212,0.22);
  position: absolute;
  bottom: -18px;
  left: 2rem;
  letter-spacing: 0.5px;
}

.nav-item {
  padding: 10px 18px 10px 0;
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--dim);
  cursor: pointer;
  text-transform: uppercase;
  transition: color 0.2s;
  text-decoration: none;
}

.nav-item:hover { color: var(--pale); }

.nav-item.broken {
  color: rgba(184,240,216,0.18);
  text-decoration: line-through;
  pointer-events: none;
  margin-left: 40px;
}

.nav-item.displaced {
  position: relative;
  top: 6px;
  color: rgba(240,216,184,0.3);
  font-size: 9px;
}

/* ─── GRID SYSTEM (intentionally fractured) ─────────── */

.grid-container {
  margin-top: 60px;
  padding: 0 2rem;
  position: relative;
}

/* The grid has deliberate holes */
.grid-main {
  display: grid;
  grid-template-columns: 340px 1fr 220px;
  grid-template-rows: auto auto auto;
  gap: 0;
  position: relative;
}

/* ─── CELLS ──────────────────────────────────────────── */

.cell {
  position: relative;
  border: 1px solid rgba(200,191,216,0.07);
  padding: 2rem;
  overflow: hidden;
}

.cell::before {
  content: attr(data-addr);
  position: absolute;
  top: 6px;
  left: 10px;
  font-size: 9px;
  color: rgba(107,95,120,0.4);
  letter-spacing: 1px;
}

.cell-a {
  grid-column: 1;
  grid-row: 1 / 3;
  border-right: 1px solid rgba(184,240,216,0.08);
  padding-top: 3rem;
}

.cell-b {
  grid-column: 2;
  grid-row: 1;
  border-bottom: 1px solid rgba(200,191,216,0.05);
  min-height: 280px;
  position: relative;
}

.cell-c {
  grid-column: 3;
  grid-row: 1 / 4;
  border-left: 1px solid rgba(240,184,212,0.08);
  padding-top: 2.5rem;
}

.cell-d {
  grid-column: 2;
  grid-row: 2;
  min-height: 200px;
  position: relative;
}

.cell-e {
  grid-column: 1 / 3;
  grid-row: 3;
  border-top: 1px solid rgba(200,191,216,0.06);
  min-height: 260px;
  overflow: visible;
}

/* ─── IMAGE FRAGMENTS ────────────────────────────────── */

.img-fragment {
  display: block;
  position: relative;
  overflow: hidden;
}

.img-fragment img {
  display: block;
  width: 100%;
  filter: saturate(0.7) contrast(1.1) brightness(0.85);
  transition: filter 0.4s;
  image-rendering: pixelated;
}

.img-fragment:hover img {
  filter: saturate(1.2) contrast(1.2) brightness(1.0);
  animation: glitch-img 0.3s steps(2) infinite;
}

.img-fragment::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(7,6,8,0.8) 100%);
  pointer-events: none;
}

/* Clip some images to feel torn */
.clip-torn {
  clip-path: polygon(0 0, 100% 2%, 98% 100%, 2% 98%);
}

.clip-diagonal {
  clip-path: polygon(0 0, 100% 0, 100% 88%, 80% 100%, 0 100%);
}

.clip-jagged {
  clip-path: polygon(0 4%, 8% 0, 100% 0, 100% 95%, 92% 100%, 0 100%);
}

/* ─── TYPOGRAPHY ─────────────────────────────────────── */

.koan {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: 22px;
  line-height: 1.5;
  color: var(--flicker);
  margin-bottom: 1.5rem;
}

.koan em {
  font-weight: 600;
  color: var(--accent-2);
  font-style: normal;
}

.koan-small {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: 16px;
  line-height: 1.6;
  color: rgba(200,191,216,0.6);
  margin-bottom: 1rem;
}

.code-fragment {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent-1);
  line-height: 1.9;
  opacity: 0.7;
  white-space: pre;
  display: block;
}

.code-fragment .comment {
  color: rgba(107,95,120,0.8);
}

.code-fragment .error {
  color: var(--accent-2);
  text-decoration: underline wavy rgba(240,184,212,0.4);
}

.small-label {
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 1rem;
  display: block;
}

.redacted {
  background: var(--pale);
  color: var(--pale);
  cursor: pointer;
  user-select: none;
  padding: 0 2px;
  transition: background 0.3s, color 0.3s;
}
.redacted:hover, .redacted.revealed {
  background: transparent;
  color: var(--accent-2);
}

/* ─── CELL A CONTENT ─────────────────────────────────── */

.cell-a .img-fragment {
  margin: 0 0 1.5rem;
}

.cell-a .stack {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.cell-a .img-small {
  width: 100%;
  position: relative;
}

.cell-a .img-small img {
  width: 100%;
  display: block;
  filter: saturate(0.5) contrast(1.15) brightness(0.7) hue-rotate(15deg);
  transition: all 0.4s;
}

.cell-a .img-small:hover img {
  filter: saturate(1.1) contrast(1.2) brightness(0.9) hue-rotate(0deg);
}

.sequence-label {
  font-size: 9px;
  color: rgba(107,95,120,0.5);
  letter-spacing: 2px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(200,191,216,0.04);
  margin-bottom: 2px;
  display: flex;
  justify-content: space-between;
}

/* ─── CELL B: broken image with text overlay ─────────── */

.cell-b .hero-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.cell-b .hero-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.5) contrast(1.2) brightness(0.5) hue-rotate(200deg);
  display: block;
}

.cell-b .overlay-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 2rem;
  background: linear-gradient(0deg, rgba(7,6,8,0.85) 0%, transparent 60%);
}

/* ─── CELL C ─────────────────────────────────────────── */

.cell-c .img-fragment {
  margin-bottom: 1.5rem;
}

.cell-c .mini-imgs {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cell-c .mini-img-row {
  display: flex;
  gap: 2px;
}

.cell-c .mini-img-row img {
  flex: 1;
  min-width: 0;
  display: block;
  filter: saturate(0.4) brightness(0.65);
  transition: filter 0.3s;
}

.cell-c .mini-img-row img:hover {
  filter: saturate(1.0) brightness(0.9);
}

/* ─── CELL D ─────────────────────────────────────────── */

.cell-d {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 0;
}

.cell-d-inner {
  padding: 1.5rem;
  border-right: 1px solid rgba(200,191,216,0.05);
}

.cell-d-inner:last-child {
  border-right: none;
}

/* ─── CELL E ─────────────────────────────────────────── */

.cell-e {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  padding: 0;
}

.cell-e-panel {
  padding: 2rem;
  border-right: 1px solid rgba(200,191,216,0.05);
  position: relative;
}

.cell-e-panel:last-child { border-right: none; }

/* ─── FLOATING / DISPLACED ELEMENTS ─────────────────── */

.displaced-block {
  position: absolute;
  z-index: 10;
  pointer-events: none;
}

/* drifts out of the grid on purpose */
.displaced-1 {
  bottom: -30px;
  right: -20px;
  width: 180px;
  opacity: 0.25;
  transform: rotate(-2deg);
  pointer-events: all;
}

.displaced-1 img {
  width: 100%;
  filter: saturate(0.3) brightness(0.6);
  display: block;
}

/* ─── TERMINAL / CODE BLOCK ──────────────────────────── */

.terminal {
  background: rgba(14,12,16,0.95);
  border: 1px solid rgba(184,240,216,0.1);
  padding: 1.2rem 1.5rem;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 2;
  color: var(--accent-1);
  position: relative;
  margin-bottom: 1.5rem;
}

.terminal::before {
  content: 'SESSION:' attr(data-session);
  position: absolute;
  top: -1px;
  left: 12px;
  font-size: 9px;
  background: var(--void);
  padding: 0 6px;
  color: rgba(184,240,216,0.3);
  letter-spacing: 2px;
}

.terminal .prompt { color: rgba(107,95,120,0.8); }
.terminal .out    { color: var(--pale); }
.terminal .err    { color: var(--accent-2); }
.terminal .null   { color: rgba(107,95,120,0.4); }

.blink {
  animation: blink-cursor 1.2s step-end infinite;
}
@keyframes blink-cursor {
  50% { opacity: 0; }
}

/* ─── INTERACTIVE: KOAN REVEAL ───────────────────────── */

.koan-oracle {
  border: 1px solid rgba(200,191,216,0.08);
  padding: 1.5rem;
  margin-top: 1.5rem;
  position: relative;
  cursor: pointer;
  transition: border-color 0.3s;
}

.koan-oracle:hover {
  border-color: rgba(200,191,216,0.2);
}

.koan-oracle::before {
  content: 'QUERY';
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--dim);
  position: absolute;
  top: -1px;
  left: 12px;
  background: var(--void);
  padding: 0 6px;
}

.koan-oracle .response {
  display: none;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(200,191,216,0.06);
}

.koan-oracle.open .response {
  display: block;
  animation: fade-in 0.6s ease;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── GLITCH STRIP ───────────────────────────────────── */

.glitch-strip {
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(184,240,216,0.4) 20%,
    rgba(240,184,212,0.4) 50%,
    transparent 80%
  );
  margin: 2rem 0;
  animation: strip-drift 6s ease-in-out infinite;
}

@keyframes strip-drift {
  0%, 100% { opacity: 0.4; transform: scaleX(1); }
  50% { opacity: 1; transform: scaleX(0.7) translateX(10%); }
}

/* ─── GLYPH COLUMN ───────────────────────────────────── */

.glyph-col {
  writing-mode: vertical-rl;
  font-size: 10px;
  letter-spacing: 6px;
  color: rgba(107,95,120,0.3);
  position: fixed;
  top: 30vh;
  right: 14px;
  z-index: 100;
  user-select: none;
  pointer-events: none;
}

/* ─── BOTTOM OVERFLOW ────────────────────────────────── */

.overflow-section {
  margin-top: 6rem;
  padding: 0 2rem;
  position: relative;
}

.overflow-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  margin-bottom: 4rem;
}

.overflow-cell {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1.6;
}

.overflow-cell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(0.3) brightness(0.6) contrast(1.1);
  transition: filter 0.5s;
}

.overflow-cell:hover img {
  filter: saturate(1.0) brightness(0.85) contrast(1.2);
  animation: glitch-img 0.25s steps(3) infinite;
}

.overflow-cell .cell-index {
  position: absolute;
  bottom: 6px;
  left: 8px;
  font-size: 9px;
  color: rgba(107,95,120,0.5);
  letter-spacing: 1px;
}

/* ─── FOOTER (wrong position) ────────────────────────── */

.site-footer {
  padding: 2rem 2rem 0;
  border-top: 1px solid rgba(200,191,216,0.05);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  position: relative;
}

.site-footer::after {
  content: '▓▒░';
  position: absolute;
  font-size: 40px;
  opacity: 0.03;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  letter-spacing: 20px;
  pointer-events: none;
}

.footer-left {
  font-size: 10px;
  color: var(--dim);
  line-height: 2;
  letter-spacing: 1px;
}

.footer-right {
  font-family: var(--serif);
  font-style: italic;
  font-size: 28px;
  color: rgba(200,191,216,0.08);
  text-align: right;
  line-height: 1.1;
  position: relative;
  top: 20px;
}

/* ─── ANIMATIONS ─────────────────────────────────────── */

@keyframes flicker-slow {
  0%, 100% { opacity: 0.9; }
  92% { opacity: 0.9; }
  93% { opacity: 0.4; }
  94% { opacity: 0.9; }
  97% { opacity: 0.9; }
  98% { opacity: 0.6; }
  99% { opacity: 0.9; }
}

@keyframes glitch-img {
  0%   { clip-path: inset(10% 0 80% 0); transform: translate(-2px, 0); }
  25%  { clip-path: inset(40% 0 40% 0); transform: translate(2px, 1px); }
  50%  { clip-path: inset(70% 0 5%  0); transform: translate(0, -1px); }
  75%  { clip-path: inset(20% 0 60% 0); transform: translate(1px, 0); }
  100% { clip-path: inset(0);           transform: translate(0,0); }
}

@keyframes drift-x {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(6px); }
}

.drift { animation: drift-x 12s ease-in-out infinite; }

/* ─── RESPONSIVE (approximate only — broken is intentional) */

@media (max-width: 900px) {
  .grid-main {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
  }
  .cell-a { grid-column: 1; grid-row: 1; }
  .cell-b { grid-column: 2; grid-row: 1; min-height: 240px; }
  .cell-c { grid-column: 1 / 3; grid-row: 2; }
  .cell-d { grid-column: 1 / 3; grid-row: 3; }
  .cell-e { grid-column: 1 / 3; grid-row: 4; }
  .overflow-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── INTERACTIVE STATES ─────────────────────────────── */

.toggle-hint {
  font-size: 9px;
  color: rgba(107,95,120,0.5);
  letter-spacing: 2px;
  margin-top: 0.5rem;
  display: block;
}

.hoverable-img { cursor: zoom-in; }

.corrupted-text {
  position: relative;
  display: inline-block;
}
.corrupted-text::after {
  content: attr(data-alt);
  position: absolute;
  top: 0; left: 2px;
  color: var(--accent-2);
  opacity: 0;
  clip-path: inset(0 100% 0 0);
  transition: none;
}
.corrupted-text:hover::after {
  opacity: 0.5;
  animation: corrupt-reveal 0.3s steps(4) forwards;
}
@keyframes corrupt-reveal {
  to { clip-path: inset(0 0% 0 0); }
}
