/* =================================================
   RESET & SAFETY
================================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* =================================================
   COLOR SYSTEM - Enhanced
================================================= */
:root {
  --bg-main: #f8ede0;
  --bg-gradient-1: #fef5e7;
  --bg-gradient-2: #f9e4c8;
  --bg-card: #fffbf5;
  --accent-red: #c94b3a;
  --accent-red-deep: #a33828;
  --accent-gold: #d4a556;
  --accent-gold-light: #e8c480;
  --text-main: #3a2a1f;
  --text-secondary: #6b5a4a;
  --shadow-soft: rgba(182, 143, 94, 0.15);
  --shadow-medium: rgba(138, 92, 51, 0.25);
  --shadow-strong: rgba(90, 60, 35, 0.35);
}

/* =================================================
   BASE
================================================= */
body {
  font-family: 'Crimson Pro', 'Georgia', serif;
  background: linear-gradient(135deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 100%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  opacity: 0;
  animation: fadeIn 0.8s ease forwards;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* Fixed: Remove animation from box, apply only initial state */
.box {
  opacity: 0;
  transform: translateY(30px) scale(0.95);
}

body.loaded .box {
  animation: slideInScale 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

body.loaded .left {
  animation-delay: 0.1s;
}

body.loaded .right-top {
  animation-delay: 0.3s;
}

body.loaded .right-bottom {
  animation-delay: 0.5s;
}

@keyframes slideInScale {
  0% {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* =================================================
   FLOATING PARTICLES BACKGROUND
================================================= */
.particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: radial-gradient(circle, var(--accent-gold-light), transparent);
  border-radius: 50%;
  opacity: 0;
  animation: float 15s infinite ease-in-out;
}

.particle:nth-child(1) {
  left: 10%;
  animation-delay: 0s;
  animation-duration: 12s;
}

.particle:nth-child(2) {
  left: 25%;
  animation-delay: 2s;
  animation-duration: 15s;
}

.particle:nth-child(3) {
  left: 40%;
  animation-delay: 4s;
  animation-duration: 18s;
}

.particle:nth-child(4) {
  left: 60%;
  animation-delay: 1s;
  animation-duration: 14s;
}

.particle:nth-child(5) {
  left: 75%;
  animation-delay: 3s;
  animation-duration: 16s;
}

.particle:nth-child(6) {
  left: 85%;
  animation-delay: 5s;
  animation-duration: 13s;
}

.particle:nth-child(7) {
  left: 50%;
  animation-delay: 6s;
  animation-duration: 17s;
}

.particle:nth-child(8) {
  left: 30%;
  animation-delay: 7s;
  animation-duration: 19s;
}

@keyframes float {
  0% {
    transform: translateY(100vh) scale(0);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  90% {
    opacity: 0.6;
  }
  100% {
    transform: translateY(-100vh) scale(1.5);
    opacity: 0;
  }
}

/* =================================================
   LAYOUT – DESKTOP DEFAULT
================================================= */
.layout {
  position: relative;
  display: flex;
  min-height: 100vh;
  padding: 40px;
  gap: 40px;
  z-index: 2;
}

/* =================================================
   OVERLAY
================================================= */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(248, 237, 224, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
  backdrop-filter: blur(0px);
}

.layout.active .overlay {
  opacity: 1;
  backdrop-filter: blur(2px);
}

/* =================================================
   CARD BASE
================================================= */
.box {
  background: linear-gradient(145deg, var(--bg-card) 0%, #fff9f0 100%);
  border-radius: 32px;
  box-shadow: 
    0 8px 32px var(--shadow-soft),
    0 24px 64px var(--shadow-medium),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  position: relative;
  z-index: 3;
  transition:
    transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.5s ease,
    filter 0.4s ease;
  will-change: transform;
  overflow: hidden;
}

/* Subtle texture overlay */
.box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(212, 165, 86, 0.02) 2px,
      rgba(212, 165, 86, 0.02) 4px
    );
  pointer-events: none;
  opacity: 0.5;
  z-index: 1;
}

.box > * {
  position: relative;
  z-index: 2;
}

.layout .box {
  transition:
    filter 0.35s ease,
    transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.layout.active .box:not(.active) {
  filter: blur(1.5px) brightness(0.92);
  transform: scale(0.99);
}

.box.active {
  transform: scale(1.18) translateY(-5px);
  z-index: 10;
  transition-delay: 0.04s;
  box-shadow: 
    0 12px 48px var(--shadow-medium),
    0 32px 96px var(--shadow-strong),
    0 0 0 2px var(--accent-gold-light),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.box::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 32px;
  opacity: 0;
  transform: scale(0.96);
  transition:
    opacity 0.35s ease,
    transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: -1;
}

.box.active::after {
  opacity: 0.25;
  transform: scale(1);
}

@keyframes borderGlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* =================================================
   LEFT CARD – PROFILE (DESKTOP)
================================================= */
.left {
  width: 50%;
  padding: 56px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  transform-origin: left center;
}

/* Profile Image Wrapper with Glow */
.profile-wrapper {
  position: relative;
  margin-bottom: 36px;
}

.profile-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, var(--accent-gold-light), transparent 70%);
  border-radius: 50%;
  opacity: 0.4;
  animation: pulse 3s ease-in-out infinite;
  z-index: 0;
}

@keyframes pulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.4;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 0.6;
  }
}

.profile-img {
  position: relative;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  border: 6px solid var(--accent-gold);
  object-fit: cover;
  object-position: center top;
  background: radial-gradient(circle at top, #fff2e0, #e8d3b8);
  box-shadow: 
    0 12px 32px var(--shadow-medium),
    0 0 0 12px rgba(212, 165, 86, 0.1),
    inset 0 -4px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 1;
}

.profile-img:hover {
  transform: scale(1.05) rotate(2deg);
  box-shadow: 
    0 16px 48px var(--shadow-strong),
    0 0 0 12px rgba(212, 165, 86, 0.2),
    inset 0 -4px 8px rgba(0, 0, 0, 0.1);
}

/* Fixed: Simplified content-wrapper animation */
.content-wrapper {
  opacity: 0;
  animation: fadeInUp 0.8s ease forwards;
  animation-delay: 0.6s;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.title-main {
  font-family: 'Playfair Display', serif;
  font-size: 2.8rem;
  font-weight: 700;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--accent-red-deep), var(--accent-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 1px;
}

.subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.tagline {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--accent-gold);
  margin-bottom: 4px;
}

.divider {
  width: 80px;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--accent-gold), transparent);
  margin: 20px auto;
  position: relative;
}

