/* The Last Commit — dark, minimal, and dripping crimson. */

@font-face {
  font-family: "Nosifer";
  src: url("/vendor/nosifer.woff2") format("woff2");
  font-display: swap;
}

:root {
  --night: #0a0507;
  --crypt: #140a0d;
  --crypt-edge: #2b1116;
  --bone: #ddd6c9;
  --bone-dim: #9a8d8a;
  --crimson: #dc143c;
  --crimson-deep: #8b0f24;
  --ember: #ff5c6e;
  --blood-bright: #ff2038;
  --ash: #6e5a5e;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: ui-sans-serif, system-ui, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --display: "Nosifer", var(--serif);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }  /* display:flex/grid must not resurrect hidden panels */

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 72% -12%, #1c070c 0%, transparent 60%),
    radial-gradient(900px 620px at 8% 112%, #170409 0%, transparent 55%),
    var(--night);
  color: var(--bone);
  font-family: var(--sans);
  line-height: 1.6;
  overflow-x: hidden;
}

/* haunted vignette pressing in from the edges */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 180px rgba(0, 0, 0, 0.85), inset 0 0 60px rgba(80, 5, 15, 0.25);
  z-index: 3;
}

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

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--night); }
::-webkit-scrollbar-thumb { background: var(--crimson-deep); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--crimson); }

/* ---------- atmosphere ---------- */

.gh-link {
  position: fixed;
  top: 22px;
  right: 26px;
  z-index: 4;
  color: rgba(221, 214, 201, 0.5);
  transition: color 0.2s, filter 0.2s, transform 0.2s;
}
.gh-link:hover {
  color: var(--ember);
  filter: drop-shadow(0 0 10px rgba(220, 20, 60, 0.6));
  transform: scale(1.1);
}
.gh-link svg { width: 30px; height: 30px; display: block; }

.moon {
  position: fixed;
  top: -160px; right: -160px;
  width: 480px; height: 480px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 38%, rgba(255, 32, 56, 0.22), rgba(139, 15, 36, 0.10) 45%, transparent 70%);
  filter: blur(2px);
  pointer-events: none;
  animation: blood-pulse 9s ease-in-out infinite;
}

@keyframes blood-pulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

.fog {
  position: fixed;
  left: -20%; right: -20%; bottom: -120px;
  height: 320px;
  background:
    radial-gradient(600px 200px at 30% 80%, rgba(139, 15, 36, 0.12), transparent 70%),
    radial-gradient(700px 220px at 70% 90%, rgba(221, 214, 201, 0.04), transparent 70%);
  filter: blur(6px);
  pointer-events: none;
  animation: fog-drift 26s ease-in-out infinite alternate;
}
.fog-b { animation-duration: 34s; animation-delay: -12s; opacity: 0.7; }

@keyframes fog-drift {
  from { transform: translateX(-4%); }
  to   { transform: translateX(5%); }
}

.wisp {
  position: fixed;
  width: 240px; height: 96px;
  background: radial-gradient(ellipse at center, rgba(220, 20, 60, 0.10), transparent 70%);
  filter: blur(18px);
  pointer-events: none;
  animation: wisp-drift 31s ease-in-out infinite alternate;
}
.wisp-a { top: 22%; left: 4%; }
.wisp-b { top: 58%; right: 6%; animation-duration: 39s; animation-delay: -15s; }

@keyframes wisp-drift {
  from { transform: translate(0, 0) scale(1); opacity: 0.6; }
  50%  { opacity: 1; }
  to   { transform: translate(-60px, 40px) scale(1.15); opacity: 0.5; }
}

.web {
  position: fixed;
  width: 220px; height: 220px;
  color: rgba(221, 214, 201, 0.09);
  pointer-events: none;
}
.web-tl { top: 0; left: 0; transform: translate(-8px, -8px); }

.bat {
  position: fixed;
  width: 34px; height: 17px;
  pointer-events: none;
  animation: bat-drift 23s linear infinite;
}
.bat-1 { top: 12%; animation-duration: 21s; color: rgba(90, 8, 20, 0.55); }
.bat-2 { top: 30%; animation-duration: 29s; animation-delay: -9s; width: 26px; color: rgba(120, 12, 26, 0.4); }
.bat-3 { top: 64%; animation-duration: 35s; animation-delay: -19s; width: 40px; color: rgba(60, 6, 14, 0.45); }

