/*
  PULSAR STORE — DESIGN SYSTEM (os.inled.es)
  Pure typography, flat layout, undeformed spinner, double-layer security review.
*/

:root {
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "Roboto Mono", Consolas, monospace;
  --max-width: 1100px;
  --transition-speed: 0.2s;

  /* Warm Light Theme (Default) */
  --bg-color: #f6f4ee;
  --bg-card: #ffffff;
  --bg-card-hover: #fcfbfa;
  --bg-highlight: #edeae2;
  --bg-success: rgba(5, 150, 105, 0.08);

  --text-primary: #111111;
  --text-secondary: #5b5952;
  --text-muted: #8c897e;
  --border-color: #e9e6dc;
  --border-focus: #c9c6bb;

  --accent-purple: #966ce8;
  --accent-blue: #676ff8;
  --accent-btn-bg: #676ff8;
  --accent-btn-text: #ffffff;
  --accent-sec-bg: #ffffff;
  --accent-sec-text: #111111;
  --accent-sec-border: #e9e6dc;

  --status-green: #059669;
}

/* Deep Pulsar Dark Theme */
html.dark {
  --bg-color: #0d0b15;
  --bg-card: #171424;
  --bg-card-hover: #1e1b2e;
  --bg-highlight: #1d192e;
  --bg-success: rgba(16, 185, 129, 0.12);

  --text-primary: #f5f4f9;
  --text-secondary: #9c99b5;
  --text-muted: #6e6a88;
  --border-color: #25213b;
  --border-focus: #3b355a;

  --accent-purple: #966ce8;
  --accent-blue: #676ff8;
  --accent-btn-bg: #966ce8;
  --accent-btn-text: #ffffff;
  --accent-sec-bg: #171424;
  --accent-sec-text: #f5f4f9;
  --accent-sec-border: #25213b;

  --status-green: #10b981;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

a {
  color: var(--accent-purple);
  text-decoration: none;
  transition: color var(--transition-speed) ease;
}
a:hover {
  color: var(--accent-blue);
}

button, input, select {
  font-family: var(--font-body);
  color: inherit;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================================================
   Header (Floating Pill Navbar)
   ========================================================================== */
.site-header {
  position: sticky;
  top: 16px;
  z-index: 100;
  max-width: var(--max-width);
  width: calc(100% - 32px);
  margin: 0 auto;
  height: 64px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  transition: all var(--transition-speed) ease;
}

html.dark .site-header {
  background: rgba(23, 20, 36, 0.90);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.header-container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-img {
  height: 32px;
  width: auto;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}
.logo-text b {
  color: var(--accent-purple);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-link {
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 4px;
  transition: color var(--transition-speed) ease;
}
.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-speed) ease;
}
.btn-icon:hover {
  color: var(--text-primary);
  border-color: var(--border-focus);
  background: var(--bg-card-hover);
}

/* ==========================================================================
   Buttons & Non-Deformed Circular Spinner
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 100px;
  cursor: pointer;
  transition: all var(--transition-speed) cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid transparent;
  text-decoration: none;
  min-height: 40px;
  box-sizing: border-box;
}

.btn-sm {
  padding: 6px 18px;
  font-size: 0.82rem;
  min-height: 32px;
}

.btn-primary {
  background-color: var(--accent-btn-bg);
  color: var(--accent-btn-text);
}
.btn-primary:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  text-decoration: none;
}

.btn-secondary {
  background-color: var(--accent-sec-bg);
  color: var(--accent-sec-text);
  border-color: var(--accent-sec-border);
}
.btn-secondary:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--border-focus);
  transform: translateY(-1px);
  text-decoration: none;
}

.btn.loading {
  pointer-events: none;
  opacity: 0.9;
}

/* Perfectly Circular Non-Deformed Spinner */
.btn-spinner {
  display: block;
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  max-width: 16px;
  max-height: 16px;
  box-sizing: border-box;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
  aspect-ratio: 1 / 1;
}

.btn-secondary .btn-spinner {
  border-color: rgba(150, 108, 232, 0.3);
  border-top-color: var(--accent-purple);
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Hero Section & Search
   ========================================================================== */
.hero-section {
  padding: 48px 0 24px 0;
  text-align: center;
}

.hero-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 8px;
}

.accent-text {
  color: var(--accent-purple);
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 580px;
  margin-bottom: 24px;
}

.search-box {
  width: 100%;
  max-width: 460px;
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 24px;
}

.search-box .search-icon {
  position: absolute;
  left: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  padding: 12px 42px 12px 44px;
  font-size: 0.95rem;
  color: var(--text-primary);
  outline: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  transition: border-color var(--transition-speed) ease;
}
.search-box input:focus {
  border-color: var(--border-focus);
}

.search-clear-btn {
  position: absolute;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 100px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-speed) ease;
}
.pill-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-focus);
}
.pill-btn.active {
  background: var(--accent-btn-bg);
  border-color: transparent;
  color: var(--accent-btn-text);
}

