/* ============================================================
   Doc-Portal — Layout
   ============================================================ */

/* ── Nav ── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(246, 248, 250, 0.92);
  border-bottom: 1px solid var(--border-light);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: background var(--duration) var(--ease),
              border-color var(--duration) var(--ease);
}

[data-theme="dark"] .nav {
  background: rgba(13, 17, 23, 0.92);
}

.nav-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--sp-4);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-xl);
  color: var(--text);
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.nav-brand-dot { color: var(--amber); }

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

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--duration) var(--ease),
              background var(--duration) var(--ease);
}

.nav-link:hover {
  color: var(--text);
  background: var(--bg-card);
}

.nav-link.active {
  color: var(--amber);
  background: var(--amber-light);
}

.nav-link-external::after {
  content: '↗';
  font-size: 0.65rem;
  opacity: 0.7;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

/* ── Container ── */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--sp-4);
}

/* ── Section ── */
section {
  padding: var(--sp-10) 0;
}

section + section {
  padding-top: 0;
}

.section-header {
  margin-bottom: var(--sp-5);
}

.section-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: var(--sp-1);
}

.section-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-3xl);
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--text);
}

.section-sub {
  margin-top: var(--sp-1);
  font-size: var(--text-md);
  color: var(--text-secondary);
  max-width: 600px;
}

/* ── Hero (index.html full-width) ── */
.hero {
  position: relative;
  padding: var(--sp-12) 0 var(--sp-10);
  overflow: hidden;
}

/* Subtle dot-grid background */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(217,119,6,0.08) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

/* Fade-out gradient at bottom edge */
.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(to bottom, transparent, var(--bg));
  pointer-events: none;
  z-index: 1;
}

/* Dark mode inherits var(--bg) from the light-mode rule above — no override needed */

.hero .container {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 860px;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: var(--sp-3);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.hero-eyebrow::before,
.hero-eyebrow::after {
  content: '';
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--amber);
  opacity: 0.5;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-5xl);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: var(--sp-3);
}

/* Gradient text on the key word */
.hero-title .gradient-word {
  background: linear-gradient(135deg, #d97706 0%, #f59e0b 50%, #ea580c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: var(--text-lg);
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto var(--sp-5);
}

.hero-ctas {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-bottom: var(--sp-8);
}

/* ── Hero Stats Row ── */
.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
  border: 1px solid var(--border-light);
  border-radius: var(--card-radius);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  max-width: 680px;
  margin: 0 auto;
}

.hero-stat-item {
  flex: 1;
  min-width: 120px;
  padding: var(--sp-3) var(--sp-2);
  text-align: center;
  border-right: 1px solid var(--border-light);
  position: relative;
}

.hero-stat-item:last-child {
  border-right: none;
}

.hero-stat-num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-3xl);
  color: var(--amber);
  line-height: 1;
  margin-bottom: 0.3rem;
}

.hero-stat-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* ── Featured Work grid (index.html) ── */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  align-items: start;
}

/* ── Category tiles ── */
.category-strip { padding: var(--sp-6) 0; }

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-2);
}


/* ── Footer ── */
.footer {
  padding: var(--sp-8) 0 var(--sp-6);
  border-top: 1px solid var(--border-light);
  margin-top: var(--sp-12);
}

.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--sp-6);
  margin-bottom: var(--sp-6);
}

.footer-bottom {
  border-top: 1px solid var(--border-light);
  padding-top: var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

/* ══════════════════════════════════════════════════════════
   PROJECTS PAGE — Topbar layout (no sidebar)
   ══════════════════════════════════════════════════════════ */

/* Sticky topbar: title + stats + search + filter pills */
.projects-topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  padding: 1.1rem 0 0;
  position: sticky;
  top: var(--nav-h);
  z-index: 90;
  transition: background var(--duration) var(--ease);
}

[data-theme="dark"] .projects-topbar {
  background: rgba(22, 27, 34, 0.96);
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.topbar-meta { display: flex; flex-direction: column; gap: 0.1rem; }

.topbar-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-xl);
  color: var(--text);
  letter-spacing: -0.02em;
}

.topbar-stats {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
}

.topbar-count { color: var(--amber); font-weight: 700; }
.topbar-dim   { color: var(--text-muted); }
.topbar-sep   { color: var(--border); }

/* Topbar search */
.topbar-search-wrap {
  position: relative;
  width: 240px;
  flex-shrink: 0;
}

.topbar-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

.topbar-search-input {
  width: 100%;
  padding: 0.5rem 2rem 0.5rem 2.1rem;
  font-size: 0.8rem;
  font-family: var(--font-body);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color var(--duration), box-shadow var(--duration);
}

.topbar-search-input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-ring);
}

.topbar-search-input::placeholder { color: var(--text-muted); }

.topbar-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-secondary);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  transition: background var(--duration);
  border: none;
}

.topbar-search-clear:hover { background: var(--border); }
.topbar-search-clear.hidden { display: none; }

