/* ========================================
   Skills Market - SkillsMP Terminal Style
   ======================================== */

/* --- CSS Variables --- */
:root {
  --background: #f5f5f5;
  --foreground: #111827;
  --card: #fff;
  --card-foreground: #111827;
  --primary: #cc7a60;
  --primary-dark: #b56850;
  --accent: #f59e0b;
  --muted: #f3f4f6;
  --muted-foreground: #5b6370;
  --border: #e5e7eb;
  --radius: 10px;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
  --green: #22c55e;
  --transition: 0.15s cubic-bezier(.4, 0, .2, 1);
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, Helvetica, sans-serif;
  background: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol { list-style: none; }
img { max-width: 100%; display: block; }

input, button {
  font-family: inherit;
  font-size: inherit;
  border: none;
  outline: none;
  background: none;
}

button { cursor: pointer; }

/* --- Animations --- */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scale-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* --- Layout --- */
.content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 40px;
  flex: 1;
  width: 100%;
}

/* --- Top Navigation Bar --- */
.top-nav {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.top-nav-inner {
  max-width: 1200px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--foreground);
  font-size: 16px;
  font-weight: 600;
}

.nav-brand .terminal-prompt {
  color: var(--green);
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 14px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links a {
  color: var(--muted-foreground);
  font-size: 14px;
  transition: color var(--transition);
}

.nav-links a:hover {
  color: var(--foreground);
}

/* ========================================
   Search Section — Terminal Window Style
   ======================================== */
.search-section {
  max-width: 1200px;
  margin: 32px auto 28px;
  padding: 0 24px;
  width: 100%;
}

.search-terminal {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Terminal title bar (with dots) */
.search-terminal-bar {
  background: #f0f0f0;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

.search-terminal-bar .window-dots {
  display: flex;
  gap: 6px;
}

.search-terminal-bar .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.red { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green { background: #28c840; }

.search-terminal-bar .bar-title {
  font-size: 13px;
  color: #999;
  font-family: var(--font-mono);
}

/* Search input area */
.search-body {
  display: flex;
  align-items: center;
  padding: 0 20px;
  height: 52px;
  gap: 10px;
}

.search-prefix {
  color: var(--foreground);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  user-select: none;
}

.search-icon {
  color: #999;
  font-size: 16px;
  flex-shrink: 0;
}

.search-body input {
  flex: 1;
  color: var(--foreground);
  font-size: 15px;
  font-family: var(--font-mono);
  background: transparent;
  min-width: 0;
}

.search-body input::placeholder {
  color: #bbb;
}

/* ========================================
   Categories — Pill Style
   ======================================== */
.categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.category-tag {
  font-size: 13px;
  padding: 6px 16px;
  color: var(--muted-foreground);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 9999px;
  transition: all var(--transition);
  cursor: pointer;
}

.category-tag:hover {
  color: var(--foreground);
  border-color: #ccc;
  box-shadow: var(--shadow-sm);
}

.category-tag.active {
  color: #fff;
  background: var(--foreground);
  border-color: var(--foreground);
}

/* ========================================
   Skills Grid
   ======================================== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 60px;
}

/* ========================================
   Skill Card — Terminal Window Style
   ======================================== */
.skill-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  animation: fade-up 0.4s ease-out both;
}

.skill-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* Card header — terminal title bar */
.card-header {
  background: #f0f0f0;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

.window-dots {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.window-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.card-filename {
  color: #555;
  font-size: 13px;
  font-family: var(--font-mono);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-stars {
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Card body */
.card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-source {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.card-icon {
  font-size: 24px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--muted);
  border-radius: 50%;
  flex-shrink: 0;
}

.card-category {
  font-size: 13px;
  color: var(--green);
  font-weight: 500;
  font-family: var(--font-mono);
}

.card-summary {
  font-size: 14px;
  color: var(--muted-foreground);
  line-height: 1.65;
  margin-bottom: 14px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: var(--font-mono);
}

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

.card-date {
  font-size: 13px;
  color: #999;
  font-family: var(--font-mono);
}

.card-favorite {
  color: #ccc;
  font-size: 18px;
  cursor: pointer;
  transition: color var(--transition);
  line-height: 1;
}

.card-favorite:hover {
  color: var(--primary);
}

.card-favorite.favorited {
  color: var(--primary);
}

.card-frameworks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* --- Framework Badge --- */
.framework-badge {
  font-size: 11px;
  padding: 2px 8px;
  background: var(--muted);
  color: var(--muted-foreground);
  border-radius: 4px;
  font-weight: 500;
  font-family: var(--font-mono);
}

/* --- Empty State --- */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: #999;
  font-size: 15px;
  font-family: var(--font-mono);
}

/* ========================================
   Skill Detail Page
   ======================================== */

/* --- Back Navigation --- */
.back-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--muted-foreground);
  transition: color var(--transition);
  margin: 24px 0;
}

.back-nav:hover {
  color: var(--foreground);
}

.skill-detail {
  max-width: 100%;
}

.skill-detail-header {
  margin-bottom: 24px;
}

.skill-detail-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.skill-detail-name {
  font-size: 30px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--foreground);
  letter-spacing: -0.025em;
}

.skill-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 14px;
  color: var(--muted-foreground);
  margin-bottom: 16px;
}

.skill-detail-meta a {
  color: var(--green);
  transition: color var(--transition);
}

.skill-detail-meta a:hover {
  color: #16a34a;
}

.skill-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}

.skill-detail-tags .tag {
  font-size: 12px;
  padding: 4px 12px;
  background: var(--muted);
  color: var(--muted-foreground);
  border-radius: 9999px;
}

/* --- Two-Column Detail Layout --- */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;
  align-items: start;
  margin-bottom: 48px;
}

.detail-main {
  min-width: 0;
}

.detail-sidebar {
  position: sticky;
  top: 80px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* --- Sidebar Download Card (Terminal Style) --- */
.detail-sidebar .download-section {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 0;
}

.detail-sidebar .download-section .section-title {
  padding: 14px 20px 0;
  margin-bottom: 8px;
}

.detail-sidebar .download-item {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  border-bottom: 1px solid var(--border);
}

.detail-sidebar .download-item:last-child {
  border-bottom: none;
}

.detail-sidebar .download-item-inner {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-sidebar .download-info {
  flex: 1;
  min-width: 0;
}

.detail-sidebar .download-framework {
  font-size: 14px;
}

.detail-sidebar .download-desc {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-sidebar .download-btn {
  margin-left: 0;
  padding: 6px 14px;
  font-size: 12px;
  flex-shrink: 0;
}

/* --- Sidebar Meta Card --- */
.meta-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.meta-card .meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.meta-card .meta-row:last-child {
  border-bottom: none;
}

.meta-card .meta-label {
  color: #999;
}

.meta-card .meta-value {
  color: var(--foreground);
  font-weight: 500;
  font-family: var(--font-mono);
  font-size: 12px;
}

.meta-card .meta-value a {
  color: var(--green);
  transition: color var(--transition);
}

.meta-card .meta-value a:hover {
  color: #16a34a;
}

/* --- Section Title --- */
.section-title {
  font-size: 13px;
  color: #999;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 16px;
  font-weight: 600;
}

/* --- Skill Description (Markdown Content) --- */
.skill-description {
  margin-bottom: 48px;
  line-height: 1.75;
}

.skill-description h1,
.skill-description h2,
.skill-description h3 {
  font-weight: 700;
  margin: 2em 0 0.75em;
  color: var(--foreground);
  line-height: 1.25;
}

.skill-description h1 { font-size: 1.875em; }
.skill-description h2 { font-size: 1.5em; }
.skill-description h3 { font-size: 1.25em; }

.skill-description p {
  margin-bottom: 1em;
  color: var(--muted-foreground);
  font-size: 15px;
}

.skill-description ul,
.skill-description ol {
  padding-left: 24px;
  margin-bottom: 1em;
}

.skill-description ul { list-style: disc; }
.skill-description ol { list-style: decimal; }

.skill-description li {
  margin-bottom: 0.5em;
  color: var(--muted-foreground);
  font-size: 15px;
}

.skill-description a {
  color: var(--primary);
  font-weight: 500;
  text-underline-offset: 2px;
}

.skill-description a:hover {
  text-decoration: underline;
}

.skill-description code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--muted);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-weight: 500;
}

.skill-description pre {
  background: #1e1e1e;
  padding: 20px 24px;
  overflow-x: auto;
  margin-bottom: 1.5em;
  border-radius: var(--radius);
}

.skill-description pre code {
  background: none;
  padding: 0;
  font-size: 0.875em;
  line-height: 1.714;
  color: #e0e0e0;
}

.skill-description blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 16px;
  margin-bottom: 1em;
  color: var(--muted-foreground);
}

/* --- Examples Section --- */
.examples-section {
  margin-bottom: 48px;
}

.example-item {
  margin-bottom: 12px;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.example-label {
  font-size: 11px;
  color: #999;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 12px 20px 4px;
  font-weight: 600;
}

.example-content {
  font-size: 14px;
  padding: 4px 20px 14px;
  color: var(--muted-foreground);
  font-family: var(--font-mono);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.65;
}

/* --- Download Section --- */
.download-section {
  margin-bottom: 48px;
}

.download-item {
  transition: all var(--transition);
}

.download-item:hover {
  background: var(--muted);
}

.download-info { flex: 1; }

.download-framework {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--foreground);
}

.download-desc {
  font-size: 13px;
  color: #999;
}

.download-btn {
  font-size: 13px;
  padding: 8px 20px;
  background: var(--primary);
  color: #fff;
  border-radius: 6px;
  transition: all var(--transition);
  display: inline-block;
  text-align: center;
  flex-shrink: 0;
  font-weight: 500;
}

.download-btn:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-md);
}

