/* =========================================================
   THEME VARIABLES
   ========================================================= */

/* Light theme (default) */
:root {
  --bg: #fbf9f4;
  --surface: #f8fafc;

  --text-main: #0f172a;
  --text-muted: #334155;
  --text-light: #64748b;

  --accent: #6366f1;
  --accent-2: #22d3ee;
  --accent-soft: #e0e7ff;

  --max-width: 720px;
}

/* Dark theme */
[data-theme="dark"] {
  --bg: #0b1020;
  --surface: #111827;

  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
  --text-light: #c7cbd1;

  --accent: #818cf8;
  --accent-2: #22d3ee;
  --accent-soft: #1e293b;
}

/* =========================================================
   GLOBAL BASE STYLES
   ========================================================= */

body {
  margin: 0;
  background: var(--bg);
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    "Segoe UI",
    "Segoe UI Emoji",
    "Apple Color Emoji",
    "Noto Color Emoji",
    sans-serif;
  color: var(--text-main);
  line-height: 1.7;
}

/* =========================================================
   HEADER & NAVIGATION
   ========================================================= */

header {
  max-width: var(--max-width);
  margin: 32px auto 0;
  padding: 0 24px 14px;
  border-bottom: 1px solid #e5e7eb;
  position: relative;
}

header::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 100%;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--accent),
    var(--accent-2),
    transparent 90%
  );
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

nav a {
  text-decoration: none;
  color: var(--text-light);
  font-size: 0.9rem;
  padding: 4px 2px;
  transition: color 0.2s ease, opacity 0.2s ease;
}

nav a:hover {
  color: var(--accent);
  opacity: 0.85;
}

#theme-toggle {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 0.95rem;
  cursor: pointer;
  padding: 4px 6px;
}

#theme-toggle:hover {
  color: var(--accent);
}

/* =========================================================
   MAIN CONTENT (ARTICLE LAYOUT)
   ========================================================= */

main {
  max-width: var(--max-width);
  margin: 10vh auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

h1 {
  font-size: clamp(2.2rem, 4vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  margin-bottom: 2.2rem;

  background: linear-gradient(
    90deg,
    var(--text-main),
    var(--accent)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

p {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 64ch;
  margin-bottom: 1.4rem;
}

p em {
  color: var(--text-main);
  font-style: italic;
}

p:last-child {
  margin-bottom: 0;
}

/* =========================================================
   FIGURES & IMAGES
   ========================================================= */

figure {
  margin: 2.6rem 0 2.2rem;
}

figure img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--accent-soft);
}

figcaption {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-top: 0.6rem;
  max-width: 64ch;
}

.citation {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.4rem;
  max-width: 64ch;
  opacity: 0.85;
}

/* =========================================================
   PROFILE IMAGE
   ========================================================= */

.profile-pic {
  display: block;
  width: 144px;
  height: 144px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 0 1.6rem 2px;
  border: 2px solid var(--accent-soft);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
}

@media (max-width: 600px) {
  .profile-pic {
    width: 112px;
    height: 112px;
  }
}

/* =========================================================
   AMBIENT FLAGS (WINDOWS-SAFE)
   ========================================================= */

.ambient-flags {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.ambient-flag {
  position: absolute;
}

.ambient-flag span {
  display: inline-block;
  font-size: 1.4rem;
  font-family:
    "Segoe UI Emoji",
    "Apple Color Emoji",
    "Noto Color Emoji";
}

.f1, .f6, .f9  { opacity: 0.9; }
.f3, .f7, .f10 { opacity: 0.75; }
.f5, .f11      { opacity: 0.65; }

.f1  { top: 14%; left: 3%;  transform: rotate(-8deg) scale(0.95); }
.f3  { top: 41%; left: 7%;  transform: rotate(5deg)  scale(1.05); }
.f5  { top: 59%; left: 5%;  transform: rotate(-3deg) scale(0.9); }
.f7  { top: 77%; left: 11%; transform: rotate(7deg)  scale(1); }
.f9  { top: 91%; left: 4%;  transform: rotate(-6deg) scale(0.85); }

.f2  { top: 19%; right: 5%; transform: rotate(4deg)  scale(1); }
.f4  { top: 33%; right: 8%; transform: rotate(-9deg) scale(0.95); }
.f6  { top: 54%; right: 6%; transform: rotate(6deg)  scale(1.1); }
.f8  { top: 71%; right: 9%; transform: rotate(-2deg) scale(0.9); }
.f10 { top: 83%; right: 3%; transform: rotate(8deg)  scale(1); }

.f11 { top: 9%; right: 2%; transform: rotate(-12deg) scale(0.85); }

@media (max-width: 700px) {
  .ambient-flags {
    display: none;
  }
}

/* =========================================================
   SIDE QUESTS – GAMES SECTION
   ========================================================= */

.side-section {
  margin-top: 4rem;
}

.side-section h2 {
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 0.6rem;
  color: var(--text-main);
}

.section-intro {
  font-size: 1rem;
  color: var(--text-light);
  max-width: 64ch;
  margin-bottom: 2.2rem;
}

.thinking-grid {
  display: grid;
  gap: 1.6rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.thinking-card {
  padding: 1.6rem;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--accent-soft);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.thinking-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

[data-theme="dark"] .thinking-card:hover {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

.thinking-card h3 {
  margin-bottom: 0.4rem;
  font-weight: 500;
  color: var(--text-main);
}

.game-meta {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 1rem;
  letter-spacing: 0.02em;
}

.thinking-card p {
  margin-bottom: 0.8rem;
}

.mechanic {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.mechanic strong {
  color: var(--text-main);
}

/* Expandable card (JS controlled) */

.expand-content {
  display: none;
  margin-top: 0.8rem;
}

.thinking-card.expanded .expand-content {
  display: block;
}

.read-more-btn {
  margin-top: 1rem;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
}

.read-more-btn:hover {
  opacity: 0.7;
}

/* =========================================================
   REMOVED COMPONENTS
   ========================================================= */

/* Accordion styles intentionally removed.
   Safe to delete related HTML and JS. */
