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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  overflow-x: hidden;
}

:root {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.875rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  --content-wide: 1280px;
  --transition: 220ms cubic-bezier(0.16, 1, 0.3, 1);
  --font-body: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-logo: "Rajdhani", Inter, sans-serif;
}

:root,
[data-theme="dark"] {
  --color-bg: #0d1117;
  --color-surface: #161b22;
  --color-surface-2: #1c2128;
  --color-surface-offset: #21262d;
  --color-surface-dynamic: #30363d;
  --color-divider: #21262d;
  --color-border: #30363d;
  --color-text: #e6edf3;
  --color-text-muted: #8b949e;
  --color-text-faint: #484f58;
  --color-primary: #3fb950;
  --color-primary-hover: #2ea043;
  --color-primary-active: #238636;
  --color-blue: #58a6ff;
  --color-purple: #bc8cff;
  --color-orange: #e3b341;
  --color-yellow: #f7c35c;
}

[data-theme="light"] {
  --color-bg: #ffffff;
  --color-surface: #f6f8fa;
  --color-surface-2: #ffffff;
  --color-surface-offset: #f0f2f5;
  --color-surface-dynamic: #e6eaee;
  --color-divider: #d0d7de;
  --color-border: #d0d7de;
  --color-text: #1f2328;
  --color-text-muted: #656d76;
  --color-text-faint: #9198a1;
  --color-primary: #1a7f37;
  --color-primary-hover: #176f31;
  --color-primary-active: #116329;
  --color-blue: #0969da;
  --color-purple: #8250df;
  --color-orange: #9a6700;
  --color-yellow: #bf8700;
}

img, svg { display: block; max-width: 100%; }
a, button {
  transition:
    color var(--transition),
    background var(--transition),
    border-color var(--transition),
    box-shadow var(--transition);
}

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

ul { list-style: none; }
h1, h2, h3, h4 { line-height: 1.2; }

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-4);
  z-index: 50;
  transform: translateY(-160%);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: #ffffff;
  font-size: var(--text-sm);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus { transform: translateY(0); }

.tech-marquee-section {
  position: relative;
  padding: var(--space-8) 0 var(--space-12);
  background: var(--color-bg);
  overflow: hidden;
}

.tech-marquee-header {
  text-align: center;
  margin-bottom: var(--space-8);
  padding-inline: var(--space-6);
}

.section-eyebrow {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-2);
}

.tech-marquee-header h1 {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.marquee-viewport {
  position: relative;
  overflow: hidden;
  padding-block: 42px 34px;
  isolation: isolate;
  -webkit-mask-image: linear-gradient(
    90deg,
    transparent 0%,
    rgba(0, 0, 0, 0.2) 5%,
    rgba(0, 0, 0, 0.85) 12%,
    rgba(0, 0, 0, 1) 18%,
    rgba(0, 0, 0, 1) 82%,
    rgba(0, 0, 0, 0.85) 88%,
    rgba(0, 0, 0, 0.2) 95%,
    transparent 100%
  );
  mask-image: linear-gradient(
    90deg,
    transparent 0%,
    rgba(0, 0, 0, 0.2) 5%,
    rgba(0, 0, 0, 0.85) 12%,
    rgba(0, 0, 0, 1) 18%,
    rgba(0, 0, 0, 1) 82%,
    rgba(0, 0, 0, 0.85) 88%,
    rgba(0, 0, 0, 0.2) 95%,
    transparent 100%
  );
}

.marquee-fade {
  position: absolute;
  top: 0;
  bottom: 0;
  width: clamp(72px, 9vw, 148px);
  z-index: 4;
  pointer-events: none;
}

.marquee-fade-left {
  left: 0;
  background: linear-gradient(
    90deg,
    var(--color-bg) 0%,
    color-mix(in srgb, var(--color-bg) 88%, transparent 26%) 26%,
    color-mix(in srgb, var(--color-bg) 62%, transparent 52%) 52%,
    transparent 100%
  );
}

.marquee-fade-right {
  right: 0;
  background: linear-gradient(
    270deg,
    var(--color-bg) 0%,
    color-mix(in srgb, var(--color-bg) 88%, transparent 26%) 26%,
    color-mix(in srgb, var(--color-bg) 62%, transparent 52%) 52%,
    transparent 100%
  );
}

.marquee-container {
  position: relative;
  width: 100%;
  overflow: visible;
  perspective: 1800px;
  cursor: grab;
  user-select: none;
}

.marquee-container.is-paused { cursor: grab; }
.marquee-container.is-dragging { cursor: grabbing; }

.marquee-track {
  display: flex;
  width: max-content;
  gap: 0;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

.tech-category-group {
  display: flex;
  gap: var(--space-10);
  padding: 0 var(--space-5);
  flex-shrink: 0;
}

.tech-category-block {
  --mx: 50;
  --my: 50;
  position: relative;
  min-width: 320px;
  padding: var(--space-6);
  border-radius: 24px;
  border: 1px solid rgba(110, 118, 129, 0.55);
  background:
    radial-gradient(circle at top left, rgba(88, 166, 255, 0.08), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 45%),
    var(--color-surface-2);
  backdrop-filter: blur(10px);
  transform-style: preserve-3d;
  will-change: transform, filter, opacity;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.55),
    0 1px 0 rgba(255, 255, 255, 0.03) inset;
  transition:
    border-color 280ms ease,
    box-shadow 280ms ease,
    filter 280ms ease,
    opacity 280ms ease;
  z-index: 1;
}

.tech-category-block::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    220px circle at calc(var(--mx) * 1%) calc(var(--my) * 1%),
    rgba(255, 255, 255, 0.12),
    rgba(255, 255, 255, 0.06) 24%,
    transparent 62%
  );
  opacity: 0;
  transition: opacity 300ms ease;
  pointer-events: none;
}

