/* --------------------------------------------------------------------------
   Siddhartha Kushwaha — Portfolio Stylesheet
   Design system inspired by Chánh Đại (chanhdai.com) & siddhaartha.in
   -------------------------------------------------------------------------- */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Space+Mono:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Light Theme */
  --background: #ffffff;
  --foreground: #09090b;
  --muted: #f4f4f5;
  --muted-foreground: #71717b;
  --border: #e4e4e7;
  --edge: #e4e4e7;
  --pattern-edge: rgba(228, 228, 231, 0.75);
  --accent: #f4f4f5;
  --accent-hover: #ebebee;
  --accent-foreground: #18181b;
  --card: #ffffff;
  --card-foreground: #09090b;
  --info: #009cf5;
  --success: #10b981;
  --ring: #9f9fa9;

  --col-left-width: 140px;
}

/* Dark Theme */
.dark,
[data-theme="dark"] {
  --background: #09090b;
  --foreground: #fafafa;
  --muted: #18181b;
  --muted-foreground: #9f9fa9;
  --border: #27272a;
  --edge: #27272a;
  --pattern-edge: rgba(39, 39, 42, 0.85);
  --accent: #18181b;
  --accent-hover: #27272a;
  --accent-foreground: #fafafa;
  --card: #09090b;
  --card-foreground: #fafafa;
  --info: #38bdf8;
  --success: #10b981;
  --ring: #52525b;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 64px;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
  min-height: 100vh;
}

/* Typography Helpers */
.font-mono {
  font-family: var(--font-mono);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
}

button {
  font-family: inherit;
  cursor: pointer;
  background: none;
  border: none;
  color: inherit;
}

/* Chánh Đại Signature Crosshair Screen Lines */
.screen-line-before {
  position: relative;
}
.screen-line-before::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100vw;
  right: -100vw;
  height: 1px;
  background-color: var(--edge);
  pointer-events: none;
  z-index: 1;
}

.screen-line-after {
  position: relative;
}
.screen-line-after::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: -100vw;
  right: -100vw;
  height: 1px;
  background-color: var(--edge);
  pointer-events: none;
  z-index: 1;
}

/* Page Frame Container */
.page-container {
  max-width: 48rem; /* 768px / max-w-3xl */
  margin: 0 auto;
  border-left: 1px solid var(--edge);
  border-right: 1px solid var(--edge);
  background-color: var(--background);
  position: relative;
}

/* Diagonal Hatch Divider */
.hatch-divider {
  position: relative;
  display: flex;
  height: 2rem;
  width: 100%;
  border-left: 1px solid var(--edge);
  border-right: 1px solid var(--edge);
  overflow: visible;
  background-color: var(--background);
}
.hatch-divider::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100vw;
  width: 200vw;
  height: 2rem;
  z-index: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    315deg,
    var(--pattern-edge) 0,
    var(--pattern-edge) 1px,
    transparent 0,
    transparent 8px
  );
}

/* --------------------------------------------------------------------------
   Sticky Header
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  background-color: var(--background);
  transition: background-color 0.25s ease;
  padding-top: 8px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 16px;
  max-width: 48rem;
  margin: 0 auto;
  border-left: 1px solid var(--edge);
  border-right: 1px solid var(--edge);
  background-color: var(--background);
}

.header-brand {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-brand .brand-dot {
  width: 6px;
  height: 6px;
  background-color: var(--info);
  border-radius: 50%;
  display: inline-block;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-nav a {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted-foreground);
  transition: color 0.15s ease;
}

.header-nav a:hover,
.header-nav a.active {
  color: var(--foreground);
}

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

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: var(--muted-foreground);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background-color: var(--accent);
  color: var(--foreground);
}

.mobile-menu-btn {
  display: none;
}

@media (max-width: 640px) {
  .header-nav {
    display: none;
  }
  .mobile-menu-btn {
    display: inline-flex;
  }
}

/* Mobile Dropdown */
.mobile-nav-panel {
  display: none;
  flex-direction: column;
  padding: 12px 16px 16px;
  border-bottom: 1px solid var(--edge);
  background-color: var(--background);
  gap: 12px;
}
.mobile-nav-panel.open {
  display: flex;
}
.mobile-nav-panel a {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--muted-foreground);
  padding: 4px 0;
}
.mobile-nav-panel a:hover {
  color: var(--foreground);
}