@keyframes bat-drift {
  0%   { left: -6%; transform: translateY(0) rotate(-4deg); }
  25%  { transform: translateY(-26px) rotate(3deg); }
  50%  { transform: translateY(10px) rotate(-2deg); }
  75%  { transform: translateY(-18px) rotate(4deg); }
  100% { left: 106%; transform: translateY(6px) rotate(-3deg); }
}

/* ---------- layout ---------- */

.graveyard {
  max-width: 860px;
  margin: 0 auto;
  padding: 9vh 24px 80px;
  position: relative;
  z-index: 2;
}

.rite { text-align: center; margin-bottom: 8px; }

.subtitle {
  margin: 10px 0 6px;
  color: var(--bone-dim);
  font-size: 0.9rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.7rem, 4.6vw, 3.1rem);
  letter-spacing: 0.03em;
  margin: 0 0 10px;
  color: var(--crimson);
  text-shadow:
    0 0 18px rgba(220, 20, 60, 0.45),
    0 0 60px rgba(139, 15, 36, 0.35);
  animation: candle-flicker 6s linear infinite;
}

@keyframes candle-flicker {
  0%, 100% { text-shadow: 0 0 18px rgba(220, 20, 60, 0.45), 0 0 60px rgba(139, 15, 36, 0.35); opacity: 1; }
  3%  { opacity: 0.78; }
  5%  { opacity: 1; }
  30% { text-shadow: 0 0 26px rgba(255, 32, 56, 0.55), 0 0 70px rgba(139, 15, 36, 0.4); }
  42% { opacity: 0.7; }
  44.5% { opacity: 1; }
  71% { opacity: 0.85; }
  72% { opacity: 1; }
}

/* blood dripping from the header rule */
.drips {
  display: block;
  width: min(560px, 84%);
  height: 30px;
  margin: 4px auto 22px;
  color: var(--crimson-deep);
  opacity: 0.9;
}
.drips circle { animation: drop-fall 7s ease-in infinite; }
.drips circle:nth-child(2) { animation-delay: -2.2s; }
.drips circle:nth-child(4) { animation-delay: -4.1s; }
.drips circle:nth-child(6) { animation-delay: -5.6s; }
.drips circle:nth-child(8) { animation-delay: -1.3s; }
.drips circle:nth-child(10) { animation-delay: -3.4s; }

@keyframes drop-fall {
  0%, 55%  { transform: translateY(0); opacity: 0; }
  65%      { opacity: 1; }
  100%     { transform: translateY(14px); opacity: 0; }
}

.tagline {
  margin: 0 auto;
  max-width: 34rem;
  color: var(--bone-dim);
  font-size: 1.02rem;
}

/* ---------- summoning form ---------- */

.summoning {
  display: flex;
  gap: 12px;
  max-width: 620px;
  margin: 38px auto 0;  /* breathing room under the drip line */
}

#repo-url {
  flex: 1;
  min-width: 0;
  background: var(--crypt);
  border: 1px solid var(--crypt-edge);
  border-radius: 6px;
  color: var(--bone);
  font-family: var(--mono);
  font-size: 0.95rem;
  padding: 13px 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#repo-url::placeholder { color: #5c454b; }
#repo-url:focus { border-color: var(--crimson-deep); box-shadow: 0 0 0 3px rgba(220, 20, 60, 0.15); }

#exhume-btn {
  background: linear-gradient(180deg, #23090f, #170409);
  color: var(--ember);
  border: 1px solid var(--crimson-deep);
  border-radius: 6px;
  font-family: var(--serif);
  font-size: 1.05rem;
  letter-spacing: 0.1em;
  padding: 12px 26px;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.1s, color 0.2s;
}
#exhume-btn:hover:not(:disabled) {
  box-shadow: 0 0 26px rgba(220, 20, 60, 0.4);
  color: #ff8092;
}
#exhume-btn:active:not(:disabled) { transform: translateY(1px); }
#exhume-btn:disabled { opacity: 0.5; cursor: wait; }

.quota {
  text-align: center;
  color: var(--bone-dim);
  font-size: 0.85rem;
  margin-top: 14px;
}
.quota .rest { color: var(--ember); }

/* ---------- ouija / progress ---------- */