.divider::before {
  content: '✦';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--accent-gold);
  font-size: 12px;
  background: var(--bg-card);
  padding: 0 8px;
}

.bio {
  max-width: 440px;
  line-height: 1.85;
  font-size: 1.05rem;
  color: var(--text-main);
  opacity: 0.9;
  font-weight: 300;
}

/* =================================================
   RIGHT COLUMN – DESKTOP
================================================= */
.right {
  width: 50%;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.right-top,
.right-bottom {
  flex: 1;
  padding: 44px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.right-top {
  transform-origin: right top;
}

.right-bottom {
  transform-origin: right bottom;
}

/* Card Headers */
.card-header {
  margin-bottom: 20px;
  position: relative;
}

.card-header h3 {
  font-family: 'Playfair Display', serif;
  color: var(--accent-red-deep);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  position: relative;
  display: inline-block;
}

.header-accent {
  width: 60px;
  height: 3px;
  background: linear-gradient(to right, var(--accent-gold), var(--accent-red));
  margin-top: 8px;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}

.header-accent::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.6), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.right-top p {
  line-height: 1.85;
  font-size: 1.05rem;
  color: var(--text-main);
  opacity: 0.9;
  font-weight: 300;
}

/* =================================================
   CONTACT ICONS - Enhanced Premium Version
================================================= */
.contact-icons {
  display: flex;
  gap: 20px;
  margin-top: 24px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.contact-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 28px;
  padding-left: 0;
  border: 2px solid transparent;
  background: linear-gradient(var(--bg-card), var(--bg-card)) padding-box,
              linear-gradient(135deg, var(--accent-gold-light), var(--accent-gold)) border-box;
  color: var(--accent-red-deep);
  text-decoration: none;
  overflow: hidden;
  transition: all 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 
    0 4px 16px var(--shadow-soft),
    inset 0 1px 2px rgba(255, 255, 255, 0.8);
  will-change: transform, box-shadow, width, padding-left;
}

.icon-bg {
  position: absolute;
  inset: 0;
  border-radius: 28px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.4), transparent 70%);
  opacity: 0;
  transition: opacity 0.45s ease, transform 0.45s ease;
  z-index: 0;
}

