/* Five Nights at Freddy's — Review site. Horror theme. */

:root {
  --bg-dark: #0c0c0c;
  --bg-card: #141414;
  --bg-section: #0f0f0f;
  --text: #e8e8e8;
  --text-muted: #a0a0a0;
  --accent: #8b0000;
  --accent-light: #b22222;
  --border: #2a1515;
  --shadow: rgba(0, 0, 0, 0.5);
  --font-head: 'Nosifer', 'Creepster', cursive;
  --font-body: 'Source Sans 3', sans-serif;
  --header-h: 64px;
  --container: min(92%, 1100px);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-dark);
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Popups — hidden by default; shown only via JS after localStorage check */
.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}
.popup-overlay.is-visible {
  opacity: 1;
  visibility: visible;
}
.popup-overlay[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
}
.popup-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem 2rem;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 8px 32px var(--shadow);
}
.popup-box h3 { margin-top: 0; font-family: var(--font-head); font-size: 1.25rem; color: var(--accent-light); }
.popup-box p { margin: 0 0 1rem; color: var(--text); }
.btn-popup-close {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.5rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}
.btn-popup-close:hover { background: var(--accent-light); }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.logo-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  text-decoration: none;
}
.logo-link:hover { text-decoration: none; color: var(--accent-light); }
.logo-img { width: 48px; height: 48px; object-fit: contain; }
.site-title {
  font-family: var(--font-head);
  font-size: clamp(0.9rem, 2.5vw, 1.15rem);
  font-weight: 400;
  color: var(--text);
}

.burger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--text);
}
.burger-line {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  margin: 0 auto;
  transition: transform 0.2s, opacity 0.2s;
}
.burger-btn[aria-expanded="true"] .burger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.burger-btn[aria-expanded="true"] .burger-line:nth-child(2) { opacity: 0; }
.burger-btn[aria-expanded="true"] .burger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-main .nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}
.nav-main a {
  color: var(--text-muted);
  font-size: 0.95rem;
}
.nav-main a:hover { color: var(--accent-light); }

.nav-mobile {
  display: none;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 1rem;
}
.nav-mobile.is-open { display: block; }
.nav-mobile-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-mobile-list li { border-bottom: 1px solid var(--border); }
.nav-mobile-list a {
  display: block;
  padding: 0.75rem;
  color: var(--text);
}
.nav-mobile-list a:hover { color: var(--accent-light); background: rgba(139, 0, 0, 0.1); }

@media (max-width: 768px) {
  .burger-btn { display: flex; }
  .nav-main { display: none; }
}

/* Main */
.site-main { padding-bottom: 2rem; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1rem;
}

.section-block {
  padding: 3rem 0;
}
.section-dark { background: var(--bg-section); }
.section-title {
  font-family: var(--font-head);
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: var(--accent-light);
  text-align: center;
  margin: 0 0 2rem;
}

/* Hero */
.hero {
  position: relative;
  min-height: 42vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, var(--bg-section) 0%, var(--bg-dark) 100%);
  background-image: url("../images/hero-bg.png");
  background-size: cover;
  background-position: center;
}
.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(12,12,12,0.4) 0%, rgba(12,12,12,0.85) 100%);
}
.hero-content { position: relative; z-index: 1; padding: 2rem 1rem; }
.hero-title {
  font-family: var(--font-head);
  font-size: clamp(2rem, 6vw, 3.5rem);
  color: var(--text);
  margin: 0 0 0.5rem;
  text-shadow: 0 0 20px rgba(139, 0, 0, 0.4);
}
.hero-tagline {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--text-muted);
  margin: 0;
}

/* Intro */
.intro-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
}
.intro-text p { margin: 0 0 1rem; color: var(--text); }
.intro-figure { margin: 0; }
.intro-img { border-radius: 12px; border: 1px solid var(--border); }
@media (max-width: 768px) {
  .intro-grid { grid-template-columns: 1fr; }
  .intro-figure { order: -1; }
}

/* Story */
.story-content p { margin: 0 0 1rem; color: var(--text); }
.story-figure { margin: 2rem 0 0; text-align: center; }
.story-img { border-radius: 12px; border: 1px solid var(--border); margin: 0 auto; max-width: 560px; }

/* Cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px var(--shadow);
}
.card-img-wrap {
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--bg-section);
}
.card-img { width: 100%; height: 100%; object-fit: cover; }
.card-body { padding: 1.25rem; }
.card-title {
  font-family: var(--font-head);
  font-size: 1.1rem;
  color: var(--accent-light);
  margin: 0 0 0.5rem;
}
.card-body p { margin: 0; font-size: 0.95rem; color: var(--text-muted); }

/* Gameplay */
.gameplay-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}
.gameplay-text p { margin: 0 0 1rem; color: var(--text); }
.gameplay-figure { margin: 0; }
.gameplay-img { border-radius: 12px; border: 1px solid var(--border); }
.gameplay-extra {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 2rem;
}
.gameplay-extra-fig { margin: 0; text-align: center; }
.gameplay-extra-img {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  display: block;
}
.gameplay-extra-fig figcaption {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
@media (max-width: 768px) {
  .gameplay-layout { grid-template-columns: 1fr; }
  .gameplay-figure { order: -1; }
  .gameplay-extra { grid-template-columns: 1fr; }
}

/* Gallery / Screenshots */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.gallery-item { margin: 0; overflow: hidden; border-radius: 12px; border: 1px solid var(--border); }
.gallery-img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
@media (max-width: 900px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .gallery-grid { grid-template-columns: 1fr; }
}

/* News */
.news-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 640px;
  margin: 0 auto;
}
.news-item {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.95rem;
}
.news-item:last-child { border-bottom: none; }

/* Specs */
.specs-wrapper {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2rem;
  justify-content: center;
}
.specs-icon-wrap { flex-shrink: 0; }
.specs-icon { width: 120px; height: 120px; object-fit: contain; border-radius: 16px; }
.specs-table-wrap { overflow-x: auto; }
.specs-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--text);
}
.specs-table th, .specs-table td {
  padding: 0.6rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.specs-table th { color: var(--text-muted); font-weight: 600; width: 40%; }
.store-badges { flex-basis: 100%; text-align: center; margin-top: 0.5rem; }
.store-link { display: inline-block; }
.store-badge { height: 56px; width: auto; }
.specs-note {
  margin: 1.5rem 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

/* Footer */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 2rem 1rem;
  margin-top: 2rem;
}
.footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  text-align: center;
}
.footer-copy {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem 1.5rem;
  margin-bottom: 1rem;
}
.footer-nav a { color: var(--text-muted); font-size: 0.9rem; }
.footer-trademark { font-size: 0.8rem; color: var(--text-muted); margin: 0; opacity: 0.8; }

/* Inner pages */
.page-content {
  max-width: var(--container);
  margin: 0 auto;
  padding: 2rem 1rem;
}
.page-content h1 {
  font-family: var(--font-head);
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: var(--accent-light);
  margin: 0 0 1.5rem;
}
.page-content h2 { font-size: 1.25rem; margin: 1.5rem 0 0.5rem; color: var(--text); }
.page-content p { margin: 0 0 1rem; color: var(--text); }
.page-content ul { margin: 0 0 1rem; padding-left: 1.5rem; color: var(--text); }
.page-content a { color: var(--accent-light); }

