/* The Virgin House™ house style: as dodgy as humanly possible. Shared by every page. */

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Comic Sans MS", "Comic Sans", "Chalkboard SE", cursive;
  color: #0f0;
  background:
    repeating-linear-gradient(45deg, #ff00ff 0 20px, #00ffff 20px 40px, #ffff00 40px 60px);
  background-size: 200% 200%;
  animation: bgscroll 6s linear infinite;
  overflow-x: hidden;
}
@keyframes bgscroll { to { background-position: 170px 170px; } }

/* flying 0s and 1s */
#binary {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 1;
}

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

/* ---------- layout ---------- */
.layout {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
}

.page {
  position: relative;
  z-index: 2;
  flex: 1;
  min-width: 0;
  max-width: 760px;
  margin: 0 auto;
  padding: 16px;
}
.layout .page { padding: 0; }

/* ---------- sidebar (Win95 window) ---------- */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 16px;
  background: #c0c0c0;
  border: 4px outset #fff;
  padding: 0 10px 10px;
  color: #000;
  box-shadow: 8px 8px 0 #000;
  transform: rotate(-1.5deg);
}
.sidebar .titlebar { margin: 0 -10px 10px; }

.logo {
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 1.5rem;
  line-height: 1.1;
  margin: 0;
  color: #f0f;
  text-shadow: 2px 2px #0ff;
}
.logo-sub {
  font-family: Papyrus, fantasy;
  font-size: 0.8rem;
  margin: 2px 0 12px;
}

