/* =========================
   1) DESIGN TOKENS
========================= */
:root{
  --bg: #f4f4f2;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-soft: rgba(255, 255, 255, 0.48);
  --surface-strong: rgba(255, 255, 255, 0.84);

  --text: #43363b;
  --muted: rgba(67, 54, 59, 0.72);

  --accent: #a54f6b;
  --accent-soft: rgba(165, 79, 107, 0.14);

  --secondary: #bab98b;
  --secondary-soft: rgba(186, 185, 139, 0.18);

  --warm: #ccab81;
  --warm-soft: rgba(204, 171, 129, 0.18);

  --border: rgba(165, 79, 107, 0.14);

  --shadow-sm: 0 8px 20px rgba(67, 54, 59, 0.06);
  --shadow-md: 0 14px 30px rgba(67, 54, 59, 0.08);
  --shadow-lg: 0 24px 60px rgba(67, 54, 59, 0.14);

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;

  --transition-fast: 0.25s ease;
  --transition-med: 0.35s ease;
  --transition-slow: 0.8s ease;
}

html[data-theme="dark"]{
  --bg: #2b2528;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-soft: rgba(255, 255, 255, 0.04);
  --surface-strong: rgba(255, 255, 255, 0.08);

  --text: #f4f4f2;
  --muted: rgba(244, 244, 242, 0.72);

  --accent: #a54f6b;
  --accent-soft: rgba(165, 79, 107, 0.22);

  --secondary: #bab98b;
  --secondary-soft: rgba(186, 185, 139, 0.18);

  --warm: #ccab81;
  --warm-soft: rgba(204, 171, 129, 0.18);

  --border: rgba(244, 244, 242, 0.12);

  --shadow-sm: 0 8px 20px rgba(0, 0, 0, 0.18);
  --shadow-md: 0 14px 30px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.34);
}

/* =========================
   2) BASE / RESET
========================= */
*{
  box-sizing: border-box;
}

html{
  scroll-behavior: smooth;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

body{
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-weight: 400;
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}

img{
  display: block;
  max-width: 100%;
}

a{
  color: inherit;
  text-decoration: none;
}

a:hover{
  text-decoration: underline;
}

h1, h2, h3, h4, .brand{
  margin-top: 0;
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  letter-spacing: 0.3px;
}

p, li, a, input, textarea, .muted{
  font-weight: 400;
}

.btn,
.nav-box,
.skill-group h4,
.card h3{
  font-weight: 500;
}

.container{
  width: min(1100px, 92%);
  margin: 0 auto;
}

.muted{
  color: var(--muted);
}

.small{
  font-size: 14px;
}

.sr-only{
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* =========================
   3) ACCESSIBILITY
========================= */
.skip-link{
  position: absolute;
  left: -999px;
  top: 10px;
  background: var(--accent);
  color: #fff;
  padding: 8px 10px;
  border-radius: 8px;
  z-index: 10000;
}

.skip-link:focus{
  left: 10px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible{
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* =========================
   4) HEADER / NAV
========================= */
.site-header{
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: rgba(244, 244, 242, 0.72);
  border-bottom: 1px solid var(--border);
}

html[data-theme="dark"] .site-header{
  background: rgba(43, 37, 40, 0.72);
}

.header-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
}

.brand{
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  display: inline-block;
}

.nav{
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-toggle{
  display: none;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.nav-menu{
  list-style: none;
  display: flex;
  gap: 10px;
  padding: 0;
  margin: 0;
}

.nav-box{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast), color var(--transition-fast);
}

html[data-theme="dark"] .nav-box{
  background: rgba(255, 255, 255, 0.05);
}

.nav-box:hover{
  background: linear-gradient(120deg, var(--accent), var(--warm));
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(165, 79, 107, 0.16);
  text-decoration: none;
}

.nav-box:active{
  transform: scale(0.97);
}

.header-actions{
  display: flex;
  align-items: center;
  gap: 8px;
}

#themeToggle{
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--border);
  box-shadow: 0 4px 14px rgba(165, 79, 107, 0.08);
  transition: transform var(--transition-fast), background var(--transition-fast), color var(--transition-fast), box-shadow var(--transition-fast);
}

