/* Technologia Buddy — Main Stylesheet */

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

:root {
  /* Dark (default) */
  --bg: #0a0a0f;
  --surface: #111118;
  --card: #181820;
  --accent: #3b82f6;
  --accent2: #ff6b6b;
  --text: #e8e8f0;
  --text-secondary: #b0b0c8;
  --muted: #8888a0;
  --border: #2a2a3a;
  --glow: rgba(108, 99, 255, 0.15);
  --overlay: rgba(0,0,0,0.6);
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
  --radius: 12px;
  --max-width: 1100px;
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg: #f4f4fa;
  --surface: #ffffff;
  --card: #eeeef6;
  --accent: #2563eb;
  --accent2: #e05555;
  --text: #1a1a2e;
  --text-secondary: #4a4a5e;
  --muted: #77778a;
  --border: #dcdce8;
  --glow: rgba(90, 82, 216, 0.12);
  --overlay: rgba(0,0,0,0.25);
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

::selection {
  background: var(--accent);
  color: #fff;
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--transition), color var(--transition);
}

/* ============ CONTAINER ============ */

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

/* ============ HEADER ============ */

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  transition: background var(--transition), border-color var(--transition),
              transform 0.3s ease;
}

header.header--hidden {
  transform: translateY(-100%);
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: nowrap;
  min-width: 0;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
  white-space: nowrap;
}

/* Theme Toggle — plain icon, no circle background, positioned on the right */
header .theme-toggle {
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 1.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  transition: transform 0.2s, color var(--transition);
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
}

header .theme-toggle:hover {
  transform: scale(1.15);
}

header .theme-toggle:active {
  transform: scale(0.85);
}

header .theme-toggle .icon {
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

header .theme-toggle.spin .icon {
  transform: rotate(360deg);
}

/* Theme toggle wrapper — groups toggle with nav on the right */
.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 24px;
  font-size: 0.95rem;
  font-weight: 500;
  position: relative;
  transition: color 0.2s;
}

nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  transition: width 0.25s ease;
}

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

nav a:hover::after {
  width: 100%;
}

/* ============ BACK TO TOP ============ */

.hero {
  text-align: center;
  padding: 80px 20px 60px;
}

.hero h1 {
  font-size: 2.8rem;
  font-weight: 800;
  margin-bottom: 16px;
  line-height: 1.2;
}

.hero .accent {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--muted);
  font-size: 1.2rem;
  max-width: 600px;
  margin: 0 auto 32px;
  transition: color var(--transition);
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  padding: 12px 28px;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.btn.primary:hover {
  background: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--glow);
}

.btn.secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), transform 0.2s;
}

.btn.secondary:hover {
  background: var(--border);
  transform: translateY(-2px);
}

/* ============ FEATURES ============ */

.features {
  padding: 60px 0;
}

.features .container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

@media (max-width: 768px) {
  .features .container {
    grid-template-columns: 1fr;
  }
}

.feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 24px;
  transition: background var(--transition), border-color var(--transition),
              transform 0.25s, box-shadow 0.25s;
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 50%), var(--glow), transparent 60%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 30px var(--glow);
}

.feature-card:hover::before {
  opacity: 1;
}

.feature-card h3 {
  font-size: 1.2rem;
  margin-bottom: 10px;
}

.feature-card p {
  color: var(--muted);
  font-size: 0.95rem;
  transition: color var(--transition);
}

/* ============ POSTS ============ */