/* --------------------------------------------------------------------------
   Hero / Top Banner
   -------------------------------------------------------------------------- */
.top-banner {
  aspect-ratio: 2 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  user-select: none;
  background-color: rgba(0, 0, 0, 0.02);
  background-image: radial-gradient(var(--edge) 1px, transparent 0);
  background-size: 12px 12px;
  background-position: center;
}

@media (min-width: 640px) {
  .top-banner {
    aspect-ratio: 3 / 1;
  }
}

.banner-mark {
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.banner-mark img {
  max-width: 100%;
  max-height: 100%;
  object-contain: contain;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.banner-mark .mark-dark {
  display: none;
}
.dark .banner-mark .mark-light,
[data-theme="dark"] .banner-mark .mark-light {
  display: none;
}
.dark .banner-mark .mark-dark,
[data-theme="dark"] .banner-mark .mark-dark {
  display: block;
}

/* --------------------------------------------------------------------------
   Profile Header (Avatar + Name)
   -------------------------------------------------------------------------- */
.profile-header {
  display: flex;
  position: relative;
}

.avatar-wrapper {
  position: relative;
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border-right: 1px solid var(--edge);
}

.avatar-img {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--border), 0 0 0 3px var(--background);
}

@media (min-width: 640px) {
  .avatar-img {
    width: 140px;
    height: 140px;
  }
}

.flag-badge {
  position: absolute;
  top: 0;
  left: -1px;
  height: 28px;
  border-radius: 0 0 4px 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.profile-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.profile-top-strip {
  display: flex;
  flex-grow: 1;
  align-items: flex-end;
  padding: 0 0 4px 16px;
  background: repeating-linear-gradient(
    315deg,
    var(--pattern-edge) 0,
    var(--pattern-edge) 1px,
    transparent 0,
    transparent 8px
  );
}

.profile-top-strip span {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-foreground);
  opacity: 0.8;
  letter-spacing: -0.01em;
}

.profile-main-box {
  border-top: 1px solid var(--edge);
  padding: 16px 16px 12px;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-name {
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--foreground);
  line-height: 1.2;
}

@media (min-width: 640px) {
  .profile-name {
    font-size: 2rem;
  }
}

.verified-badge {
  color: var(--info);
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.profile-title {
  font-size: 0.95rem;
  color: var(--muted-foreground);
  margin-top: 4px;
  font-weight: 400;
}

.profile-status-bar {
  border-top: 1px solid var(--edge);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-foreground);
}

.status-dot {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 8px;
  height: 8px;
}

.status-dot .ping {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: var(--success);
  opacity: 0.75;
  animation: ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.status-dot .dot {
  position: relative;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--success);
}

@keyframes ping {
  75%, 100% {
    transform: scale(2.4);
    opacity: 0;
  }
}

/* --------------------------------------------------------------------------
   Overview Section
   -------------------------------------------------------------------------- */
.overview-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px 28px;
  padding: 20px 16px;
}

@media (min-width: 640px) {
  .overview-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.overview-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--foreground);
}

.overview-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--edge);
  background-color: var(--muted);
  color: var(--muted-foreground);
  flex-shrink: 0;
}

.overview-item a {
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
}
.overview-item a:hover {
  color: var(--info);
}

/* --------------------------------------------------------------------------
   Social Links Grid
   -------------------------------------------------------------------------- */
.social-links-grid {
  display: grid;
  grid-template-columns: 1fr;
  padding: 8px;
  gap: 8px;
}

