:root{
  --bg: #060913;
  --panel: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.14);
  --text: #e6e9f2;
  --muted: rgba(230,233,242,0.72);

  --blue: #4cc9ff;
  --green: #34d399;
  --amber: #fbbf24;
  --purple: #a78bfa;
  --pink: #fb7185;
}

*{ box-sizing: border-box; }

html, body { overflow-x: hidden; }

body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 12% 0%, rgba(76,201,255,0.26), transparent 58%),
    radial-gradient(850px 450px at 88% 12%, rgba(52,211,153,0.18), transparent 58%),
    radial-gradient(800px 450px at 60% 95%, rgba(167,139,250,0.14), transparent 55%),
    linear-gradient(180deg, #050714, #060913 60%, #050714);
  min-height: 100vh;
}

.no-scroll{ overflow: hidden; }

/* NAV */
.topnav{
  max-width: 1100px;
  margin: 28px auto 0;
  padding: 14px 18px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(10px);
}

.topnav a{
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  margin-right: 16px;
  padding: 8px 10px;
  border-radius: 10px;
  display: inline-block;
}

.topnav a:hover{ background: rgba(255,255,255,0.06); }

.topnav a.active{
  background: rgba(76,201,255,0.12);
  border: 1px solid rgba(76,201,255,0.25);
}

/* HERO */
.hero{
  max-width: 1100px;
  margin: 24px auto 0;
  padding: 24px 18px 10px;
}

.hero h1{
  margin: 0 0 8px;
  font-size: 36px;
}

.hero p{
  margin: 0;
  color: var(--muted);
  max-width: 80ch;
}

/* GRID */
.grid{
  max-width: 1100px;
  margin: 18px auto 0;
  padding: 0 18px 50px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}

.card{
  grid-column: span 12;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  position: relative;
  overflow: hidden;
}

@media (min-width: 900px){
  .card{ grid-column: span 6; }
  .card.wide{ grid-column: 1 / -1; }
}

/* Glow border */
.card:before{
  content: "";
  position: absolute;
  inset: -2px;
  background: linear-gradient(90deg,
    rgba(76,201,255,0.35),
    rgba(52,211,153,0.25),
    rgba(167,139,250,0.22),
    rgba(251,191,36,0.18)
  );
  filter: blur(20px);
  opacity: 0.35;
  z-index: 0;
}

.card > *{ position: relative; z-index: 1; }

.card-top{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card h2{
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.card h3{
  margin: 16px 0 8px;
  font-size: 14px;
  color: rgba(230,233,242,0.92);
  letter-spacing: 0.2px;
}

.card p, .card ul{
  color: var(--muted);
}

.card ul{
  margin: 10px 0 0 18px;
}

/* BADGES */
.badges{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.badge{
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  background: rgba(255,255,255,0.04);
  white-space: nowrap;
}

.badge.net{ border-color: rgba(76,201,255,0.45); background: rgba(76,201,255,0.12); color: var(--blue); }
.badge.sec{ border-color: rgba(52,211,153,0.45); background: rgba(52,211,153,0.12); color: var(--green); }
.badge.ops{ border-color: rgba(251,191,36,0.45); background: rgba(251,191,36,0.12); color: var(--amber); }
.badge.vm{ border-color: rgba(167,139,250,0.45); background: rgba(167,139,250,0.12); color: var(--purple); }
.badge.cloud{ border-color: rgba(251,113,133,0.45); background: rgba(251,113,133,0.12); color: var(--pink); }

/* Tags */
.tags{ margin-top: 12px; }

.tags span{
  display: inline-block;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  margin-right: 8px;
  margin-top: 6px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.05);
}

/* Diagram */
.diagram{
  margin-top: 12px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.12);
  overflow: auto;
}

.diagram code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12.5px;
  color: rgba(230,233,242,0.92);
  white-space: pre;
}

/* View description (details/summary) */
.more{ margin-top: 12px; }

.more summary::-webkit-details-marker{ display: none; }

