:root {
  --bg: #f9f7fb;
  --panel: #ffffff;
  --border: #e2d8f1;
  --accent: #8b5fbf;
  --accent-soft: rgba(139, 95, 191, 0.12);
  --accent-glow: rgba(139, 95, 191, 0.45);
  --text: #2b223a;
  --muted: #6b5a85;
  --code-bg: #f4f2f8;

  --radius: 14px;
  --radius-sm: 8px;

  --shadow-md: 0 18px 44px rgba(0,0,0,0.12);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fast: 0.18s;
  --med: 0.4s;
  --slow: 2.4s;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14121a;
    --panel: #1e1b26;
    --border: #33284a;
    --accent: #c9a7ff;
    --accent-soft: rgba(201, 167, 255, 0.14);
    --accent-glow: rgba(201, 167, 255, 0.55);
    --text: #e9e4f2;
    --muted: #a899c1;
    --code-bg: #1a1724;

    --shadow-md: 0 24px 60px rgba(0,0,0,0.45);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 2rem;
  background: var(--bg);
  color: var(--text);
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  line-height: 1.7;
}

.container {
  max-width: 900px;
  margin: auto;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

/* ---------- HEADER ---------- */

header {
  text-align: center;
  padding: 2.6rem 1.5rem 2.1rem;
}

header h1 {
  margin: 0;
  font-size: 2.05rem;
  letter-spacing: 0.22em;
  animation: title-glow 7s ease-in-out infinite;
}

@keyframes title-glow {
  0%, 100% { text-shadow: none; }
  50% {
    text-shadow:
      0 0 14px var(--accent-soft),
      0 0 22px rgba(0,0,0,0.04);
  }
}

.tagline {
  color: var(--muted);
  font-style: italic;
  margin-top: 0.4rem;
}

/* ---------- SECTIONS ---------- */

main,
.about,
.buttons,
article,
.category {
  padding: 2.4rem;
}

.about {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

/* ---------- MARKDOWN ---------- */

.markdown {
  animation: content-fade var(--med) var(--ease);
}

@keyframes content-fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.markdown h1 { font-size: 2rem; }
.markdown h2 { font-size: 1.55rem; }
.markdown h3 { font-size: 1.25rem; }

.markdown p { margin: 0.75rem 0; }

.markdown blockquote {
  margin: 1.4rem 0;
  padding: 0.9rem 1.2rem;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
}

.markdown code {
  background: var(--code-bg);
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  font-family: ui-monospace, monospace;
}

.markdown pre {
  background: var(--code-bg);
  padding: 1.2rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

/* ---------- LINKS ---------- */

a {
  color: var(--accent);
  text-decoration: none;
  position: relative;
}

a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--med) var(--ease);
  opacity: 0.6;
}

a:hover::after {
  transform: scaleX(1);
}

/* ---------- TREE ---------- */

.tree {
  margin-top: 1.6rem;
  font-family: ui-monospace, monospace;
}

.tree-folder {
  margin-top: 1.2rem;
  padding: 0.35rem 0.2rem;
  font-weight: bold;
}

.tree-file {
  margin-left: 1.8rem;
  padding: 0.35rem 0.4rem;
  border-radius: 6px;
  position: relative;
  transition: background var(--fast) var(--ease);
}

.tree-file:hover {
  background:
    linear-gradient(
      110deg,
      var(--accent-soft),
      transparent 65%
    );
  animation: tree-shimmer var(--slow) linear infinite;
}

@keyframes tree-shimmer {
  from { background-position: -200% 0; }
  to { background-position: 200% 0; }
}

.tree-file a {
  z-index: 1;
}

.tree-date {
  color: var(--muted);
  font-size: 0.75rem;
  margin-left: 0.4rem;
}

.tree img {
  width: 16px;
  height: 16px;
  vertical-align: text-bottom;
  margin-right: 4px;
}

/* ---------- BUTTONS ---------- */

.buttons {
  text-align: center;
}

.buttons img {
  width: 88px;
  height: 31px;
  margin: 6px;
  image-rendering: pixelated;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  transition: transform var(--fast) var(--ease);
}

.buttons a:hover img {
  transform: translateY(-4px);
}

/* ---------- META ---------- */

.date {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.back {
  margin-top: 2.6rem;
  font-size: 0.9rem;
}

/* ---------- FOOTER ---------- */

footer {
  text-align: center;
  padding: 1.2rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

/* ---------- MOBILE ---------- */

@media (max-width: 768px) {
  body { padding: 1rem; }
  header h1 { font-size: 1.55rem; }
  main, .about, article, .category { padding: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
