/* ==========================================================================
   DESIGN SYSTEM & VARIABLES
   ========================================================================== */
:root {
  /* Color Palette (Botanical Editorial / Parchment Aesthetic) */
  --bg-primary: #f4ece0;
  --bg-secondary: #f6efe6;
  --text-primary: #2d261e;
  --text-secondary: #6e5e4d;
  --accent-gold: #bfa27a;
  --accent-gold-dark: #8e7456;
  --accent-green: #0f6b47; /* Matching the reference green dot */
  --accent-green-light: #e6f0eb;
  --border-light: #ebdcc8;
  
  /* Fonts */
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  
  /* Layout */
  --max-width: 1400px;
  --sidebar-width: 320px;
}

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

html {
  scroll-behavior: smooth;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
}

body {
  overflow-x: hidden;
  min-height: 100vh;
  cursor: none; /* Hide default cursor to enable custom cursor */
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-gold);
}

/* ==========================================================================
   AESTHETIC LAYERS (GRAIN, CANVAS, CURSOR)
   ========================================================================== */

/* Tactile Paper Grain Overlay */
.grain-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  opacity: 0.045;
  pointer-events: none;
  z-index: 9999;
  /* SVG noise filter compiled inline */
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Custom Cursor Elements */
.custom-cursor {
  position: fixed;
  width: 8px;
  height: 8px;
  background-color: var(--accent-green);
  border-radius: 50%;
  pointer-events: none;
  z-index: 10000;
  transform: translate(-50%, -50%);
  transition: transform 0.05s ease-out, background-color 0.3s ease;
}

.custom-cursor-ring {
  position: fixed;
  width: 32px;
  height: 32px;
  border: 1px solid var(--accent-gold);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: transform 0.15s cubic-bezier(0.25, 1, 0.5, 1), border-color 0.3s ease;
}

/* Cursor interaction modifications */
.hovering .custom-cursor {
  transform: translate(-50%, -50%) scale(1.5);
  background-color: var(--accent-gold-dark);
}

.hovering .custom-cursor-ring {
  transform: translate(-50%, -50%) scale(1.6);
  border-color: var(--accent-green);
  background-color: rgba(15, 107, 71, 0.03);
}

/* ==========================================================================
   BOTANICAL FLOWER ART & ANIMATIONS
   ========================================================================== */
.botanical-flower-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 580px;
  z-index: 10;
  pointer-events: none;
}

#botanical-flower {
  width: 100%;
  height: auto;
  display: block;
  /* Gentle organic sway animation — pivoting from the stem (top-left corner) */
  transform-origin: 0% 0%;
  animation: flowerSway 8s ease-in-out infinite alternate;
  /* Crop only the very edge of the image to remove potential border lines */
  clip-path: inset(1% 0 0 1%);
  /* Smoothly fade the image edges into the background to hide the rectangle */
  -webkit-mask-image: radial-gradient(ellipse 540px 410px at 0 0, rgba(0,0,0,1) 40%, rgba(0,0,0,0) 85%);
  mask-image: radial-gradient(ellipse 540px 410px at 0 0, rgba(0,0,0,1) 40%, rgba(0,0,0,0) 85%);
}

/* Primary organic sway — slow, natural wind-like motion */
@keyframes flowerSway {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(0.8deg) scale(1.002); }
  50% { transform: rotate(-0.5deg) scale(0.998); }
  75% { transform: rotate(1deg) scale(1.003); }
  100% { transform: rotate(-0.8deg) scale(1); }
}

/* ==========================================================================
   MODERN BLOCH SPHERE BACKGROUND
   ========================================================================== */
.bloch-sphere-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0; /* behind all contents and the flower */
  pointer-events: none;
  opacity: 0.35; /* extremely light and non-contrasting */
  mix-blend-mode: multiply; /* blends seamlessly with background color */
}

#bloch-sphere-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ==========================================================================
   NAVIGATION BAR
   ========================================================================== */
.navbar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  height: 80px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 80px;
  z-index: 100;
  mix-blend-mode: multiply; /* Helps blend links on light sections */
  transition: padding 0.4s ease, background-color 0.4s ease;
}

/* Minimal Logo */
.logo {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.05em;
  padding-left: 280px; /* Offset to clear the floating flower container */
}

/* Hamburger Menu Controls */
.menu-toggle {
  display: none;
}

.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 16px;
  cursor: pointer;
  z-index: 110;
  transition: transform 0.3s ease;
}

.hamburger-btn span {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--text-primary);
  border-radius: 1px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Nav Links */
.nav-links {
  display: flex;
  gap: 40px;
}

.nav-item {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-secondary);
  position: relative;
  padding: 6px 0;
  transition: color 0.3s ease;
}

.nav-item:hover {
  color: var(--accent-green);
}

