/* ═══════════════════════════════════════════════════════════
   JS TRICKS & TIPS — page styles
   (design tokens inherited from style.css)
   ═══════════════════════════════════════════════════════════ */

.tips-main {
  position: relative;
  z-index: 1;
  padding-top: 40px;
  padding-bottom: 60px;
}

/* ── HERO ──────────────────────────────────────────────────── */
.tips-hero {
  max-width: 780px;
  margin-bottom: 36px;
}

.tips-hero h1 {
  font-family: var(--font-title);
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 14px;
}

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

.tips-hero-sub {
  color: var(--text-dim);
  font-size: 1rem;
  line-height: 1.7;
  max-width: 640px;
}

.tips-hero-sub em {
  color: var(--accent);
  font-style: normal;
  font-weight: 600;
}

/* ── TOOLBAR (search + chips) ──────────────────────────────── */
.tips-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}

/* Sticky on larger screens, matching the CSS animations page:
   transparent at rest, full-width glass bar once pinned. */
@media (min-width: 1024px) {
  .tips-toolbar {
    position: sticky;
    top: 62px;
    z-index: 50;
    margin-inline: calc(50% - 50vw);
    padding: 14px calc(50vw - 50%);
    border-bottom: 1px solid transparent;
    transition: background 0.25s ease, border-color 0.25s ease;
  }

  .tips-toolbar.is-stuck {
    background: rgba(6, 9, 19, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom-color: var(--border);
  }
}

.gallery-search-wrap {
  position: relative;
  max-width: 420px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 1.1rem;
  pointer-events: none;
}

.gallery-search {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  padding: 12px 16px 12px 40px;
  outline: none;
  transition: var(--transition);
}

.gallery-search:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.12);
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-dim);
  font-family: var(--font-title);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.chip:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.2);
}

.chip.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(6, 182, 212, 0.2));
  border-color: var(--secondary);
  color: var(--text);
}

.chip .chip-count {
  opacity: 0.6;
  font-weight: 400;
  margin-left: 4px;
}

.level-chips .chip.active {
  background: rgba(16, 185, 129, 0.12);
  border-color: var(--accent);
}

/* ── SNIPPET LIST ──────────────────────────────────────────── */
.tips-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 860px;
}

.tip-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}

.tip-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.tip-card.hidden { display: none; }

/* Editor window chrome */
.editor-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid var(--border);
}

.editor-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}

.editor-dot.red { background: #ff5f57; }
.editor-dot.yellow { background: #febc2e; }
.editor-dot.green { background: #28c840; }

.editor-file {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-left: 8px;
}

.editor-badges {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}

.level-badge {
  font-family: var(--font-title);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 12px;
  white-space: nowrap;
}

.level-badge.beginner {
  background: rgba(16, 185, 129, 0.14);
  color: var(--accent);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.level-badge.intermediate {
  background: rgba(6, 182, 212, 0.12);
  color: var(--secondary);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.level-badge.pro {
  background: rgba(139, 92, 246, 0.15);
  color: #b79cff;
  border: 1px solid rgba(139, 92, 246, 0.35);
}

.tip-cat-tag {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 12px;
  white-space: nowrap;
}

/* Code area */
.tip-code {
  margin: 0;
  padding: 18px 20px;
  background: #04060b;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.65;
  color: #dbe4f0;
  tab-size: 2;
}

.tip-code code { font-family: inherit; }

/* Syntax token colours */
.tok-keyword { color: #c792ea; }
.tok-string  { color: #a5e08c; }
.tok-comment { color: #5c6a82; font-style: italic; }
.tok-number  { color: #f7a35c; }
.tok-literal { color: #64c9e8; }

/* Body: title, why, actions */
.tip-body {
  padding: 18px 20px 20px;
}

.tip-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.tip-body h3 {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 600;
}

.tip-why {
  color: var(--text-dim);
  font-size: 0.88rem;
  line-height: 1.75;
  border-left: 3px solid var(--secondary);
  padding: 4px 0 4px 14px;
  margin-bottom: 16px;
}

.tip-why strong { color: var(--text); }

.tip-why code,
.tip-body code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--secondary);
}

.tip-actions {
  display: flex;
  gap: 10px;
}

.btn-copy-tip,
.btn-run-tip {
  border-radius: 8px;
  cursor: pointer;
  font-family: var(--font-title);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 9px 20px;
  transition: var(--transition);
}

.btn-copy-tip {
  background: var(--secondary);
  border: 1px solid var(--secondary);
  color: #001018;
}

.btn-copy-tip:hover {
  background: var(--text);
  border-color: var(--text);
}

.btn-run-tip {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--accent);
}

.btn-run-tip:hover {
  background: rgba(16, 185, 129, 0.22);
}

/* Mini console output */
.tip-console {
  margin-top: 14px;
  background: #04060b;
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: 8px;
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.7;
  color: #9fe8c8;
  white-space: pre-wrap;
  word-break: break-word;
  animation: consoleIn 0.25s ease;
}

@keyframes consoleIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.tip-console .console-label {
  display: block;
  color: var(--text-disabled);
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.no-results {
  text-align: center;
  color: var(--text-dim);
  padding: 40px 0;
  font-size: 0.95rem;
}

/* ── ARTICLES (shared look with gallery page) ──────────────── */
.gallery-articles { margin-top: 24px; max-width: 860px; }

.gallery-articles .seo-explanation h2 {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.gallery-articles code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--secondary);
}

/* ── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .tip-code { font-size: 0.72rem; padding: 14px; }
  .tip-body { padding: 14px 16px 16px; }
  .tip-actions { flex-direction: column; }
  .btn-copy-tip, .btn-run-tip { width: 100%; }
}

/* Wide screens (2K+): two snippet columns instead of dead space */
@media (min-width: 1680px) {
  .tips-list {
    max-width: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
  .tips-list .ad-inline { grid-column: 1 / -1; }
  .gallery-articles { max-width: 1100px; }
}
