/* ============================================
   CSS Custom Properties (60-30-10 Color Rule)
   ============================================ */
:root {
  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Spacing */
  --section-padding: 6rem 0;
  --container-max: 1100px;
  --container-padding: 0 1.5rem;

  /* Transitions */
  --transition: 0.3s ease;
  --transition-slow: 0.6s ease;
}

/* Dark theme (default) */
[data-theme="dark"] {
  --bg-primary: #0A0A0A;
  --bg-secondary: #1A1A2E;
  --bg-card: #141428;
  --text-primary: #F0F0F5;
  --text-secondary: #A0A0B0;
  --accent: #007AFF;
  --accent-hover: #0062CC;
  --border: #2A2A40;
  --nav-bg: rgba(10, 10, 10, 0.85);
  --tag-bg: #1E1E3A;
  --tag-text: #007AFF;
  --badge-dev-bg: #1a3a1a;
  --badge-dev-text: #4ade80;
  --badge-oss-bg: #1a2a3a;
  --badge-oss-text: #60a5fa;
  --badge-disc-bg: #3a2a1a;
  --badge-disc-text: #f59e0b;
  --timeline-line: #2A2A40;
  --timeline-marker: #007AFF;
}

/* Light theme */
[data-theme="light"] {
  --bg-primary: #FAFAFA;
  --bg-secondary: #F0F0F5;
  --bg-card: #FFFFFF;
  --text-primary: #1A1A2E;
  --text-secondary: #6B6B80;
  --accent: #007AFF;
  --accent-hover: #0062CC;
  --border: #E0E0E8;
  --nav-bg: rgba(250, 250, 250, 0.85);
  --tag-bg: #E8F0FE;
  --tag-text: #007AFF;
  --badge-dev-bg: #dcfce7;
  --badge-dev-text: #166534;
  --badge-oss-bg: #dbeafe;
  --badge-oss-text: #1e40af;
  --badge-disc-bg: #fef3c7;
  --badge-disc-text: #92400e;
  --timeline-line: #E0E0E8;
  --timeline-marker: #007AFF;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  transition: background-color var(--transition), color var(--transition);
}

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

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

/* Focus styles for keyboard navigation */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip to content link for screen readers */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: 0 0 8px 8px;
  font-size: 0.875rem;
  font-weight: 600;
  z-index: 9999;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 0;
  outline: none;
}

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

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--container-padding);
}

/* ============================================
   Navigation
   ============================================ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--transition), border-color var(--transition);
}

.nav__container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}

.nav__logo {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

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

.nav__links {
  display: flex;
  list-style: none;
  gap: 2rem;
}

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

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

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

/* Theme Toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition), border-color var(--transition);
}

.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; }

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

.nav__hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

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

.nav__hamburger.active span:nth-child(2) {
  opacity: 0;
}

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

/* ============================================
   Hero
   ============================================ */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: 6rem 0 4rem;
  background: var(--bg-primary);
}

.hero__container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--container-padding);
  display: flex;
  align-items: center;
  gap: 4rem;
}

.hero__photo-wrapper {
  flex-shrink: 0;
  width: 206px;
  height: 206px;
  border-radius: 50%;
  background: linear-gradient(135deg, #007AFF, #00C6FF, #007AFF);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero__photo {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg-primary);
  box-shadow: 0 0 30px rgba(0, 122, 255, 0.15);
}

.hero__content {
  flex: 1;
}

.hero__greeting {
  color: var(--accent);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.hero__name {
  font-size: 3.5rem;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 0.25rem;
}

.hero__fullname {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.hero__title {
  font-size: 1.25rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.hero__tagline {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 500px;
  margin-bottom: 2rem;
}

.hero__cta {
  display: flex;
  gap: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.75rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
  border: none;
}

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

.btn--primary:hover {
  background: var(--accent-hover);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 122, 255, 0.3);
}

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

.btn--outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

/* ============================================
   Sections (shared)
   ============================================ */
.section {
  padding: var(--section-padding);
}

.section:nth-child(even) {
  background: var(--bg-secondary);
}

.section__title {
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 3rem;
  letter-spacing: -0.02em;
}

/* ============================================
   About
   ============================================ */
.about__content {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}

.about__content p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 1rem;
}

.about__content p:last-child {
  margin-bottom: 0;
}

.about__content strong {
  color: var(--text-primary);
}

/* ============================================
   Projects
   ============================================ */
.projects__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  border-color: var(--accent);
}

/* Badge */
.project-card__badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 1;
}

