/*
 * Sleepy Talon Games - Main Stylesheet
 * A clean, organized dark theme for a game studio site
 */

/* -----------------------------
 * CSS VARIABLES
 * ----------------------------- */
:root {
  /* Colors */
  --color-bg: #000;
  --color-text: #fff;
  --color-text-muted: #ccc;
  --color-text-subtle: #aaa;
  --color-accent: #ffcc00;
  --color-link-hover: #ffcc00;
  --color-border: rgba(255, 255, 255, 0.1);
  --color-hover-overlay: rgba(255, 255, 255, 0.2);

  /* Typography */
  --font-size-small: 0.9rem;
  --font-size-base: 1rem;
  --font-size-medium: 1.1rem;
  --font-size-large: 1.2rem;
  --font-size-xl: 1.5rem;
  --font-size-xxl: 2rem;
  --font-size-xxxl: 2.5rem;
  --font-size-title: 3rem;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-xxl: 3rem;

  /* Layout */
  --content-width-narrow: 600px;
  --content-width-medium: 800px;
  --container-padding: 1rem;

  /* Animation */
  --transition-speed: 0.2s;

  /* Other */
  --border-radius: 4px;
  --border-radius-lg: 8px;

  scroll-behavior: smooth;
  color-scheme: dark;
}

/* Ensure box-sizing is border-box globally */
* {
  box-sizing: border-box;
}

/* -----------------------------
 * BASE STYLES
 * ----------------------------- */
html {
  overflow-y: scroll;
}

html,
body {
  background-color: var(--color-bg);
  color: var(--color-text);
  margin: 0;
  font-family: sans-serif;
  line-height: 1.5;
}

.site-wrapper {
  min-height: 100vh;
  background-color: var(--color-bg);
}

/* Links */
a {
  color: var(--color-text);
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, 0.35);
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  transition:
    color var(--transition-speed) ease-in-out,
    text-decoration-color var(--transition-speed) ease-in-out;
}

a:hover {
  color: var(--color-accent);
  text-decoration-color: var(--color-accent);
}

/* Typography defaults */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin-top: 0;
  line-height: 1.2;
}

p {
  margin-top: 0;
}

img {
  max-width: 100%;
  height: auto;
}

/* -----------------------------
 * LAYOUT CONTAINERS
 * ----------------------------- */
.blog-container,
.games-container,
.blog-post-container {
  width: 100%;
  margin: 0 auto;
  padding: var(--container-padding);
}

.blog-container,
.games-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.blog-container {
  max-width: var(--content-width-narrow);
}

.games-container {
  max-width: var(--content-width-medium);
}

.blog-post-container {
  max-width: var(--content-width-narrow);
  margin-bottom: var(--space-md);
  text-align: left;
}

.blog-post-container .post-date {
  font-size: var(--font-size-medium);
  color: var(--color-text-muted);
}

/* -----------------------------
 * HEADER & NAVIGATION
 * ----------------------------- */
header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xxl);
  text-align: center;
}

header h1 {
  font-size: var(--font-size-title);
  margin-bottom: var(--space-sm);
}

.nav-links {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  margin-bottom: var(--space-lg);
}

.nav-links a {
  color: var(--color-text);
  font-weight: 600;
  text-decoration: none;
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--border-radius);
  transition: all var(--transition-speed) ease-in-out;
  position: relative;
}

.nav-links a:hover {
  color: var(--color-text);
}

.nav-links a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--border-radius);
  background-color: var(--color-text);
  opacity: 0;
  transition: opacity var(--transition-speed) ease-in-out;
}

.nav-links a:hover::after {
  opacity: 0.2;
}

.nav-links a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* -----------------------------
 * BLOG STYLES
 * ----------------------------- */
/* Page title */
.page-title {
  font-size: var(--font-size-xxl);
  margin: 0 0 var(--space-xxl) 0;
  padding: 0 0 var(--space-md) 0;
  text-align: center;
  width: 100%;
  letter-spacing: 0.5px;
  font-weight: bold;
  position: relative;
}

.page-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100px; /* Fixed width for the underline */
  height: 2px;
  background-color: var(--color-border); /* Subtle border color */
}

/* Blog posts list */
.blog-posts-list {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.single-post {
  margin: 1.5rem 0;
  padding: 0;
  width: 100%;
  text-align: center;
}

.single-post h2 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-sm);
  margin-top: 0;
}

.post-date {
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
  display: block;
}

.post-summary {
  margin-top: var(--space-xs);
  margin-bottom: var(--space-xs);
  font-size: var(--font-size-medium);
  color: var(--color-text-muted);
  max-width: 80%;
  margin-left: auto;
  margin-right: auto;
}

.post-meta {
  font-size: var(--font-size-medium);
  color: var(--color-text-muted);
  margin-bottom: var(--space-xl);
}

/* Blog post content */
.blog-post-header {
  text-align: left;
  margin-bottom: var(--space-xl);
}

.blog-post-header h1 {
  font-size: var(--font-size-xxxl);
  margin-bottom: var(--space-sm);
}

.blog-post-header .post-date {
  font-size: var(--font-size-base);
}

