/* =========================================================
   Sudo Vision — hacker terminal design system
   Background: #060807 / #0a0d0b   Surface: #10140f / #161b14
   Text: #eafff0 (primary) / #7d9182 (muted)
   Accent: #39ff88 (phosphor green) — glow used sparingly
   Accent-2: #00d1ff (cold cyan) — secondary hover states
   Display: VT323 (big CRT wordmark)   Body/UI: Share Tech Mono
   ========================================================= */

:root{
  --bg:#060807;
  --bg-soft:#090c0a;
  --surface:#10140f;
  --surface-2:#161c15;
  --border:#1f281f;
  --text:#eafff0;
  --text-muted:#7d9182;
  --text-dim:#4a584c;
  --accent:#39ff88;
  --accent-dim:#22a85c;
  --accent-soft:rgba(57,255,136,.12);
  --accent-2:#00d1ff;
  --danger:#ff5c7a;
  --radius-lg:20px;
  --radius-md:14px;
  --radius-sm:9px;
  --mono:'Share Tech Mono', ui-monospace, 'Courier New', monospace;
  --display:'VT323', var(--mono);
  --sans:'Share Tech Mono', ui-monospace, monospace;
  --shadow-lg:0 20px 60px -20px rgba(0,0,0,.7);
  --glow: 0 0 12px rgba(57,255,136,.45);
  --ease:cubic-bezier(.16,1,.3,1);
}

*,*::before,*::after{box-sizing:border-box;}
html{scroll-behavior:smooth;}
@media (prefers-reduced-motion: reduce){
  html{scroll-behavior:auto;}
  *,*::before,*::after{animation-duration:.001ms !important; animation-iteration-count:1 !important; transition-duration:.001ms !important; scroll-behavior:auto !important;}
}

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:var(--sans);
  -webkit-font-smoothing:antialiased;
  overflow-x:hidden;
}

img{max-width:100%; display:block;}
button{font:inherit; color:inherit;}
a{color:inherit; text-decoration:none;}

.skip-link{
  position:absolute; left:-999px; top:0; background:var(--accent); color:#04140a;
  padding:10px 16px; z-index:999; border-radius:0 0 8px 0; font-weight:700;
}
.skip-link:focus{left:0;}

:focus-visible{ outline:2px solid var(--accent); outline-offset:3px; border-radius:4px; }