.project-card__badge--dev {
  background: var(--badge-dev-bg);
  color: var(--badge-dev-text);
}

.project-card__badge--oss {
  background: var(--badge-oss-bg);
  color: var(--badge-oss-text);
}

.project-card__badge--discontinued {
  background: var(--badge-disc-bg);
  color: var(--badge-disc-text);
}

/* Media area */
.project-card__media {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem 1.5rem 0;
}

.project-card__logo {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.project-card__screenshot {
  height: 120px;
  width: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
  object-fit: contain;
}

/* Content */
.project-card__content {
  padding: 1.25rem 1.5rem 1.5rem;
}

.project-card__name {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.project-card__role {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.project-card__desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.6;
}

/* Tags */
.project-card__tags,
.skills__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tag {
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  transition: background-color var(--transition), color var(--transition);
}

/* Links */
.project-card__links {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.project-card__link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--accent);
  border-radius: 6px;
  transition: all var(--transition);
}

.project-card__link:hover {
  background: var(--accent);
  color: #fff;
}

.project-card__logo--placeholder {
  background: var(--bg-secondary);
  border: 1px dashed var(--border);
}

.project-card__nda-label {
  font-size: 0.6rem;
  color: var(--text-secondary);
  font-style: italic;
}

.project-card__coming-soon,
.project-card__discontinued-note {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* ============================================
   Experience / Timeline
   ============================================ */
.timeline {
  position: relative;
  max-width: 700px;
  margin: 0 auto;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--timeline-line);
}

.timeline__item {
  position: relative;
  padding-bottom: 2.5rem;
}

.timeline__item:last-child {
  padding-bottom: 0;
}

.timeline__marker {
  position: absolute;
  left: -2rem;
  top: 0.35rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--timeline-marker);
  border: 2px solid var(--bg-primary);
  transform: translateX(-5px);
}

.timeline__date {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.timeline__title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0.25rem 0 0.15rem;
}

.timeline__company {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.timeline__desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ============================================
   Skills
   ============================================ */
.skills__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  max-width: 900px;
  margin: 0 auto;
  justify-content: center;
}

.skills__group {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  min-width: 200px;
  flex: 0 1 auto;
  transition: border-color var(--transition);
}

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

.skills__group-title {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

/* ============================================
   Education
   ============================================ */
.education__grid {
  display: flex;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
}

.education__item {
  text-align: center;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  flex: 1;
  min-width: 280px;
  max-width: 400px;
  transition: border-color var(--transition);
}

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

.education__degree {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.education__school {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ============================================
   Contact
   ============================================ */
.contact {
  text-align: center;
}

.contact__subtitle {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 2rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.contact__links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.contact__link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: all var(--transition);
}

.contact__link:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.contact__link svg {
  flex-shrink: 0;
}

/* ============================================
   Footer
   ============================================ */
.footer {
  text-align: center;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ============================================
   Scroll Animations
   ============================================ */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  /* Nav */
  .nav__links {
    display: none;
    position: absolute;
    top: 4rem;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    flex-direction: column;
    padding: 1.5rem;
    gap: 1rem;
    border-bottom: 1px solid var(--border);
  }

  .nav__links.active {
    display: flex;
  }

  .nav__hamburger {
    display: flex;
  }

  /* Hero */
  .hero__container {
    flex-direction: column;
    text-align: center;
    gap: 2rem;
    padding-top: 2rem;
  }

  .hero__name {
    font-size: 2.5rem;
  }

  .hero__tagline {
    margin-left: auto;
    margin-right: auto;
  }

  .hero__cta {
    justify-content: center;
  }

  .hero__photo-wrapper {
    width: 166px;
    height: 166px;
  }

  .hero__photo {
    width: 160px;
    height: 160px;
  }

  /* Projects */
  .projects__grid {
    grid-template-columns: 1fr;
  }

  /* Skills */
  .skills__group {
    min-width: 150px;
  }

  /* Education */
  .education__grid {
    flex-direction: column;
    align-items: center;
  }

  /* Contact */
  .contact__links {
    flex-direction: column;
    align-items: center;
  }

  /* Section */
  .section {
    padding: 4rem 0;
  }

  .section__title {
    font-size: 1.75rem;
    margin-bottom: 2rem;
  }
}

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

  .hero__photo-wrapper {
    width: 136px;
    height: 136px;
  }

  .hero__photo {
    width: 130px;
    height: 130px;
  }

  .skills__group {
    min-width: 100%;
  }

  .project-card__media {
    flex-direction: column;
    align-items: flex-start;
  }
}