@media (min-width: 640px) {
  .social-links-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.social-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  background-color: transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.social-card:hover {
  background-color: var(--accent);
  border-color: var(--edge);
}

.social-icon-box {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--muted);
  border: 1px solid var(--edge);
  flex-shrink: 0;
  color: var(--foreground);
}

.social-meta {
  min-width: 0;
  flex: 1;
}

.social-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
}

.social-sub {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.social-arrow {
  color: var(--muted-foreground);
  font-size: 14px;
  transition: transform 0.15s ease;
}

.social-card:hover .social-arrow {
  transform: translate(2px, -2px);
  color: var(--foreground);
}

/* --------------------------------------------------------------------------
   Section Panels & Headers
   -------------------------------------------------------------------------- */
.section-panel {
  background-color: var(--background);
}

.panel-header {
  padding: 20px 16px 16px;
}

.panel-title {
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-count {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted-foreground);
}

.panel-body {
  padding: 16px;
}

/* --------------------------------------------------------------------------
   About Section
   -------------------------------------------------------------------------- */
.about-text {
  font-size: 15px;
  line-height: 1.75;
  color: var(--foreground);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.about-text b,
.about-text strong {
  font-weight: 600;
}

.about-text a {
  text-decoration: underline;
  text-underline-offset: 3px;
  color: var(--foreground);
}

.about-text a:hover {
  color: var(--info);
}

/* --------------------------------------------------------------------------
   Experience Section
   -------------------------------------------------------------------------- */
.experience-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 8px 0 16px;
}

.exp-company-group {
  display: flex;
  flex-direction: column;
}

.exp-company-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.exp-dot-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--muted-foreground);
  opacity: 0.45;
  flex-shrink: 0;
}

.exp-company-name {
  font-size: 1.15rem;
  font-weight: 600;
}

.exp-timeline-wrap {
  position: relative;
  padding-left: 20px;
  margin-left: 3px;
  border-left: 1px solid var(--edge);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.exp-card {
  position: relative;
  padding: 12px 14px;
  border-radius: 8px;
  background-color: transparent;
  transition: background-color 0.15s ease;
}

.exp-card:hover {
  background-color: var(--muted);
}

.exp-role-title {
  font-size: 0.98rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.exp-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-foreground);
  margin-bottom: 8px;
}

.exp-desc {
  font-size: 14px;
  color: var(--muted-foreground);
  line-height: 1.6;
  margin-bottom: 10px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--edge);
  background-color: var(--muted);
  color: var(--foreground);
}

/* --------------------------------------------------------------------------
   Stack Section
   -------------------------------------------------------------------------- */
.stack-rows {
  position: relative;
  display: flex;
  flex-direction: column;
}

.stack-row {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--edge);
}

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

@media (min-width: 640px) {
  .stack-row {
    grid-template-columns: var(--col-left-width) 1fr;
    gap: 16px;
  }
}

.stack-label {
  font-size: 13px;
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
}

.stack-idx {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-foreground);
  opacity: 0.5;
  margin-right: 8px;
}

.stack-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
}

.stack-item-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--edge);
  background-color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--foreground);
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}

.stack-item-pill:hover {
  border-color: var(--ring);
  background-color: var(--accent-hover);
}

.stack-icon {
  width: 14px;
  height: 14px;
  object-fit: contain;
  flex-shrink: 0;
  display: inline-block;
}

.dark .stack-icon-invert,
[data-theme="dark"] .stack-icon-invert {
  filter: invert(1);
}

/* --------------------------------------------------------------------------
   Projects Section (Accordion & Cards)
   -------------------------------------------------------------------------- */
.projects-container {
  display: flex;
  flex-direction: column;
}

.project-accordion-item {
  border-bottom: 1px solid var(--edge);
}

.project-accordion-item:last-child {
  border-bottom: none;
}

