/* ================================================
   DESIGN SYSTEM — CSS Variables & Base
   ================================================ */

@font-face {
  font-family: 'Geist';
  src: url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&display=swap');
}

:root {
  --radius: 0.625rem;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);

  /* Light theme */
  --background: #ffffff;
  --foreground: #0a0a0a;
  --card: #ffffff;
  --card-foreground: #0a0a0a;
  --popover: #ffffff;
  --popover-foreground: #0a0a0a;
  --primary: #1a1a1a;
  --primary-foreground: #fafafa;
  --secondary: #f5f5f5;
  --secondary-foreground: #1a1a1a;
  --muted: #f5f5f5;
  --muted-foreground: #737373;
  --accent: #f5f5f5;
  --accent-foreground: #1a1a1a;
  --destructive: #ef4444;
  --border: #e5e5e5;
  --input: #e5e5e5;
  --ring: #a3a3a3;

  --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', 'Fira Code', monospace;
}

.dark {
  --background: #1c1c1c;
  --foreground: #fafafa;
  --card: #1f1f1f;
  --card-foreground: #fafafa;
  --popover: #1f1f1f;
  --popover-foreground: #fafafa;
  --primary: #e5e5e5;
  --primary-foreground: #1a1a1a;
  --secondary: #2e2e2e;
  --secondary-foreground: #fafafa;
  --muted: #2e2e2e;
  --muted-foreground: #a3a3a3;
  --accent: #2e2e2e;
  --accent-foreground: #fafafa;
  --destructive: #f87171;
  --border: rgba(255,255,255,0.1);
  --input: rgba(255,255,255,0.15);
  --ring: #737373;
}

/* ================================================
   RESET & BASE
   ================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-color: var(--border);
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  transition: background-color 0.3s ease, color 0.3s ease;
}

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

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

/* ================================================
   LAYOUT
   ================================================ */
.page-wrapper {
  position: relative;
  z-index: 10;
  max-width: 42rem; /* 672px ~ max-w-2xl */
  margin: 0 auto;
  padding: 3rem 1.5rem 6rem;
}

@media (min-width: 640px) {
  .page-wrapper {
    padding: 6rem 1.5rem 6rem;
  }
}

/* Flickering grid top band */
.top-flicker-band {
  position: absolute;
  inset: 0;
  top: 0;
  left: 0;
  right: 0;
  height: 100px;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.top-flicker-band canvas {
  -webkit-mask-image: linear-gradient(to bottom, black, transparent);
  mask-image: linear-gradient(to bottom, black, transparent);
}

main {
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
  min-height: 100dvh;
  position: relative;
}

/* ================================================
   SECTION HEADINGS
   ================================================ */
.section-heading {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--foreground);
}

/* ================================================
   HERO SECTION
   ================================================ */
#hero .hero-inner {
  max-width: 42rem;
  margin: 0 auto;
}

.hero-row {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
}

@media (min-width: 768px) {
  .hero-row {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
  }
}

.hero-text {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  order: 2;
}

@media (min-width: 768px) {
  .hero-text {
    order: 1;
  }
}

.hero-name {
  font-size: 1.875rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--foreground);
}

@media (min-width: 640px) {
  .hero-name {
    font-size: 2.25rem;
  }
}

@media (min-width: 1024px) {
  .hero-name {
    font-size: 3rem;
  }
}

.hero-description {
  color: var(--muted-foreground);
  max-width: 600px;
  font-size: 1rem;
}

@media (min-width: 768px) {
  .hero-description {
    font-size: 1.125rem;
  }
}

@media (min-width: 1024px) {
  .hero-description {
    font-size: 1.25rem;
  }
}

.hero-avatar-wrap {
  order: 1;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .hero-avatar-wrap {
    order: 2;
  }
}

.hero-avatar {
  width: 6rem;
  height: 6rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  outline: 4px solid var(--muted);
  object-fit: cover;
  display: block;
}

@media (min-width: 768px) {
  .hero-avatar {
    width: 8rem;
    height: 8rem;
  }
}

/* ================================================
   ABOUT SECTION
   ================================================ */
#about .about-inner {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.prose-about {
  color: var(--muted-foreground);
  font-family: var(--font-sans);
  line-height: 1.75;
  font-size: 1rem;
  max-width: 100%;
}

.prose-about strong {
  color: var(--foreground);
  font-weight: 600;
}

.prose-about a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ================================================
   WORK SECTION
   ================================================ */
#work .work-inner {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.work-list {
  display: grid;
  gap: 1.5rem;
  width: 100%;
}

.accordion-item {
  border-bottom: none;
  display: grid;
  gap: 0.5rem;
}

.accordion-trigger {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--foreground);
  font-family: var(--font-sans);
  transition: color 0.2s;
  position: relative;
}

