/* updated_catalogue.css — shared layout for catalogue-style pages
   (software, tooling, exploits, research, writeups, about, news).
   Depends on theme.css for design tokens. Matte, professional, no glow. */

body {
  background-image:
    radial-gradient(900px circle at 15% -10%, rgba(122, 162, 247, 0.06), transparent 60%),
    radial-gradient(700px circle at 100% 0%, rgba(122, 162, 247, 0.04), transparent 55%);
  background-attachment: fixed;
  min-height: 100vh;
}

/* Header ------------------------------------------------------------------ */
.header {
  position: relative;
  text-align: center;
  padding: 72px 20px 48px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(to bottom, rgba(28, 32, 48, 0.35), transparent);
}

.header h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: 12px;
}

.header p {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto;
}

/* Return button ----------------------------------------------------------- */
.return-button {
  position: absolute;
  top: 20px;
  left: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  transition: all var(--speed) var(--ease);
  z-index: 999;
}

.return-button::before {
  content: '\2190';
}

.return-button:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--bg-elev-2);
}

/* Catalogue grid ---------------------------------------------------------- */
.catalogue {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
  padding: 48px 24px 72px;
  max-width: 1200px;
  margin: 0 auto;
}

.item-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  cursor: pointer;
  transition: transform var(--speed) var(--ease),
              border-color var(--speed) var(--ease),
              box-shadow var(--speed) var(--ease),
              background var(--speed) var(--ease);
  display: flex;
  flex-direction: column;
}

.item-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  background: var(--bg-elev-2);
  box-shadow: var(--shadow);
}

.item-image {
  width: 100%;
  height: 168px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.item-image img {
  filter: grayscale(0.15);
  opacity: 0.92;
  transition: transform var(--speed) var(--ease), opacity var(--speed) var(--ease);
}

.item-card:hover .item-image img {
  transform: scale(1.04);
  opacity: 1;
}

.item-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
}

.item-price {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 12px;
}

.item-description {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-muted);
  margin-bottom: 20px;
  flex-grow: 1;
}

.view-more {
  align-self: flex-start;
  background: transparent;
  border: 1px solid var(--border-strong);
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--speed) var(--ease);
}

.view-more:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-hover);
}

/* Modal ------------------------------------------------------------------- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 14, 0.7);
  backdrop-filter: blur(6px);
  z-index: 1000;
  animation: fadeIn var(--speed) var(--ease);
}

.modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 36px;
  max-width: 600px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.close {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  transition: color var(--speed) var(--ease);
}

.close:hover {
  color: var(--danger);
}

.modal-image {
  width: 100%;
  height: 220px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.spec-list {
  list-style: none;
  margin: 20px 0;
}

.spec-list li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
}

.spec-label {
  color: var(--text-muted);
  font-weight: 600;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* "Visit page" style link inside modals ----------------------------------- */
.about-developer-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 28px auto 8px;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 11px 22px;
  color: #0c0f16;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background var(--speed) var(--ease);
}

.about-developer-button:hover {
  background: var(--accent-hover);
  color: #0c0f16;
}

.about-developer-button::after {
  content: '\2192';
}

/* Small screens ----------------------------------------------------------- */
@media (max-width: 600px) {
  .header { padding: 56px 16px 36px; }
  .catalogue { grid-template-columns: 1fr; gap: 18px; padding: 32px 16px 56px; }
}

/* ===========================================================================
   Repository explorer (master–detail catalogue)
   =========================================================================== */
.explorer {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 72px;
  align-items: start;
}

.explorer-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 20px;
}

.explorer-item-wrap {
  display: block;
}

.explorer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  color: var(--text);
  font-family: var(--font);
  transition: background var(--speed) var(--ease),
              border-color var(--speed) var(--ease);
}

.explorer-item:hover {
  background: var(--bg-elev-2);
  border-color: var(--border-strong);
}

.explorer-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.explorer-item.active {
  background: var(--bg-elev-2);
  border-color: var(--border-strong);
  border-left-color: var(--accent);
}

.ex-thumb {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  padding: 7px;
  flex-shrink: 0;
}

.ex-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.ex-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.ex-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ex-lang {
  font-size: 0.68rem;
  color: var(--text-faint);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 2px 9px;
  flex-shrink: 0;
}

.explorer-detail {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  min-height: 420px;
}

.explorer-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
  margin-bottom: 22px;
}

.explorer-detail-head h2 {
  font-size: 1.4rem;
}

.ex-gh-link {
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--accent);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 13px;
  white-space: nowrap;
  transition: all var(--speed) var(--ease);
}

.ex-gh-link:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Rendered README, themed -------------------------------------------------- */
.readme {
  color: var(--text-muted);
  line-height: 1.7;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.readme-status {
  color: var(--text-faint);
  font-style: italic;
}

.readme h1, .readme h2, .readme h3, .readme h4 {
  color: var(--text);
  margin: 1.5em 0 0.6em;
  line-height: 1.3;
}

.readme h1 { font-size: 1.5rem; }
.readme h2 { font-size: 1.25rem; border-bottom: 1px solid var(--border); padding-bottom: 0.3em; }
.readme h3 { font-size: 1.05rem; }
.readme p { margin: 0.8em 0; }
.readme a { color: var(--accent); }
.readme a:hover { text-decoration: underline; }
.readme ul, .readme ol { margin: 0.8em 0; padding-left: 1.4em; }
.readme li { margin: 0.3em 0; }

.readme code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.12em 0.4em;
}

.readme pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  overflow-x: auto;
  margin: 1em 0;
}

.readme pre code {
  background: none;
  border: none;
  padding: 0;
}

.readme blockquote {
  border-left: 3px solid var(--border-strong);
  padding-left: 1em;
  margin: 1em 0;
  color: var(--text-faint);
}

.readme img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.readme hr { border: none; border-top: 1px solid var(--border); margin: 1.5em 0; }

.readme table {
  border-collapse: collapse;
  margin: 1em 0;
  display: block;
  overflow-x: auto;
}

.readme th, .readme td { border: 1px solid var(--border); padding: 8px 12px; }
.readme th { background: var(--bg-elev-2); color: var(--text); }

/* Hide GitHub's heading anchor icons. */
.readme .octicon,
.readme svg.octicon,
.readme a.anchor { display: none; }

/* Download buttons reused inside an explorer detail (e.g. SysProbe). */
.readme .download-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

@media (max-width: 760px) {
  .explorer {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 28px 16px 56px;
  }
  .explorer-list {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 6px;
  }
  .explorer-item { min-width: 230px; }
  .ex-desc { white-space: normal; }
  .explorer-detail { padding: 22px 18px; }
}