.project-summary-bar {
  display: flex;
  align-items: center;
  transition: background-color 0.15s ease;
}

.project-summary-bar:hover {
  background-color: var(--accent);
}

.project-icon-box {
  margin: 0 16px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--muted);
  border: 1px solid var(--edge);
  color: var(--muted-foreground);
  flex-shrink: 0;
}

.project-click-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 16px 12px;
  border-left: 1px dashed var(--edge);
  cursor: pointer;
  text-align: left;
}

.project-header-text h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--foreground);
}

.project-period {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-foreground);
}

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

.project-ext-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--muted-foreground);
  transition: color 0.15s ease, transform 0.15s ease;
}

.project-ext-link:hover {
  color: var(--foreground);
  transform: translate(2px, -2px);
}

.project-chevron {
  color: var(--muted-foreground);
  transition: transform 0.2s ease;
}

.project-accordion-item.open .project-chevron {
  transform: rotate(180deg);
}

.project-content-body {
  display: none;
  padding: 16px 16px 20px 58px;
  border-top: 1px solid var(--edge);
  background-color: var(--background);
}

.project-accordion-item.open .project-content-body {
  display: block;
}

.project-desc {
  font-size: 14px;
  color: var(--muted-foreground);
  line-height: 1.65;
  margin-bottom: 12px;
}

.project-highlight-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--info);
  margin-bottom: 12px;
}

/* --------------------------------------------------------------------------
   GitHub Section & Contribution Heatmap
   -------------------------------------------------------------------------- */
.github-wrap {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.heatmap-scroll {
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
}

.heatmap-grid {
  display: flex;
  gap: 4px;
  width: max-content;
}

.heatmap-col {
  display: grid;
  grid-template-rows: repeat(7, 10px);
  gap: 4px;
}

.heat-cell {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background-color: var(--muted);
}

.heat-cell.l1 {
  background-color: rgba(16, 185, 129, 0.3);
}
.heat-cell.l2 {
  background-color: rgba(16, 185, 129, 0.55);
}
.heat-cell.l3 {
  background-color: rgba(16, 185, 129, 0.8);
}
.heat-cell.l4 {
  background-color: #10b981;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-foreground);
  margin-top: 4px;
}

.heatmap-legend-scale {
  display: flex;
  align-items: center;
  gap: 4px;
}

.stats-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 8px;
}

@media (min-width: 640px) {
  .stats-cards-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-metric-card {
  border: 1px solid var(--edge);
  border-radius: 8px;
  background-color: var(--muted);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
}

.stat-metric-num {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--foreground);
}

.stat-metric-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-foreground);
  text-transform: uppercase;
  margin-top: 2px;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
  max-width: 48rem;
  margin: 0 auto;
  border-left: 1px solid var(--edge);
  border-right: 1px solid var(--edge);
  padding: 32px 16px 40px;
  text-align: center;
  background-color: var(--background);
}

.footer-text {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--muted-foreground);
  margin-bottom: 8px;
}

.footer-text a {
  text-decoration: underline;
  text-underline-offset: 3px;
  color: var(--foreground);
}

.footer-text a:hover {
  color: var(--info);
}

.footer-sub {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-foreground);
  opacity: 0.8;
  margin-bottom: 20px;
}

.footer-bottom-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--edge);
  padding-top: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-foreground);
}

.scroll-top-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--edge);
  background-color: var(--muted);
  color: var(--foreground);
  font-size: 12px;
  transition: background-color 0.15s ease;
}

.scroll-top-btn:hover {
  background-color: var(--accent-hover);
}

/* Toast Notification */
.toast-notice {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 10px 16px;
  border-radius: 8px;
  background-color: var(--foreground);
  color: var(--background);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translateY(80px);
  opacity: 0;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  z-index: 100;
  pointer-events: none;
}

.toast-notice.show {
  transform: translateY(0);
  opacity: 1;
}