.nav-item::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background-color: var(--accent-green);
  transition: width 0.3s ease;
}

.nav-item:hover::after {
  width: 100%;
}

/* Scrolled Navbar Modifiers */
.navbar-scrolled {
  background-color: rgba(251, 248, 243, 0.9);
  border-bottom: 1px solid var(--border-light);
  height: 70px;
  padding: 0 60px;
  backdrop-filter: blur(10px);
}

/* ==========================================================================
   LAYOUT STRUCTURE (GRID SYSTEM)
   ========================================================================== */
.content-wrapper {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 60px;
  position: relative;
  z-index: 2;
}

.section-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 40px;
  padding: 120px 0;
  border-top: 1px solid var(--border-light);
}

.section-header-col {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.section-num {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--accent-gold-dark);
  font-weight: 500;
  letter-spacing: 0.05em;
}

.section-title {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.1;
  position: sticky;
  top: 120px;
}

/* ==========================================================================
   SECTION: HERO
   ========================================================================== */
.hero-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-left: 280px; /* Aligns content away from the flower */
  padding-bottom: 60px;
}

.hero-content {
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.eyebrow-text {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent-gold-dark);
  font-weight: 500;
}

.main-title {
  font-family: var(--font-serif);
  font-size: 5.5rem;
  font-weight: 300;
  line-height: 1.05;
  color: var(--text-primary);
  margin-top: 10px;
}

.divider-line {
  width: 80px;
  height: 1px;
  background-color: var(--accent-gold);
  margin-top: 25px;
}

.hero-description {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  color: var(--text-secondary);
  line-height: 1.5;
  font-style: italic;
  font-weight: 300;
}

/* Scroll Down Indicator */
.scroll-indicator {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 30px;
  align-self: flex-start;
  opacity: 0.8;
}

.scroll-text {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-secondary);
}

.scroll-arrow {
  animation: bounceArrow 2s infinite ease-in-out;
}

@keyframes bounceArrow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

/* ==========================================================================
   SECTION: ABOUT
   ========================================================================== */
.lead-text {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 30px;
  font-weight: 400;
}

.body-text {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 25px;
  font-weight: 300;
}

/* ==========================================================================
   SECTION: SELECTED WORKS
   ========================================================================== */
.portfolio-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 50px;
}

.project-card {
  padding: 40px;
  background-color: var(--bg-secondary);
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1),
              border-color 0.4s ease,
              box-shadow 0.4s ease;
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background-color: var(--accent-gold);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.4s ease;
}

.project-card:hover {
  transform: translateY(-8px);
  border-color: var(--border-light);
  box-shadow: 0 15px 35px rgba(142, 116, 86, 0.05);
}

.project-card:hover::before {
  transform: scaleY(1);
}

.project-header {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.project-tag {
  color: var(--accent-green);
  font-weight: 600;
}

.project-year {
  color: var(--text-secondary);
}

.project-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 400;
  color: var(--text-primary);
}

.project-desc {
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  font-weight: 300;
}

.project-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.tech-tag {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  padding: 4px 10px;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  border-radius: 20px;
}

/* ==========================================================================
   SECTION: SKILLS
   ========================================================================== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 40px;
}

.skill-category {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.category-title {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  font-weight: 400;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 10px;
}

.skill-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.skill-list li {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 300;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform 0.2s ease, color 0.2s ease;
}

.skill-list li::before {
  content: '';
  width: 4px;
  height: 4px;
  background-color: var(--accent-gold);
  border-radius: 50%;
}

.skill-list li:hover {
  transform: translateX(4px);
  color: var(--accent-green);
}

/* ==========================================================================
   SECTION: CONTACT & FOOTER
   ========================================================================== */
.contact-lead {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: 50px;
  font-weight: 300;
  line-height: 1.4;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 40px;
  margin-bottom: 80px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

.form-group {
  position: relative;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 12px 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-light);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.3s ease;
}

.form-group textarea {
  resize: none;
}

.form-group label {
  position: absolute;
  left: 0;
  top: 12px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text-secondary);
  pointer-events: none;
  transition: top 0.3s ease, font-size 0.3s ease, color 0.3s ease;
}

/* CSS Floating Label Mechanics */
.form-group input:focus ~ label,
.form-group input:not(:placeholder-shown) ~ label,
.form-group textarea:focus ~ label,
.form-group textarea:not(:placeholder-shown) ~ label {
  top: -15px;
  font-size: 0.75rem;
  color: var(--accent-green);
}

.form-group input:focus,
.form-group textarea:focus {
  border-bottom-color: var(--accent-green);
}

/* Submit Button */
.submit-btn {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 15px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 600;
  cursor: none;
  padding: 10px 0;
  position: relative;
  transition: color 0.3s ease;
}

