/* CSS Variables for theming */
:root {
  --bg-primary: #ffffff;
  --bg-card: #ffffff;
  --text-primary: #171717;
  --text-secondary: #737373;
  --border-color: #e5e5e5;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.12);
  --transition: 0.2s ease;
  --radius: 20px;
  --radius-small: 12px;
}

[data-theme="dark"] {
  --bg-primary: #0a0a0a;
  --bg-card: #0a0a0a;
  --text-primary: #fafafa;
  --text-secondary: #a3a3a3;
  --border-color: #262626;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color var(--transition), color var(--transition);
  min-height: 100vh;
}

/* Main Layout - Two columns on desktop */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 3rem 2rem;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .container {
    grid-template-columns: 380px 1fr;
    gap: 3rem;
    padding: 4rem 3rem;
    align-items: start;
  }
}

/* Profile Section - Left column */
#profile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

@media (min-width: 1024px) {
  #profile {
    position: sticky;
    top: 2rem;
  }
}

.avatar {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1.5rem;
  background-color: var(--bg-card);
}

.profile-name {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.profile-bio {
  list-style: none;
}

.profile-bio li {
  color: var(--text-primary);
  font-size: 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.profile-bio li::before {
  content: "✦";
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* Content - Right column */
.content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Cards Grid */
#cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: minmax(120px, auto);
  gap: 1rem;
}

@media (min-width: 640px) {
  #cards {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: minmax(140px, auto);
    gap: 1.25rem;
  }
}

@media (min-width: 1024px) {
  #cards {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: minmax(160px, auto);
    gap: 1.5rem;
  }
}

/* Social Links Grid - 4 columns on desktop */
#socials {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (min-width: 640px) {
  #socials {
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
  }
}

/* Projects Grid */
#projects {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: minmax(280px, auto);
  gap: 1.5rem;
}

@media (min-width: 640px) {
  #projects {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: minmax(320px, auto);
  }
}

/* Card Base */
.card {
  background-color: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

a.card {
  cursor: pointer;
}

/* Link arrow icon */
.card-arrow {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 28px;
  height: 28px;
  background-color: rgba(0, 0, 0, 0.06);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity var(--transition);
}

[data-theme="dark"] .card-arrow {
  background-color: rgba(255, 255, 255, 0.1);
}

.card:hover .card-arrow {
  opacity: 1;
}

.card-arrow svg {
  width: 14px;
  height: 14px;
  color: var(--text-secondary);
}

/* Card Sizes */
.size-1x1 {
  grid-column: span 1;
  grid-row: span 1;
}

.size-2x1 {
  grid-column: span 2;
  grid-row: span 1;
}

.size-1x2 {
  grid-column: span 1;
  grid-row: span 2;
}

.size-2x2 {
  grid-column: span 2;
  grid-row: span 2;
}

/* Social Card */
.card-social {
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.25rem;
  min-height: 160px;
}

.card-social .icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.card-social .icon svg {
  width: 28px;
  height: 28px;
}

/* Social icon - black & white */
.card-social .icon {
  background-color: transparent;
  color: var(--text-primary);
}

.card-social .icon svg {
  width: 36px;
  height: 36px;
}

.card-social .social-info {
  margin-top: auto;
}

.card-social .social-label {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.125rem;
}

.card-social .social-username {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Image Card */
.card-image {
  padding: 0;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
}

/* Image card with padding */
.card-image.has-padding {
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-image.has-padding img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-small);
}

.card-image .card-arrow {
  background-color: rgba(255, 255, 255, 0.9);
}

.card-image .card-arrow svg {
  color: #333;
}

/* Project Card - Image with title label */
.card-project {
  padding: 0;
  min-height: 280px;
  overflow: hidden;
}

@media (min-width: 640px) {
  .card-project {
    min-height: 360px;
  }
}

.card-project img {
  width: 100%;
  height: auto;
  min-height: 100%;
  position: absolute;
  left: 0;
  border-radius: var(--radius);
}

/* Image vertical position */
.card-project.img-top img {
  top: 0;
  transform: none;
}

.card-project.img-center img {
  top: 50%;
  transform: translateY(-50%);
}

.card-project.img-bottom img {
  bottom: 0;
  top: auto;
  transform: none;
}

.card-project .project-title {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  background-color: var(--bg-card);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  max-width: calc(100% - 2rem);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.card-project .card-arrow {
  background-color: rgba(0, 0, 0, 0.3);
}

.card-project .card-arrow svg {
  color: white;
}

/* Text Card */
.card-text {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.card-text .card-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.card-text .card-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* Theme Toggle Button */
#theme-toggle {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background-color: var(--bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
  z-index: 100;
}

#theme-toggle:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-hover);
}

#theme-toggle svg {
  width: 24px;
  height: 24px;
  color: var(--text-primary);
}

/* Show/hide icons based on theme */
.sun-icon {
  display: none;
}

.moon-icon {
  display: block;
}

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

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

/* Mobile adjustments */
@media (max-width: 639px) {
  .container {
    padding: 2rem 1rem;
  }

  .avatar {
    width: 140px;
    height: 140px;
  }

  .profile-name {
    font-size: 2rem;
  }

  #cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .size-2x1 {
    grid-column: span 2;
  }

  .size-2x2 {
    grid-column: span 2;
    grid-row: span 2;
  }

  .size-1x2 {
    grid-column: span 1;
    grid-row: span 2;
  }

  .card-text .card-title {
    font-size: 1.5rem;
  }

  .card-social {
    min-height: 140px;
  }
}
