/* The Tomb of The Director — dark archive interface. */

:root {
  --void: #06060a;
  --stone: #0c0c11;
  --stone-2: #12121a;
  --line: rgba(201, 173, 116, 0.16);
  --line-strong: rgba(201, 173, 116, 0.36);
  --gold: #c9ad74;
  --gold-bright: #e9d4a2;
  --bone: #e7e1d4;
  --ash: #8c8578;
  --ash-dim: #625d55;
  --blood: #c25a49;
  --sage: #7fae93;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--void);
  background-image:
    radial-gradient(120% 65% at 50% -15%, rgba(201, 173, 116, 0.1), transparent 62%),
    radial-gradient(90% 55% at 50% 115%, rgba(94, 38, 28, 0.15), transparent 70%),
    linear-gradient(180deg, #08080c 0%, #06060a 55%, #050508 100%);
  background-attachment: fixed;
  color: var(--bone);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Vignette film over everything. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: radial-gradient(78% 68% at 50% 45%, transparent 52%, rgba(0, 0, 0, 0.58) 100%);
}

[hidden] {
  display: none !important;
}

h1,
h2 {
  margin: 0;
  font-weight: 400;
}

::selection {
  background: rgba(201, 173, 116, 0.3);
  color: #fff;
}

:focus-visible {
  outline: 1px solid var(--gold-bright);
  outline-offset: 3px;
}

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

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 10;
  padding: 8px 14px;
  background: var(--stone-2);
  border: 1px solid var(--line-strong);
  color: var(--gold-bright);
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: none;
}

.skip:focus {
  top: 16px;
}

/* ---------------------------------------------------------------- gate */

.gate {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 56px 24px 72px;
  animation: gate-in 900ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.gate.is-opening {
  animation: gate-out 560ms cubic-bezier(0.4, 0, 0.7, 0.2) both;
}

.gate-inner {
  width: 100%;
  max-width: 430px;
  text-align: center;
}

.sigil {
  display: block;
  width: 92px;
  height: 108px;
  margin: 0 auto 30px;
  animation: sigil-in 1400ms ease both;
}

.sigil-outline {
  fill: none;
  stroke: var(--gold);
  stroke-opacity: 0.3;
  stroke-width: 1.1;
}

.sigil-door {
  fill: rgba(201, 173, 116, 0.05);
  stroke: var(--gold);
  stroke-opacity: 0.55;
  stroke-width: 1.2;
}

.sigil-line {
  fill: none;
  stroke: var(--gold);
  stroke-opacity: 0.22;
  stroke-width: 1;
}

.sigil-ring {
  fill: none;
  stroke: var(--gold-bright);
  stroke-opacity: 0.7;
  stroke-width: 1.2;
}

.gate h1 {
  font-size: clamp(27px, 7vw, 38px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bone);
  text-shadow: 0 0 28px rgba(201, 173, 116, 0.18);
}

.gate h1 em,
.brand-text em {
  display: block;
  margin-top: 12px;
  font-size: 0.4em;
  font-style: normal;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.82;
}

.whisper {
  margin: 26px 0 34px;
  font-size: 14px;
  font-style: italic;
  color: var(--ash);
}

.gate-form {
  display: grid;
  gap: 18px;
}

input[type="password"],
input[type="text"],
input[type="search"] {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.018);
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--bone);
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.08em;
  transition: border-color 220ms ease, background 220ms ease, box-shadow 220ms ease;
}

input::placeholder {
  color: var(--ash-dim);
  letter-spacing: 0.06em;
}

input[type="password"]:focus,
input[type="text"]:focus,
input[type="search"]:focus {
  outline: none;
  border-color: var(--line-strong);
  background: rgba(201, 173, 116, 0.045);
  box-shadow: 0 0 0 1px rgba(201, 173, 116, 0.12), 0 0 26px rgba(201, 173, 116, 0.08);
}

input:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ------------------------------------------------------------- buttons */

.seal-btn,
.ghost-btn {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2px;
  transition: background 200ms ease, border-color 200ms ease, color 200ms ease, opacity 200ms ease;
}

.seal-btn {
  padding: 15px 22px;
  width: 100%;
  background: rgba(201, 173, 116, 0.06);
  border: 1px solid var(--line-strong);
  color: var(--gold-bright);
}

.seal-btn:hover:not(:disabled) {
  background: rgba(201, 173, 116, 0.14);
  border-color: var(--gold);
  color: #fff8e8;
}

.seal-btn:active:not(:disabled) {
  background: rgba(201, 173, 116, 0.2);
}

.seal-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ghost-btn {
  padding: 9px 15px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ash);
}

.ghost-btn:hover:not(:disabled) {
  border-color: var(--line-strong);
  color: var(--gold-bright);
}

