/* ============================================
   Glorified Calculator — Main Stylesheet
   Puzzle Games, Strategy & Logic
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;800&family=Inter:wght@400;500;600&display=swap');

/* ---------- Design Tokens ---------- */
:root {
  /* Brand — derived from the logo (red, yellow, blue, grey) */
  --blue:        #3b82f6;
  --blue-dark:   #2563eb;
  --blue-light:  #dbeafe;
  --red:         #ef4444;
  --red-dark:    #dc2626;
  --red-light:   #fee2e2;
  --yellow:      #f59e0b;
  --yellow-light:#fef3c7;

  /* Semantic */
  --primary:       var(--blue);
  --primary-hover:  var(--blue-dark);
  --accent:        var(--yellow);
  --danger:        var(--red);

  /* Surfaces */
  --bg:          #ffffff;
  --bg-alt:      #f8fafc;
  --bg-card:     #ffffff;
  --text:        #111827;
  --text-muted:  #6b7280;
  --border:      #e5e7eb;

  /* Layout */
  --container:   1100px;
  --radius:      12px;
  --radius-sm:   8px;
  --radius-lg:   16px;

  /* Shadows */
  --shadow-xs:   0 1px 2px rgb(0 0 0/.05);
  --shadow:      0 1px 3px rgb(0 0 0/.1), 0 1px 2px -1px rgb(0 0 0/.1);
  --shadow-md:   0 4px 6px -1px rgb(0 0 0/.1), 0 2px 4px -2px rgb(0 0 0/.1);
  --shadow-lg:   0 10px 15px -3px rgb(0 0 0/.1), 0 4px 6px -4px rgb(0 0 0/.1);

  /* Transition */
  --ease:        200ms ease;
}

/* ---------- Dark Mode ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:         #0f172a;
    --bg-alt:     #1e293b;
    --bg-card:    #1e293b;
    --text:       #f1f5f9;
    --text-muted: #94a3b8;
    --border:     #334155;
    --blue-light: rgba(59,130,246,.15);
    --red-light:  rgba(239,68,68,.15);
    --yellow-light:rgba(245,158,11,.15);
    --shadow-xs:  0 1px 2px rgb(0 0 0/.2);
    --shadow:     0 1px 3px rgb(0 0 0/.3), 0 1px 2px -1px rgb(0 0 0/.3);
    --shadow-md:  0 4px 6px -1px rgb(0 0 0/.3), 0 2px 4px -2px rgb(0 0 0/.3);
    --shadow-lg:  0 10px 15px -3px rgb(0 0 0/.3), 0 4px 6px -4px rgb(0 0 0/.3);
  }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}
h1 { font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -.02em; font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

p { color: var(--text-muted); margin-bottom: 1rem; }
a { color: var(--primary); text-decoration: none; transition: color var(--ease); }
a:hover { color: var(--primary-hover); }

ul, ol { padding-left: 1.5rem; margin-bottom: 1rem; color: var(--text-muted); }
li { margin-bottom: .4rem; }
strong { color: var(--text); }

/* ---------- Layout ---------- */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.25rem;
  width: 100%;
}

.section { padding: 4rem 0; }
.section-alt { background: var(--bg-alt); }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
.grid-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.logo:hover { color: var(--text); }
.logo-img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

/* Desktop nav */
.main-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.main-nav a {
  font-weight: 600;
  font-size: .95rem;
  color: var(--text-muted);
  transition: color var(--ease);
  position: relative;
}
.main-nav a:hover,
.main-nav a.active {
  color: var(--primary);
}
.main-nav a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0; right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
}

/* Mobile hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  z-index: 110;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--ease), opacity var(--ease);
}

@media (max-width: 768px) {
  .nav-toggle { display: flex; }

  .main-nav {
    position: fixed;
    inset: 0;
    background: var(--bg);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--ease);
    z-index: 105;
  }
  .main-nav.open {
    opacity: 1;
    pointer-events: auto;
  }
  .main-nav a {
    font-size: 1.3rem;
  }

  /* Hamburger → X animation */
  .nav-toggle.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .nav-toggle.open span:nth-child(2) {
    opacity: 0;
  }
  .nav-toggle.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

/* ---------- Hero ---------- */
.hero {
  padding: 5rem 0 4rem;
  text-align: center;
}
.hero h1 {
  margin-bottom: 1rem;
}
.hero p {
  font-size: 1.15rem;
  max-width: 640px;
  margin: 0 auto 2rem;
}
.hero .btn-row {
  display: flex;
  gap: .75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-highlight {
  color: var(--primary);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem 1.5rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background var(--ease), transform var(--ease), border-color var(--ease), color var(--ease);
  text-decoration: none;
  white-space: nowrap;
  /* Default: filled primary style (so bare .btn works in articles) */
  background: var(--primary);
  color: #fff;
}
.btn:hover {
  background: var(--primary-hover);
  color: #fff;
  transform: translateY(-1px);
}
.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.btn-sm {
  padding: .45rem 1rem;
  font-size: .85rem;
}
.btn-red {
  background: var(--red);
  color: #fff;
}
.btn-red:hover {
  background: var(--red-dark);
  color: #fff;
  transform: translateY(-1px);
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: transform var(--ease), box-shadow var(--ease);
}
.card:hover {
  box-shadow: var(--shadow-md);
}
.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}
.card-link:hover {
  color: inherit;
}
.card-link:hover .card {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* App card */
.app-card {
  display: flex;
  flex-direction: column;
  text-align: center;
}
.app-card .app-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--blue-light), var(--yellow-light));
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  overflow: hidden;
}
.app-card .app-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.app-card h3 { margin-bottom: .5rem; }
.app-card p { font-size: .9rem; flex-grow: 1; }
.app-card .btn-row {
  display: flex;
  gap: .5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 1rem;
}

