/* ========================================
   Variables & Reset
   ======================================== */
:root {
  --bg-primary: #08080c;
  --bg-secondary: #0f0f14;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);
  --text-primary: #f0f0f5;
  --text-secondary: #9898a8;
  --text-muted: #5c5c6e;
  --accent: #6ee7b7;
  --accent-dim: rgba(110, 231, 183, 0.15);
  --accent-glow: rgba(110, 231, 183, 0.25);
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-hero: 'Outfit', system-ui, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --header-height: 72px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

ul {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: min(1120px, 90%);
  margin-inline: auto;
}

/* Noise texture overlay */
.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ========================================
   Header & Navigation
   ======================================== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-height);
  transition: background var(--transition), backdrop-filter var(--transition), border-color var(--transition);
}

.header--scrolled {
  background: rgba(8, 8, 12, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.nav__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  height: 2.75rem;
  padding: 0 0.65rem;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), background var(--transition);
}

.nav__logo:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.nav__logo-dot {
  color: var(--accent);
}

.nav__links {
  display: flex;
  gap: 2rem;
}

.nav__link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition);
  position: relative;
}

.nav__link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width var(--transition);
}

.nav__link:hover,
.nav__link--active {
  color: var(--text-primary);
}

.nav__link:hover::after,
.nav__link--active::after {
  width: 100%;
}

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav__toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: transform var(--transition), opacity var(--transition);
}

.nav__toggle--open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav__toggle--open span:nth-child(2) {
  opacity: 0;
}

.nav__toggle--open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ========================================
   Hero
   ======================================== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding-top: var(--header-height);
}

.hero__glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
}

.hero__glow--1 {
  width: 500px;
  height: 500px;
  background: var(--accent-glow);
  top: -10%;
  right: -5%;
  opacity: 0.4;
}

.hero__glow--2 {
  width: 400px;
  height: 400px;
  background: rgba(99, 102, 241, 0.15);
  bottom: 10%;
  left: -10%;
  opacity: 0.5;
}

.hero__content {
  position: relative;
  z-index: 1;
}

