@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

:root {
  /* Color Palette */
  --bg-primary: #121212;
  --bg-secondary: #1e1e1e;
  --bg-card: #252525;
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0a0;
  --accent-color: #34d399;
  --accent-hover: #10b981;
  --border-color: #333;

  /* Spacing */
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 2rem;
  --spacing-xl: 4rem;
  --spacing-2xl: 6rem;

  /* Typography */
  --font-main: 'VT323', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.2s ease;
}

ul {
  list-style: none;
}

picture,
img {
  max-width: 100%;
}

.mono-font {
  font-family: var(--font-main);
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

.grid {
  display: grid;
  gap: var(--spacing-lg);
}

header {
  padding: var(--spacing-sm) 0;
  border-bottom: 1px solid var(--border-color);
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-color);
  letter-spacing: -0.02em;
}

/* Hero */
.hero {
  position: relative;
  text-align: center;
  margin-bottom: var(--spacing-xl);
  padding: 8rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero picture {
  position: absolute;
  inset: 0;
  z-index: -100;
}

.hero h1 {
  font-size: 4rem;
  font-weight: 800;
  margin-bottom: var(--spacing-md);
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.hero p {
  color: #e0e0e0;
  font-size: 1.4rem;
  max-width: 700px;
  margin: 0 auto;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  font-weight: 500;
}

.toc-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.toc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: var(--spacing-lg);
  transition: transform 0.2s ease, border-color 0.2s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.toc-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-color);
}

.card-number {
  font-size: 0.9rem;
  color: var(--accent-color);
  font-weight: 600;
  margin-bottom: var(--spacing-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.toc-card h2 {
  font-size: 1.5rem;
  margin-bottom: var(--spacing-sm);
}

.toc-card p {
  color: var(--text-secondary);
  flex-grow: 1;
}

.card-link {
  margin-top: var(--spacing-md);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.card-link::after,
.read-next::after {
  content: '→';
  transition: transform 0.2s ease;
}

.toc-card:hover .card-link::after,
.read-next:hover::after {
  transform: translateX(4px);
}

/* Content Pages */
.content-page {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--spacing-2xl) 0 var(--spacing-xl);
  background: linear-gradient(to bottom, rgba(18, 18, 18, 0.4), #121212 300px), url('../img/hero_banner_w.webp') no-repeat top center;
}

.back-link {
  display: inline-block;
  margin-bottom: var(--spacing-lg);
  color: var(--text-secondary);
}

.back-link:hover {
  color: var(--accent-color);
}

.content-page h1 {
  font-size: 2.5rem;
  margin-bottom: var(--spacing-lg);
}

.content-page h2 {
  font-size: 1.8rem;
  margin: var(--spacing-xl) 0 var(--spacing-md);
  color: var(--text-primary);
}

.content-page p {
  margin-bottom: var(--spacing-md);
  color: var(--text-secondary);
}

.content-page ul {
  list-style: disc;
  padding-left: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  color: var(--text-secondary);
}

.content-page li {
  margin-bottom: var(--spacing-sm);
}

/* Footer */
footer {
  margin-top: var(--spacing-xl);
  padding: var(--spacing-lg) 0;
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Speedrun Timer */
#speedrun-timer {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid var(--accent-color);
  border-radius: 8px;
  padding: 10px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent-color);
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  animation: slideIn 0.5s ease-out;
  backdrop-filter: blur(5px);
}

.clock-container {
  position: relative;
  width: 32px;
  height: 32px;
}

.clock-frame,
.clock-dial {
  position: absolute;
  inset: 0;
  image-rendering: pixelated;
}

.clock-frame {
  z-index: 2;
}

.clock-dial {
  z-index: 1;
  animation: spin 4s linear infinite;
}

.timer-content {
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  gap: 2px;
}

.timer-time {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent-color);
}

.timer-context {
  font-weight: 400;
  opacity: 0.7;
}

.timer-remark {
  color: var(--text-secondary);
}

#speedrun-timer.timer-hidden {
  animation: slideOut 0.5s ease-in forwards;
}

main {
  animation: fadeIn 2s ease-out;
}

.timer-heartbeat {
  animation: heartbeat 1s infinite ease-in-out;
}

/* Read Next Link */
.read-next {
  display: inline-block;
  margin-top: var(--spacing-xl);
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--accent-color);
  font-weight: 600;
  font-size: 1.1rem;
  transition: all 0.2s ease;
}

.read-next:hover {
  background: var(--bg-secondary);
  border-color: var(--accent-color);
  transform: translateX(4px);
}

.read-next::after {
  margin-left: var(--spacing-sm);
}

/* Keyframes */
@keyframes slideIn {
  from {
    transform: translateY(100%);
    opacity: 0;
  }

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

@keyframes slideOut {
  from {
    transform: translateY(0);
    opacity: 1;
  }

  to {
    transform: translateY(150%);
    opacity: 0;
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes heartbeat {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}