/* ==========================================================================
   CodeToCoin – Modern Responsive Stylesheet (Fixed Mobile Menu)
   ========================================================================== */

/* === 1. Root Variables & Base Styles === */
:root {
  --accent: #0B5FFF;
  --bg: #ffffff;
  --muted: #6b7280;
  --maxw: 1100px;
  --radius: 10px;
  --card-shadow: 0 6px 18px rgba(11,15,80,0.06);
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: #0f172a;
  line-height: 1.6;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px;
}

/* ==========================================================================
   2. HEADER
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 10px rgba(11, 95, 255, 0.08);
  transition: all 0.3s ease;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
}

.logo a {
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--accent);
  text-decoration: none;
}

/* Navigation */
.main-nav {
  display: flex;
  gap: 18px;
  align-items: center;
  transition: all 0.3s ease;
}

.main-nav a {
  color: #0f172a;
  text-decoration: none;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 6px;
  transition: background 0.2s ease;
}

.main-nav a:hover { background: rgba(11, 95, 255, 0.1); }

/* Controls & Buttons */
.controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

#theme-toggle {
  border: none;
  background: rgba(11,95,255,0.08);
  color: var(--accent);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  transition: all 0.3s ease;
}

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

.admin-link {
  text-decoration: none;
  color: var(--accent);
  font-weight: 600;
}

/* Mobile Menu Button */
.mobile-menu {
  display: none;
  flex-direction: column;
  gap: 5px;
  border: none;
  background: transparent;
  cursor: pointer;
  z-index: 1001;
}

.mobile-menu .bar {
  width: 24px;
  height: 3px;
  background: #0f172a;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.mobile-menu.active .bar:nth-child(1) {
  transform: rotate(45deg) translateY(8px);
}
.mobile-menu.active .bar:nth-child(2) {
  opacity: 0;
}
.mobile-menu.active .bar:nth-child(3) {
  transform: rotate(-45deg) translateY(-8px);
}

/* ==========================================================================
   3. HERO & SECTION STYLES
   ========================================================================== */
.hero {
  text-align: center;
  padding: 100px 0 60px;
  background: linear-gradient(180deg, rgba(11,95,255,0.05), rgba(255,255,255,0));
}

.hero.small-hero { padding: 80px 0 40px; }

.hero h1, .hero h2 {
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 8px;
}

.hero h1 { font-size: 2.5rem; }
.hero h2 { font-size: 2rem; }

.hero .lead {
  color: var(--muted);
  font-size: 1.1rem;
  margin-top: 10px;
}

.section { padding: 60px 0; }

.cta .btn { margin: 6px; }

/* ==========================================================================
   4. BUTTONS
   ========================================================================== */
.btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  border: none;
  cursor: pointer;
}

.btn.primary { background: var(--accent); color: #fff; }

.btn.outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}

/* ==========================================================================
   5. CARDS & POSTS
   ========================================================================== */
.featured .cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.card {
  background: #fff;
  padding: 16px;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
}

.card img {
  width: 100%;
  height: 140px;
  object-fit: contain;
}

.posts-grid { display: grid; gap: 12px; }

.post-card {
  padding: 12px;
  border-bottom: 1px solid #f1f5f9;
}

/* ==========================================================================
   6. DOWNLOADS
   ========================================================================== */
.downloads-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.downloads-teaser {
  margin-top: 28px;
  padding: 18px;
  background: #fbfcff;
  border-radius: 12px;
  box-shadow: var(--card-shadow);
}

/* ==========================================================================
   7. CONTACT FORM
   ========================================================================== */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 20px;
  max-width: 480px;
}

.contact-form input,
.contact-form textarea {
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  width: 100%;
}

.contact-form textarea {
  min-height: 120px;
  resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--accent);
  outline: none;
}

/* ==========================================================================
   8. NEWSLETTER SECTION
   ========================================================================== */
.newsletter {
  background: linear-gradient(90deg, rgba(11,95,255,0.05), rgba(11,95,255,0.02));
  padding: 40px 0;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
}

.newsletter-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
}

.newsletter-text h3 {
  margin: 0;
  font-weight: 700;
  color: var(--accent);
  font-size: 1.4rem;
}

.newsletter-text p {
  margin: 6px 0 0;
  color: var(--muted);
}

.newsletter-form {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.newsletter-form input {
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 1rem;
  width: 240px;
}

.newsletter-form input:focus {
  border-color: var(--accent);
  outline: none;
}

/* ==========================================================================
   9. FOOTER
   ========================================================================== */
.site-footer {
  background: linear-gradient(180deg, rgba(11,95,255,0.04), rgba(11,95,255,0.02));
  border-top: 1px solid #eef2ff;
  padding-top: 32px;
  padding-bottom: 16px;
  color: #1e293b;
  margin-top: 32px;
}

.footer-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-brand { flex: 1 1 220px; }

.footer-logo {
  color: var(--accent);
  font-weight: 700;
  margin: 0;
}

.footer-tagline {
  color: var(--muted);
  margin-top: 6px;
  font-size: 0.9rem;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-links a {
  color: #0f172a;
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.footer-links a:hover { color: var(--accent); }

.footer-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--accent);
  background: rgba(11,95,255,0.06);
  transition: all 0.3s ease;
}

.footer-social a:hover {
  background: var(--accent);
  color: #fff;
}

.footer-bottom {
  text-align: center;
  border-top: 1px solid #e5e7eb;
  margin-top: 24px;
  padding-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ==========================================================================
   10. MISCELLANEOUS
   ========================================================================== */
.article pre {
  background: #0b1225;
  color: #e6eef8;
  padding: 14px;
  border-radius: 8px;
  overflow: auto;
}

/* ==========================================================================
   11. RESPONSIVE & MOBILE MENU FIX
   ========================================================================== */
@media (max-width: 800px) {

  .container { padding: 16px; }

  .hero h1 { font-size: 1.9rem; }
  .hero h2 { font-size: 1.6rem; }
  .section { padding: 40px 0; }

  /* Newsletter */
  .newsletter-container {
    flex-direction: column;
    text-align: center;
  }
  .newsletter-form { width: 100%; justify-content: center; }
  .newsletter-form input { width: 70%; }

  /* Footer */
  .footer-container { flex-direction: column; text-align: center; }
  .footer-links { flex-direction: row; justify-content: center; flex-wrap: wrap; gap: 12px; }
  .footer-social { margin-top: 12px; justify-content: center; display: flex; gap: 12px; }
  .footer-bottom { font-size: 0.85rem; padding-top: 10px; }

  /* Mobile menu */
  .main-nav {
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: #fff;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: max-height 0.35s ease, opacity 0.3s ease, transform 0.3s ease;
    box-shadow: var(--card-shadow);
    border-top: 1px solid #eef2ff;
    z-index: 999;
  }

  .main-nav.nav-open {
    max-height: 600px; /* enough for links */
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    padding: 16px;
  }

  .mobile-menu { display: flex; }

  .controls { display: none; }
}