.tech-card-gloss {
  position: absolute;
  inset: -18px;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  mix-blend-mode: screen;
  background: radial-gradient(
    240px 180px at calc(var(--mx) * 1%) calc(var(--my) * 1%),
    rgba(255, 255, 255, 0.16),
    rgba(255, 255, 255, 0.06) 28%,
    transparent 68%
  );
  filter: blur(16px);
  transition: opacity 320ms ease;
}

.tech-category-block.is-active {
  border-color: rgba(63, 185, 80, 0.55);
  box-shadow:
    0 36px 78px rgba(0, 0, 0, 0.72),
    0 0 0 1px rgba(63, 185, 80, 0.14);
  z-index: 20;
}

.tech-category-block.is-active::before,
.tech-category-block.is-active .tech-card-gloss {
  opacity: 1;
}

.marquee-container.is-paused .tech-category-block:not(.is-active) {
  filter: blur(2px) saturate(0.8);
  opacity: 0.46;
}

.tech-category-title {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-divider);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: 0.02em;
  text-align: left;
}

.tech-category-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04), rgba(88,166,255,0.08));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 10px 30px rgba(0,0,0,0.24), inset 0 1px 0 rgba(255,255,255,0.08);
}

.tech-category-icon svg {
  width: 22px;
  height: 22px;
  color: var(--color-primary);
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
}

.tech-items-list {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: stretch;
}

.tech-item-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  width: 100%;
  min-height: 44px;
  gap: var(--space-3);
  font-size: var(--text-sm);
  padding: 0.52rem 0;
  border-radius: 10px;
  color: var(--color-text-muted);
  background: transparent;
  transition: color 180ms ease;
}

.tech-item-row.is-tech-active {
  color: var(--color-text);
}

.tech-dot {
  position: relative;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: transform 220ms ease;
}

.tech-dot.blue { background: var(--color-blue); box-shadow: 0 0 8px rgba(88,166,255,0.55); }
.tech-dot.green { background: var(--color-primary); box-shadow: 0 0 8px rgba(63,185,80,0.55); }
.tech-dot.purple { background: var(--color-purple); box-shadow: 0 0 8px rgba(188,140,255,0.55); }
.tech-dot.orange { background: var(--color-orange); box-shadow: 0 0 8px rgba(227,179,65,0.55); }
.tech-dot.yellow { background: var(--color-yellow); box-shadow: 0 0 8px rgba(247,195,92,0.55); }

@keyframes techDotPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.16); }
  100% { transform: scale(1); }
}

.tech-dot.is-linked {
  animation: techDotPulse 1.35s ease-in-out infinite;
}

.tech-name {
  font-weight: 500;
  color: currentColor;
  flex: 1;
  text-align: left;
}

.tech-legend {
  position: relative;
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.7rem 1.15rem;
  margin: var(--space-5) auto 0;
  padding-inline: var(--space-6);
  max-width: min(960px, calc(100vw - 48px));
  color: var(--color-text-faint);
}

.tech-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.46rem;
  font-size: var(--text-xs);
}

.stack-terminal {
  position: relative;
  z-index: 6;
  margin: var(--space-4) auto 0;
  padding-inline: var(--space-6);
  max-width: min(960px, calc(100vw - 48px));
}

.stack-terminal-inner {
  position: relative;
  min-height: 70px;
  display: grid;
  grid-template-columns: auto auto auto minmax(0, 1fr);
  align-items: start;
  column-gap: 10px;
  padding: 0.92rem 1.05rem;
  border: 1px solid color-mix(in srgb, var(--color-border) 82%, rgba(255,255,255,0.06));
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.045), rgba(255,255,255,0.012) 38%);
  backdrop-filter: blur(14px);
}

.stack-terminal-prompt,
.stack-terminal-label,
.stack-terminal-divider,
.stack-terminal-text {
  position: relative;
  z-index: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92rem;
}

.stack-terminal-prompt {
  color: var(--color-primary);
  font-weight: 700;
}

.stack-terminal-text {
  color: var(--color-text-muted);
  line-height: 1.6;
}

.stack-terminal-text::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 1.05em;
  margin-left: 0.14rem;
  vertical-align: -0.14em;
  background: var(--color-primary);
  animation: caretBlink 1s steps(1, end) infinite;
}

@keyframes caretBlink {
  0%, 48% { opacity: 1; }
  49%, 100% { opacity: 0.16; }
}

.stack-empty {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-12) var(--space-6);
  text-align: center;
  color: var(--color-text-muted);
}

.stack-empty strong {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--color-text);
  font-size: var(--text-base);
}

@media (max-width: 768px) {
  .tech-category-block { min-width: 286px; padding: var(--space-5); }
  .stack-terminal-inner {
    grid-template-columns: auto 1fr;
    padding: 0.82rem 0.92rem;
  }
  .stack-terminal-label,
  .stack-terminal-divider { display: none; }
}

@media (max-width: 480px) {
  .tech-category-block { min-width: 282px; }
  .marquee-fade { width: 42px; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .tech-dot.is-linked { animation: none; transform: scale(1.08); }
}
