/* ===== CSS Custom Properties ===== */

:root {
  --font-family: 'Geist Mono', 'SF Mono', 'Fira Code', 'Fira Mono', monospace;
  --sidebar-width: 200px;
  --transition-speed: 0.3s;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --text: #e0e0e0;
  --text-muted: #888888;
  --accent: #ffffff;
  --divider: #2a2a2a;
}

[data-theme="light"] {
  --bg: #f5f5f5;
  --text: #1a1a1a;
  --text-muted: #666666;
  --accent: #000000;
  --divider: #d0d0d0;
}

/* ===== Reset ===== */

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

html {
  scroll-behavior: smooth;
}

body {
  cursor: none;
  font-family: var(--font-family);
  font-weight: 300;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

a, button {
  cursor: none;
}

a {
  color: var(--text);
  text-decoration: none;
  transition: opacity var(--transition-speed) ease;
}

a:hover {
  opacity: 0.6;
}

/* ===== Preloader ===== */

.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.preloader.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader__text {
  font-size: 1.2rem;
  font-weight: 300;
  letter-spacing: 0.15em;
  color: var(--text-muted);
}

/* ===== Custom Cursor ===== */

.custom-cursor {
  position: fixed;
  width: 40px;
  height: 40px;
  border: 1px solid var(--text-muted);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease, border-color 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}

.custom-cursor--dot {
  width: 4px;
  height: 4px;
  border: none;
  background-color: var(--accent);
  transition: width 0.15s ease, height 0.15s ease, opacity 0.3s ease;
}

.custom-cursor.visible {
  opacity: 1;
}

.custom-cursor.hover {
  width: 60px;
  height: 60px;
  border-color: var(--accent);
}

.custom-cursor--dot.hover {
  width: 6px;
  height: 6px;
}

@media (pointer: coarse) {
  .custom-cursor,
  .custom-cursor--dot {
    display: none !important;
  }
}

strong {
  font-weight: 400;
}

/* ===== Sidebar ===== */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem 2rem;
  background-color: var(--bg);
  z-index: 100;
}

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

