@import url("../assets/fonts/fonts.css");

/* =========================================================
   esotericBasement.org
   ========================================================= */

:root {
  --bg: #060505;
  --panel: #0a0908;
  --bone: #e7decb;
  --bone-dim: #b6ad9c;
  --muted: #837b6d;
  --faint: #5c574e;
  --line: rgba(231, 222, 203, 0.13);
  --line-soft: rgba(231, 222, 203, 0.06);
  --mono: "Courier Prime", "Courier New", Courier, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--bone);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; }

::selection { background: var(--bone); color: var(--bg); }

/* =========================================================
   the gate
   ========================================================= */

body.gate {
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}

/* animated masonry wall */
.wall {
  position: fixed;
  inset: 0;
  display: flex;
  gap: 14px;
  padding: 0 7px;
  z-index: 0;
  filter: grayscale(1) sepia(0.22) brightness(0.62) contrast(1.02);
  opacity: 0.78;
  pointer-events: none;
}

.col {
  flex: 1 1 0;
  height: 100%;
  overflow: hidden;
  min-width: 0;
}

.track {
  display: flex;
  flex-direction: column;
  will-change: transform;
  animation: rise var(--dur, 80s) linear infinite;
  animation-delay: var(--delay, 0s);
}

.col.rev .track { animation-name: sink; }

.track img {
  width: 100%;
  height: auto;
  margin-bottom: 14px;
  user-select: none;
  -webkit-user-drag: none;
}

@keyframes rise {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(0, -50%, 0); }
}

@keyframes sink {
  from { transform: translate3d(0, -50%, 0); }
  to { transform: translate3d(0, 0, 0); }
}

.veil {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(62% 55% at 50% 48%, rgba(6, 5, 5, 0.42) 0%, rgba(6, 5, 5, 0.72) 58%, rgba(6, 5, 5, 0.95) 100%),
    linear-gradient(180deg, rgba(6, 5, 5, 0.6) 0%, rgba(6, 5, 5, 0.12) 44%, rgba(6, 5, 5, 0.8) 100%);
}

/* film grain */
body.gate::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* old plate frame */
body.gate::before {
  content: "";
  position: fixed;
  inset: 16px;
  z-index: 3;
  pointer-events: none;
  border: 1px solid var(--line-soft);
}

.gate-center {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10vw;
  background: radial-gradient(48% 31% at 50% 50%, rgba(6, 5, 5, 0.84) 0%, rgba(6, 5, 5, 0.6) 46%, rgba(6, 5, 5, 0) 74%);
  pointer-events: none;
}

.gate-center .invite { pointer-events: auto; }

.wordmark {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(1.5rem, 3.6vw, 3.8rem);
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.1;
  color: var(--bone);
  text-shadow: 0 0 46px rgba(0, 0, 0, 0.95), 0 0 8px rgba(0, 0, 0, 0.7);
  animation: breathe 9s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.88; }
}

.invite {
  position: relative;
  margin-top: clamp(2rem, 4.5vw, 3.2rem);
  font-size: clamp(0.78rem, 1.05vw, 0.95rem);
  letter-spacing: 0.14em;
  color: #d3c9b4;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid rgba(231, 222, 203, 0.22);
  transition: color 0.35s, border-color 0.35s, letter-spacing 0.35s;
}

.invite:hover,
.invite:focus-visible {
  color: var(--bone);
  border-color: rgba(231, 222, 203, 0.7);
  letter-spacing: 0.17em;
  outline: none;
}

.cursor {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 0.55em;
  vertical-align: -0.14em;
  background: currentColor;
  animation: blink 1.15s steps(1) infinite;
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.colophon {
  position: fixed;
  left: 50%;
  bottom: 2rem;
  transform: translateX(-50%);
  z-index: 2;
  margin: 0;
  width: max-content;
  max-width: min(92vw, 1000px);
  text-align: center;
  text-transform: uppercase;
  font-size: 0.55rem;
  letter-spacing: 0.17em;
  line-height: 2.1;
  color: rgba(231, 222, 203, 0.3);
  pointer-events: none;
}
.colophon-line { margin: 0; font: inherit; font-weight: 400; color: inherit; letter-spacing: inherit; text-transform: inherit; }
.colophon .sep { color: rgba(231, 222, 203, 0.16); padding: 0 0.6em; }

/* =========================================================
   the vault
   ========================================================= */

body.vault {
  min-height: 100svh;
  background: var(--bg);
  color: var(--bone-dim);
}

.vault-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.05rem 2.2rem;
  background: rgba(6, 5, 5, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.vault-wordmark {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--bone);
  white-space: nowrap;
}

.vault-search input {
  width: min(38vw, 320px);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--bone);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  padding: 0.35rem 0.1rem;
  outline: none;
  transition: border-color 0.3s;
}
.vault-search input:focus { border-color: rgba(231, 222, 203, 0.5); }
.vault-search input::placeholder { color: var(--faint); }

