/* --------------------------------------------------------------------------
 * Master Theme Architecture: 4 Distinct Design Personalities
 * Responsive Card Grid Directory (Mobile-First, Zero Emojis)
 * - minimal-list: Ultra-clean directory cards inspired by Linear & Vercel
 * - terminal: Monospace developer index inspired by GitHub CLI & Raycast
 * - neobrutalism: High-contrast, sharp offset shadow inspired by Gumroad
 * - fintech: Razor-sharp slate/charcoal luxury inspired by Mercury & Stripe
 * -------------------------------------------------------------------------- */

:root {
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, Monaco, Consolas, monospace;
}

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

body {
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.2s ease, color 0.2s ease;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   THEME 1: MINIMAL (Default)
   Linear / Vercel style. Clean high-density cards, slate typography.
   ========================================================================== */
body[data-theme="minimal-list"] {
  background-color: #f8fafc;
  color: #0f172a;
}

body[data-theme="minimal-list"] .masthead {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
}

body[data-theme="minimal-list"] .brand-mark {
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #0f172a;
  border-radius: 6px;
}

body[data-theme="minimal-list"] .hero-title {
  color: #0f172a;
}

body[data-theme="minimal-list"] .hero-lead {
  color: #64748b;
}

body[data-theme="minimal-list"] .app-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body[data-theme="minimal-list"] .app-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

body[data-theme="minimal-list"] .card-icon {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

body[data-theme="minimal-list"] .card-title {
  color: #0f172a;
}

body[data-theme="minimal-list"] .card-version {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

body[data-theme="minimal-list"] .card-category {
  color: #64748b;
}

body[data-theme="minimal-list"] .card-tagline {
  color: #1e293b;
}

body[data-theme="minimal-list"] .card-desc {
  color: #64748b;
}

body[data-theme="minimal-list"] .card-foot {
  border-top: 1px solid #f1f5f9;
}

body[data-theme="minimal-list"] .card-tech {
  color: #94a3b8;
}

body[data-theme="minimal-list"] .card-links a {
  color: #0284c7;
}

body[data-theme="minimal-list"] .card-links a:hover {
  color: #0369a1;
  text-decoration: underline;
}

body[data-theme="minimal-list"] .btn-lock-auth {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
}

body[data-theme="minimal-list"] .btn-lock-auth:hover {
  background: #f8fafc;
  color: #0f172a;
}

body[data-theme="minimal-list"] .btn-download {
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #0f172a;
}

body[data-theme="minimal-list"] .btn-download:hover {
  background: #1e293b;
}

/* ==========================================================================
   THEME 2: TERMINAL / DEVELOPER FIRST
   Monospace-led, pitch black, Raycast & GitHub CLI telemetry.
   ========================================================================== */
body[data-theme="terminal"] {
  background-color: #0d1117;
  color: #c9d1d9;
  font-family: var(--font-mono);
}

body[data-theme="terminal"] .masthead {
  background: #161b22;
  border-bottom: 1px solid #30363d;
}

body[data-theme="terminal"] .brand-mark {
  background: #0d1117;
  border: 1px solid #30363d;
  color: #58a6ff;
  border-radius: 4px;
}

body[data-theme="terminal"] .hero-title {
  color: #58a6ff;
}

body[data-theme="terminal"] .hero-lead {
  color: #8b949e;
}

body[data-theme="terminal"] .app-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
}

body[data-theme="terminal"] .app-card:hover {
  border-color: #58a6ff;
  background: #1c2128;
}

body[data-theme="terminal"] .card-icon {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 4px;
}

body[data-theme="terminal"] .card-title {
  color: #f0f6fc;
}

body[data-theme="terminal"] .card-version {
  background: #21262d;
  color: #79c0ff;
  border: 1px solid #30363d;
}

body[data-theme="terminal"] .card-category {
  color: #8b949e;
}

body[data-theme="terminal"] .card-tagline {
  color: #58a6ff;
}

body[data-theme="terminal"] .card-desc {
  color: #8b949e;
}

body[data-theme="terminal"] .card-foot {
  border-top: 1px solid #21262d;
}

body[data-theme="terminal"] .card-tech {
  color: #6e7681;
}

body[data-theme="terminal"] .card-links a {
  color: #58a6ff;
}

body[data-theme="terminal"] .card-links a:hover {
  text-decoration: underline;
}

body[data-theme="terminal"] .btn-lock-auth {
  background: #21262d;
  border: 1px solid #30363d;
  color: #c9d1d9;
}

body[data-theme="terminal"] .btn-lock-auth:hover {
  border-color: #58a6ff;
  color: #f0f6fc;
}

body[data-theme="terminal"] .btn-download {
  background: #238636;
  border: 1px solid #2ea043;
  color: #ffffff;
}

body[data-theme="terminal"] .btn-download:hover {
  background: #2ea043;
}

/* ==========================================================================
   THEME 3: NEOBRUTALISM
   Gumroad style. Solid 2.5px borders, sharp offset shadow, tactile feel.
   ========================================================================== */
body[data-theme="neobrutalism"] {
  background-color: #fffbeb;
  color: #18181b;
}

body[data-theme="neobrutalism"] .masthead {
  background: #ffffff;
  border-bottom: 2.5px solid #000000;
}

body[data-theme="neobrutalism"] .brand-mark {
  background: #fbbf24;
  border: 2px solid #000000;
  color: #000000;
  border-radius: 0;
  box-shadow: 2px 2px 0px #000000;
}

body[data-theme="neobrutalism"] .hero-title {
  color: #000000;
}

body[data-theme="neobrutalism"] .hero-lead {
  color: #27272a;
}

body[data-theme="neobrutalism"] .app-card {
  background: #ffffff;
  border: 2.5px solid #000000;
  border-radius: 0;
  box-shadow: 4px 4px 0px #000000;
}

body[data-theme="neobrutalism"] .app-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0px #000000;
}

body[data-theme="neobrutalism"] .card-icon {
  background: #fef08a;
  border: 2px solid #000000;
  border-radius: 0;
}

body[data-theme="neobrutalism"] .card-title {
  color: #000000;
  font-weight: 800;
}

body[data-theme="neobrutalism"] .card-version {
  background: #fde047;
  color: #000000;
  border: 1.5px solid #000000;
  font-weight: 700;
  border-radius: 0;
}

body[data-theme="neobrutalism"] .card-category {
  color: #000000;
  font-weight: 700;
}

body[data-theme="neobrutalism"] .card-tagline {
  color: #000000;
  font-weight: 700;
}

body[data-theme="neobrutalism"] .card-desc {
  color: #27272a;
  font-weight: 500;
}

body[data-theme="neobrutalism"] .card-foot {
  border-top: 2px solid #000000;
}

body[data-theme="neobrutalism"] .card-tech {
  color: #52525b;
  font-weight: 600;
}

body[data-theme="neobrutalism"] .card-links a {
  color: #000000;
  font-weight: 700;
  text-decoration: underline;
}

body[data-theme="neobrutalism"] .btn-lock-auth {
  background: #ffffff;
  border: 2px solid #000000;
  color: #000000;
  box-shadow: 2px 2px 0px #000000;
  font-weight: 700;
  border-radius: 0;
}

body[data-theme="neobrutalism"] .btn-lock-auth:active {
  transform: translate(2px, 2px);
  box-shadow: 0px 0px 0px #000000;
}

body[data-theme="neobrutalism"] .btn-download {
  background: #4ade80;
  border: 2px solid #000000;
  color: #000000;
  box-shadow: 2px 2px 0px #000000;
  font-weight: 800;
  border-radius: 0;
}

body[data-theme="neobrutalism"] .btn-download:active {
  transform: translate(2px, 2px);
  box-shadow: 0px 0px 0px #000000;
}

/* ==========================================================================
   THEME 4: FINTECH / MONOCHROMATIC
   Mercury & Stripe style. Obsidian dark, razor micro-borders, glass blur.
   ========================================================================== */
body[data-theme="fintech"] {
  background-color: #0b0e14;
  color: #e2e8f0;
}

body[data-theme="fintech"] .masthead {
  background: rgba(15, 20, 30, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body[data-theme="fintech"] .brand-mark {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  border-radius: 8px;
}

body[data-theme="fintech"] .hero-title {
  color: #f8fafc;
}

body[data-theme="fintech"] .hero-lead {
  color: #94a3b8;
}

body[data-theme="fintech"] .app-card {
  background: #0f141e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
}

body[data-theme="fintech"] .app-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: #141a26;
}

body[data-theme="fintech"] .card-icon {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
}

body[data-theme="fintech"] .card-title {
  color: #f8fafc;
}

body[data-theme="fintech"] .card-version {
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

body[data-theme="fintech"] .card-category {
  color: #94a3b8;
}

body[data-theme="fintech"] .card-tagline {
  color: #f1f5f9;
}

body[data-theme="fintech"] .card-desc {
  color: #94a3b8;
}

body[data-theme="fintech"] .card-foot {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

body[data-theme="fintech"] .card-tech {
  color: #64748b;
}

body[data-theme="fintech"] .card-links a {
  color: #38bdf8;
}

body[data-theme="fintech"] .card-links a:hover {
  text-decoration: underline;
}

body[data-theme="fintech"] .btn-lock-auth {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}

body[data-theme="fintech"] .btn-lock-auth:hover {
  background: rgba(255, 255, 255, 0.08);
}

body[data-theme="fintech"] .btn-download {
  background: #f8fafc;
  border: 1px solid #f8fafc;
  color: #0b0e14;
  font-weight: 600;
}

body[data-theme="fintech"] .btn-download:hover {
  background: #ffffff;
}

/* ==========================================================================
   SHARED UI FRAMEWORK & LAYOUT
   ========================================================================== */
.masthead-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-cluster {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.brand-name {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.05rem;
}

.masthead-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-switcher {
  display: none; /* revealed only after unlock */
  align-items: center;
  gap: 0.2rem;
  padding: 0.2rem;
  border-radius: 6px;
  background: rgba(125, 125, 125, 0.1);
  border: 1px solid rgba(125, 125, 125, 0.2);
}

.theme-btn {
  padding: 0.3rem 0.55rem;
  border: none;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 0.725rem;
  color: inherit;
  cursor: pointer;
  border-radius: 4px;
  opacity: 0.65;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.theme-btn:hover {
  opacity: 1;
}

.theme-btn.active {
  opacity: 1;
  background: rgba(125, 125, 125, 0.25);
  font-weight: 600;
}

.key-control {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  background: rgba(125, 125, 125, 0.1);
  border: 1px solid rgba(125, 125, 125, 0.2);
  color: inherit;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
}

.key-control.is-unlocked {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
}

.page-container {
  flex: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  width: 100%;
}

.editorial-hero {
  margin-bottom: 2rem;
}

.hero-title {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.hero-lead {
  font-size: 1rem;
  line-height: 1.6;
  max-width: 42rem;
}

/* ==========================================================================
   RESPONSIVE APPS GRID & CARD ARCHITECTURE
   ========================================================================== */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
  width: 100%;
}

.app-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.card-identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-titles {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title {
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.card-version {
  font-family: var(--font-mono);
  font-size: 0.675rem;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

.card-category {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-action button,
.card-action a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  font-family: var(--font-mono);
  font-size: 0.725rem;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
}

.card-tagline {
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.card-desc {
  font-size: 0.825rem;
  line-height: 1.55;
  margin-bottom: 1.25rem;
  flex: 1;
}

.card-foot {
  padding-top: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.card-tech {
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.card-links {
  display: flex;
  gap: 0.75rem;
  font-size: 0.775rem;
}

.card-links a {
  text-decoration: none;
  font-weight: 500;
}

.apps-loading {
  padding: 3rem;
  text-align: center;
  opacity: 0.6;
}

/* ==========================================================================
   PIN AUTH DIALOG
   ========================================================================== */
.pin-dialog {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 400px;
  width: 90vw;
  margin: auto;
}

.pin-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
}

.dialog-frame {
  background: #ffffff;
  color: #000000;
  padding: 2rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

body[data-theme="terminal"] .dialog-frame {
  background: #161b22;
  color: #c9d1d9;
  border-color: #30363d;
}

body[data-theme="neobrutalism"] .dialog-frame {
  background: #fffbeb;
  color: #000000;
  border: 2.5px solid #000000;
  box-shadow: 6px 6px 0px #000000;
}

body[data-theme="fintech"] .dialog-frame {
  background: #0f141e;
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.15);
}

.dialog-frame h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.dialog-frame p {
  font-size: 0.85rem;
  opacity: 0.75;
  margin-bottom: 1.25rem;
}

.pin-field input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: 1.25rem;
  letter-spacing: 0.35em;
  text-align: center;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.dialog-alert {
  color: #dc2626;
  font-size: 0.8rem;
  margin-bottom: 1rem;
}

.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.btn-subtle {
  padding: 0.4rem 0.8rem;
  background: transparent;
  border: 1px solid rgba(125, 125, 125, 0.3);
  color: inherit;
  border-radius: 4px;
  cursor: pointer;
}

.btn-solid {
  padding: 0.4rem 1rem;
  background: #0f172a;
  color: #ffffff;
  border: 1px solid #0f172a;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}

.colophon {
  border-top: 1px solid rgba(125, 125, 125, 0.2);
  padding: 1.5rem;
  font-size: 0.8rem;
  text-align: center;
  color: inherit;
  opacity: 0.7;
}

.colophon a {
  color: inherit;
}

/* ==========================================================================
   MOBILE RESPONSIVENESS
   ========================================================================== */
@media (max-width: 640px) {
  .masthead-inner {
    padding: 0.75rem 1rem;
  }

  .page-container {
    padding: 1.75rem 1rem 3rem;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .apps-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .app-card {
    padding: 1rem;
  }

  .card-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .card-links {
    width: 100%;
    justify-content: flex-start;
    gap: 1rem;
  }
}