.noise-overlay{
  position:fixed; inset:0; pointer-events:none; z-index:1; opacity:.035; mix-blend-mode:overlay;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='90' height='90'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.scanlines{
  position:fixed; inset:0; pointer-events:none; z-index:2; opacity:.05;
  background:repeating-linear-gradient(0deg, #000 0px, #000 1px, transparent 1px, transparent 3px);
}

/* ---------------- hero header (logo / search / actions) ---------------- */
.hero-header{
  max-width:640px; margin:0 auto;
  padding:44px 24px 8px;
  text-align:center;
}
.logo{
  display:inline-flex; align-items:baseline; justify-content:center; gap:1px;
  font-family:var(--display);
  font-size:clamp(40px, 11vw, 58px);
  line-height:1;
  letter-spacing:.01em;
  color:var(--text);
  text-shadow:0 0 18px rgba(57,255,136,.35), 0 0 2px rgba(57,255,136,.5);
}
.logo-prompt{ color:var(--accent); }
.logo-word{ color:var(--text); margin-left:.18em; }
.logo-cursor{
  color:var(--accent); font-weight:400; margin:0 2px;
  animation:blink 1s step-end infinite;
}
@keyframes blink{ 50%{ opacity:0; } }

.hero-tag{
  font-family:var(--mono); color:var(--text-dim); font-size:13px; letter-spacing:.08em;
  margin:10px 0 26px; text-transform:uppercase;
}

.search-wrap{
  position:relative;
  display:flex; align-items:center;
  background:var(--surface);
  border:1px solid var(--border);
  border-radius:999px;
  padding:2px 6px 2px 20px;
  transition:border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.search-wrap:focus-within{
  border-color:var(--accent);
  box-shadow:0 0 0 4px var(--accent-soft);
}
.search-prefix{
  font-family:var(--mono); color:var(--accent-dim); font-size:14px; font-weight:700; padding-right:6px;
}
.search-input{
  flex:1; background:transparent; border:none; color:var(--text);
  font-family:var(--mono); font-size:14.5px; padding:13px 4px; min-width:0;
}
.search-input::placeholder{ color:var(--text-dim); }
.search-input:focus{ outline:none; }
.search-input::-webkit-search-cancel-button{ display:none; }
.search-clear{
  background:none; border:none; color:var(--text-dim); cursor:pointer; padding:4px 8px; font-size:13px;
}
.search-clear:hover{ color:var(--text); }
.search-submit{
  width:38px; height:38px; border-radius:50%; flex-shrink:0;
  background:var(--surface-2); border:1px solid var(--border); color:var(--text-muted);
  display:flex; align-items:center; justify-content:center; cursor:pointer;
}
.search-submit:hover{ color:var(--accent); border-color:var(--accent); }

.header-actions{ display:flex; gap:12px; justify-content:center; margin:18px 0 6px; }
.action-btn{
  display:flex; align-items:center; gap:8px;
  background:var(--surface); border:1px solid var(--border);
  padding:10px 20px; border-radius:999px; cursor:pointer;
  font-family:var(--mono); font-size:13.5px; font-weight:700; color:var(--text-muted);
  letter-spacing:.03em;
  transition:all .18s var(--ease);
}
.action-btn:hover{ color:var(--text); border-color:#2a352a; background:var(--surface-2); transform:translateY(-1px); }
.action-btn.is-active{ color:#04140a; border-color:var(--accent); background:var(--accent); box-shadow:var(--glow); }
#btnFavorites.has-favs svg{ fill:var(--danger); stroke:var(--danger); }

.scroll-cue{
  margin:22px auto 4px; background:none; border:1px solid var(--border); color:var(--text-dim);
  width:40px; height:40px; border-radius:50%; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  animation:float 2.4s ease-in-out infinite;
  transition:color .2s, border-color .2s;
}
.scroll-cue:hover{ color:var(--accent); border-color:var(--accent); }
@keyframes float{ 0%,100%{ transform:translateY(0);} 50%{ transform:translateY(6px);} }

/* ---------------- category chips ---------------- */
.chip-row{
  max-width:1280px; margin:22px auto 0;
  padding:0 24px 8px;
  display:flex; gap:10px; overflow-x:auto;
  scrollbar-width:none;
}
.chip-row::-webkit-scrollbar{ display:none; }
.chip{
  font-family:var(--mono); font-size:12.5px; white-space:nowrap; flex-shrink:0;
  padding:8px 15px; border-radius:20px;
  background:var(--surface); border:1px solid var(--border); color:var(--text-muted);
  cursor:pointer; transition:all .18s var(--ease);
}
.chip::before{ content:"#"; color:var(--text-dim); margin-right:2px; }
.chip:hover{ border-color:#2a352a; color:var(--text); }
.chip.is-active{ background:var(--accent); border-color:var(--accent); color:#04140a; font-weight:700; }
.chip.is-active::before{ color:rgba(4,20,10,.6); }

/* ---------------- sections ---------------- */
.section{ max-width:1280px; margin:0 auto; padding:34px 20px; }
.section-head{
  display:flex; align-items:center; justify-content:space-between; margin-bottom:18px;
  flex-wrap:wrap; gap:10px;
}
.section-head h2{
  font-family:var(--display);
  font-size:32px; letter-spacing:.02em; margin:0; font-weight:400;
  text-transform:uppercase; line-height:1;
}
.section-head h2 .accent-word{ color:var(--accent); text-shadow:0 0 14px rgba(57,255,136,.4); }
.section-head h2 .dim-word{ color:var(--text-dim); margin-left:.3em; }
.section-head .tag{ display:none; }
.view-all{
  background:var(--surface); border:1px solid var(--border); color:var(--text);
  font-family:var(--mono); font-weight:700; font-size:12.5px; cursor:pointer;
  padding:9px 16px; border-radius:999px; letter-spacing:.03em;
  transition:all .18s var(--ease);
}
.view-all:hover{ border-color:var(--accent); color:var(--accent); }

.empty-state{ color:var(--text-muted); text-align:center; padding:40px 0; font-family:var(--mono); font-size:14px; }

/* ---------------- grids & cards (landscape, single column on mobile) ---------------- */
.grid{
  display:grid;
  grid-template-columns:1fr;
  gap:18px;
}
@media (min-width:680px){ .grid{ grid-template-columns:repeat(2, 1fr); } }
@media (min-width:1020px){ .grid{ grid-template-columns:repeat(3, 1fr); } }

.card{
  position:relative;
  border-radius:var(--radius-md);
  overflow:hidden;
  background:var(--surface);
  border:1px solid var(--border);
  cursor:pointer;
  transform:translateZ(0);
  transition:transform .35s var(--ease), border-color .35s var(--ease), box-shadow .35s var(--ease);
}
.card:hover{ transform:translateY(-3px); border-color:var(--accent-dim); box-shadow:0 0 0 1px rgba(57,255,136,.15), var(--shadow-lg); }
.card .card-media{
  position:relative; width:100%;
  aspect-ratio:var(--ar, 16/10);
  overflow:hidden;
  background:linear-gradient(135deg, var(--surface), var(--surface-2));
}
.card img{
  width:100%; height:100%; object-fit:cover; display:block;
  transition:transform .6s var(--ease);
}
.card:hover img{ transform:scale(1.045); }

.card-overlay{
  position:absolute; inset:0;
  background:linear-gradient(0deg, rgba(4,8,5,.88) 0%, rgba(4,8,5,.1) 50%, transparent 68%);
  opacity:0; transition:opacity .28s var(--ease);
  display:flex; flex-direction:column; justify-content:flex-end;
  padding:16px;
}
.card:hover .card-overlay, .card:focus-within .card-overlay{ opacity:1; }
.card-cat{
  font-family:var(--mono); font-size:11px; color:var(--accent); margin:0 0 4px; text-transform:lowercase; letter-spacing:.03em;
}
.card-title{
  font-family:var(--mono); font-size:14.5px; font-weight:700; margin:0 0 12px; color:#fff;
}
.card-actions{ display:flex; gap:8px; }
.card-icon-btn{
  width:34px; height:34px; border-radius:8px;
  background:rgba(10,14,11,.55); border:1px solid rgba(255,255,255,.14);
  backdrop-filter:blur(6px);
  display:flex; align-items:center; justify-content:center;
  color:#fff; cursor:pointer; transition:background .2s, transform .15s;
}
.card-icon-btn:hover{ background:rgba(57,255,136,.2); border-color:var(--accent); transform:scale(1.06); }
.card-icon-btn.is-fav{ color:var(--danger); }
.card-icon-btn.is-fav svg{ fill:var(--danger); stroke:var(--danger); }

.sentinel{ height:1px; }
.loader{ display:flex; justify-content:center; gap:6px; padding:30px 0; }
.loader span{
  width:8px; height:8px; border-radius:50%; background:var(--accent);
  animation:bounce 1.2s infinite ease-in-out;
}
.loader span:nth-child(2){ animation-delay:.15s; }
.loader span:nth-child(3){ animation-delay:.3s; }
@keyframes bounce{ 0%,80%,100%{ transform:scale(.6); opacity:.4;} 40%{ transform:scale(1); opacity:1;} }

/* ---------------- lightbox ---------------- */
.lightbox{ position:fixed; inset:0; z-index:200; display:flex; align-items:center; justify-content:center; }
.lightbox[hidden]{ display:none; }
.lightbox-backdrop{
  position:absolute; inset:0; background:rgba(3,5,4,.94); backdrop-filter:blur(6px);
}
.lightbox-inner{
  position:relative; z-index:2; width:min(920px, 94vw); max-height:92vh;
  display:flex; flex-direction:column;
  animation:pop .28s var(--ease);
}
@keyframes pop{ from{ opacity:0; transform:scale(.96) translateY(10px);} to{ opacity:1; transform:none;} }
.lb-image-wrap{
  position:relative; border-radius:16px; overflow:hidden; background:var(--surface);
  display:flex; align-items:center; justify-content:center;
  max-height:70vh; border:1px solid var(--border);
}
.lb-image-wrap img{ max-height:70vh; width:auto; margin:0 auto; object-fit:contain; }
.lb-spinner{
  position:absolute; width:34px; height:34px; border-radius:50%;
  border:3px solid var(--border); border-top-color:var(--accent);
  animation:spin .8s linear infinite; display:none;
}
.lb-spinner.is-active{ display:block; }
@keyframes spin{ to{ transform:rotate(360deg); } }
.lb-close{
  position:absolute; top:-46px; right:0; background:none; border:none; color:var(--text-muted);
  font-size:20px; cursor:pointer; padding:8px; z-index:3; font-family:var(--mono);
}
.lb-close:hover{ color:var(--accent); }
.lb-nav{
  position:absolute; top:50%; transform:translateY(-50%);
  background:rgba(6,8,7,.6); border:1px solid var(--border); color:#fff;
  width:44px; height:44px; border-radius:50%; font-size:22px; cursor:pointer; z-index:3;
  display:flex; align-items:center; justify-content:center;
}
.lb-nav:hover{ background:var(--accent); border-color:var(--accent); color:#04140a; }
.lb-prev{ left:-8px; }
.lb-next{ right:-8px; }
@media (max-width:720px){ .lb-prev{ left:4px; } .lb-next{ right:4px; } }

.lb-meta{
  display:flex; align-items:flex-start; justify-content:space-between; gap:16px;
  padding:18px 4px 0;
}
.lb-meta-text h3{ margin:0 0 4px; font-size:18px; font-family:var(--mono); }
.lb-meta-text p{ margin:0; color:var(--text-muted); font-family:var(--mono); font-size:12.5px; }
.lb-meta-actions{ display:flex; gap:10px; flex-shrink:0; }
.lb-btn{
  display:flex; align-items:center; gap:8px; padding:10px 16px; border-radius:10px;
  background:var(--surface); border:1px solid var(--border); cursor:pointer; font-weight:700; font-size:13.5px;
  font-family:var(--mono);
}
.lb-btn:hover{ border-color:var(--accent-dim); }
.lb-btn--primary{ background:var(--accent); border-color:var(--accent); color:#04140a; }
.lb-btn--primary:hover{ background:#2fe377; }
.lb-btn--primary:disabled{ opacity:.6; cursor:progress; }
#lbFav.is-fav{ color:var(--danger); border-color:var(--danger); background:rgba(255,92,122,.1); }
#lbFav.is-fav svg{ fill:var(--danger); stroke:var(--danger); }

/* ---------------- toast ---------------- */
.toast{
  position:fixed; bottom:24px; left:50%; transform:translateX(-50%) translateY(20px);
  background:var(--surface-2); border:1px solid var(--accent-dim); color:var(--text);
  padding:12px 20px; border-radius:12px; font-size:13.5px; font-weight:700; font-family:var(--mono);
  opacity:0; pointer-events:none; transition:all .3s var(--ease); z-index:300;
  box-shadow:var(--shadow-lg);
  display:flex; align-items:center; gap:8px;
}
.toast.is-visible{ opacity:1; transform:translateX(-50%) translateY(0); }

/* ---------------- footer ---------------- */
.site-footer{ border-top:1px solid var(--border); margin-top:60px; }
.footer-inner{
  max-width:1280px; margin:0 auto; padding:44px 24px 60px;
  display:flex; flex-direction:column; align-items:center; gap:16px; text-align:center;
}
.footer-copy{ color:var(--text-dim); font-size:13px; font-family:var(--mono); margin:0; }
.footer-nav{ display:flex; flex-wrap:wrap; justify-content:center; gap:22px; }
.footer-nav a{ color:var(--text-muted); font-size:13.5px; font-family:var(--mono); }
.footer-nav a:hover{ color:var(--accent); }

/* ---------------- responsive ---------------- */
@media (max-width:720px){
  .hero-header{ padding:36px 20px 4px; }
  .section{ padding:26px 16px; }
  .section-head h2{ font-size:26px; }
}