.ouija {
  max-width: 620px;
  margin: 40px auto 0;
  padding: 18px 22px;
  background: var(--crypt);
  border: 1px solid var(--crypt-edge);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.planchette {
  width: 14px; height: 14px;
  flex: none;
  border-radius: 50% 50% 50% 0;
  background: var(--crimson);
  transform: rotate(45deg);
  box-shadow: 0 0 16px rgba(220, 20, 60, 0.7);
  animation: planchette-slide 1.6s ease-in-out infinite alternate;
}

@keyframes planchette-slide {
  from { transform: translateX(-5px) rotate(45deg); }
  to   { transform: translateX(5px) rotate(45deg); }
}

.stage {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  color: var(--bone-dim);
}

.stage-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
}

.stage-note {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ash);
  font-family: var(--mono);
}

/* ---------- epitaph (errors) ---------- */

.epitaph {
  max-width: 620px;
  margin: 40px auto 0;
  padding: 16px 20px;
  background: rgba(220, 20, 60, 0.08);
  border: 1px solid rgba(220, 20, 60, 0.45);
  border-radius: 8px;
  color: #f0aeb6;
  font-size: 0.95rem;
}

/* ---------- report ---------- */

.report-card {
  max-width: 860px;
  margin: 48px auto 0;
  background: var(--crypt);
  border: 1px solid rgba(139, 15, 36, 0.45);
  border-radius: 10px;
  padding: 28px 34px 36px;
  box-shadow:
    0 18px 60px rgba(0, 0, 0, 0.6),
    0 0 40px rgba(139, 15, 36, 0.15) inset;
}

.report-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(139, 15, 36, 0.5);
  padding-bottom: 14px;
  margin-bottom: 20px;
}

.report-repo {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.3rem;
  color: var(--blood-bright);
  letter-spacing: 0.02em;
}