.category-hero { text-align: center; padding: 40px 20px 20px; }
.category-hero h1 { font-size: 1.8em; margin-bottom: 8px; color: #ffffff; }
.category-hero p { color: #ccccdd; }

.latest-posts, .posts-list {
  padding: 40px 0 60px;
}

.latest-posts h2, .page-header h1 {
  font-size: 1.8rem;
  margin-bottom: 24px;
  color: #ffffff;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

@media (max-width: 768px) {
  .post-grid {
    grid-template-columns: 1fr;
  }
}

a.post-card-link, a.post-card-link:link, a.post-card-link:visited {
  text-decoration: none;
  color: inherit;
  display: block;
}
a.post-card:link, a.post-card:visited {
  color: inherit;
  text-decoration: none;
}
.post-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: background var(--transition), border-color var(--transition),
              transform 0.25s, box-shadow 0.25s;
}

.post-body h3 a, .post-body h3 a:link, .post-body h3 a:visited {
  color: #ffffff;
  text-decoration: none;
}
.post-body h3 a:hover {
  color: var(--accent);
}

.post-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow: 0 8px 30px var(--glow);
}

.post-img {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.4s ease;
  background: var(--card);
  position: relative;
}

.post-img img {
  width: 100%;
  height: auto;
  display: block;
}

.post-card:hover .post-img {
  transform: scale(1.05);
}

.post-body {
  padding: 20px;
}

.tag {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
  font-weight: 600;
}

.post-body h2, .post-body h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.35;
  color: var(--text);
}

.post-body p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 12px;
  transition: color var(--transition);
}

/* Post card children — force explicit not-purple colors (browser :visited color
   does NOT cascade from parent <a> to children due to privacy restrictions) */
.activity-info strong {
  display: block;
  margin-bottom: 2px;
}
.post-body .post-category {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--accent, #3b82f6);
  font-weight: 600;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.post-body .post-excerpt {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 8px;
}
.post-body .post-date {
  display: inline-block;
  font-size: 0.78rem;
  color: var(--text-secondary, #888);
}

/* Article body links — bright, readable, no purple visited */
.article-body a, .article-body a:link, .article-body a:visited {
  color: #4a9eff;
  text-decoration: underline;
  font-weight: 500;
}
.article-body a:hover {
  color: #7cb9ff;
  text-decoration: underline;
}

/* Affiliate CTA buttons — prevent .article-body a from overriding */
.article-body a.affiliate-cta,
.article-body a.affiliate-cta:link,
.article-body a.affiliate-cta:visited {
  color: #fff;
  text-decoration: none;
}
.article-body a.affiliate-cta:hover {
  color: #fff;
  text-decoration: none;
}

.read-more {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: color var(--transition), gap 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.read-more:hover {
  gap: 8px;
}

/* ============ PAGE HEADER ============ */

.page-header {
  text-align: center;
  padding: 60px 20px 30px;
}

.page-header p {
  color: var(--muted);
  font-size: 1.1rem;
  transition: color var(--transition);
}

/* ============ CATEGORIES ============ */

.categories-grid .container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding-bottom: 60px;
}

@media (max-width: 768px) {
  .categories-grid .container {
    grid-template-columns: repeat(2, 1fr);
  }
}

.category-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: background var(--transition), border-color var(--transition),
              transform 0.25s, box-shadow 0.25s, color var(--transition);
}

.category-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 8px 30px var(--glow);
}

.category-card span {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 10px;
}

.category-card h3 {
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.category-card p {
  color: var(--muted);
  font-size: 0.85rem;
  transition: color var(--transition);
}

/* ============ CONTENT PAGE ============ */

.content-page {
  padding: 20px 0 60px;
}

.content-page p {
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 700px;
  transition: color var(--transition);
}

/* ============ CONTACT FORM ============ */

.contact-form {
  max-width: 500px;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: background var(--transition), border-color var(--transition),
              color var(--transition), box-shadow 0.2s;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--glow);
}

.contact-form textarea {
  resize: vertical;
}

/* ============ BACK TO TOP ============ */

.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1100;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease,
              background var(--transition), border-color var(--transition),
              color var(--transition), box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 6px 20px var(--glow);
}

.back-to-top.visible:hover {
  transform: translateY(-3px);
}

.back-to-top:active {
  transform: scale(0.9);
}

/* ============ SCROLL REVEAL ============ */

.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }

/* ============ FOOTER ============ */

footer {
  margin-top: auto;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
  transition: background var(--transition), border-color var(--transition);
}

footer p {
  color: var(--muted);
  font-size: 0.85rem;
  transition: color var(--transition);
}

/* Responsive logo on tiny mobile */
@media (max-width: 400px) {
  .logo {
    font-size: 1.2rem;
  }
  header {
    padding: 14px 0;
  }
}

