/* ============================================================
   CSS Custom Properties — Theme Tokens
   ============================================================ */
:root {
  /* Dark theme (default) */
  --bg:           #0d0d0d;
  --bg-2:         #141414;
  --bg-3:         #1c1c1c;
  --surface:      #222222;
  --surface-2:    #2a2a2a;
  --border:       #2e2e2e;
  --text:         #e8e8e8;
  --text-muted:   #888888;
  --text-faint:   #555555;
  --accent:       #c8c8c8;
  --accent-hover: #ffffff;

  /* Typography */
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Spacing */
  --section-py: 6rem;
  --container:  1200px;
  --radius:     6px;
  --radius-lg:  12px;

  /* Transitions */
  --transition: 0.25s ease;
}

[data-theme="light"] {
  --bg:           #f5f5f5;
  --bg-2:         #efefef;
  --bg-3:         #e8e8e8;
  --surface:      #ffffff;
  --surface-2:    #f0f0f0;
  --border:       #d4d4d4;
  --text:         #1a1a1a;
  --text-muted:   #555555;
  --text-faint:   #999999;
  --accent:       #333333;
  --accent-hover: #000000;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.6;
  transition: background-color var(--transition), color var(--transition);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
}

ul {
  list-style: none;
}

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

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

/* ============================================================
   Utility
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

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

.section-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.section-header {
  margin-bottom: 3rem;
}

.section-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: background-color var(--transition), color var(--transition),
              border-color var(--transition), transform var(--transition),
              box-shadow var(--transition);
}

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

.btn--primary:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--bg);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

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

.btn--ghost:hover {
  border-color: var(--text-muted);
  background-color: var(--surface);
  transform: translateY(-1px);
}

.btn--full {
  width: 100%;
  justify-content: center;
}

/* ============================================================
   Header / Navigation
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--transition), border-color var(--transition);
}

.nav {
  display: flex;
  align-items: center;
  height: 64px;
  gap: 2rem;
}

.nav__logo {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav__links {
  display: flex;
  gap: 1.75rem;
  margin-left: auto;
}

.nav__links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition);
}

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

/* ---- Theme Toggle ---- */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background-color: var(--surface);
  color: var(--text-muted);
  font-size: 1rem;
  flex-shrink: 0;
  transition: background-color var(--transition), border-color var(--transition),
              color var(--transition), transform var(--transition);
  overflow: hidden;
  position: relative;
}

.theme-toggle:hover {
  background-color: var(--surface-2);
  color: var(--text);
  border-color: var(--text-muted);
  transform: scale(1.1);
}

.theme-toggle__icon {
  position: absolute;
  transition: opacity 0.3s, transform 0.3s;
  line-height: 1;
}

/* Dark theme: show moon, hide sun */
[data-theme="dark"] .theme-toggle__sun  { opacity: 0; transform: translateY(-6px); }
[data-theme="dark"] .theme-toggle__moon { opacity: 1; transform: translateY(0); }

/* Light theme: show sun, hide moon */
[data-theme="light"] .theme-toggle__sun  { opacity: 1; transform: translateY(0); }
[data-theme="light"] .theme-toggle__moon { opacity: 0; transform: translateY(6px); }

/* ---- Mobile Burger ---- */
.nav__burger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  margin-left: 0.5rem;
}

.nav__burger span {
  display: block;
  height: 2px;
  width: 100%;
  background-color: var(--text);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

.nav__burger.is-open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav__burger.is-open span:nth-child(2) { opacity: 0; }
.nav__burger.is-open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ---- Mobile Menu ---- */
.nav__mobile-menu {
  display: none;
  position: absolute;
  top: 64px;
  left: 0;
  right: 0;
  background-color: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 1.5rem;
}

.nav__mobile-menu.is-open {
  display: block;
}

.nav__mobile-menu ul {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.nav__mobile-menu a {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-muted);
  display: block;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  transition: color var(--transition);
}

.nav__mobile-menu a:hover {
  color: var(--text);
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  padding-block: var(--section-py);
  min-height: calc(100dvh - 64px);
  display: flex;
  align-items: center;
}

.hero__inner {
  max-width: 780px;
}

.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.hero__title {
  font-size: clamp(2.5rem, 7vw, 5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 1.5rem;
}

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

.hero__cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 4rem;
}

.hero__stats {
  display: flex;
  gap: 3rem;
  flex-wrap: wrap;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
}

.stat__number {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat__label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ============================================================
   About
   ============================================================ */
.about {
  padding-block: var(--section-py);
  background-color: var(--bg-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--transition);
}

.about__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}

.about__text p {
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 1rem;
  font-size: 1.05rem;
}

.about__values {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.value-card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  transition: background-color var(--transition), transform var(--transition);
}

.value-card:hover {
  border-color: var(--text-muted);
}

.value-card__icon {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  flex-shrink: 0;
}

.value-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.value-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ============================================================
   Services
   ============================================================ */
.services {
  padding-block: var(--section-py);
}

.services__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

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

.service-card:hover {
  border-color: var(--text-faint);
}

.service-card__number {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  letter-spacing: 0.1em;
  margin-bottom: 1rem;
}

.service-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.service-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ============================================================
   Portfolio
   ============================================================ */
.portfolio {
  padding-block: var(--section-py);
  background-color: var(--bg-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--transition);
}

.portfolio__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.75rem;
}