.accordion-trigger:hover .company-name {
  /* Arrow shows on hover */
}

.accordion-logo {
  width: 2rem;
  height: 2rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 9999px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  outline: 2px solid var(--border);
  overflow: hidden;
  object-fit: contain;
  flex-shrink: 0;
  background: var(--muted);
}

@media (min-width: 768px) {
  .accordion-logo {
    width: 2.5rem;
    height: 2.5rem;
  }
}

.accordion-trigger-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.accordion-trigger-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.company-name {
  font-weight: 600;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
}

.accordion-chevron-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
}

.chevron-right,
.chevron-down {
  position: absolute;
  width: 0.875rem;
  height: 0.875rem;
  color: var(--muted-foreground);
  stroke-width: 2;
  transition: all 0.2s ease;
}

.chevron-right {
  opacity: 0;
  transform: translateX(0);
}

.chevron-down {
  opacity: 0;
  transform: rotate(0deg);
}

.accordion-trigger:hover .chevron-right {
  opacity: 1;
  transform: translateX(4px);
}

.accordion-item.open .chevron-right {
  opacity: 0 !important;
  transform: translateX(0) !important;
}

.accordion-item.open .chevron-down {
  opacity: 1;
  transform: rotate(180deg);
}

.work-title {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.accordion-dates {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted-foreground);
  text-align: right;
  flex-shrink: 0;
}

.accordion-content {
  display: none;
  padding: 0;
  margin-left: 3.25rem;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  line-height: 1.7;
  overflow: hidden;
}

@media (min-width: 640px) {
  .accordion-content {
    font-size: 0.875rem;
  }
}

.accordion-item.open .accordion-content {
  display: block;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================================================
   EDUCATION SECTION
   ================================================ */
#education .education-inner {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.education-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.education-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: space-between;
  color: var(--foreground);
  transition: color 0.2s;
  text-decoration: none;
}

.education-item:hover .edu-school {
  /* Handled by arrow opacity */
}

.edu-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.edu-logo {
  width: 2rem;
  height: 2rem;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 9999px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  outline: 2px solid var(--border);
  overflow: hidden;
  object-fit: contain;
  flex-shrink: 0;
  background: var(--muted);
}

@media (min-width: 768px) {
  .edu-logo {
    width: 2.5rem;
    height: 2.5rem;
  }
}

.edu-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.edu-school {
  font-weight: 600;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
}

.edu-arrow {
  width: 0.875rem;
  height: 0.875rem;
  color: var(--muted-foreground);
  opacity: 0;
  transform: translateX(-8px);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.education-item:hover .edu-arrow {
  opacity: 1;
  transform: translateX(0);
}

.edu-degree {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

.edu-dates {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted-foreground);
  text-align: right;
  flex-shrink: 0;
}

/* ================================================
   SKILLS SECTION
   ================================================ */
#skills .skills-inner {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.skill-badge {
  border: 1px solid var(--border);
  background: var(--background);
  outline: 2px solid rgba(0,0,0,0.05);
  border-radius: 0.75rem;
  height: 2rem;
  width: fit-content;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--foreground);
  transition: background 0.15s;
}

.dark .skill-badge {
  outline: 2px solid rgba(255,255,255,0.05);
}

/* ================================================
   PROJECTS SECTION
   ================================================ */
#projects .projects-inner {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.projects-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  justify-content: center;
}

.section-divider-row {
  display: flex;
  align-items: center;
  width: 100%;
}

.divider-line-left {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent 5%, var(--border) 95%, transparent);
}

.divider-line-right {
  flex: 1;
  height: 1px;
  background: linear-gradient(to left, transparent 5%, var(--border) 95%, transparent);
}

.section-label {
  border: 1px solid var(--border);
  background: var(--primary);
  z-index: 10;
  border-radius: 0.75rem;
  padding: 0.25rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--primary-foreground);
}

