/*
 * D-ARCHITECTURE STYLE SYSTEM
 * Theme: VOID AFTER
 * Shared across all pages
 */

/* ===== VARIABLES ===== */
:root {
  /* Palette */
  --c-void: #050505;
  --c-structure: #111111;
  --c-text: #e0e0e0;
  --c-dim: #565656;
  --c-line: #222222;
  --c-accent: #ffffff;

  /* Signal Colors */
  --signal-caution: #d4a276;
  --signal-halt: #cc6b6b;
  --signal-neutral: #888888;

  /* Typography */
  --font-sys: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-code: "Courier New", Courier, monospace;

  /* Dimensions */
  --header-h: 60px;
  --footer-h: 40px;

  /* Deco Animation Speed (seconds) */
  --deco-dur-base: 5;
  --deco-dur-range: 7;
  --deco-delay-range: 3;
}

/* ===== RESET & BASE ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  cursor: default;
}

body {
  background-color: var(--c-void);
  color: var(--c-text);
  font-family: var(--font-sys);
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

a,
a * {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

/* ===== BACKGROUND LAYER ===== */
#bg-layer {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.grid-lines {
  position: absolute;
  width: 200%;
  height: 200%;
  background-image:
    linear-gradient(var(--c-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--c-line) 1px, transparent 1px);
  background-size: 100px 100px;
  opacity: 0.15;
  top: -50%;
  left: -50%;
}

.deco-text {
  position: absolute;
  font-family: var(--font-code);
  color: var(--c-dim);
  opacity: 0.1;
  font-size: 4rem;
  font-weight: bold;
  white-space: nowrap;
  user-select: none;
  z-index: 0;
}

/* ===== LAYOUT ===== */
#layout {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  border: 1px solid var(--c-line);
}

/* ===== HEADER ===== */
header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--c-line);
  background-color: rgba(5, 5, 5, 0.9);
  backdrop-filter: blur(5px);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.back-btn {
  font-family: var(--font-code);
  font-size: 11px;
  color: var(--c-dim);
  padding: 6px 10px;
  border: 1px solid var(--c-line);
  background: none;
  cursor: pointer;
  transition: all 0.3s;
  letter-spacing: 0.05em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.back-btn:hover {
  color: var(--c-text);
  border-color: var(--c-dim);
}

.brand {
  font-family: var(--font-sys);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--c-text);
}

.brand a {
  color: inherit;
}

.brand-home-hint {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  margin-bottom: 3px;
  opacity: 0.4;
  vertical-align: middle;
  transition: opacity 0.3s;
}

a.brand:hover .brand-home-hint {
  opacity: 0.7;
}

.sys-meta {
  font-family: var(--font-code);
  font-size: 11px;
  color: var(--c-dim);
  display: flex;
  gap: 16px;
}

/* ===== FOOTER ===== */
footer {
  height: var(--footer-h);
  border-top: 1px solid var(--c-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background-color: var(--c-void);
  font-family: var(--font-code);
  font-size: 10px;
  color: var(--c-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
  gap: 12px;
}

/* Footer donate */
.footer-donate {
  color: var(--c-dim);
  opacity: 0.4;
  transition: opacity 0.3s;
  cursor: pointer;
}

.footer-donate:hover {
  opacity: 1;
}

/* QR popup overlay */
.donate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.donate-popup {
  background: var(--c-void);
  border: 1px solid var(--c-line);
  padding: 24px;
  text-align: center;
  max-width: 280px;
}

.donate-popup img {
  width: 200px;
  height: 200px;
  display: block;
  margin: 0 auto 16px;
}

.donate-popup-addr {
  font-family: var(--font-code);
  font-size: 9px;
  color: var(--c-dim);
  word-break: break-all;
  line-height: 1.4;
  letter-spacing: 0.03em;
  margin-bottom: 14px;
}

.donate-copy-popup {
  background: none;
  border: 1px solid var(--c-line);
  color: var(--c-dim);
  font-family: var(--font-code);
  font-size: 10px;
  padding: 6px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.3s, border-color 0.3s;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.donate-copy-popup:hover {
  color: var(--c-text);
  border-color: var(--c-dim);
}

/* ===== CORNER MARKERS ===== */
.corner {
  position: absolute;
  width: 12px;
  height: 12px;
  border-color: var(--c-dim);
  border-style: solid;
}

.c-tl {
  top: 24px;
  left: 24px;
  border-width: 1px 0 0 1px;
}

.c-tr {
  top: 24px;
  right: 24px;
  border-width: 1px 1px 0 0;
}

.c-bl {
  bottom: 24px;
  left: 24px;
  border-width: 0 0 1px 1px;
}

.c-br {
  bottom: 24px;
  right: 24px;
  border-width: 0 1px 1px 0;
}

/* ===== SHARED ANIMATIONS ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes decoFloat {

  0%,
  100% {
    translate: 0 0;
  }

  50% {
    translate: 0 -18px;
  }
}

@keyframes gridDrift {
  0% {
    transform: translate(0, 0);
  }

  50% {
    transform: translate(-30px, -30px);
  }

  100% {
    transform: translate(0, 0);
  }
}

@keyframes statusGlitch {

  0%,
  93%,
  97%,
  100% {
    opacity: 1;
    transform: translateX(0);
  }

  94% {
    opacity: 0.4;
    transform: translateX(3px);
  }

  95% {
    opacity: 0.1;
    transform: translateX(-2px);
  }

  96% {
    opacity: 0.7;
    transform: translateX(1px);
  }
}

/* ===== THE GATE: Back Link ===== */
.gate-back {
  display: block;
  margin-top: 32px;
  font-family: var(--font-code);
  font-size: 14px;
  color: var(--line);
  opacity: 0.3;
  transition: opacity 0.3s;
}

.gate-back:hover {
  opacity: 0.6;
}

/* ===== THE GATE: "Reason for sentence" Component ===== */
.q-reason {
  font-family: var(--font-sys);
  font-size: 15px;
  font-weight: 300;
  color: var(--c-dim);
  margin-bottom: 32px;
}

.why-toggle-btn {
  background: transparent;
  border: none;
  font-family: var(--font-code);
  font-size: 17px;
  color: var(--c-dim);
  cursor: pointer;
  border-bottom: 1px dotted var(--c-dim);
  padding-bottom: 2px;
  transition: color 0.3s;
}

.why-toggle-btn:hover {
  color: var(--c-text);
  border-color: var(--c-text);
}

.why-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.6s ease;
  width: 100%;
  text-align: left;
  margin-top: 24px;
  background: var(--c-structure);
  border-radius: 4px;
}

.why-content.open {
  max-height: 3000px;
}

.why-inner {
  padding: 24px;
  font-size: 15px;
  line-height: 1.8;
  color: var(--c-dim);
  white-space: pre-wrap;
}

.why-inner b {
  color: var(--c-text);
}

/* ===== RESPONSIVE (shared) ===== */
@media (max-width: 768px) {
  header {
    padding: 0 10px;
  }

  footer {
    height: auto;
    flex-direction: column;
    padding: 8px 16px;
    gap: 4px;
    text-align: center;
  }

  .footer-donate {
    order: -1;
  }

  .deco-text {
    font-size: 2rem;
  }
}