.contact-icon i {
  font-size: 1.5rem;
  line-height: 1;
  position: relative;
  z-index: 1;
  transition: all 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.contact-icon span {
  position: absolute;
  left: 64px;
  white-space: nowrap;
  opacity: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  transition: all 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
  z-index: 1;
  font-family: 'Playfair Display', serif;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Hover/Focus State */
.contact-icon:hover,
.contact-icon:focus-visible {
  width: 160px;
  justify-content: flex-start;
  padding-left: 20px;
  transform: translateY(-6px) scale(1.02);
  box-shadow: 
    0 12px 32px var(--shadow-medium),
    0 16px 48px var(--shadow-strong),
    inset 0 1px 2px rgba(255, 255, 255, 0.9);
  border-color: transparent;
}

.contact-icon:hover .icon-bg,
.contact-icon:focus-visible .icon-bg {
  opacity: 1;
  transform: scale(1.1);
}

.contact-icon:hover i,
.contact-icon:focus-visible i {
  transform: rotate(8deg) scale(1.15);
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.contact-icon:hover span,
.contact-icon:focus-visible span {
  opacity: 1;
  transform: translateX(4px);
}

/* Premium Glow Effect */
.contact-icon::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 36px;
  background: radial-gradient(circle, var(--accent-gold-light), transparent);
  opacity: 0;
  transition: opacity 0.45s ease, transform 0.45s ease;
  filter: blur(8px);
  z-index: -1;
}

.contact-icon:hover::after,
.contact-icon:focus-visible::after {
  opacity: 0.5;
  transform: scale(1.2);
}

/* Platform-Specific Gradients (Enhanced with Premium Feel) */
.contact-icon.github:hover {
  background: linear-gradient(135deg, #24292e, #444d56);
}

.contact-icon.pinterest:hover {
  background: linear-gradient(135deg, #bd081c, #e60023);
}

.contact-icon.instagram:hover {
  background: linear-gradient(135deg, #f56040, #f77737, #fcaf45, #e1306c);
}

.contact-icon.reddit:hover {
  background: linear-gradient(135deg, #ff4500, #ff5714);
}

.contact-icon.discord:hover {
  background: linear-gradient(135deg, #404eed, #5865f2);
}

.contact-icon.x:hover {
  background: linear-gradient(135deg, #000000, #434343);
}

/* Load Animation for Icons */
.contact-icons .contact-icon {
  opacity: 0;
  transform: translateY(20px);
  animation: iconRise 0.8s ease forwards;
}

.contact-icons .contact-icon:nth-child(1) { animation-delay: 0.2s; }
.contact-icons .contact-icon:nth-child(2) { animation-delay: 0.3s; }
.contact-icons .contact-icon:nth-child(3) { animation-delay: 0.4s; }
.contact-icons .contact-icon:nth-child(4) { animation-delay: 0.5s; }
.contact-icons .contact-icon:nth-child(5) { animation-delay: 0.6s; }
.contact-icons .contact-icon:nth-child(6) { animation-delay: 0.7s; }

@keyframes iconRise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =================================================
   CUSTOM SCROLLBAR
================================================= */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg-gradient-1);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent-gold), var(--accent-red));
  border-radius: 10px;
  border: 3px solid var(--bg-gradient-1);
  transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--accent-gold-light), var(--accent-red-deep));
  border-width: 2px;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--accent-gold) var(--bg-gradient-1);
}

/* =================================================
   TABLET & LARGE PHONES (≤ 900px)
================================================= */
@media (max-width: 900px) {
  body {
    overflow-y: auto;
  }

  .layout {
    flex-direction: column;
    align-items: center;
    padding: 32px 24px;
    gap: 32px;
  }

  .overlay {
    position: fixed;
  }

  .left {
    width: 100%;
    max-width: 700px;
    padding: 40px 32px;
    transform-origin: center;
  }

  .profile-img {
    width: 200px;
    height: 200px;
  }

  .profile-glow {
    width: 220px;
    height: 220px;
  }

  .title-main {
    font-size: 2.2rem;
  }

  .right {
    width: 100%;
    max-width: 700px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }

  .right-top,
  .right-bottom {
    padding: 32px 28px;
    align-items: center;
    text-align: center;
    transform-origin: center;
  }

  .card-header h3 {
    font-size: 1.4rem;
  }

  .right-top p {
    font-size: 0.98rem;
  }

  .contact-icons {
    justify-content: center;
  }

  .box.active {
    transform: scale(1.08);
  }
}

/* =================================================
   SMALL PHONES (≤ 520px)
================================================= */
@media (max-width: 520px) {
  .layout {
    padding: 24px 16px;
  }

  .left {
    max-width: 400px;
    padding: 32px 24px;
  }

  .profile-img {
    width: 160px;
    height: 160px;
  }

  .profile-glow {
    width: 180px;
    height: 180px;
  }

  .title-main {
    font-size: 1.8rem;
  }

  .subtitle {
    font-size: 1.1rem;
  }

  .bio {
    font-size: 0.95rem;
  }

  .right {
    max-width: 400px;
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .right-top,
  .right-bottom {
    padding: 28px 24px;
  }

  .contact-icons {
    gap: 12px;
  }

  .box.active .contact-icon {
    width: 150px;
  }

  .box.active .contact-icon span {
    opacity: 1;
  }
}

/* =================================================
   TOUCH DEVICE FIX
================================================= */
@media (hover: none) and (pointer: coarse) {
  .box,
  .box.active {
    transform: none !important;
  }

  .layout.active .box:not(.active) {
    filter: none !important;
  }

  .overlay {
    display: none;
  }

  .contact-icon:active {
    width: 150px;
  }

  .contact-icon:active span {
    opacity: 1;
  }
}

/* =================================================
   ADAPTIVE HEIGHT FOR SMALLER SCREENS (e.g., 1366x768)
================================================= */
@media (max-height: 800px) {
 

  .layout {
    padding: 20px;
    gap: 20px;
  }

  .left {
    padding: 30px 25px;
  }

  .profile-img {
    width: 180px;
    height: 180px;
  }

  .profile-glow {
    width: 200px;
    height: 200px;
  }

  .profile-wrapper {
    margin-bottom: 20px;
  }

  .title-main {
    font-size: 2.2rem;
    margin-bottom: 4px;
  }

  .subtitle {
    font-size: 1.2rem;
    margin-bottom: 4px;
  }

  .tagline {
    font-size: 1rem;
    margin-bottom: 2px;
  }

  .divider {
    margin: 10px auto;
  }

  .bio {
    font-size: 0.95rem;
    line-height: 1.6;
  }

  .right {
    gap: 20px;
  }

  .right-top,
  .right-bottom {
    padding: 25px 20px;
  }

  .card-header {
    margin-bottom: 10px;
  }

  .card-header h3 {
    font-size: 1.4rem;
  }

  .header-accent {
    width: 50px;
    height: 2px;
    margin-top: 4px;
  }

  .right-top p {
    font-size: 0.95rem;
    line-height: 1.6;
  }

  .contact-icons {
    gap: 15px;
    margin-top: 15px;
  }

  .contact-icon {
    width: 48px;
    height: 48px;
  }

  .contact-icon i {
    font-size: 1.3rem;
  }

  .contact-icon:hover,
  .contact-icon:focus-visible {
    width: 140px;
    padding-left: 15px;
  }

  .contact-icon span {
    left: 55px;
    font-size: 0.9rem;
  }
}