.vault-body {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: calc(100svh - 57px);
}

.tree {
  border-right: 1px solid var(--line);
  padding: 1.5rem 0 3rem;
  overflow: auto;
  max-height: calc(100svh - 57px);
  position: sticky;
  top: 57px;
}

.tree button {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  padding: 0.42rem 1.4rem;
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  transition: color 0.25s, background 0.25s;
}
.tree button:hover { color: var(--bone); background: rgba(231, 222, 203, 0.03); }
.tree button.active { color: var(--bone); }
.tree button .mark { color: var(--faint); flex: 0 0 auto; font-size: 0.7rem; }
.tree button .fold { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree button.root { margin-bottom: 0.6rem; color: var(--bone); }
.tree .sub button { padding-left: 2.2rem; font-size: 0.72rem; }

.files {
  padding: 1.6rem 2.4rem 7rem;
  min-width: 0;
}

.crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: baseline;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--faint);
  margin-bottom: 1.4rem;
  min-height: 1.2em;
}
.crumb button { color: var(--muted); transition: color 0.25s; }
.crumb button:hover { color: var(--bone); }
.crumb .sep { color: var(--faint); }
.crumb .cur { color: var(--bone-dim); }

.list { border-top: 1px solid var(--line); }

.row {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  padding: 0.52rem 0.2rem;
  border-bottom: 1px solid var(--line-soft);
  font-size: 0.84rem;
  color: var(--bone-dim);
  transition: color 0.2s, padding-left 0.2s, background 0.2s;
}
.row:hover { color: var(--bone); padding-left: 0.6rem; background: rgba(231, 222, 203, 0.025); }
.row .mark { color: var(--faint); flex: 0 0 auto; font-size: 0.72rem; }
.row .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.dir .name::after { content: "/"; color: var(--faint); margin-left: 0.05rem; }
.row .path { color: var(--faint); font-size: 0.68rem; margin-left: auto; padding-left: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }

.empty {
  padding: 3.5rem 0;
  color: var(--faint);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

/* pdf viewer */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  flex-direction: column;
  background: #000;
}
.viewer.open { display: flex; }

.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.7rem 1.2rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: var(--bg);
  flex: 0 0 auto;
}
.viewer-bar .vname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-bar button {
  font-size: 0.62rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--bone-dim);
  border: 1px solid var(--line);
  padding: 0.45rem 0.85rem;
  transition: color 0.25s, border-color 0.25s;
}
.viewer-bar button:hover { color: var(--bone); border-color: rgba(231, 222, 203, 0.5); }

.viewer iframe {
  flex: 1 1 auto;
  width: 100%;
  border: 0;
  background: #141414;
}

/* =========================================================
   responsive
   ========================================================= */

@media (max-width: 900px) {
  .wall { gap: 10px; padding: 0 5px; }
  .track img { margin-bottom: 10px; }
  .vault-body { grid-template-columns: 200px minmax(0, 1fr); }
  .files { padding: 1.3rem 1.4rem 6rem; }
  .vault-top { padding: 0.9rem 1.3rem; }
  .row .path { display: none; }
}

@media (max-width: 680px) {
  body.gate::before { inset: 10px; }
  .vault-top { flex-wrap: wrap; gap: 0.6rem 1rem; }
  .vault-search { flex: 1 1 100%; }
  .vault-search input { width: 100%; }
  .vault-body { grid-template-columns: 1fr; align-content: start; }
  .tree {
    position: static;
    max-height: 24svh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 0.7rem 0;
  }
  .tree button { padding: 0.38rem 1.2rem; }
  .tree .sub button { padding-left: 2rem; }
  .files { padding: 1.1rem 1.2rem 5rem; }
  .wordmark { font-size: clamp(1.4rem, 7vw, 2rem); }
  .invite { font-size: 0.8rem; letter-spacing: 0.1em; }
  .viewer-bar { padding: 0.6rem 0.8rem; }
  .colophon { bottom: 1.3rem; font-size: 0.52rem; letter-spacing: 0.1em; line-height: 1.85; }
  .colophon .part { display: block; }
  .colophon .sep { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .track { animation: none !important; }
  .cursor { animation: none !important; }
  .wordmark { animation: none !important; }
}