.projects-title-block {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.projects-title-block h2 {
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

@media (min-width: 640px) {
  .projects-title-block h2 {
    font-size: 2.25rem;
  }
}

.projects-subtitle {
  color: var(--muted-foreground);
  max-width: 36rem;
  text-align: center;
  font-size: 1rem;
  line-height: 1.75;
}

@media (min-width: 768px) {
  .projects-subtitle {
    font-size: 1.125rem;
  }
}

.projects-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

@media (min-width: 640px) {
  .projects-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ================================================
   PROJECT CARD
   ================================================ */
.project-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  overflow: hidden;
  transition: box-shadow 0.2s ease, outline 0.2s ease;
  cursor: pointer;
  background: var(--card);
}

.project-card:hover {
  outline: 2px solid var(--muted);
}

.project-card-media {
  position: relative;
  flex-shrink: 0;
}

.project-card-media a {
  display: block;
}

.project-card video,
.project-card-img {
  width: 100%;
  height: 12rem;
  object-fit: cover;
  display: block;
}

.project-card-placeholder {
  width: 100%;
  height: 12rem;
  background: var(--muted);
}

.project-card-links {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.project-link-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.6875rem;
  font-weight: 500;
  background: #000;
  color: #fff;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  text-decoration: none;
  transition: background 0.15s;
}

.project-link-badge:hover {
  background: rgba(0,0,0,0.85);
}

.project-link-badge svg {
  width: 0.75rem;
  height: 0.75rem;
}

.project-card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.project-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.project-card-title-block {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.project-card-title {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.3;
}

.project-card-dates {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.project-card-ext-link {
  color: var(--muted-foreground);
  transition: color 0.15s;
  flex-shrink: 0;
  display: flex;
}

.project-card-ext-link:hover {
  color: var(--foreground);
}

.project-card-desc {
  font-size: 0.75rem;
  flex: 1;
  color: var(--muted-foreground);
  line-height: 1.7;
}

.project-card-desc a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.project-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: auto;
}

.tag-badge {
  font-size: 0.6875rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 9999px;
  height: 1.5rem;
  padding: 0 0.5rem;
  display: inline-flex;
  align-items: center;
  color: var(--foreground);
  background: transparent;
}

/* ================================================
   CONTACT SECTION
   ================================================ */
.contact-card {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 2.5rem;
  position: relative;
}

.contact-label-wrap {
  position: absolute;
  top: -1rem;
  left: 50%;
  transform: translateX(-50%);
  border: 1px solid var(--border);
  background: var(--primary);
  z-index: 10;
  border-radius: 0.75rem;
  padding: 0.25rem 1rem;
}

.contact-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--primary-foreground);
}

.contact-flicker {
  position: absolute;
  inset: 0;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  border-radius: 0.75rem;
  overflow: hidden;
  pointer-events: none;
}

.contact-flicker canvas {
  -webkit-mask-image: linear-gradient(to bottom, black, transparent);
  mask-image: linear-gradient(to bottom, black, transparent);
}

.contact-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

.contact-title {
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

@media (min-width: 640px) {
  .contact-title {
    font-size: 3rem;
  }
}

.contact-desc {
  max-width: 32rem;
  color: var(--muted-foreground);
  text-align: center;
}

.contact-desc a {
  color: #3b82f6;
  transition: text-decoration 0.15s;
}

.contact-desc a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* ================================================
   NAVBAR (Dock)
   ================================================ */
.navbar-wrapper {
  pointer-events: none;
  position: fixed;
  inset-inline: 0;
  bottom: 1rem;
  z-index: 30;
}

.dock {
  z-index: 50;
  pointer-events: auto;
  position: relative;
  height: 3.5rem;
  padding: 0.5rem;
  width: fit-content;
  margin: 0 auto;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border-radius: 9999px;
  box-shadow: 0 0 10px 3px rgba(0,0,0,0.03);
}

.dark .dock {
  background: rgba(31,31,31,0.9);
  box-shadow: 0 0 10px 3px rgba(0,0,0,0.1);
}

.dock-separator {
  width: 1px;
  height: 66%;
  background: var(--border);
  margin: auto 0;
  flex-shrink: 0;
}

.dock-icon-wrap {
  position: relative;
}

.dock-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--muted-foreground);
  transition: color 0.15s, background 0.15s, transform 0.15s;
  text-decoration: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}

.dock-icon:hover,
.dock-icon.active {
  color: var(--foreground);
  background: var(--muted);
  transform: scale(1.1);
}

.dock-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

/* Tooltip */
.tooltip-content {
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  box-shadow: 0 10px 40px -10px rgba(0,0,0,0.3);
  z-index: 100;
}

.dark .tooltip-content {
  box-shadow: 0 10px 40px -10px rgba(0,0,0,0.5);
}

.tooltip-content::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--primary);
}

.dock-icon-wrap:hover .tooltip-content {
  opacity: 1;
}

/* Theme toggle icon */
.icon-sun,
.icon-moon {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}

.icon-moon {
  display: none;
}

.dark .icon-sun {
  display: none;
}

.dark .icon-moon {
  display: block;
}

/* ================================================
   BLUR FADE ANIMATIONS
   ================================================ */
.blur-fade {
  opacity: 0;
  filter: blur(6px);
  transform: translateY(-6px);
  transition-property: opacity, filter, transform;
  transition-timing-function: ease-out;
  transition-duration: 0.4s;
}

.blur-fade.visible {
  opacity: 1;
  filter: blur(0px);
  transform: translateY(0);
}

/* ================================================
   UTILITIES
   ================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}