/* ---- Portfolio Card ---- */
.portfolio-card {
  flex: 1 1 clamp(280px, calc(33.333% - 1.17rem), 380px);
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition);
}

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

.portfolio-card__thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background-color: var(--bg-3);
}

.portfolio-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portfolio-card__thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--text-faint);
  background: repeating-linear-gradient(
    45deg,
    var(--bg-3),
    var(--bg-3) 10px,
    var(--bg-2) 10px,
    var(--bg-2) 20px
  );
  transition: background var(--transition);
}

.portfolio-card__visit {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 36px;
  height: 36px;
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  opacity: 0;
  transition: opacity var(--transition), background-color var(--transition);
}

.portfolio-card:hover .portfolio-card__visit {
  opacity: 1;
}

.portfolio-card__visit:hover {
  background-color: var(--surface-2);
}

.portfolio-card__body {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.portfolio-card__category {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.portfolio-card__title {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
}

.portfolio-card__desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
}

.portfolio-card__tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.portfolio-card__tech span {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  background-color: var(--bg-3);
  transition: border-color var(--transition), background-color var(--transition);
}

/* ============================================================
   Contact
   ============================================================ */
.contact {
  padding-block: var(--section-py);
}

.contact__grid {
  display: block;
  max-width: 560px;
}

.contact__info > p {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 2rem;
}

.contact__details {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact__details li {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
}

.contact__icon {
  font-size: 1rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.contact__details a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  background-color: var(--bg-2);
  border-top: 1px solid var(--border);
  padding-block: 2rem;
  transition: background-color var(--transition);
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer__copy,
.footer__made {
  font-size: 0.8rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .about__grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
}

@media (max-width: 768px) {
  :root {
    --section-py: 4rem;
  }

  .nav__links {
    display: none;
  }

  .nav__burger {
    display: flex;
    margin-left: auto;
  }

  .theme-toggle {
    margin-left: 0;
  }

  .hero__stats {
    gap: 2rem;
  }

  .portfolio__grid {
    /* flex-wrap already ensures single-column on narrow screens */
  }

}

@media (max-width: 480px) {
  .hero__cta {
    flex-direction: column;
  }

  .hero__cta .btn {
    text-align: center;
    justify-content: center;
  }

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

/* ============================================================
   Selection color
   ============================================================ */
::selection {
  background-color: var(--text);
  color: var(--bg);
}

/* ============================================================
   Scrollbar (Webkit)
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--surface-2);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-faint);
}

/* ============================================================
   Loader / Splash screen
   ============================================================ */
#loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background-color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loader.loader--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader__content {
  text-align: center;
}

.loader__logo {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  margin-bottom: 2rem;
  animation: loaderPulse 1.8s ease-in-out infinite;
}

.loader__dot {
  color: var(--text-muted);
  animation: loaderDotBlink 1s step-end infinite;
}

.loader__bar {
  width: 220px;
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin: 0 auto;
}

.loader__bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--text-muted), var(--text));
  border-radius: 2px;
  transition: width 0.12s ease;
}

@keyframes loaderPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

@keyframes loaderDotBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ============================================================
   Scroll progress bar
   ============================================================ */
#scrollProgress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--text-muted), var(--text));
  z-index: 200;
  transition: width 0.08s linear;
  pointer-events: none;
}

/* ============================================================
   Hero — particle canvas
   ============================================================ */
.hero {
  position: relative;
}

#heroParticles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.55;
  z-index: 0;
}

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

/* ============================================================
   Enhanced scroll-reveal variants
   ============================================================ */
.reveal {
  opacity: 0;
  transition: opacity 0.75s ease, transform 0.75s ease;
}

.reveal--bottom { transform: translateY(44px); }
.reveal--left   { transform: translateX(-52px); }
.reveal--right  { transform: translateX(52px); }
.reveal--scale  { transform: scale(0.88); }

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* Restore fast hover transitions once reveal has completed */
.portfolio-card.reveal.visible,
.service-card.reveal.visible,
.value-card.reveal.visible {
  transition: opacity 0.75s ease, background-color var(--transition);
}

/* ============================================================
   Typewriter caret
   ============================================================ */
.typewriter--active::after {
  content: '|';
  color: var(--text-muted);
  margin-left: 1px;
  animation: caretBlink 0.75s step-end infinite;
}

@keyframes caretBlink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ============================================================
   Hero title accent word — no animation
   ============================================================ */
.hero__title .accent {
  display: inline-block;
}

/* ============================================================
   DevTools blocker overlay
   ============================================================ */
#dt-blocker {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  text-align: center;
  color: var(--text);
}

#dt-blocker p:first-child {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
}

#dt-blocker p:last-child {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ============================================================
   Back-to-top button
   ============================================================ */
#backTop {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s, background-color var(--transition),
              border-color var(--transition), transform var(--transition);
  z-index: 800;
}

#backTop.visible {
  opacity: 1;
  visibility: visible;
}

#backTop:hover {
  background-color: var(--bg-2);
  border-color: var(--text-muted);
  transform: scale(1.1);
}