.post-content {
  font-size: var(--font-size-large);
  line-height: 1.6;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
  max-width: 100%;
}

.post-content h1 {
  font-size: var(--font-size-xxl);
  margin: var(--space-xl) 0 var(--space-md);
}

.post-content h2 {
  font-size: 1.75rem;
  margin: var(--space-lg) 0 var(--space-md);
}

.post-content p {
  margin-bottom: var(--space-md);
}

.post-content pre,
.post-content code {
  white-space: pre-wrap;
  overflow-x: auto;
  max-width: 100%;
  display: block;
}

.post-content table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
  border-collapse: collapse;
}

/* Blog post images */
.blog-image {
  margin: var(--space-xl) 0;
  width: 100%;
  --img-width: 100%; /* Default width, can be overridden inline */
}

.blog-image img {
  width: var(--img-width);
  max-width: 100%;
  height: auto;
  border: 2px solid var(--color-text);
  display: block;
  border-radius: var(--border-radius);
  margin: 0 auto;
}

.post-content img {
  max-width: 100%;
  height: auto;
  width: auto !important; /* Override any inline width */
}

.blog-image figcaption {
  text-align: center;
  font-size: var(--font-size-small);
  color: var(--color-text-muted);
  margin-top: var(--space-sm);
  font-style: italic;
}

/* Blog image size modifiers */
.blog-image.small img {
  max-width: 400px;
}

.blog-image.medium img {
  max-width: 600px;
}

.blog-image.large img {
  max-width: 800px;
}

.blog-image.centered {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* -----------------------------
 * GAMES STYLES
 * ----------------------------- */
.games-content {
  font-size: var(--font-size-large);
  line-height: 1.5;
  margin-bottom: var(--space-xl);
  text-align: center;
  max-width: var(--content-width-narrow);
}

.games-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6rem;
  width: 100%;
  margin: var(--space-xxl) 0;
}

/* Game card */
.game-card {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  margin-bottom: var(--space-lg);
  position: relative;
  border-radius: 0;
  background-color: transparent;
  transition: transform var(--transition-speed) ease;
}

.game-image-container {
  width: 100%;
  max-width: 400px;
  margin-bottom: var(--space-lg);
  overflow: hidden;
  border-radius: var(--border-radius-lg);
  border: 2px solid var(--color-border);
  transition: border-color var(--transition-speed) ease;
}

.game-card:hover .game-image-container {
  border-color: rgba(255, 204, 0, 0.6);
}

.game-image-container img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.3s ease;
}

/* Game card separator */
.game-card:not(:last-child)::after {
  content: "";
  position: absolute;
  bottom: -3rem;
  left: 20%;
  right: 20%;
  height: 1px;
  background: var(--color-border);
}

.game-info {
  width: 100%;
  max-width: 500px;
  text-align: center;
}

.game-title {
  font-size: var(--font-size-xl);
  margin: 0 0 var(--space-sm);
}

.game-description {
  font-size: var(--font-size-medium);
  color: #ddd;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.game-meta {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  font-size: var(--font-size-small);
  color: var(--color-text-subtle);
}

.game-platform::before {
  content: "•";
  margin-right: var(--space-sm);
}

/* -----------------------------
 * FOOTER
 * ----------------------------- */
footer {
  text-align: center;
  margin-top: var(--space-lg);
  padding: var(--space-md) 0;
  background-color: var(--color-bg);
}

.footer-links {
  margin-bottom: var(--space-sm);
}

.footer-links a {
  color: var(--color-text);
  margin: 0 var(--space-sm);
  text-decoration: none;
}

.footer-links a:hover {
  text-decoration: underline;
}

.social-icon {
  width: 24px;
  height: 24px;
  margin: 0 var(--space-sm);
  vertical-align: middle;
}

/* -----------------------------
 * RESPONSIVE DESIGN
 * ----------------------------- */
@media (max-width: 768px) {
  :root {
    --container-padding: 0.75rem;
  }

  .page-title {
    font-size: var(--font-size-xxl);
    margin: 0 0 var(--space-xl) 0;
  }

  header h1,
  .home-container h1,
  .blog-container h1,
  .games-container h1 {
    font-size: var(--font-size-xxl);
  }

  .game-title {
    font-size: 1.3rem;
  }

  .game-description {
    font-size: var(--font-size-base);
  }

  .games-list {
    gap: 5rem;
  }

  .game-card:not(:last-child)::after {
    bottom: -2.5rem;
  }

  .blog-image {
    margin: var(--space-lg) 0;
  }
}

@media (max-width: 480px) {
  :root {
    --container-padding: 0.5rem;
  }

  .nav-links {
    gap: var(--space-md);
    flex-wrap: wrap;
  }

  .nav-links a,
  .footer-links a {
    padding: var(--space-sm) 0.75rem;
  }

  .blog-post-container {
    max-width: 95%;
  }

  .post-content {
    padding: 0;
  }

  /* Adjust image margins on small screens */
  .blog-image {
    margin: var(--space-md) 0;
  }

  /* Ensure summaries fit on small screens */
  .post-summary {
    max-width: 95%;
  }
}

/* Respect user preferences for reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }

  :root {
    scroll-behavior: auto;
  }
}