.ghost-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* -------------------------------------------------------------- status */

.status {
  min-height: 20px;
  margin: 18px 0 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  letter-spacing: 0.04em;
  color: var(--ash);
}

.status--error {
  color: var(--blood);
}

.status--ok {
  color: var(--sage);
}

.status--info {
  color: var(--gold);
}

/* Collapse the reserved line when there is no message. */
.status:empty {
  min-height: 0;
  margin: 0;
}

/* ------------------------------------------------------------- archive */

.archive {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  animation: archive-in 620ms ease both;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 20px clamp(18px, 4vw, 46px);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(201, 173, 116, 0.045), transparent);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 10px;
  height: 22px;
  border: 1px solid var(--gold);
  border-radius: 5px 5px 0 0;
  border-bottom-color: transparent;
  opacity: 0.8;
}

.brand-text {
  font-size: 15px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--bone);
}

.brand-text em {
  display: inline;
  margin: 0 0 0 10px;
  font-size: 10px;
  letter-spacing: 0.28em;
  color: var(--gold);
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr);
  gap: 26px;
  align-items: start;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 34px clamp(18px, 4vw, 46px) 48px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.022), rgba(255, 255, 255, 0.005));
  padding: 22px 22px 24px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  font-size: 13px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
}

.count {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ash-dim);
}

.vault-tools {
  margin-top: 16px;
}

.vault-tools input {
  padding: 10px 13px;
  font-size: 13px;
}

/* ----------------------------------------------------------- file list */

.file-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.file {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 13px 4px;
  border-bottom: 1px solid rgba(201, 173, 116, 0.08);
  transition: background 200ms ease;
}

.file:hover {
  background: rgba(201, 173, 116, 0.035);
}

.file-main {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  flex: 1 1 260px;
}

.file-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--gold);
  background: rgba(201, 173, 116, 0.05);
}

.file-text {
  min-width: 0;
}

.file-name {
  display: block;
  font-size: 15px;
  color: var(--bone);
  overflow-wrap: anywhere;
}

.file-path {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--ash-dim);
  overflow-wrap: anywhere;
}

.file-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.file-size {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ash);
  white-space: nowrap;
}

.download-btn {
  padding: 8px 13px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 200ms ease, color 200ms ease, background 200ms ease;
}

.download-btn:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold-bright);
  background: rgba(201, 173, 116, 0.1);
}

.download-btn:disabled {
  opacity: 0.5;
  cursor: progress;
}

.empty {
  margin: 22px 0 4px;
  font-size: 14px;
  font-style: italic;
  color: var(--ash);
  text-align: center;
}

.vault.is-loading .file-list {
  opacity: 0.4;
}

/* -------------------------------------------------------------- upload */

.upload-form {
  display: grid;
  gap: 18px;
  margin-top: 20px;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 30px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 2px;
  background: rgba(201, 173, 116, 0.025);
  text-align: center;
  cursor: pointer;
  transition: border-color 200ms ease, background 200ms ease;
}

.dropzone:hover,
.dropzone.is-dragging {
  border-color: var(--gold);
  background: rgba(201, 173, 116, 0.07);
}

.dropzone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dropzone-title {
  font-size: 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  overflow-wrap: anywhere;
}

.dropzone-hint {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--ash-dim);
  overflow-wrap: anywhere;
}

.field {
  display: grid;
  gap: 8px;
}

.field-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ash);
}

.check {
  display: flex;
  gap: 10px;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  line-height: 1.5;
  color: var(--ash);
  cursor: pointer;
}

.check input {
  width: 14px;
  height: 14px;
  accent-color: var(--gold);
  cursor: pointer;
}

.progress {
  height: 2px;
  background: rgba(201, 173, 116, 0.14);
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: var(--gold);
  transition: width 160ms linear;
}

.footer {
  padding: 18px clamp(18px, 4vw, 46px) 26px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ash-dim);
  text-align: center;
  overflow-wrap: anywhere;
}

.noscript {
  margin: 40px;
  text-align: center;
  color: var(--blood);
}

/* ---------------------------------------------------------- animations */

@keyframes gate-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes gate-out {
  from {
    opacity: 1;
    transform: none;
  }
  to {
    opacity: 0;
    transform: translateY(-14px);
    filter: blur(3px);
  }
}

@keyframes sigil-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes archive-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}

/* -------------------------------------------------------- breakpoints */

@media (max-width: 900px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .brand-text em {
    display: none;
  }

  .panel {
    padding: 18px 16px 20px;
  }

  .file-actions {
    width: 100%;
    justify-content: space-between;
  }

  .file {
    padding: 14px 2px;
  }
}