.more-summary{
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(76,201,255,0.35);
  background: rgba(76,201,255,0.14);
  color: rgba(230,233,242,0.92);
  font-weight: 800;
  font-size: 13px;
  transition: transform 0.18s ease, background 0.18s ease;
}

.more-summary:hover{
  background: rgba(76,201,255,0.22);
  transform: translateY(-1px);
}

.chev{
  color: rgba(230,233,242,0.75);
  transition: transform 0.18s ease;
  font-size: 14px;
}

.more[open] .chev{ transform: rotate(180deg); }

.more-body{
  margin-top: 12px;
  padding-top: 2px;
}

/* Toggle + hint row */
.viewer-actions{
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  width: 100%;
}

.hint{
  font-size: 12.5px;
  color: rgba(230,233,242,0.70);
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.03);
  padding: 6px 10px;
  border-radius: 999px;
}

/* Toggle Button */
.toggle-btn{
  padding: 10px 16px;
  font-weight: 800;
  border-radius: 12px;
  border: 1px solid rgba(76,201,255,0.35);
  background: rgba(76,201,255,0.14);
  color: var(--text);
  cursor: pointer;
  transition: all 0.25s ease;
}

.toggle-btn:hover{
  background: rgba(76,201,255,0.22);
  transform: translateY(-1px);
}

/* Expand/collapse image container (FIXED) */
.hidden-image{
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.45s ease, opacity 0.35s ease, padding 0.35s ease;
  margin-top: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.03);
  padding: 0;
}

.hidden-image.open{
  opacity: 1;
  padding: 12px;
  max-height: 900px; /* prevents layout blowouts */
}

/* Clickable image button (preview) */
.img-btn{
  position: relative;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  display: block;
  border-radius: 12px;
  overflow: hidden;
}

.img-btn img{
  width: 100%;
  height: auto;
  display: block;
  max-height: 520px;      /* keeps preview clean */
  object-fit: contain;
  background: rgba(0,0,0,0.25);
}

.img-overlay{
  position: absolute;
  right: 12px;
  bottom: 12px;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.35);
  color: rgba(230,233,242,0.92);
  backdrop-filter: blur(8px);
}

/* Meta + Footer */
.meta{
  margin-top: 12px;
  font-size: 13px;
  color: rgba(230,233,242,0.70);
}

.footer{
  max-width: 1100px;
  margin: 0 auto 40px;
  padding: 0 18px;
  color: var(--muted);
  font-size: 13px;
}

/* LIGHTBOX (FIXED) */
.lightbox{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(6px);
  display: none;
  z-index: 9999;
}

.lightbox.open{
  display: grid;
  grid-template-rows: auto 1fr;
}

.lightbox-top{
  width: 100%;
  max-width: 1200px;
  margin: 14px auto 10px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: rgba(230,233,242,0.92);
}

.lightbox-title{
  font-weight: 800;
  letter-spacing: 0.2px;
}

.lightbox-sub{
  display: inline-block;
  margin-left: 10px;
  font-weight: 600;
  font-size: 12px;
  color: rgba(230,233,242,0.70);
}

.lightbox-controls{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.lb-btn{
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: rgba(230,233,242,0.92);
  padding: 8px 10px;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.lb-btn:hover{
  background: rgba(255,255,255,0.10);
  transform: translateY(-1px);
}

.lb-btn.close{
  border-color: rgba(251,113,133,0.35);
  background: rgba(251,113,133,0.10);
}

.lb-btn.close:hover{
  background: rgba(251,113,133,0.16);
}

.lightbox-stage{
  width: 100%;
  max-width: 1200px;
  height: calc(100vh - 86px);
  margin: 0 auto 18px;
  padding: 0 14px 14px;
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: grab;
}

.lightbox-stage.dragging{ cursor: grabbing; }

.lightbox-stage img{
  max-width: 100%;
  max-height: 100%;
  transform-origin: center center;
  transition: transform 0.05s linear;
  user-select: none;
  -webkit-user-drag: none;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.02);
  display: block;
}