@media (max-width: 640px) {
  header {
    padding: 14px 0;
  }
}

/* Related articles section must always be visible (not hidden by fade-section JS) */
/* Constrain product images in articles */
.cmp-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.image-wrap { max-width: 100%; overflow: hidden; }
.image-wrap img { max-width: 100%; height: auto; display: block; }
figure { margin: 0; }

/* Comparison table overflow prevention */
.cmp-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }





#related {
  opacity: 1 !important;
  transform: none !important;
}

/* ============ NEWS SECTION ============ */

.news-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 2px 10px;
  border-radius: 20px;
  color: #fff;
  white-space: nowrap;
}

.news-card {
  background: var(--card, #181820);
  border-radius: var(--radius, 12px);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid var(--border, #2a2a3a);
}
.news-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
  border-color: var(--accent, #3b82f6);
}
.news-card a {
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.news-card-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface, #111118);
}
.news-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.news-card-body {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.news-card-body h2 {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
  color: var(--text, #e8e8f0);
}
.news-card-body p {
  font-size: 0.85rem;
  color: var(--text-secondary, #b0b0c8);
  margin: 0;
  line-height: 1.5;
  flex: 1;
}
.news-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--muted, #8888a0);
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border, #2a2a3a);
}
.news-card-meta .news-author {
  color: var(--accent, #3b82f6);
  font-weight: 500;
}

/* News grid (2x2 on desktop) */
.news-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin: 20px 0;
}

/* News list (compact) */
.news-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 20px 0;
}
.news-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border, #2a2a3a);
}
.news-list-item:last-child {
  border-bottom: none;
}
.news-list-item a {
  flex: 1;
  color: inherit;
  text-decoration: none;
}
.news-list-item a:hover h3 {
  color: var(--accent, #3b82f6);
}
.news-list-item h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 2px;
  transition: color 0.15s;
}
.news-list-item p {
  font-size: 0.8rem;
  color: var(--text-secondary, #b0b0c8);
  margin: 0;
}
.news-list-date {
  font-size: 0.78rem;
  color: var(--muted, #8888a0);
  white-space: nowrap;
  flex-shrink: 0;
}

/* News section heading separator */
.news-section-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 32px 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.news-section-title:after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border, #2a2a3a);
}

@media (max-width: 640px) {
  .news-grid {
    grid-template-columns: 1fr;
  }
  .news-list-item {
    flex-wrap: wrap;
  }
  .news-list-date {
    width: 100%;
    padding-left: 0;
  }
}

/* Mobile: pros-cons grid must collapse to single column to prevent overflow zoom-out */
@media (max-width: 640px) {
  .pros-cons {
    grid-template-columns: 1fr !important;
  }
}

/* ============ FOLDING TABLE OF CONTENTS (TOC) ============ */
/* Shared across all articles — inline style overrides if needed */
.toc-wrap { background: var(--card,#181820); border: 1px solid var(--border,#2a2a3a); border-radius: 12px; padding: 0; margin: 24px 0; overflow: hidden; }
.toc-header { padding: 14px 20px; background: var(--surface,#111118); cursor: pointer; display: flex; align-items: center; justify-content: space-between; font-weight: 800; font-size: 1rem; user-select: none; letter-spacing: 0.3px; }
.toc-toggle { font-size: 0.9rem; transition: transform 0.2s; }
.toc-toggle.open { transform: rotate(180deg); }
.toc-body { padding: 6px 20px 14px; }
.toc-body.collapsed { display: none; }
.toc-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 0.92rem; border-bottom: 1px solid var(--border,#2a2a3a); }
.toc-item:last-child { border-bottom: none; }
.toc-item a { color: var(--text,#e0e0e8); text-decoration: none; flex: 1; font-weight: 600; }
.toc-item a:hover { color: var(--accent,#3b82f6); }
.toc-num { width: 22px; height: 22px; border-radius: 50%; background: var(--accent,#3b82f6); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 800; flex-shrink: 0; }
.toc-item .toc-icon { font-size: 1rem; }