.download {
  flex: none;
  color: var(--ember);
  border: 1px solid rgba(220, 20, 60, 0.5);
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.9rem;
  padding: 8px 16px;
  transition: box-shadow 0.2s, color 0.2s;
}
.download:hover { box-shadow: 0 0 20px rgba(220, 20, 60, 0.4); color: #ff8092; }

/* rendered markdown */
.report { font-size: 0.98rem; overflow-wrap: break-word; }
.report table {
  display: block;
  border-collapse: collapse;
  margin: 1em 0;
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;   /* cadence tables scroll instead of bursting the card */
}
.report h1 { font-family: var(--serif); font-size: 1.6rem; color: var(--bone); margin: 1.4em 0 0.6em; }
.report h1:first-child { margin-top: 0; }
.report h2 {
  font-family: var(--serif);
  font-size: 1.25rem;
  color: var(--crimson);
  margin: 1.8em 0 0.5em;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(220, 20, 60, 0.28);
}
.report h3, .report h4 { font-family: var(--serif); color: var(--bone); margin: 1.4em 0 0.4em; }
.report h4 { color: var(--ember); font-size: 1.02rem; }
.report p { margin: 0.7em 0; color: #ccc3b9; }
.report a { color: var(--ember); text-decoration-color: rgba(220, 20, 60, 0.5); }
.report strong { color: var(--bone); }
.report em { color: var(--bone-dim); }
.report ul { padding-left: 1.4em; }
.report li { margin: 0.3em 0; color: #ccc3b9; }
.report li::marker { color: var(--crimson-deep); }
.report code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: rgba(220, 20, 60, 0.12);
  border-radius: 4px;
  padding: 1px 5px;
  color: #ff9aa5;
}
.report pre {
  background: #100609;
  border: 1px solid var(--crypt-edge);
  border-radius: 6px;
  padding: 14px 16px;
  overflow-x: auto;
}
.report pre code { background: none; padding: 0; }
.report blockquote {
  margin: 0.8em 0;
  padding: 2px 16px;
  border-left: 3px solid rgba(220, 20, 60, 0.55);
  color: var(--bone-dim);
  font-style: italic;
}
.report hr { border: none; border-top: 1px solid var(--crypt-edge); margin: 2em 0; }
.report code, .msg code {
  overflow-wrap: anywhere;  /* long shas and paths must wrap, not push */
}
.report th, .report td { border: 1px solid var(--crypt-edge); padding: 6px 14px; text-align: left; }
.report th { color: var(--ember); font-weight: 600; background: rgba(220, 20, 60, 0.06); }
.report td { color: #ccc3b9; }

/* ---------- seance (chat with the maintainer) ---------- */

.seance {
  max-width: 860px;
  margin: 48px auto 0;
  background: var(--crypt);
  border: 1px solid rgba(139, 15, 36, 0.45);
  border-radius: 10px;
  padding: 26px 32px 30px;
  box-shadow:
    0 18px 60px rgba(0, 0, 0, 0.6),
    0 0 40px rgba(139, 15, 36, 0.15) inset;
}

.seance-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.3rem;
  color: var(--blood-bright);
}

.seance-note {
  margin: 8px 0 18px;
  color: var(--bone-dim);
  font-size: 0.9rem;
}

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.msg {
  max-width: 88%;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.94rem;
  overflow-wrap: break-word;
}
.msg.you {
  align-self: flex-end;
  background: rgba(220, 20, 60, 0.10);
  border: 1px solid rgba(220, 20, 60, 0.35);
  color: var(--bone);
}
.msg.ghost {
  align-self: flex-start;
  background: #100609;
  border: 1px solid var(--crypt-edge);
  color: #ccc3b9;
}
.msg.ghost .receipts {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(220, 20, 60, 0.35);
  color: var(--bone-dim);
  font-size: 0.85em;
}
.msg p { margin: 0.35em 0; }
.msg p:first-child { margin-top: 0; }
.msg p:last-child { margin-bottom: 0; }
.msg ul { margin: 0.3em 0; padding-left: 1.3em; }
.msg code { font-family: var(--mono); font-size: 0.86em; background: rgba(220, 20, 60, 0.12); border-radius: 4px; padding: 1px 5px; color: #ff9aa5; }
.msg .thinking { font-style: italic; color: var(--bone-dim); animation: waver 1.2s ease-in-out infinite alternate; }

@keyframes waver { from { opacity: 0.45; } to { opacity: 1; } }

.chat-form { display: flex; gap: 10px; }

#chat-input {
  flex: 1;
  min-width: 0;
  background: var(--night);
  border: 1px solid var(--crypt-edge);
  border-radius: 6px;
  color: var(--bone);
  font-family: var(--sans);
  font-size: 0.95rem;
  padding: 11px 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
#chat-input::placeholder { color: #5c454b; }
#chat-input:focus { border-color: var(--crimson-deep); box-shadow: 0 0 0 3px rgba(220, 20, 60, 0.15); }

#chat-btn {
  background: linear-gradient(180deg, #23090f, #170409);
  color: var(--ember);
  border: 1px solid var(--crimson-deep);
  border-radius: 6px;
  font-family: var(--serif);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  padding: 11px 20px;
  cursor: pointer;
  transition: box-shadow 0.2s, color 0.2s;
}
#chat-btn:hover:not(:disabled) { box-shadow: 0 0 22px rgba(220, 20, 60, 0.35); color: #ff8092; }
#chat-btn:disabled { opacity: 0.5; cursor: wait; }

/* ---------- footer ---------- */

.foot {
  margin-top: 70px;
  text-align: center;
  color: #5e4247;
  font-size: 0.8rem;
}

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  .graveyard { padding: 6vh 18px 60px; }
  .moon { width: 300px; height: 300px; top: -110px; right: -110px; }
  .web { width: 150px; height: 150px; }
  .gh-link { top: 16px; right: 16px; }
  .gh-link svg { width: 26px; height: 26px; }
  .summoning, .ouija, .epitaph { margin-top: 30px; }
  .report-card, .seance { margin-top: 34px; }
  #repo-url, #chat-input { font-size: 16px; }  /* ≥16px so iOS Safari doesn't zoom inputs on focus */
}

@media (max-width: 420px) {
  .title { font-size: clamp(1.15rem, 6.4vw, 1.8rem); }
  .tagline { font-size: 0.95rem; }
}

@media (prefers-reduced-motion: reduce) {
  .title, .fog, .bat, .planchette, .moon, .wisp, .drips circle, .thinking { animation: none; }
}

@media (max-width: 560px) {
  .summoning, .chat-form { flex-direction: column; }
  #exhume-btn, #chat-btn { width: 100%; padding: 13px; }
  .report-card, .seance { padding: 20px 18px 26px; }
  .msg { max-width: 100%; }
}