html[data-theme="dark"] #themeToggle{
  background: var(--surface-strong);
  color: var(--text);
}

#themeToggle:hover{
  background: var(--accent);
  color: #fff;
  transform: scale(1.05);
}

/* =========================
   5) BUTTONS
========================= */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast), color var(--transition-fast);
}

.btn:hover{
  box-shadow: var(--shadow-md);
  text-decoration: none;
}

.btn.primary{
  border: none;
  background: linear-gradient(120deg, var(--accent), var(--warm));
  color: #fff;
}

.btn.ghost{
  background: transparent;
}

.btn.small{
  font-size: 14px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}

/* =========================
   6) LAYOUT SECTIONS
========================= */
.section{
  width: min(1100px, 92%);
  margin: 40px auto;
  padding: 80px 24px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-med), box-shadow var(--transition-med);
}

html[data-theme="dark"] .section{
  background: var(--surface-soft);
}

.section:hover{
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(165, 79, 107, 0.12);
}

.section.alt{
  background: rgba(255, 255, 255, 0.5);
}

.section-head{
  margin-bottom: 22px;
}

.section-head h2{
  margin-bottom: 6px;
  font-size: 30px;
}

/* =========================
   7) HERO
========================= */
.hero{
  width: min(1100px, 92%);
  margin: 40px auto;
  padding: 40px 24px;
}

.hero-grid{
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 22px;
  align-items: start;
}

.hero-title{
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-size: clamp(34px, 5vw, 54px);
  margin: 12px 0 10px;
}

.hero-title.with-photo{
  display: flex;
  align-items: center;
  gap: 16px;
}

.hero-subtitle{
  font-size: 18px;
  margin: 0 0 16px;
}