/* Filter pills row */
.filter-pills-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;           /* constrain to container — prevents page-level overflow */
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  flex-wrap: nowrap;
  padding-bottom: 0.85rem; /* unified bottom breathing room */
}

.filter-pills-row::-webkit-scrollbar { display: none; }

.filter-pills {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.filter-pills-divider {
  width: 1px;
  height: 18px;
  background: var(--border-light);
  flex-shrink: 0;
  margin: 0 0.15rem;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.26rem 0.72rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  border: 1.5px solid var(--border-light);
  background: transparent;
  color: var(--text-secondary);
  transition: all var(--duration) var(--ease);
}

.filter-pill:hover {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--amber-light);
}

.filter-pill.active {
  background: var(--amber);
  color: #fff;
  border-color: var(--amber);
  box-shadow: 0 2px 8px rgba(217,119,6,0.3);
}

[data-theme="dark"] .filter-pill.active {
  box-shadow: 0 2px 8px rgba(217,119,6,0.45);
}

.filter-pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  opacity: 0.85;
}

.filter-pill.active .filter-pill-dot {
  background: rgba(255,255,255,0.7) !important;
}

.filter-pill-count {
  font-size: 0.6rem;
  opacity: 0.7;
  font-family: var(--font-mono);
}

.pill-clear {
  white-space: nowrap;
  padding: 0.26rem 0.72rem;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--amber);
  background: var(--amber-light);
  border: 1.5px solid rgba(217,119,6,0.25);
  cursor: pointer;
  flex-shrink: 0;
  transition: all var(--duration);
}

.pill-clear:hover { background: rgba(217,119,6,0.2); }
.pill-clear.hidden { display: none; }

/* ── AI Tools reference promo box ── */
.ai-tools-ref-box {
  margin-top: 3rem;
  border: 1.5px solid rgba(109,40,217,0.18);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg,
    rgba(109,40,217,0.05) 0%,
    rgba(217,119,6,0.04) 100%);
  padding: 1.75rem 2rem;
  transition: border-color var(--duration);
}

.ai-tools-ref-box:hover {
  border-color: rgba(109,40,217,0.3);
}

[data-theme="dark"] .ai-tools-ref-box {
  background: linear-gradient(135deg,
    rgba(109,40,217,0.09) 0%,
    rgba(217,119,6,0.06) 100%);
}

.ai-tools-ref-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.ai-tools-ref-left { flex: 1; min-width: 240px; }

.ai-tools-ref-eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6d28d9;
  margin-bottom: 0.35rem;
}

[data-theme="dark"] .ai-tools-ref-eyebrow { color: #a78bfa; }

.ai-tools-ref-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-lg);
  color: var(--text);
  margin-bottom: 0.35rem;
  letter-spacing: -0.02em;
}

.ai-tools-ref-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.ai-tools-ref-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.ai-tools-ref-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(109,40,217,0.1);
  color: #6d28d9;
  border: 1px solid rgba(109,40,217,0.2);
}

[data-theme="dark"] .ai-tools-ref-chip {
  background: rgba(109,40,217,0.18);
  color: #a78bfa;
  border-color: rgba(109,40,217,0.3);
}

.ai-tools-ref-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-md);
  background: #6d28d9;
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--duration), box-shadow var(--duration);
  box-shadow: 0 2px 10px rgba(109,40,217,0.35);
}

.ai-tools-ref-cta:hover {
  background: #5b21b6;
  box-shadow: 0 4px 16px rgba(109,40,217,0.45);
}

/* Projects main content */
.projects-main {
  padding-top: 2.5rem;
  padding-bottom: 5rem;
}

/* Card grid — full width */
#grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  align-items: start;
}

#grid[hidden] { display: none; }

/* Empty state */
#empty { text-align: center; padding: 5rem 1rem; }
#empty[hidden] { display: none; }

/* ── Responsive ── */
@media (max-width: 960px) {
  #grid { grid-template-columns: repeat(2, 1fr); }
  .topbar-search-wrap { width: 200px; }
}

@media (max-width: 600px) {
  #grid { grid-template-columns: 1fr; }
  .topbar-search-wrap { width: 100%; }
  .topbar-row { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
}

/* ── Responsive: index.html hero ── */
@media (max-width: 1024px) {
  .hero-title { font-size: var(--text-4xl); }
  .featured-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .project-grid { grid-template-columns: repeat(2, 1fr); }
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
  .container { padding: 0 var(--sp-2); }
  .nav-inner { padding: 0 var(--sp-2); }
  .hero { padding: var(--sp-8) 0 var(--sp-6); }
  .hero-title { font-size: var(--text-3xl); }
  .hero-sub { font-size: var(--text-base); }
  .hero-stats { border-radius: var(--radius-lg); }
  .hero-stat-item { min-width: 100px; padding: var(--sp-2) var(--sp-1); }
  .hero-stat-num { font-size: var(--text-2xl); }
  .featured-grid { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .category-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .footer-bottom { flex-direction: column; gap: var(--sp-2); text-align: center; }
}
