/* ===================================================
   L2Cache — Editorial Split Design System & Tools Theme
   Brand Colors: Mint / Emerald (#00C896), Editorial Serif, DM Sans, DM Mono
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Playfair+Display:ital,wght@0,700;0,800;0,900;1,700;1,800;1,900&display=swap');

:root {
  --purple:      #00C896;
  --purple-dark: #00a87f;
  --purple-deep: #003d2e;
  --pink:        #00C896;
  --bg:          #f7f7f5;
  --bg2:         #ffffff;
  --bg3:         #eeeeea;
  --border:      #e4e4e0;
  --text:        #0a0a0a;
  --text-muted:  #555550;
  --text-dim:    #999992;
  --mono:        "DM Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --serif:       "Playfair Display", Georgia, "Times New Roman", serif;
  --sans:        "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Subtle background noise */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none; z-index: 0; opacity: 0.5;
}

.page-wrap {
  position: relative; z-index: 1;
}

/* ── Navigation ── */
nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 48px;
  background: rgba(247, 247, 245, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
@media (max-width: 768px) { nav { padding: 14px 20px; } }

.nav-logo {
  font-family: var(--mono);
  font-size: 16px; font-weight: 600; color: var(--text);
  text-decoration: none; display: flex; align-items: center; gap: 8px;
}
.nav-logo-icon {
  width: 28px; height: 28px; border-radius: 7px;
  background: #0a0a0a; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.nav-links { display: flex; align-items: center; gap: 24px; list-style: none; }
.nav-links a {
  color: var(--text-muted); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: color 0.15s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-cta {
  background: #0a0a0a; color: #fff !important;
  padding: 9px 20px; border-radius: 100px; font-size: 13px; font-weight: 600;
  text-decoration: none; transition: background 0.2s, transform 0.2s;
}
.nav-cta:hover { background: #222; transform: translateY(-1px); }

/* ── Sticky Offline Challenge Bar ── */
#offline-challenge-bar {
  position: sticky; top: 0; z-index: 1000;
  background: #0a0a0a;
  border-bottom: 2px solid rgba(0, 200, 150, 0.4);
  padding: 10px 24px;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  flex-wrap: wrap;
  transition: all 0.4s ease;
}
#offline-challenge-bar.offline-active {
  background: #180d0d;
  border-bottom-color: #f59e0b;
  animation: offline-pulse-bg 2.5s ease-in-out infinite;
}
@keyframes offline-pulse-bg {
  0%,100% { border-bottom-color: #f59e0b; }
  50% { border-bottom-color: rgba(245,158,11,0.2); }
}
.challenge-left { display: flex; align-items: center; gap: 10px; }
.challenge-icon { font-size: 20px; }
.challenge-text { font-size: 13px; line-height: 1.3; }
.challenge-title { font-weight: 700; color: #fff; }
.challenge-title em { font-style: italic; color: var(--purple); }
.challenge-sub { font-size: 11px; color: #999; }
#offline-toggle-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--purple);
  color: #003d2e; font-weight: 700; font-size: 12px;
  padding: 7px 16px; border-radius: 100px; border: none; cursor: pointer;
  font-family: var(--sans); letter-spacing: 0.02em;
  transition: all 0.2s ease; white-space: nowrap;
}
#offline-toggle-btn:hover { transform: scale(1.03); background: #00dfa8; }
#offline-toggle-btn.is-offline {
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  color: #fff;
}
.challenge-status {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px;
}
.status-pill {
  padding: 3px 10px; border-radius: 100px; font-weight: 700;
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  display: flex; align-items: center; gap: 5px;
}
.status-pill.online  { background: rgba(0, 200, 150, 0.15); color: var(--purple); border: 1px solid rgba(0, 200, 150, 0.3); }
.status-pill.offline { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.4); animation: pill-blink 1.2s infinite; }
@keyframes pill-blink { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.status-dot { width: 6px; height: 6px; border-radius: 50%; }
.online .status-dot { background: var(--purple); box-shadow: 0 0 6px var(--purple); }
.offline .status-dot { background: #f59e0b; }
#offline-timer { color: #f59e0b; font-weight: 600; min-width: 35px; }

/* ── Hero Headline ── */
.article-wrap {
  max-width: 960px; margin: 0 auto;
  padding: 130px 24px 80px; position: relative;
}
.section-label {
  display: inline-block;
  background: rgba(0, 200, 150, 0.12);
  border: 1px solid rgba(0, 200, 150, 0.35);
  border-radius: 100px;
  padding: 4px 14px;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #00a87f;
  margin-bottom: 16px;
  font-weight: 600;
  font-family: var(--mono);
}
h1 {
  font-family: var(--serif);
  font-size: clamp(34px, 5.5vw, 56px);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: -1.5px;
  color: #0a0a0a;
  margin-bottom: 18px;
}
h1 em { font-style: italic; color: var(--purple); }
.hero-sub {
  font-size: 18px; color: var(--text-muted);
  line-height: 1.6; max-width: 680px; margin-bottom: 32px;
}

/* ── Tool Playground Workspace ── */
.tool-workspace {
  background: #111118;
  border-radius: 20px;
  border: 1px solid #242436;
  box-shadow: 0 24px 64px rgba(0,0,0,0.18);
  overflow: hidden;
  margin: 32px 0 48px;
  color: #fff;
}
.tool-header-bar {
  padding: 14px 20px;
  background: #181824;
  border-bottom: 1px solid #28283a;
  display: flex; align-items: center; justify-content: space-between;
}
.tool-title-group { display: flex; align-items: center; gap: 10px; }
.tool-icon-pill {
  width: 30px; height: 30px; border-radius: 8px;
  background: rgba(0, 200, 150, 0.12);
  border: 1px solid rgba(0, 200, 150, 0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--purple);
}
.tool-name-text { font-size: 14px; font-weight: 700; color: #fff; }
.tool-badge-pill {
  font-size: 10px; font-weight: 700; color: var(--purple);
  background: rgba(0, 200, 150, 0.1); border: 1px solid rgba(0, 200, 150, 0.3);
  padding: 3px 8px; border-radius: 100px; font-family: var(--mono);
}
.tool-main-body { padding: 20px; }
.tool-io-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
@media (max-width: 768px) { .tool-io-grid { grid-template-columns: 1fr; } }
.tool-pane { display: flex; flex-direction: column; gap: 6px; }
.pane-label-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; font-weight: 600; color: #888;
  font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.05em;
}
.tool-textarea {
  width: 100%; height: 260px;
  background: #09090e;
  border: 1px solid #222;
  border-radius: 10px;
  padding: 12px 14px;
  color: #e0ffe8;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
}
.tool-textarea:focus { border-color: var(--purple); }
.tool-output-view {
  width: 100%; height: 260px;
  background: #09090e;
  border: 1px solid #222;
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--purple);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.tool-output-view.error { color: #fc6a6a; }

/* ── Tool Control Buttons ── */
.tool-controls {
  display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 6px;
}
.tbtn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  padding: 8px 16px; border-radius: 100px; border: none; cursor: pointer;
  transition: all 0.15s ease;
}
.tbtn-primary { background: var(--purple); color: #003d2e; }
.tbtn-primary:hover { transform: translateY(-1px); background: #00dfa8; }
.tbtn-ghost { background: #1c1c28; color: #bbb; border: 1px solid #2c2c3e; }
.tbtn-ghost:hover { color: #fff; border-color: var(--purple); }
.tbtn-copy { background: rgba(0, 200, 150, 0.15); color: var(--purple); border: 1px solid rgba(0, 200, 150, 0.3); }
.tbtn-copy:hover { background: rgba(0, 200, 150, 0.25); color: #fff; }

/* ── Pac-Man Transform Animation ── */
.pac-track {
  position: relative; width: 100%; height: 44px;
  margin: 12px 0 8px;
  background: #07070a;
  border: 1px solid #20202e;
  border-radius: 8px; overflow: hidden;
  display: none;
}
.pac-track.running { display: block; }
.pac-rail {
  position: absolute; left: 0; right: 0;
  top: 50%; transform: translateY(-50%); height: 2px;
  background: repeating-linear-gradient(
    90deg, rgba(255,255,255,0.08) 0px, rgba(255,255,255,0.08) 6px,
    transparent 6px, transparent 14px
  );
}
.pac-man {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; left: -34px;
}
.pac-jaw-top, .pac-jaw-bot {
  position: absolute; width: 100%; height: 50%;
  background: #FFD700; left: 0;
}
.pac-jaw-top {
  top: 0; border-radius: 14px 14px 0 0;
  transform-origin: center bottom;
  animation: munch-top 0.16s linear infinite alternate;
}
.pac-jaw-bot {
  bottom: 0; border-radius: 0 0 14px 14px;
  transform-origin: center top;
  animation: munch-bot 0.16s linear infinite alternate;
}
.pac-eye {
  position: absolute; top: 5px; right: 7px;
  width: 4px; height: 4px; background: #000; border-radius: 50%;
}
@keyframes munch-top { 0% { transform: rotate(-32deg); } 100% { transform: rotate(0deg); } }
@keyframes munch-bot { 0% { transform: rotate(32deg); } 100% { transform: rotate(0deg); } }
.pac-pellet {
  position: absolute; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  padding: 2px 6px; border-radius: 4px; white-space: nowrap; pointer-events: none;
  background: rgba(0, 200, 150, 0.15); color: var(--purple); border: 1px solid rgba(0, 200, 150, 0.3);
  transition: opacity 0.15s, transform 0.15s;
}
.pac-pellet.eaten { opacity: 0; transform: translateY(-50%) scale(0.2); }
.pac-score {
  position: absolute; font-family: var(--mono); font-size: 11px; font-weight: 700;
  color: #FFD700; pointer-events: none; animation: score-fly 0.6s ease-out forwards;
}
@keyframes score-fly { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-22px); } }
.pac-burst-star {
  position: absolute; top: 50%; right: 12px; font-size: 16px; pointer-events: none;
  animation: burst-star 0.7s ease-out forwards;
}
@keyframes burst-star { 0% { opacity: 0; transform: translateY(-50%) scale(0.2); } 50% { opacity: 1; transform: translateY(-50%) scale(1.3); } 100% { opacity: 0; } }

/* ── Contextual App Conversion Card ── */
.app-bridge-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--purple);
  border-radius: 16px;
  padding: 24px 28px;
  margin: 40px 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; box-shadow: 0 4px 16px rgba(0,0,0,0.04);
}
@media (max-width: 768px) { .app-bridge-card { flex-direction: column; align-items: flex-start; } }
.app-bridge-content h3 {
  font-size: 18px; font-weight: 700; margin-bottom: 4px; color: #0a0a0a;
}
.app-bridge-content p {
  font-size: 14px; color: var(--text-muted); margin-bottom: 0; line-height: 1.5;
}
.app-bridge-btn {
  flex-shrink: 0;
  background: #0a0a0a; color: #fff;
  padding: 11px 22px; border-radius: 100px;
  font-weight: 600; font-size: 13px; text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px;
  transition: background 0.2s, transform 0.2s;
}
.app-bridge-btn:hover { background: #222; transform: translateY(-1px); color: #fff; }

/* ── Educational Guide / Article Content ── */
.article-body h2 {
  font-family: var(--serif); font-weight: 800;
  font-size: clamp(24px, 3.5vw, 32px);
  margin: 48px 0 16px; color: var(--text);
}
.article-body h3 {
  font-size: 18px; font-weight: 700; margin: 28px 0 10px; color: var(--text);
}
.article-body p {
  font-size: 16px; color: var(--text-muted); line-height: 1.7; margin-bottom: 20px;
}
.article-body ul, .article-body ol {
  margin: 0 0 24px 24px; color: var(--text-muted); font-size: 16px; line-height: 1.7;
}
.article-body li { margin-bottom: 8px; }
.article-body code {
  background: #eeeeea; border: 1px solid #e0e0dc;
  padding: 2px 6px; border-radius: 4px; font-family: var(--mono); font-size: 13px; color: #0a0a0a;
}

/* ── FAQ Accordion ── */
.faq-section { margin: 56px 0 32px; }
.faq-item {
  background: #ffffff; border: 1px solid var(--border); border-radius: 12px;
  padding: 20px 24px; margin-bottom: 14px;
}
.faq-q { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.faq-a { font-size: 15px; color: var(--text-muted); line-height: 1.6; }

/* ── Related Tools Grid ── */
.related-tools-section { margin: 56px 0; }
.tools-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px; margin: 20px 0;
}
.tool-card-item {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  display: flex; flex-direction: column; gap: 8px;
}
.tool-card-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  border-color: var(--purple);
}
.tool-card-top { display: flex; align-items: center; justify-content: space-between; }
.tool-card-icon-box {
  width: 34px; height: 34px; border-radius: 8px;
  background: rgba(0, 200, 150, 0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: var(--purple);
}
.tool-card-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  color: #00a87f; background: rgba(0, 200, 150, 0.12);
  padding: 2px 7px; border-radius: 100px; font-family: var(--mono);
}
.tool-card-item h3 { font-size: 16px; font-weight: 700; color: #0a0a0a; margin: 0; }
.tool-card-item p { font-size: 13px; color: var(--text-muted); line-height: 1.4; margin: 0; }

/* ── Footer ── */
footer {
  background: #0a0a0a; color: #888;
  padding: 48px 24px 36px; margin-top: 80px; font-size: 14px;
}
.footer-wrap { max-width: 960px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; }
.footer-brand { font-family: var(--mono); color: #fff; font-size: 16px; font-weight: 600; }
.footer-links { display: flex; gap: 20px; list-style: none; }
.footer-links a { color: #888; text-decoration: none; transition: color 0.15s; }
.footer-links a:hover { color: #fff; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 2000;
  background: #0a0a0a; border: 1px solid var(--purple);
  border-radius: 10px; padding: 12px 18px;
  font-size: 13px; font-weight: 600; color: var(--purple);
  transform: translateY(80px); opacity: 0; transition: all 0.3s cubic-bezier(.34,1.56,.64,1);
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ── Code Export Modal & Drawer ── */
.code-modal-overlay {
  position: fixed; inset: 0; z-index: 1500;
  background: rgba(10, 10, 14, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 20px;
}
.code-modal-overlay.open {
  opacity: 1; pointer-events: auto;
}
.code-modal-box {
  background: #111118;
  border: 1px solid #28283a;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0, 200, 150, 0.2);
  border-radius: 16px;
  width: 100%; max-width: 720px;
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.code-modal-overlay.open .code-modal-box {
  transform: translateY(0) scale(1);
}
.code-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  background: #181824;
  border-bottom: 1px solid #28283a;
}
.code-modal-title-wrap { display: flex; align-items: center; gap: 10px; }
.code-modal-title { font-size: 15px; font-weight: 700; color: #fff; }
.code-modal-badge {
  font-size: 10px; font-weight: 700; color: var(--purple);
  background: rgba(0, 200, 150, 0.12);
  border: 1px solid rgba(0, 200, 150, 0.25);
  border-radius: 100px; padding: 2px 8px; font-family: var(--mono);
}
.code-modal-close-btn {
  background: none; border: none; color: #888; font-size: 20px;
  cursor: pointer; padding: 4px 8px; line-height: 1;
  transition: color 0.15s; border-radius: 6px;
}
.code-modal-close-btn:hover { color: #fff; background: rgba(255,255,255,0.08); }

.code-lang-tabs {
  display: flex; gap: 6px; padding: 10px 20px;
  background: #14141e; border-bottom: 1px solid #222232;
}
.code-lang-btn {
  background: none; border: none; color: #888;
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  padding: 6px 14px; border-radius: 6px; cursor: pointer;
  transition: all 0.15s;
}
.code-lang-btn:hover { color: #fff; background: rgba(255,255,255,0.05); }
.code-lang-btn.active { color: var(--purple); background: rgba(0, 200, 150, 0.12); border: 1px solid rgba(0, 200, 150, 0.3); }

.code-modal-body {
  padding: 16px 20px;
  background: #09090e;
  overflow-y: auto;
  max-height: 420px;
}
.code-pre-box {
  margin: 0; font-family: var(--mono); font-size: 13px; line-height: 1.65;
  color: #e0e0e0; white-space: pre; overflow-x: auto;
}

.code-modal-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; background: #181824; border-top: 1px solid #28283a;
}
.code-modal-note { font-size: 12px; color: #777; font-family: var(--mono); }
.code-modal-actions { display: flex; gap: 10px; }
.tbtn-code-export {
  background: rgba(0, 200, 150, 0.1); border: 1px solid rgba(0, 200, 150, 0.3);
  color: var(--purple); font-size: 12px; font-weight: 700; font-family: var(--mono);
  padding: 5px 12px; border-radius: 6px; cursor: pointer; display: inline-flex;
  align-items: center; gap: 6px; transition: all 0.15s;
}
.tbtn-code-export:hover {
  background: var(--purple); color: #000;
}