.hero__eyebrow {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.hero__title {
  font-family: var(--font-hero);
  font-size: clamp(2.8rem, 8vw, 5.5rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
}

.hero__title-accent {
  background: linear-gradient(135deg, var(--accent), #34d399);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--text-secondary);
  max-width: 520px;
  margin-bottom: 2.5rem;
  line-height: 1.7;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  cursor: pointer;
  border: none;
}

.btn--primary {
  background: var(--accent);
  color: var(--bg-primary);
}

.btn--primary:hover {
  background: #5dd9a8;
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--accent-glow);
}

.btn--ghost {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn--ghost:hover {
  border-color: var(--border-hover);
  background: var(--bg-card);
  transform: translateY(-2px);
}

.hero__scroll {
  display: block;
  width: 24px;
  height: 40px;
  border: 2px solid var(--border);
  border-radius: 12px;
  margin-top: 4rem;
  position: relative;
  transition: border-color var(--transition);
}

.hero__scroll:hover {
  border-color: var(--accent);
}

.hero__scroll span {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 8px;
  background: var(--accent);
  border-radius: 2px;
  animation: scrollBounce 2s infinite;
}

@keyframes scrollBounce {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: 1; }
  50% { transform: translateX(-50%) translateY(10px); opacity: 0.3; }
}

/* ========================================
   Sections
   ======================================== */
.section {
  padding: 6rem 0;
}

.section--alt {
  background: var(--bg-secondary);
}

.section__header {
  margin-bottom: 3.5rem;
  max-width: 560px;
}

.section__tag {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}

.section__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.section__desc {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.7;
}

/* ========================================
   About Cards
   ======================================== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity var(--transition);
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-4px);
}

.card:hover::before {
  opacity: 1;
}

.card__icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  border-radius: var(--radius-sm);
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.card__icon svg {
  width: 22px;
  height: 22px;
}

.card__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.card__text {
  color: var(--text-secondary);
  font-size: 0.925rem;
  line-height: 1.7;
}

/* ========================================
   Projects
   ======================================== */
.projects {
  display: grid;
  gap: 2rem;
}

.project {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.project:not(.project--expandable):hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.project--expandable {
  cursor: pointer;
}

.project:not(.project--expandable) {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
}

.project--expandable:hover {
  border-color: var(--border-hover);
}

.project--expandable.project--expanded {
  border-color: var(--accent);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.project__main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
}

.project:nth-child(even):not(.project--expandable) {
  direction: rtl;
}

.project:nth-child(even):not(.project--expandable) > * {
  direction: ltr;
}

.project__visual,
.project__placeholder {
  aspect-ratio: 16 / 10;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.project__placeholder {
  border-style: dashed;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.project__visual-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.project__visual-inner--chess {
  background: linear-gradient(145deg, #0d1117 0%, #161b22 100%);
}

.project__visual-inner--preview {
  padding: 0;
  background: var(--bg-secondary);
}

.project__preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.chess-mock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
  max-width: 180px;
}

.chess-mock__timer {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  border: 3px solid var(--border);
  position: relative;
}

.chess-mock__timer--white {
  background: radial-gradient(circle at 30% 30%, #f0f0f5, #9898a8);
  color: #08080c;
  box-shadow: 0 0 24px rgba(240, 240, 245, 0.15);
}

.chess-mock__timer--black {
  background: radial-gradient(circle at 30% 30%, #2a2a35, #08080c);
  color: var(--text-primary);
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.4);
}

.chess-mock__divider {
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.5;
}

.project__number {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  color: var(--text-muted);
  opacity: 0.3;
}

.project__skeleton {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 70%;
}

.project__skeleton-line {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  animation: shimmer 2s infinite;
}

.project__skeleton-line--wide {
  width: 100%;
}

.project__skeleton-line--short {
  width: 50%;
}

@keyframes shimmer {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

.project__status {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 0.3rem 0.75rem;
  border-radius: 100px;
  margin-bottom: 0.75rem;
}

.project__status--live {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: transparent;
}

.project__title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-muted);
}

.project__title--active {
  color: var(--text-primary);
}

.project__hint {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: color var(--transition);
}

.project__hint-icon {
  display: inline-block;
  transition: transform 0.4s ease;
}

.project--expandable:hover .project__hint {
  color: var(--accent);
}

.project--expanded .project__hint-icon {
  transform: rotate(180deg);
}

.project--expanded .project__hint {
  color: var(--accent);
}

.project__desc {
  color: var(--text-secondary);
  font-size: 0.925rem;
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

.project__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 0.3rem 0.75rem;
  border-radius: 100px;
}

/* Expandable project details */
.project__expand {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

.project--expanded .project__expand {
  grid-template-rows: 1fr;
}

.project__expand-inner {
  overflow: hidden;
}

.project__details {
  padding-top: 2rem;
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity 0.45s ease 0.08s, transform 0.45s ease 0.08s;
}

.project--expanded .project__details {
  opacity: 1;
  transform: translateY(0);
}

.project__details-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.project__details-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.project__feature-list,
.project__stack-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.project__feature-list li,
.project__stack-list li {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.65;
  padding-left: 1.1rem;
  position: relative;
}

.project__feature-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.project__feature-list strong {
  color: var(--text-primary);
  font-weight: 600;
}

.project__stack-list li {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding-left: 1rem;
}

.project__stack-list li::before {
  display: none;
}

.project__stack-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}

.project__stack-list code {
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 0.85em;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.project__details-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.project__github {
  cursor: pointer;
}

.project__close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}

.project__close:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

/* ========================================
   Contact
   ======================================== */
.contact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem;
}

.contact__links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.social-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.social-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.social-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  background: var(--accent-dim);
  transform: translateX(4px);
}

.social-btn--static {
  width: 100%;
  font: inherit;
  text-align: left;
  word-break: break-all;
  cursor: pointer;
}

/* ========================================
   Visitor Counter
   ======================================== */
.visitor-counter {
  width: min(380px, 100%);
  margin: 2.5rem auto 0;
  padding: 1rem 1.25rem;
  border: 1px solid rgba(110, 231, 183, 0.18);
  border-radius: 24px;
  background: rgba(110, 231, 183, 0.08);
  box-shadow: 0 24px 50px rgba(26, 184, 143, 0.08), 0 0 0 1px rgba(110, 231, 183, 0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: transform var(--transition), border-color var(--transition), background var(--transition);
}

.visitor-counter:hover {
  transform: translateY(-1px);
}

.visitor-counter__wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.visitor-counter__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: rgba(110, 231, 183, 0.16);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(110, 231, 183, 0.18);
  flex-shrink: 0;
}

.visitor-counter__icon svg {
  width: 1.4rem;
  height: 1.4rem;
}

.visitor-counter__body {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.visitor-counter__label {
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-secondary);
}

.visitor-counter__count {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  min-width: 5ch;
  display: inline-block;
  text-align: right;
}

/* ========================================
   Footer
   ======================================== */
.footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer__top {
  color: var(--text-secondary);
  transition: color var(--transition);
}

.footer__top:hover {
  color: var(--accent);
}

/* ========================================
   Reveal Animation
   ======================================== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal--visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children in hero */
.hero .reveal:nth-child(1) { transition-delay: 0.1s; }
.hero .reveal:nth-child(2) { transition-delay: 0.2s; }
.hero .reveal:nth-child(3) { transition-delay: 0.3s; }
.hero .reveal:nth-child(4) { transition-delay: 0.4s; }
.hero .reveal:nth-child(5) { transition-delay: 0.6s; }

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
  .nav__toggle {
    display: flex;
    z-index: 1001;
  }

  .nav__links {
    position: fixed;
    top: 0;
    right: -100%;
    width: min(300px, 80vw);
    height: 100vh;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    transition: right var(--transition);
    z-index: 1000;
  }

  .nav__links--open {
    right: 0;
  }

  .nav__link {
    font-size: 1.1rem;
  }

  .project__main,
  .project:not(.project--expandable) {
    grid-template-columns: 1fr;
  }

  .project:not(.project--expandable) {
    display: grid;
  }

  .project:nth-child(even):not(.project--expandable) {
    direction: ltr;
  }

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

  .contact {
    grid-template-columns: 1fr;
    padding: 2rem;
  }

  .hero__scroll {
    display: none;
  }
}

@media (max-width: 480px) {
  .section {
    padding: 4rem 0;
  }

  .hero__actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .footer__inner {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
}