.sidebar__link {
  font-size: 0.8rem;
  font-weight: 300;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-decoration: none;
  padding-bottom: 0.25rem;
  border-bottom: 1px solid transparent;
  width: fit-content;
  transition: color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

.sidebar__link:hover {
  color: var(--accent);
  opacity: 1;
}

.sidebar__link.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

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

.sidebar__social a {
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

.sidebar__social a:hover {
  color: var(--accent);
  opacity: 1;
}

/* ===== Main Content ===== */

.main {
  margin-left: var(--sidebar-width);
  padding: 0 4rem;
}

/* ===== Sections ===== */

.section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 6rem 0;
}

/* Hero */
.hero-reveal {
  display: inline-block;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

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

.section--hero {
  padding: 0;
  position: relative;
  overflow: hidden;
}

/* Commit Graph Background */
.commit-graph {
  position: absolute;
  right: 0;
  top: 35%;
  transform: translateY(-50%);
  display: grid;
  gap: 2px;
  opacity: 0.3;
  z-index: 0;
  pointer-events: none;
  max-width: 400px;
}

.commit-graph__cell {
  width: 5px;
  height: 5px;
  border-radius: 1px;
  transition: background-color 0.4s ease;
}

.hero__content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4rem;
  margin-top: 6rem;
  width: 100%;
}

.hero__name {
  font-size: 7rem;
  font-weight: 200;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  line-height: 1.05;
  color: var(--accent);
}

.hero__years {
  font-size: 0.75rem;
  font-weight: 300;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-top: 1rem;
  opacity: 0.6;
}

.hero__subtitle {
  font-size: 1.2rem;
  font-weight: 300;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-top: 1rem;
}

.hero__about {
  position: relative;
  z-index: 1;
  max-width: 400px;
  margin-left: auto;
  margin-top: 2rem;
  font-size: 0.85rem;
  line-height: 1.8;
}

/* Text Scramble */
.bracket {
  color: var(--text-muted);
}

.scramble-char {
  display: inline-block;
  position: relative;
  padding: 0;
  margin: 0 1px;
  line-height: 1;
  transition: background-color 0.1s ease, color 0.1s ease;
}

.scramble-char.glitch {
  background-color: var(--accent);
  color: var(--bg);
}

.hero__about p {
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* Section headings */
.section__heading {
  font-size: 1.1rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 2rem;
}

.section__subheading {
  font-size: 0.95rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

.section__content {
  max-width: 600px;
}

.section__content--right {
  max-width: 600px;
  margin-left: auto;
}

.section__content p {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* Experience */
.experience__list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.experience__item {
  padding-left: 1.5rem;
  border-left: 1px solid var(--divider);
}

.experience__role {
  font-size: 1rem;
  font-weight: 400;
  color: var(--accent);
}

.experience__meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0.5rem;
}

.experience__desc {
  color: var(--text-muted);
}

/* Skills */
.skills__group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.skills__group p {
  margin-bottom: 0.5rem;
}

/* Contact */
.section--contact {
  min-height: 60vh;
  justify-content: center;
}

/* Terminal */
.terminal {
  width: 100%;
  max-width: 550px;
  margin-left: auto;
  border: 1px solid var(--divider);
  border-radius: 8px;
  overflow: hidden;
}

.terminal__header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--divider);
}

.terminal__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.terminal__dot--red { background: #ff5f57; }
.terminal__dot--yellow { background: #febc2e; }
.terminal__dot--green { background: #28c840; }

.terminal__title {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.terminal__body {
  padding: 1.25rem;
  min-height: 200px;
}

.terminal__line {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  line-height: 1.6;
}

.terminal__prompt {
  color: var(--accent);
  flex-shrink: 0;
}

.terminal__typed {
  color: var(--text-muted);
}

.terminal__input-line {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
}

.terminal__label {
  color: var(--accent);
  flex-shrink: 0;
  white-space: nowrap;
}

.terminal__input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-family);
  font-size: 0.8rem;
  width: 100%;
  caret-color: var(--accent);
}

.terminal__input::placeholder {
  color: var(--divider);
}

.terminal__message-input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-family);
  font-size: 0.8rem;
  width: 100%;
  resize: none;
  min-height: 60px;
  caret-color: var(--accent);
}

.terminal__message-input::placeholder {
  color: var(--divider);
}

.terminal__success {
  color: var(--accent);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.terminal__cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  background-color: var(--accent);
  animation: blink 1s step-end infinite;
  vertical-align: middle;
  margin-left: 2px;
}

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

.footer {
  margin-top: auto;
  padding: 2rem 0;
}

.footer p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ===== Theme Toggle ===== */

.theme-toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: 1px solid var(--divider);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  z-index: 200;
  transition: color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

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

[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* ===== Scroll Animations ===== */

.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* ===== Mobile Header ===== */

.mobile-header {
  display: none;
}

.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0.5rem;
}

.hamburger span {
  display: block;
  width: 24px;
  height: 1px;
  background-color: var(--accent);
  transition: transform var(--transition-speed) ease, opacity var(--transition-speed) ease;
}

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

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

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

/* ===== Responsive ===== */

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--bg);
    padding: 5rem 2rem 2rem;
    transform: translateX(-100%);
    transition: transform var(--transition-speed) ease;
    z-index: 150;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1.5rem 2rem;
    background-color: var(--bg);
    z-index: 200;
  }

  .main {
    margin-left: 0;
    padding: 0 2rem;
  }

  .hero__content {
    flex-direction: column;
    align-items: flex-start;
    gap: 2rem;
    margin-top: 2rem;
  }

  .hero__about {
    align-self: flex-start;
    margin-left: 0;
    max-width: 100%;
    margin-top: 2rem;
  }

  .hero__name {
    font-size: 2.5rem;
  }

  .hero__subtitle {
    font-size: 0.9rem;
  }

  .hero__years {
    font-size: 0.65rem;
  }

  .commit-graph {
    opacity: 0.08;
    right: 0;
    max-width: 200px;
    gap: 1px;
  }

  .commit-graph__cell {
    width: 3px;
    height: 3px;
  }

  .section {
    min-height: auto;
    padding: 4rem 0;
  }

  .section--hero {
    min-height: 100vh;
  }

  .section__content--right {
    margin-left: 0;
    max-width: 100%;
  }

  .section__content {
    max-width: 100%;
  }

  .experience__item {
    padding-left: 1rem;
  }

  .section--contact {
    min-height: auto;
  }

  .theme-toggle {
    top: 1.25rem;
    right: 1.5rem;
    z-index: 250;
  }
}

@media (max-width: 480px) {
  .hero__name {
    font-size: 2rem;
  }

  .main {
    padding: 0 1.5rem;
  }

  .commit-graph {
    max-width: 150px;
  }
}