.hero-cta{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.badge{
  display: inline-block;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
  color: var(--muted);
}

.accent{
  color: var(--accent);
}

.hero-photo{
  width: 300px;
  height: 300px;
  object-fit: cover;
  border: none;
  border-radius: 14px;
  background: transparent;
  box-shadow: none;
}

.hero-card{
  justify-self: end;
}

.hero-card h2{
  font-size: 22px;
}

.quick-info{
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: grid;
  gap: 8px;
}

.quick-info li{
  display: flex;
  align-items: center;
  gap: 10px;
}

/* =========================
   8) CARDS / COMMON
========================= */
.card{
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.card-title{
  margin-bottom: 6px;
}

/* =========================
   9) ABOUT / SKILLS
========================= */
.about-grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.skills-full{
  grid-column: span 3;
}

.skills-groups{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-top: 16px;
  align-items: start;
}

.skill-group{
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.38);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

html[data-theme="dark"] .skill-group{
  background: rgba(255, 255, 255, 0.05);
}

.skill-group:hover{
  transform: translateY(-4px);
  box-shadow: 0 16px 30px rgba(165, 79, 107, 0.12);
}

.skill-group h4{
  margin: 0 0 14px;
  font-size: 16px;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  color: var(--accent);
}

.tags{
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.tags li{
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--text);
  font-size: 14px;
}

html[data-theme="dark"] .tags li{
  background: rgba(255, 255, 255, 0.06);
}

/* =========================
   10) PROJECTS / FLIP CARDS
========================= */
.projects-grid{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.flip-card{
  perspective: 1000px;
  min-height: 380px;
}

.flip-card-inner{
  position: relative;
  width: 100%;
  min-height: 380px;
  transform-style: preserve-3d;
  transition: transform var(--transition-slow);
}

.flip-card:hover .flip-card-inner{
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back{
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 380px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.flip-card-front{
  z-index: 2;
}

.flip-card-back{
  transform: rotateY(180deg);
  align-items: center;
  gap: 14px;
  text-align: center;
  background: linear-gradient(135deg, rgba(165, 79, 107, 0.12), rgba(204, 171, 129, 0.28));
  color: var(--text);
}

html[data-theme="dark"] .flip-card-back{
  background: linear-gradient(135deg, rgba(165, 79, 107, 0.24), rgba(204, 171, 129, 0.16));
}

.flip-card .card{
  height: 100%;
  padding: 20px;
  border-radius: var(--radius-md);
}

.project-img{
  width: 100%;
  height: 180px;
  object-fit: cover;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.details-btn{
  margin-top: 6px;
}

/* =========================
   11) DESIGNS STACK
========================= */
.design-stack{
  position: relative;
  width: 100%;
  max-width: 720px;
  height: 500px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stack-img{
  position: absolute;
  left: 50%;
  top: 50%;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.16);
  transform-origin: center center;
  cursor: pointer;
  transition: transform 0.75s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.55s ease, filter 0.55s ease;
}

.stack-img:nth-child(1){
  z-index: 4;
  transform: translate(-50%, -50%) rotate(0deg) scale(1);
  opacity: 1;
  filter: blur(0);
}

.stack-img:nth-child(2){
  z-index: 3;
  transform: translate(-46%, -46%) rotate(-3deg) scale(0.96);
  opacity: 0.9;
  filter: blur(0.2px);
}

.stack-img:nth-child(3){
  z-index: 2;
  transform: translate(-54%, -42%) rotate(3deg) scale(0.92);
  opacity: 0.75;
  filter: blur(0.4px);
}

.stack-img:nth-child(4){
  z-index: 1;
  transform: translate(-50%, -38%) rotate(-5deg) scale(0.88);
  opacity: 0.6;
  filter: blur(0.8px);
}

.design-stack:hover .stack-img:nth-child(1){
  transform: translate(-50%, -50%) rotate(0deg) scale(1.02);
}

.stack-img.exit-right{
  transform: translate(-18%, -52%) rotate(12deg) scale(0.96) !important;
  opacity: 0;
  filter: blur(1px);
}

/* =========================
   12) FORMS / CONTACT
========================= */
.contact-grid{
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
}

.form label{
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
}

input,
textarea{
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.48);
  color: var(--text);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

html[data-theme="dark"] input,
html[data-theme="dark"] textarea{
  background: rgba(255, 255, 255, 0.05);
}

input:focus,
textarea:focus{
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(165, 79, 107, 0.10);
}

textarea{
  resize: vertical;
  min-height: 130px;
}

.list{
  margin: 0;
  padding-left: 18px;
}

.form-status{
  display: none;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 500;
}

.form-status.show{
  display: block;
}

.form-status.error{
  background: rgba(255, 80, 80, 0.12);
  color: #ff6b6b;
  border: 1px solid rgba(255, 80, 80, 0.25);
}

.form-status.success{
  background: rgba(70, 201, 125, 0.12);
  color: #46c97d;
  border: 1px solid rgba(70, 201, 125, 0.25);
}

.input-error{
  border-color: #ff6b6b !important;
}

/* =========================
   13) MODAL
========================= */
.modal{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.65);
}

.hidden{
  display: none;
}

.modal-content{
  position: relative;
  width: min(500px, 100%);
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: #fffdf9;
  color: var(--text);
  box-shadow: var(--shadow-lg);
  animation: modalFade 0.3s ease;
}

html[data-theme="dark"] .modal-content{
  background: #322b2f;
  color: var(--text);
}

.modal-content h3{
  margin-bottom: 14px;
}

.modal-content p{
  margin-bottom: 12px;
  line-height: 1.7;
}

.modal-content .muted{
  color: var(--muted);
}

.modal-content a{
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.modal-content a:hover{
  color: var(--warm);
  text-decoration: underline;
}

.modal-close{
  position: absolute;
  top: 12px;
  right: 16px;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 1.8rem;
  cursor: pointer;
}

#modalTitle{
  font-size: 1.7rem;
}

#modalTools{
  font-weight: 600;
}

@keyframes modalFade{
  from{
    opacity: 0;
    transform: translateY(16px);
  }
  to{
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================
   14) FALLING WORDS
========================= */
.falling-elements{
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.falling-elements span{
  position: absolute;
  top: -80px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: rgba(165, 79, 107, 0.34);
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fallDown 5.2s ease forwards;
}

.falling-elements span:nth-child(1){ left: 6%; animation-delay: 0s; }
.falling-elements span:nth-child(2){ left: 15%; animation-delay: 0.15s; }
.falling-elements span:nth-child(3){ left: 28%; animation-delay: 0.3s; }
.falling-elements span:nth-child(4){ left: 40%; animation-delay: 0.45s; }
.falling-elements span:nth-child(5){ left: 52%; animation-delay: 0.6s; }
.falling-elements span:nth-child(6){ left: 64%; animation-delay: 0.75s; }
.falling-elements span:nth-child(7){ left: 74%; animation-delay: 0.9s; }
.falling-elements span:nth-child(8){ left: 84%; animation-delay: 1.05s; }
.falling-elements span:nth-child(9){ left: 22%; animation-delay: 1.2s; }
.falling-elements span:nth-child(10){ left: 58%; animation-delay: 1.35s; }

@keyframes fallDown{
  0%{
    transform: translateY(-140px) rotate(-8deg);
    opacity: 0;
  }
  10%{
    opacity: 1;
  }
  75%{
    opacity: 1;
  }
  100%{
    transform: translateY(520px) rotate(8deg);
    opacity: 0.15;
  }
}

/* =========================
   15) MOUSE GLOW
========================= */
body::before{
  content: "";
  position: fixed;
  inset: -100px;
  z-index: 0;
  pointer-events: none;
  opacity: 0.32;
  background: radial-gradient(
    900px circle at var(--mx, 50%) var(--my, 40%),
    rgba(165, 79, 107, 0.18),
    rgba(204, 171, 129, 0.14) 35%,
    transparent 65%
  );
  filter: blur(18px);
}

body > *{
  position: relative;
  z-index: 1;
}

/* =========================
   16) REVEAL ANIMATION
========================= */
.reveal{
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.active{
  opacity: 1;
  transform: translateY(0);
}

/* =========================
   17) TYPING EFFECT
========================= */
.typing-text{
  display: inline-block;
  min-width: 170px;
  white-space: nowrap;
  overflow: hidden;
  vertical-align: bottom;
}

.typing-text::after{
  content: "|";
  display: inline-block;
  margin-left: 4px;
  color: var(--accent);
  animation: blinkCursor 0.8s infinite;
}

@keyframes blinkCursor{
  0%, 50%{ opacity: 1; }
  51%, 100%{ opacity: 0; }
}

/* =========================
   18) FOOTER
========================= */
.site-footer{
  padding: 22px 0;
  border-top: 1px solid var(--border);
}

.footer-inner{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* =========================
   19) RESPONSIVE
========================= */
@media (max-width: 900px){
  .hero-grid,
  .about-grid,
  .projects-grid,
  .contact-grid,
  .skills-groups{
    grid-template-columns: 1fr;
  }

  .skills-full{
    grid-column: span 1;
  }

  .nav-toggle{
    display: inline-flex;
  }

  .nav-menu{
    display: none;
    position: absolute;
    right: 4%;
    top: 62px;
    flex-direction: column;
    width: min(240px, 92vw);
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg);
    box-shadow: var(--shadow-md);
  }

  .nav-menu.open{
    display: flex;
  }

  .hero-title.with-photo{
    flex-wrap: wrap;
  }

  .flip-card,
  .flip-card-inner,
  .flip-card-front,
  .flip-card-back{
    min-height: 340px;
  }

  .hero-card{
    width: 100%;
    min-height: auto;
    padding: 18px;
  }

  .design-stack{
    max-width: 100%;
    height: 380px;
  }
}

@media (max-width: 600px){
  .section,
  .hero{
    padding-left: 18px;
    padding-right: 18px;
  }

  .hero-photo{
    width: 220px;
    height: 220px;
  }

  .design-stack{
    height: 300px;
  }

  .stack-img{
    max-width: 92%;
    max-height: 92%;
  }

  .section-head h2{
    font-size: 26px;
  }

  .hero-title{
    font-size: clamp(30px, 9vw, 42px);
  }
}

/* =========================
   20) REDUCED MOTION
========================= */
@media (prefers-reduced-motion: reduce){
  html{
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after{
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal{
    opacity: 1;
    transform: none;
  }
}