/* Featured app card — horizontal on desktop */
.app-feature {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  align-items: center;
}
@media (min-width: 640px) {
  .app-feature {
    grid-template-columns: 120px 1fr;
  }
}
.app-feature .app-icon-lg {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--blue-light), var(--yellow-light));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  overflow: hidden;
  margin: 0 auto;
}
@media (min-width: 640px) {
  .app-feature .app-icon-lg { margin: 0; }
}
.app-feature .app-icon-lg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.app-feature h2 { margin-bottom: .5rem; }

/* Article card */
.article-card { padding: 0; overflow: hidden; }
.article-card-body { padding: 1.25rem; }
.article-card-img {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, var(--blue-light), var(--bg-alt));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.article-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.article-card h3 { margin-bottom: .5rem; }
.article-card p { font-size: .9rem; margin-bottom: .5rem; }
.article-card .meta {
  font-size: .8rem;
  color: var(--text-muted);
}

/* ---------- Tags / Badges ---------- */
.tag {
  display: inline-block;
  padding: .2rem .65rem;
  border-radius: 50px;
  font-size: .78rem;
  font-weight: 600;
  border: 1px solid;
}
.tag-blue {
  background: var(--blue-light);
  color: var(--blue-dark);
  border-color: rgba(59,130,246,.2);
}
.tag-red {
  background: var(--red-light);
  color: var(--red-dark);
  border-color: rgba(239,68,68,.2);
}
.tag-yellow {
  background: var(--yellow-light);
  color: #92400e;
  border-color: rgba(245,158,11,.2);
}

.score-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  padding: .25rem .75rem;
  border-radius: 50px;
  font-size: .85rem;
  white-space: nowrap;
}

/* ---------- Section Headers ---------- */
.section-header {
  text-align: center;
  margin-bottom: 2.5rem;
}
.section-header h2 {
  margin-bottom: .5rem;
}
.section-header p {
  max-width: 600px;
  margin: 0 auto;
}

/* ---------- Coming Soon Banner ---------- */
.coming-soon {
  background: linear-gradient(135deg, var(--blue-light), var(--yellow-light));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
}
.coming-soon h2 { margin-bottom: .5rem; }
.coming-soon p { max-width: 500px; margin: 0 auto 1.5rem; }

/* ---------- CTA Banner ---------- */
.cta-banner {
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
}
.cta-banner h2, .cta-banner p { color: #fff; }
.cta-banner p { opacity: .9; max-width: 550px; margin: .5rem auto 1.5rem; }
.cta-banner .btn {
  background: #fff;
  color: var(--primary);
}
.cta-banner .btn:hover {
  background: #f1f5f9;
  transform: translateY(-1px);
}

/* ---------- Highlight Box (used in articles) ---------- */
.highlight-box {
  background: var(--blue-light);
  border: 1px solid rgba(59,130,246,.2);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 2rem 0;
}
.highlight-box h3 { margin-bottom: .5rem; }
.highlight-box p { margin-bottom: 1rem; }

/* ---------- Review Cards (article pages) ---------- */
.review-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 2rem 0;
  box-shadow: var(--shadow);
}
.review-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .review-grid {
    grid-template-columns: 180px 1fr;
    align-items: start;
  }
}
.review-img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.review-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  margin-bottom: .75rem;
  flex-wrap: wrap;
}
.review-specs {
  list-style: none;
  padding: 1rem;
  margin: 1rem 0;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  border: 1px solid var(--border);
}
.review-specs li {
  margin-bottom: .5rem;
  line-height: 1.6;
}
.review-specs li:last-child { margin-bottom: 0; }
.review-specs strong {
  color: var(--primary);
}

/* ---------- Article Content ---------- */
.article-content {
  max-width: 800px;
  margin: 0 auto;
}
.article-content h1 {
  margin-bottom: .5rem;
}
.article-content h2 {
  margin-top: 2.5rem;
  margin-bottom: .75rem;
}
.article-content h3 {
  margin-top: 1.5rem;
  margin-bottom: .5rem;
}
.article-content p {
  margin-bottom: 1rem;
  line-height: 1.8;
}
.article-content ul,
.article-content ol {
  margin-bottom: 1.25rem;
}
.article-content li {
  line-height: 1.7;
}

/* Article meta */
.article-meta {
  font-size: .9rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Breadcrumb */
.breadcrumb {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { margin: 0 .4rem; }

/* ---------- Page Header ---------- */
.page-header {
  padding: 3rem 0 2rem;
  text-align: center;
}
.page-header h1 { margin-bottom: .75rem; }
.page-header p {
  max-width: 600px;
  margin: 0 auto;
  font-size: 1.1rem;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: auto;
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: 3rem 0 1.5rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
@media (min-width: 640px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  }
}
.footer-grid h4 {
  font-size: .9rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: .75rem;
}
.footer-grid a {
  display: block;
  color: var(--text-muted);
  font-size: .9rem;
  margin-bottom: .4rem;
}
.footer-grid a:hover { color: var(--primary); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  text-align: center;
  font-size: .85rem;
}
.footer-bottom p { color: var(--text-muted); margin: 0; }
.footer-brand p {
  font-size: .9rem;
  margin-top: .5rem;
}

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* ---------- Responsive Tweaks ---------- */
@media (max-width: 480px) {
  .hero { padding: 3rem 0 2.5rem; }
  .section { padding: 2.5rem 0; }
  .card { padding: 1.25rem; }
}