.submit-btn svg {
  transition: transform 0.3s ease;
}

.submit-btn:hover {
  color: var(--accent-green);
}

.submit-btn:hover svg {
  transform: translateX(8px);
}

/* Footer Section */
.footer {
  border-top: 1px solid var(--border-light);
  padding: 40px 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.footer-links {
  display: flex;
  gap: 30px;
}

.footer-link {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-decoration: none;
  color: var(--text-secondary);
  transition: color 0.3s ease;
}

.footer-link:hover {
  color: var(--accent-green);
}

.copyright {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--accent-gold-dark);
  font-weight: 300;
}

/* ==========================================================================
   SCROLL REVEAL INTERSECTIONS
   ========================================================================== */
.scroll-reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1s cubic-bezier(0.215, 0.61, 0.355, 1),
              transform 1s cubic-bezier(0.215, 0.61, 0.355, 1);
}

.scroll-reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   RESPONSIVENESS
   ========================================================================== */
@media (max-width: 1024px) {
  .botanical-flower-container {
    width: 420px;
  }
  #botanical-flower {
    -webkit-mask-image: radial-gradient(ellipse 400px 315px at 0 0, rgba(0,0,0,1) 65%, rgba(0,0,0,0) 95%);
    mask-image: radial-gradient(ellipse 400px 315px at 0 0, rgba(0,0,0,1) 65%, rgba(0,0,0,0) 95%);
  }
  .navbar {
    padding: 0 40px;
  }
  .logo {
    padding-left: 160px;
  }
  .hero-section {
    padding-left: 160px;
  }
  .main-title {
    font-size: 4rem;
  }
}

@media (max-width: 768px) {
  body {
    cursor: auto; /* Fallback on smaller devices */
  }
  .custom-cursor,
  .custom-cursor-ring {
    display: none;
  }
  
  .botanical-flower-container {
    position: absolute;
    width: 340px;
    top: 0;
    left: 0;
    z-index: 1; /* Place behind header/text to act as watermark */
  }
  #botanical-flower {
    -webkit-mask-image: radial-gradient(ellipse 320px 250px at 0 0, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 98%);
    mask-image: radial-gradient(ellipse 320px 250px at 0 0, rgba(0,0,0,1) 70%, rgba(0,0,0,0) 98%);
  }
  
  .navbar {
    height: 70px;
    padding: 0 30px;
    z-index: 100;
  }
  .logo {
    padding-left: 55px; /* Compact padding to match scaled flower */
    font-size: 1.25rem;
  }
  
  /* Mobile Menu Drawer Layout */
  .hamburger-btn {
    display: flex;
  }
  
  .nav-links {
    display: flex;
    position: fixed;
    top: 0;
    right: -100%;
    width: 75%;
    max-width: 300px;
    height: 100vh;
    background-color: var(--bg-secondary);
    border-left: 1px solid var(--border-light);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 30px;
    z-index: 105;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -5px 0 25px rgba(0,0,0,0.05);
  }
  
  .menu-toggle:checked ~ .nav-links {
    right: 0;
  }
  
  /* Hamburger Checked Animations */
  .menu-toggle:checked ~ .hamburger-btn span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  
  .menu-toggle:checked ~ .hamburger-btn span:nth-child(2) {
    opacity: 0;
  }
  
  .menu-toggle:checked ~ .hamburger-btn span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
  
  .content-wrapper {
    padding: 0 30px;
  }
  .hero-section {
    padding-left: 55px;
    padding-top: 140px;
    min-height: auto;
  }
  .main-title {
    font-size: 3rem;
  }
  .section-grid {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 60px 0;
  }
  .section-title {
    position: static;
    font-size: 2rem;
  }
  .form-row {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  .footer-links {
    flex-wrap: wrap;
    gap: 20px;
  }
}

@media (max-width: 480px) {
  .botanical-flower-container {
    width: 250px;
  }
  #botanical-flower {
    -webkit-mask-image: radial-gradient(ellipse 230px 180px at 0 0, rgba(0,0,0,1) 75%, rgba(0,0,0,0) 98%);
    mask-image: radial-gradient(ellipse 230px 180px at 0 0, rgba(0,0,0,1) 75%, rgba(0,0,0,0) 98%);
  }
  
  .navbar {
    padding: 0 20px;
  }
  .logo {
    padding-left: 45px;
    font-size: 1.15rem;
  }
  
  .content-wrapper {
    padding: 0 20px;
  }
  .hero-section {
    padding-left: 45px;
    padding-top: 120px;
  }
  .main-title {
    font-size: 2.2rem;
  }
  .eyebrow-text {
    font-size: 0.7rem;
    letter-spacing: 0.15em;
  }
  .hero-description {
    font-size: 0.95rem;
    line-height: 1.5;
  }
}