.pill-count {
  font-size: 0.75rem;
  padding: 1px 6px;
  border-radius: 100px;
  background: rgba(0, 0, 0, 0.08);
}
.pill-btn.active .pill-count {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* ==========================================================================
   Catalog Grid & Cards
   ========================================================================== */
.catalog-section {
  padding: 10px 0 80px 0;
  flex: 1;
}

.packages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.pkg-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
}
.pkg-card:hover {
  border-color: var(--border-focus);
  background-color: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.05);
}
html.dark .pkg-card:hover {
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.card-top {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.card-icon-frame {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--bg-highlight);
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-info {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta-line {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.card-desc {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border-color);
  padding-top: 12px;
}

.card-tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.card-actions {
  display: flex;
  gap: 8px;
}

/* ==========================================================================
   Full Dedicated Detail Page (Flat, no boxed nesting or slop)
   ========================================================================== */
.package-detail-container {
  padding: 36px 24px 80px 24px;
  max-width: 900px;
  flex: 1;
}

.back-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  margin-bottom: 32px;
  padding: 4px 0;
  transition: color var(--transition-speed) ease;
}
.back-link-btn:hover {
  color: var(--text-primary);
}

/* Flat Detail Article */
.detail-article {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.detail-header-block {
  display: flex;
  gap: 24px;
  align-items: center;
}

.detail-large-icon {
  width: 80px;
  height: 80px;
  border-radius: 18px;
  background: var(--bg-highlight);
  border: 1px solid var(--border-color);
  object-fit: cover;
  flex-shrink: 0;
}

.detail-title {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.8px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.detail-meta-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.detail-actions-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.detail-description {
  font-size: 1.1rem;
  color: var(--text-primary);
  line-height: 1.65;
}

/* Simple Background Highlight for Terminal Snippet */
.terminal-highlight-box {
  background-color: var(--bg-highlight);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.terminal-highlight-box code {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent-purple);
  overflow-x: auto;
  white-space: nowrap;
}

.btn-copy {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 14px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--transition-speed) ease;
}
.btn-copy:hover {
  border-color: var(--border-focus);
  color: var(--accent-blue);
}

/* Flat Specs Section */
.detail-section-heading {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.specs-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.specs-table th, .specs-table td {
  padding: 12px 0;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}
.specs-table th {
  color: var(--text-muted);
  width: 32%;
  font-weight: 500;
}

/* Double-layer Security Highlight (OpenCode + VirusTotal) */
.security-highlight-box {
  background-color: var(--bg-success);
  border-radius: 16px;
  padding: 22px;
}

.security-box-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--status-green);
  margin-bottom: 8px;
}

.security-box-text {
  font-size: 0.92rem;
  color: var(--text-primary);
  line-height: 1.6;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
  padding: 48px 0 32px 0;
  margin-top: auto;
}

.footer-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 24px;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.logo-img-small {
  height: 28px;
  width: auto;
}

.footer-right {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-link {
  font-family: var(--font-body);
  font-size: 0.88rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-speed) ease;
}
.footer-link:hover {
  color: var(--text-primary);
}

.footer-disclaimer {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.skill-md-box {
  background-color: var(--bg-highlight);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px 20px;
  font-family: 'Space Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 450px;
  overflow-y: auto;
  margin: 0 0 20px 0;
}

.hidden {
  display: none !important;
}

@media (max-width: 768px) {
  .site-header {
    border-radius: 20px;
    height: auto;
    padding: 12px 16px;
  }
  .nav-menu {
    display: none;
  }
  .packages-grid {
    grid-template-columns: 1fr;
  }
  .detail-header-block {
    flex-direction: column;
    align-items: flex-start;
  }
  .terminal-highlight-box {
    flex-direction: column;
    align-items: flex-start;
  }
}