/* --- Links Section --- */
.links-section {
  margin-bottom: 48px;
}

.links-section a {
  display: inline-block;
  font-size: 14px;
  color: var(--primary);
  margin-right: 20px;
  font-weight: 500;
  text-underline-offset: 2px;
  transition: color var(--transition);
}

.links-section a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* --- Related Skills --- */
.related-section {
  margin-bottom: 48px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

/* ========================================
   About Page
   ======================================== */
.about-content {
  max-width: 860px;
}

.about-header {
  margin-bottom: 32px;
}

.about-header .page-title {
  font-size: 30px;
  font-weight: 700;
  color: var(--foreground);
  margin-bottom: 8px;
  letter-spacing: -0.025em;
}

.about-header .page-subtitle {
  font-size: 15px;
  color: var(--muted-foreground);
}

.about-section {
  margin-bottom: 48px;
}

.about-section h2 {
  font-size: 13px;
  color: #999;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 16px;
  font-weight: 600;
}

.about-text {
  font-size: 15px;
  color: var(--muted-foreground);
  line-height: 1.75;
}

.about-text p {
  margin-bottom: 12px;
}

.framework-list {
  margin-top: 12px;
}

.framework-item {
  display: flex;
  align-items: flex-start;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.framework-item-name {
  font-size: 15px;
  font-weight: 600;
  min-width: 140px;
  margin-right: 20px;
  color: var(--foreground);
}

.framework-item-desc {
  font-size: 14px;
  color: var(--muted-foreground);
  line-height: 1.7;
}

.framework-item-format {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
  font-family: var(--font-mono);
}

.submit-steps {
  counter-reset: step;
  margin-top: 12px;
}

.submit-step {
  display: flex;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.submit-step::before {
  counter-increment: step;
  content: counter(step);
  font-size: 13px;
  color: var(--primary);
  font-weight: 700;
  min-width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  border-radius: 50%;
  flex-shrink: 0;
}

.submit-step-text {
  font-size: 14px;
  color: var(--muted-foreground);
  line-height: 1.7;
  padding-left: 12px;
  padding-top: 3px;
}

.contact-info {
  margin-top: 12px;
}

.contact-item {
  font-size: 14px;
  color: var(--muted-foreground);
  padding: 6px 0;
}

.contact-item a {
  color: var(--primary);
  font-weight: 500;
  transition: color var(--transition);
}

.contact-item a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* ========================================
   Footer
   ======================================== */
footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  background: var(--card);
}

footer p {
  font-size: 13px;
  color: #999;
}

footer a {
  color: var(--muted-foreground);
  transition: color var(--transition);
}

footer a:hover {
  color: var(--foreground);
}

/* ========================================
   Responsive
   ======================================== */

/* Large tablets and below */
@media (max-width: 1024px) {
  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile */
@media (max-width: 768px) {
  .top-nav {
    padding: 0 16px;
    height: 48px;
  }

  .nav-brand { font-size: 14px; }

  .search-section {
    margin: 20px auto 20px;
    padding: 0 16px;
  }

  .content {
    padding: 0 16px 24px;
  }

  .categories {
    gap: 6px;
    margin-bottom: 20px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .category-tag {
    font-size: 12px;
    padding: 5px 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  .skills-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .skill-detail-name {
    font-size: 22px;
  }

  .skill-detail-icon {
    font-size: 36px;
  }

  .skill-detail-meta {
    gap: 10px;
    flex-direction: column;
  }

  .detail-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .detail-sidebar {
    position: static;
  }

  .related-grid {
    grid-template-columns: 1fr;
  }

  .back-nav {
    margin: 16px 0;
  }

  .framework-item {
    flex-direction: column;
  }

  .framework-item-name {
    margin-bottom: 6px;
    min-width: auto;
  }

  .about-header .page-title {
    font-size: 22px;
  }

  .card-summary {
    -webkit-line-clamp: 4;
  }

}

/* Small mobile */
@media (max-width: 480px) {
  .search-body {
    height: 44px;
    padding: 0 14px;
  }

  .search-body input {
    font-size: 14px;
  }
}