/* Reviews page */
.reviews-intro { margin-bottom: 2rem; }
.reviews-list { display: flex; flex-direction: column; gap: 1.5rem; margin-bottom: 2rem; }
.review-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}
.review-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}
.review-rating { color: #c9a227; font-size: 1rem; letter-spacing: 0.05em; }
.review-author { font-weight: 600; color: var(--text); }
.review-date { font-size: 0.9rem; color: var(--text-muted); }
.review-text { margin: 0 0 0.5rem; color: var(--text); line-height: 1.6; }
.review-helpful { margin: 0; font-size: 0.85rem; color: var(--text-muted); }
.reviews-cta { margin-top: 1.5rem; }

/* ========== ADAPTIVE (all pages) ========== */

/* Tablet and below */
@media (max-width: 900px) {
  .section-block { padding: 2rem 0; }
  .section-title { margin-bottom: 1.5rem; font-size: clamp(1.25rem, 3.5vw, 1.75rem); }
  .container { padding: 0 1rem; }
  .intro-grid,
  .gameplay-layout { gap: 1.5rem; }
  .cards-grid { gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .specs-wrapper { gap: 1.5rem; flex-direction: column; }
  .specs-icon { width: 96px; height: 96px; }
  .footer-inner { padding: 0 0.5rem; }
}

/* Mobile */
@media (max-width: 768px) {
  .header-inner { padding: 0.5rem 0.75rem; gap: 0.5rem; }
  .logo-img { width: 40px; height: 40px; }
  .site-title { font-size: clamp(0.8rem, 4vw, 1rem); max-width: 180px; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .burger-btn { width: 44px; height: 44px; min-width: 44px; min-height: 44px; }
  .nav-mobile { padding: 0.75rem 1rem; }

  .hero { min-height: 36vh; }
  .hero-content { padding: 1.5rem 0.75rem; }
  .hero-title { font-size: clamp(1.5rem, 7vw, 2.25rem); }
  .hero-tagline { font-size: clamp(0.9rem, 2.5vw, 1rem); }

  .section-block { padding: 1.75rem 0; }
  .section-title { margin-bottom: 1.25rem; font-size: clamp(1.2rem, 5vw, 1.5rem); }
  .container { padding: 0 0.75rem; }
  .intro-grid { gap: 1.25rem; }
  .intro-text p,
  .story-content p,
  .gameplay-text p { margin-bottom: 0.75rem; }
  .story-figure { margin-top: 1.5rem; }
  .story-img { max-width: 100%; }
  .gameplay-extra { gap: 1.25rem; margin-top: 1.5rem; }
  .gameplay-extra-img { max-width: 100%; }

  .cards-grid { grid-template-columns: 1fr; gap: 1rem; }
  .card-body { padding: 1rem; }
  .card-title { font-size: 1rem; }

  .gallery-grid { gap: 0.75rem; }
  .news-item { padding: 0.6rem 0.75rem; font-size: 0.9rem; }

  .specs-wrapper { gap: 1rem; }
  .specs-icon { width: 80px; height: 80px; }
  .specs-table th,
  .specs-table td { padding: 0.5rem 0.75rem; font-size: 0.9rem; }
  .specs-table th { width: 38%; }
  .store-badge { height: 48px; }
  .specs-note { margin-top: 1rem; font-size: 0.85rem; }

  .site-footer { padding: 1.5rem 0.75rem; margin-top: 1.5rem; }
  .footer-copy { font-size: 0.85rem; margin-bottom: 0.75rem; }
  .footer-nav { gap: 0.75rem 1rem; margin-bottom: 0.75rem; }
  .footer-nav a { font-size: 0.85rem; }
  .footer-trademark { font-size: 0.75rem; }

  .page-content { padding: 1.5rem 0.75rem; }
  .page-content h1 { font-size: clamp(1.35rem, 5vw, 1.75rem); margin-bottom: 1.25rem; }
  .page-content h2 { font-size: 1.1rem; margin-top: 1.25rem; }
  .page-content p,
  .page-content ul { margin-bottom: 0.75rem; }

  .review-card { padding: 1.25rem; }
  .review-meta { gap: 0.4rem 0.75rem; }
  .review-text,
  .review-helpful { font-size: 0.9rem; }
  .reviews-list { gap: 1.25rem; margin-bottom: 1.5rem; }
  .reviews-intro { margin-bottom: 1.5rem; }

  .popup-box { padding: 1.25rem 1.5rem; width: 92%; max-width: none; }
  .popup-box h3 { font-size: 1.1rem; }
  .popup-box p { margin-bottom: 0.75rem; font-size: 0.95rem; }
  .btn-popup-close { padding: 0.6rem 1rem; font-size: 0.95rem; min-height: 44px; }
}

/* Small phones */
@media (max-width: 480px) {
  :root { --container: 96%; }
  .header-inner { padding: 0.5rem 0.5rem; }
  .site-title { max-width: 140px; font-size: 0.75rem; -webkit-line-clamp: 2; }
  .logo-link { gap: 0.5rem; min-width: 0; }

  .hero { min-height: 32vh; }
  .hero-content { padding: 1.25rem 0.5rem; }
  .hero-title { font-size: 1.4rem; }
  .hero-tagline { font-size: 0.875rem; }

  .section-block { padding: 1.5rem 0; }
  .section-title { font-size: 1.15rem; margin-bottom: 1rem; }
  .container { padding: 0 0.5rem; }

  .intro-img,
  .story-img,
  .gameplay-img { border-radius: 8px; }
  .card { border-radius: 10px; }
  .card-body { padding: 0.875rem; }
  .gallery-item { border-radius: 8px; }
  .gallery-grid { gap: 0.5rem; }

  .specs-icon { width: 64px; height: 64px; border-radius: 12px; }
  .specs-table { font-size: 0.85rem; }
  .specs-table th,
  .specs-table td { padding: 0.45rem 0.5rem; }
  .specs-table th { width: 36%; }
  .store-badge { height: 44px; }

  .site-footer { padding: 1.25rem 0.5rem; }
  .footer-nav { flex-direction: column; gap: 0.5rem; align-items: center; }
  .footer-nav a { display: block; padding: 0.35rem 0; min-height: 44px; line-height: 44px; text-align: center; }

  .page-content { padding: 1.25rem 0.5rem; }
  .page-content h1 { font-size: 1.3rem; }
  .page-content h2 { font-size: 1.05rem; }
  .page-content ul { padding-left: 1.25rem; }

  .review-card { padding: 1rem; border-radius: 10px; }
  .review-meta { flex-direction: column; align-items: flex-start; }
  .review-author,
  .review-date { font-size: 0.85rem; }

  .popup-box { padding: 1rem 1.25rem; width: 94%; }
  .popup-box h3 { font-size: 1rem; }
}

/* Landscape phones / short height */
@media (max-width: 768px) and (max-height: 420px) {
  .hero { min-height: 28vh; }
  .hero-content { padding: 1rem 0.5rem; }
}

/* Prevent horizontal scroll */
html { overflow-x: hidden; }
body { overflow-x: hidden; }