.sidebar a,
.sidebar button {
  display: block;
  width: 100%;
  margin: 6px 0;
  padding: 8px 10px;
  text-align: left;
  background: #c0c0c0;
  color: #00f;
  border: 3px outset #fff;
  font: bold 1rem "Times New Roman", serif;
  text-decoration: underline;
  cursor: pointer;
}
.sidebar a:hover,
.sidebar button:hover { background: #ff0; color: #f00; }
.sidebar a:active,
.sidebar button:active { border-style: inset; }
.sidebar a.active { background: #000080; color: #fff; border-style: inset; }

.sidebar .ff-btn {
  margin-top: 14px;
  text-align: center;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 1.15rem;
  text-decoration: none;
  color: #000;
  background: linear-gradient(#ff0, #f80);
  border: 4px outset #ff0;
  animation: wobble 1.2s ease-in-out infinite;
}
.sidebar .ff-btn:hover { background: linear-gradient(#0f0, #0a0); color: #000; animation-duration: 0.2s; }

.sidebar-foot {
  font-family: "Courier New", monospace;
  font-size: 0.7rem;
  margin: 12px 0 0;
}

/* ---------- headings & bits ---------- */
marquee {
  display: block;
  background: #f00;
  color: #ff0;
  font-weight: 900;
  font-size: 1.1rem;
  padding: 4px 0;
  border: 4px ridge #0ff;
  font-family: Impact, "Arial Black", sans-serif;
  letter-spacing: 2px;
}

h1 {
  font-family: Impact, "Arial Black", sans-serif;
  font-size: clamp(2.2rem, 8vw, 4.5rem);
  text-align: center;
  margin: 20px 0 6px;
  color: #fff;
  text-shadow: 3px 0 #f0f, -3px 0 #0ff, 0 0 20px #0f0;
  transform: rotate(-3deg);
  position: relative;
}
h1 .tm { font-size: 0.4em; vertical-align: super; }

/* RGB-split glitch on the title */
.glitch { position: relative; display: inline-block; }
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute; left: 0; top: 0; width: 100%;
  overflow: hidden;
}
.glitch::before { color: #f0f; animation: slice1 2.3s infinite steps(1); }
.glitch::after  { color: #0ff; animation: slice2 1.7s infinite steps(1); }
@keyframes slice1 {
  0%   { clip-path: inset(10% 0 70% 0); transform: translate(-6px, 0); }
  20%  { clip-path: inset(60% 0 10% 0); transform: translate(5px, 2px); }
  40%  { clip-path: inset(30% 0 50% 0); transform: translate(-3px, -2px); }
  60%  { clip-path: inset(80% 0 2% 0);  transform: translate(8px, 0); }
  80%  { clip-path: inset(0 0 90% 0);   transform: translate(-8px, 1px); }
  100% { clip-path: inset(45% 0 40% 0); transform: translate(2px, 0); }
}
@keyframes slice2 {
  0%   { clip-path: inset(70% 0 5% 0);  transform: translate(6px, 0); }
  25%  { clip-path: inset(5% 0 80% 0);  transform: translate(-5px, -1px); }
  50%  { clip-path: inset(40% 0 40% 0); transform: translate(4px, 2px); }
  75%  { clip-path: inset(85% 0 0 0);   transform: translate(-7px, 0); }
  100% { clip-path: inset(20% 0 60% 0); transform: translate(3px, 0); }
}

.subtitle {
  text-align: center;
  font-family: Papyrus, fantasy;
  color: #000;
  background: #0f0;
  display: table;
  margin: 0 auto 20px;
  padding: 2px 10px;
  transform: rotate(2deg);
  font-weight: bold;
}

.blink { animation: blink 0.6s steps(1) infinite; }
@keyframes blink { 50% { visibility: hidden; } }

.under-construction {
  text-align: center;
  font-size: 2rem;
  margin: 0;
}

/* ---------- Win95 boxes ---------- */
.box {
  background: #000080;
  border: 6px outset #c0c0c0;
  padding: 18px;
  margin: 20px 0;
  color: #fff;
  box-shadow: 10px 10px 0 #f0f;
}
.box:nth-of-type(odd) { transform: rotate(-1deg); }
.box:nth-of-type(even) { transform: rotate(1.2deg); }

.titlebar {
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #fff;
  margin: -18px -18px 14px;
  padding: 4px 8px;
  font-family: Tahoma, sans-serif;
  font-weight: bold;
  font-size: 0.9rem;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.titlebar > span:last-child,
.titlebar > button {
  background: #c0c0c0; color: #000; padding: 0 6px; border: 2px outset #fff;
  font: bold 0.9rem Tahoma, sans-serif; cursor: pointer;
}

/* ---------- event cards ---------- */
.event-list { display: grid; gap: 14px; }

.event {
  position: relative;
  background: #000;
  border: 3px inset #0f0;
  padding: 10px 14px;
}
.event:nth-child(odd) { transform: rotate(0.6deg); }
.event:nth-child(even) { transform: rotate(-0.8deg); }
.event h3 {
  margin: 0 0 4px;
  font-size: 1.25rem;
  color: #ff0;
  text-shadow: 2px 2px #f00;
}
.event .meta {
  margin: 0 0 6px;
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
  color: #0ff;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
}
.event p.desc { margin: 0; color: #0f0; white-space: pre-wrap; }

.event.done { filter: grayscale(0.8); }
.event.done h3 { text-decoration: line-through; }
.event.done::after {
  content: "DONE ✔";
  position: absolute;
  top: 8px; right: 10px;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 1.3rem;
  color: #f00;
  border: 3px solid #f00;
  padding: 0 6px;
  transform: rotate(12deg);
  opacity: 0.85;
}

.empty {
  color: #ff0;
  font-family: "Courier New", monospace;
  margin: 0;
}

.see-all {
  display: inline-block;
  margin-top: 14px;
  color: #ff0;
  font-weight: bold;
}
.see-all:hover { color: #f0f; }

/* ---------- forms ---------- */
label {
  display: block;
  margin: 12px 0 4px;
  font-size: 1.05rem;
  color: #ff0;
  text-shadow: 2px 2px #f00;
}

input, textarea {
  width: 100%;
  padding: 8px;
  font: inherit;
  font-family: "Courier New", monospace;
  background: #000;
  color: #0f0;
  border: 3px inset #0f0;
  caret-color: #f0f;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, textarea:focus { outline: 3px dashed #f0f; background: #001a00; }

.big-btn {
  margin-top: 18px;
  width: 100%;
  padding: 14px;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 1.5rem;
  color: #000;
  background: linear-gradient(#ff0, #f80);
  border: 6px outset #ff0;
  cursor: pointer;
  animation: wobble 1.2s ease-in-out infinite;
}
.big-btn:hover { animation-duration: 0.2s; background: linear-gradient(#0f0, #0a0); }
.big-btn:active { border-style: inset; }
.big-btn:disabled { filter: grayscale(1); cursor: wait; }
@keyframes wobble {
  0%, 100% { transform: rotate(-1.5deg) scale(1); }
  50% { transform: rotate(1.5deg) scale(1.03); }
}

.win-btn {
  color: #00f;
  background: #c0c0c0;
  border: 4px outset #fff;
  padding: 6px 14px;
  font: bold 1rem "Times New Roman", serif;
  text-decoration: underline;
  cursor: pointer;
}
.win-btn:active { border-style: inset; }

/* ---------- password dialog ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 70;
}
.modal-backdrop.open { display: flex; }

.modal {
  width: 100%;
  max-width: 380px;
  margin: 0;
  transform: rotate(-2deg) !important;
}
.modal p { margin: 0 0 12px; font-family: "Courier New", monospace; }
.modal .row { display: flex; gap: 8px; margin-top: 14px; }
.modal .row button { flex: 1; }
.modal .error { color: #f44; font-weight: bold; min-height: 1em; margin: 10px 0 0; }

/* ---------- misc ---------- */
.counter {
  text-align: center;
  font-family: "Courier New", monospace;
  color: #fff;
  background: #000;
  display: table;
  margin: 0 auto 40px;
  padding: 4px 10px;
  border: 2px solid #0f0;
}
.counter b { color: #f00; letter-spacing: 3px; }

/* whole-screen glitch moments, toggled from chaos.js */
body.glitching .page,
body.glitching .sidebar {
  animation: shake 0.25s steps(2) infinite;
  filter: hue-rotate(160deg) saturate(3) contrast(1.4);
}
body.invert { filter: invert(1); }
@keyframes shake {
  0%   { transform: translate(0, 0) skewX(0); }
  25%  { transform: translate(-12px, 4px) skewX(8deg); }
  50%  { transform: translate(10px, -6px) skewX(-6deg); }
  75%  { transform: translate(-4px, 8px) skewX(3deg); }
  100% { transform: translate(6px, -2px) skewX(-10deg); }
}

/* random glitch bars that tear across the screen */
.tear {
  position: fixed;
  left: 0; right: 0;
  z-index: 45;
  pointer-events: none;
  mix-blend-mode: difference;
}

/* fake error popups */
.popup {
  position: fixed;
  z-index: 60;
  width: 260px;
  background: #c0c0c0;
  border: 3px outset #fff;
  color: #000;
  font-family: Tahoma, sans-serif;
  font-size: 0.85rem;
  box-shadow: 4px 4px 0 #000;
}
.popup .titlebar { margin: 0; }
.popup .body { padding: 12px; display: flex; gap: 10px; align-items: center; }
.popup .body span:first-child { font-size: 1.8rem; }

/* ---------- phones ---------- */
@media (max-width: 700px) {
  .layout { flex-direction: column; align-items: stretch; padding: 12px; }
  .sidebar { width: auto; position: static; transform: none; }
  .logo-sub, .sidebar-foot { display: none; }
  .popup { width: calc(100% - 32px); left: 16px !important; }
}

@media (prefers-reduced-motion: reduce) {
  body, .glitch::before, .glitch::after, .big-btn, .sidebar .ff-btn, .blink { animation: none !important; }
}
