/* =========================================================
   CLOUDSTACKER LAB - SITE-WIDE ADDITIONS (2026-11)
   Accessibility basics + All Tutorials page + 404 page.
   ========================================================= */

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
::selection { background: rgba(37, 99, 235, .22); }
:focus-visible { outline: 3px solid #60a5fa; outline-offset: 2px; border-radius: 6px; }

.csl-skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 2000; padding: 10px 16px; border-radius: 10px;
  background: #2563eb; color: #fff; font-weight: 700; text-decoration: none; transition: top .15s ease;
}
.csl-skip-link:focus { top: 12px; }

/* =========================================================
   ALL TUTORIALS PAGE
   ========================================================= */
.csl-lib { background: #f3f5f9; padding: 34px 0 80px; color: #0f172a; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.csl-lib-shell { width: min(1320px, calc(100% - 48px)); margin: 0 auto; }
.csl-lib-hero {
  position: relative; overflow: hidden; padding: 38px 40px; border-radius: 24px; color: #fff;
  background:
    radial-gradient(circle at 88% 12%, rgba(20, 184, 166, .32), transparent 40%),
    radial-gradient(circle at 10% 110%, rgba(37, 99, 235, .45), transparent 45%),
    linear-gradient(135deg, #0b1220 0%, #12213b 60%, #0f3a44 100%);
  box-shadow: 0 24px 50px -30px rgba(11, 18, 32, .8);
}
.csl-lib-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .35;
  background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 28px 28px; mask-image: linear-gradient(90deg, transparent, #000 60%);
}
.csl-lib-hero > * { position: relative; z-index: 1; }
.csl-lib-kicker { color: #5eead4; font-size: 11.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.csl-lib-hero h1 { margin: 8px 0 10px; font-size: clamp(28px, 3.4vw, 42px); line-height: 1.12; letter-spacing: -.035em; color: #fff; }
.csl-lib-hero p { margin: 0; max-width: 680px; color: #cbd5e1; font-size: 15.5px; line-height: 1.65; }
.csl-lib-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.csl-lib-stats span { display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px; border-radius: 999px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); font-size: 13px; font-weight: 700; color: #e2e8f0; }
.csl-lib-stats i { color: #5eead4; }

.csl-lib-toolbar {
  position: sticky; top: 76px; z-index: 50; display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin: 20px 0 18px; padding: 12px; border-radius: 16px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
  border: 1px solid #e2e8f0; box-shadow: 0 10px 26px -20px rgba(15, 23, 42, .5);
}
.csl-lib-search { position: relative; flex: 1 1 300px; }
.csl-lib-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #94a3b8; }
.csl-lib-search input {
  width: 100%; box-sizing: border-box; padding: 11px 70px 11px 40px; border-radius: 12px; border: 1px solid #e2e8f0; background: #f8fafc;
  font-size: 14.5px; color: #0f172a; outline: none; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.csl-lib-search input:focus { background: #fff; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }
.csl-lib-search kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); padding: 2px 7px; border-radius: 6px; border: 1px solid #e2e8f0; background: #fff; color: #64748b; font-size: 11px; font-family: inherit; }
.csl-lib-sort { padding: 10px 12px; border-radius: 12px; border: 1px solid #e2e8f0; background: #fff; font-size: 13.5px; font-weight: 600; color: #334155; }
.csl-lib-chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; width: 100%; scrollbar-width: thin; }
.csl-lib-chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid #e2e8f0; background: #fff; color: #475569; font-size: 12.5px; font-weight: 700; text-decoration: none; transition: all .15s ease;
}
.csl-lib-chip small { color: #94a3b8; font-weight: 700; }
.csl-lib-chip:hover { border-color: #93c5fd; color: #1d4ed8; }
.csl-lib-chip.is-active { background: #0f172a; border-color: #0f172a; color: #fff; }
.csl-lib-chip.is-active small { color: #94a3b8; }

.csl-lib-count { margin: 0 0 14px; color: #64748b; font-size: 13.5px; font-weight: 600; }
.csl-lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.csl-lib-card {
  --t-fg: #2563eb; --t-soft: #eff6ff;
  display: flex; flex-direction: column; min-width: 0; overflow: hidden; border-radius: 18px; background: #fff; border: 1px solid #e2e8f0;
  text-decoration: none; color: inherit; box-shadow: 0 1px 2px rgba(15,23,42,.04); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.csl-lib-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--t-fg) 35%, #e2e8f0); box-shadow: 0 20px 36px -24px rgba(15, 23, 42, .45); }
.csl-lib-thumb { position: relative; aspect-ratio: 16 / 8.5; background: linear-gradient(135deg, var(--t-soft), #fff); display: grid; place-items: center; overflow: hidden; border-bottom: 1px solid #eef2f7; }
.csl-lib-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.csl-lib-card:hover .csl-lib-thumb img { transform: scale(1.03); }
.csl-lib-thumb > i { font-size: 38px; color: var(--t-fg); opacity: .85; }
.csl-lib-badge { position: absolute; left: 12px; top: 12px; display: inline-flex; gap: 6px; align-items: center; padding: 5px 10px; border-radius: 999px; background: rgba(255,255,255,.94); color: #0f172a; font-size: 11px; font-weight: 800; box-shadow: 0 4px 12px rgba(15,23,42,.12); }
.csl-lib-badge i { color: var(--t-fg); }
.csl-lib-body { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px 18px; flex: 1; }
.csl-lib-body h2 { margin: 0; font-size: 16.5px; line-height: 1.4; letter-spacing: -.01em; color: #0f172a; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.csl-lib-body p { margin: 0; color: #64748b; font-size: 13.5px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.csl-lib-meta { margin-top: auto; padding-top: 8px; display: flex; flex-wrap: wrap; gap: 12px; color: #94a3b8; font-size: 12px; font-weight: 600; }
.csl-lib-meta i { margin-right: 4px; }
.csl-lib-empty { grid-column: 1 / -1; padding: 50px 20px; text-align: center; border-radius: 18px; border: 1px dashed #cbd5e1; background: #fff; color: #64748b; }
.csl-lib-empty i { font-size: 30px; color: #94a3b8; display: block; margin-bottom: 10px; }

/* Topic colours (same as homepage) */
.csl-lib-card.csl-topic--aws      { --t-fg: #f59e0b; --t-soft: #fff7ed; }
.csl-lib-card.csl-topic--linux    { --t-fg: #ca8a04; --t-soft: #fefce8; }
.csl-lib-card.csl-topic--windows  { --t-fg: #0078d4; --t-soft: #eef6fc; }
.csl-lib-card.csl-topic--python   { --t-fg: #3776ab; --t-soft: #eef4fa; }
.csl-lib-card.csl-topic--docker   { --t-fg: #1d63ed; --t-soft: #eef2ff; }
.csl-lib-card.csl-topic--cloud    { --t-fg: #0ea5e9; --t-soft: #f0f9ff; }
.csl-lib-card.csl-topic--database { --t-fg: #0d9488; --t-soft: #f0fdfa; }
.csl-lib-card.csl-topic--devops   { --t-fg: #7c3aed; --t-soft: #f5f3ff; }
.csl-lib-card.csl-topic--security { --t-fg: #dc2626; --t-soft: #fef2f2; }
.csl-lib-card.csl-topic--apple    { --t-fg: #475569; --t-soft: #f1f5f9; }

@media (max-width: 680px) {
  .csl-lib-shell { width: calc(100% - 24px); }
  .csl-lib-hero { padding: 26px 22px; border-radius: 18px; }
  .csl-lib-toolbar { top: 66px; }
  .csl-lib-search kbd { display: none; }
}

/* =========================================================
   404 PAGE
   ========================================================= */
.csl-404 { background: #f3f5f9; padding: 60px 0 90px; }
.csl-404-card { width: min(760px, calc(100% - 32px)); margin: 0 auto; padding: 44px 36px; border-radius: 24px; background: #fff; border: 1px solid #e2e8f0; text-align: center; box-shadow: 0 24px 50px -36px rgba(15, 23, 42, .5); }
.csl-404-code { font: 800 64px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: -.04em; background: linear-gradient(135deg, #2563eb, #0d9488); -webkit-background-clip: text; background-clip: text; color: transparent; }
.csl-404-card h1 { margin: 14px 0 8px; font-size: 26px; color: #0f172a; letter-spacing: -.02em; }
.csl-404-card p { margin: 0 auto; max-width: 520px; color: #64748b; line-height: 1.65; }
.csl-404-term { margin: 22px auto 0; max-width: 520px; text-align: left; padding: 14px 16px; border-radius: 12px; background: #0b1020; color: #cbd5e1; font: 13px/1.7 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.csl-404-term b { color: #5eead4; font-weight: 600; }
.csl-404-term span { color: #f87171; }
.csl-404-search { display: flex; gap: 8px; max-width: 460px; margin: 22px auto 0; }
.csl-404-search input { flex: 1; padding: 11px 14px; border-radius: 12px; border: 1px solid #e2e8f0; font-size: 14px; }
.csl-404-search button, .csl-404-btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 16px; border-radius: 12px; border: 0; background: #2563eb; color: #fff; font-weight: 700; font-size: 14px; text-decoration: none; cursor: pointer; }
.csl-404-links { margin-top: 26px; text-align: left; }
.csl-404-links h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: #64748b; margin: 0 0 10px; }
.csl-404-links a { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 10px; color: #0f172a; text-decoration: none; font-weight: 600; font-size: 14px; }
.csl-404-links a:hover { background: #f1f5f9; color: #1d4ed8; }
.csl-404-links a i { color: #2563eb; }
