/* ---------- Reset & Base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 400;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  letter-spacing: 0.005em;    /* was 0.01em — Plus Jakarta needs less */
  transition: background 0.5s ease, color 0.5s ease;
}


/* ---------- Link Defaults ---------- */
a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--accent);
}


/* ---------- Theme Variables ---------- */
:root[data-theme="light"] {
  --bg: #f3ebdb;
  --surface: rgba(255, 250, 240, 0.45);
  --surface-strong: rgba(255, 250, 240, 0.82);
  --border: rgba(80, 60, 40, 0.14);
  --text: #2d2820;
  --text-muted: #6a6154;
  --accent: #8a6b4a;
  --accent-2: #6b7a5a;
  --accent-3: #a07890;
  --blob-1: #d4a68a;   /* warm terracotta */
  --blob-2: #a8b89a;   /* sage moss */
  --blob-3: #c9a9c2;   /* dusty rose */
  --blob-4: #e8c88a;   /* honey gold */
  --shadow: 0 20px 60px rgba(80, 60, 30, 0.08);
  --shadow-soft: 0 4px 20px rgba(80, 60, 30, 0.05);
}

:root[data-theme="dark"] {
  --bg: #15130f;
  --surface: rgba(40, 36, 30, 0.45);
  --surface-strong: rgba(40, 36, 30, 0.82);
  --border: rgba(255, 240, 220, 0.1);
  --text: #ece4d4;
  --text-muted: #a9a090; 
  --accent: #d4a67a;
  --accent-2: #a8b89a;
  --accent-3: #c9a9c2;
  --blob-1: #6b4838;
  --blob-2: #3e4a3a;
  --blob-3: #5a3d52;
  --blob-4: #6b5230;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.25);
}

/* ---------- Typography ---------- */
h1, h2, h3, .logo-text {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--text);
}

h1 em, h2 em, h3 em, .logo-text em {
  font-style: italic;
  font-weight: 500;
  color: var(--accent);
}

.subhead, .lead, .eyebrow {
  font-family: 'Cormorant Garamond', serif;
}

.lead {
  font-size: 1.25rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-muted);
  max-width: 580px;
  line-height: 1.6;
}

.subhead {
  font-size: 1.35rem;          /* was 1.15rem */
  font-weight: 400;
  font-style: italic;
  color: var(--text-muted);
  max-width: 640px;            /* was 600px — room for larger text */
  margin: 0 auto;
  line-height: 1.55;           /* NEW — better for larger italics */
}

.eyebrow {
  display: inline-block;
  font-size: 1.2rem;          
  font-weight: 500;
  font-style: italic;
  letter-spacing: 0.2em;      /* slightly more breathing room */
  color: var(--text);
  margin-bottom: 1.25rem;      /* was 1rem */
  text-transform: lowercase;
}

/* ---------- Background Blobs ---------- */
.blobs {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  animation: float 18s ease-in-out infinite;
}

:root[data-theme="dark"] .blob { opacity: 0.75; }

.blob-1 {
  width: 340px; height: 340px;     /* was 480px */
  background: var(--blob-1);
  top: -80px; left: -70px;
  animation-delay: 0s;
}
.blob-2 {
  width: 300px; height: 300px;     /* was 420px */
  background: var(--blob-2);
  top: 30%; right: -90px;
  animation-delay: -4s;
}
.blob-3 {
  width: 380px; height: 380px;     /* was 520px */
  background: var(--blob-3);
  bottom: -110px; left: 20%;
  animation-delay: -8s;
}
.blob-4 {
  width: 270px; height: 270px;     /* was 380px */
  background: var(--blob-4);
  top: 55%; left: -60px;
  animation-delay: -12s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(40px, -30px) scale(1.08); }
  66%      { transform: translate(-30px, 40px) scale(0.95); }
}

/* ---------- Navigation ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2.5rem;
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text);
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 600;
}

.logo-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
}

.logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;

  /* subtle mystical glow */
  filter: drop-shadow(0 0 6px rgba(212, 166, 122, 0.35));
  transition: transform 0.3s ease, filter 0.3s ease;
}

.logo-moon {
  position: absolute;
  inset: 0;
  display: none;

  font-size: 1.4rem;
  color: var(--accent);
  align-items: center;
  justify-content: center;
}

.logo-icon.show-fallback .logo-moon {
  display: flex;
  animation: moonPulse 3s ease-in-out infinite;
}

@keyframes moonPulse {
  0%, 100% { opacity: 0.7; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}

.logo:hover .logo-img {
  transform: scale(1.05);
  filter: drop-shadow(0 0 10px rgba(212, 166, 122, 0.6));
}

.logo-glyph {
  font-size: 1.4rem;
  color: var(--accent);
}

.logo-text em {
  font-style: italic;
  color: var(--accent);
}

.navbar nav ul {
  display: flex;
  gap: 2.2rem;
  list-style: none;
}

.navbar nav a {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text);
  letter-spacing: 0.05em;
  position: relative;
  transition: color 0.3s ease;
}

/* ---------- Active Nav Link (scroll state) ---------- */

/* Active link text color */
.navbar nav a.active {
  color: var(--accent);
}

/* Underline for active link */
.navbar nav a.active::after {
  width: 100%;
}

.navbar nav a:hover::after,
.navbar nav a.active::after {
  width: 100%;
}

.navbar nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.35s ease;
}

.navbar nav a:hover { color: var(--accent); }
.navbar nav a:hover::after { width: 100%; }

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px; height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.3s ease, transform 0.3s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: rotate(20deg);
}

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

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 0.85rem 1.75rem;
  border-radius: 999px;
  text-decoration: none;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  transition: all 0.3s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--text);
  color: var(--bg);
}
.btn-primary:hover {
  background: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}


/* ---------- Sections ---------- */
.section {
  padding: 6rem 2.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-head {
  text-align: center;
  margin-bottom: 4rem;
}

.section-head h2 {
  font-size: clamp(2.25rem, 5vw, 3.75rem);  /* was clamp(2rem, 4.5vw, 3.25rem) */
  margin-bottom: 1.25rem;                   /* was 1rem — balances bigger size */
}


/* ---------- Contact ---------- */
.contact {
  text-align: center;
}

.contact-card {
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 32px;
  padding: 4rem 2.5rem;
  box-shadow: var(--shadow-soft);
}

.contact-card h2 {
  font-size: clamp(2rem, 4.5vw, 3.5rem);
  margin-bottom: 1rem;
}

.contact-card .subhead {
  margin-bottom: 2rem;
}

.socials {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.75rem;
  margin-top: 2.5rem;
}

.socials a {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.05em;
  position: relative;
  transition: color 0.3s ease;
}

.socials a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -3px;
  width: 0; height: 1px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.socials a:hover { color: var(--accent); }
.socials a:hover::after { width: 100%; }

/* ---------- Footer ---------- */
.footer {
  padding: 2.5rem 2rem;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.footer p {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

/* ---------- Mobile Nav Toggle (optional enhancement) ---------- */
.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 40px; height: 40px;
  cursor: pointer;
  color: var(--text);
  align-items: center;
  justify-content: center;
}

/* ======================================================
   RESPONSIVE — TABLET (≤ 900px)
====================================================== */
@media (max-width: 900px) {
  .navbar {
    padding: 1rem 1.5rem;
  }

  .navbar nav ul {
    gap: 1.5rem;
  }

  .navbar nav a {
    font-size: 1.1rem;
  }

  .hero {
    padding: 4rem 1.5rem 3rem;
  }

  .hero h1 {
    font-size: clamp(2.25rem, 7vw, 3.5rem);
  }

  .stats {
    gap: 2rem;
    margin-top: 3rem;
  }

  .stats strong {
    font-size: 2rem;
  }

  .section {
    padding: 4rem 1.5rem;
  }

  .section-head {
    margin-bottom: 3rem;
  }

  .cards,
  .portfolio-grid {
    gap: 1.25rem;
  }

  .card,
  .project-body {
    padding: 1.75rem;
  }

  .contact-card {
    padding: 3rem 1.75rem;
  }

  /* Soften blobs on tablet */
  .blob {
    filter: blur(70px);
    opacity: 0.45;
  }
  .blob-1 { width: 260px; height: 260px; }   /* was 360px */
  .blob-2 { width: 230px; height: 230px; }   /* was 320px */
  .blob-3 { width: 290px; height: 290px; }   /* was 400px */
  .blob-4 { width: 210px; height: 210px; }   /* was 300px */
}

/* ======================================================
   RESPONSIVE — MOBILE (≤ 640px)
====================================================== */
@media (max-width: 640px) {
  body {
    line-height: 1.65;
  }

  /* Navigation — stack into compact layout */
  .navbar {
    padding: 0.9rem 1.2rem;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .logo {
    font-size: 1.2rem;
    order: 1;
  }

  .theme-toggle {
    order: 2;
    width: 36px;
    height: 36px;
  }

  .navbar nav {
    order: 3;
    flex-basis: 100%;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
  }

  .navbar nav ul {
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .navbar nav a {
    font-size: 1.05rem;
    letter-spacing: 0.03em;
  }

  /* Hero */
  .hero {
    padding: 3rem 1.25rem 2.5rem;
  }

  .badge {
    font-size: 0.85rem;
    padding: 0.35rem 0.85rem;
    margin-bottom: 1.5rem;
  }

  .hero h1 {
    font-size: clamp(2rem, 9vw, 2.75rem);
    line-height: 1.2;
  }

  .hero h1 br {
    display: none; /* let lines wrap naturally on small screens */
  }

  .lead {
    font-size: 1.08rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .btn {
    text-align: center;
    padding: 0.95rem 1.5rem;
    font-size: 1.05rem;
  }

  .stats {
    gap: 1.5rem;
    margin-top: 2.5rem;
    justify-content: space-between;
  }

  .stats > div {
    flex: 1 1 30%;
    min-width: 90px;
  }

  .stats strong {
    font-size: 1.6rem;
  }

  .stats span {
    font-size: 0.88rem;
  }

  /* Sections */
  .section {
    padding: 3.5rem 1.25rem;
  }

  .section-head {
    margin-bottom: 2.5rem;
  }

  .section-head h2,
  .about h2,
  .contact-card h2 {
    font-size: clamp(2rem, 7.5vw, 2.5rem);  /* was clamp(1.75rem, 7vw, 2.25rem) */
  }

  .subhead {
    font-size: 1.15rem;                      /* was 1.02rem */
  }

  .eyebrow {
    font-size: 0.98rem;                      /* was 0.85rem */
    letter-spacing: 0.14em;
  }

  /* Cards & Projects — single column */
  .cards,
  .portfolio-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .card {
    padding: 1.6rem;
    border-radius: 20px;
  }

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

  .card-icon {
    font-size: 1.75rem;
    margin-bottom: 1rem;
  }

  .project {
    border-radius: 20px;
  }

  .project-image {
    height: 180px;
  }

  .project-body {
    padding: 1.5rem;
  }

  .project h3 {
    font-size: 1.35rem;
  }

  /* About */
  .about p {
    font-size: 1rem;
    text-align: left;
  }

  .tech-pills {
    gap: 0.5rem;
  }

  .tech-pills span {
    font-size: 0.9rem;
    padding: 0.35rem 0.9rem;
  }

  /* Contact */
  .contact-card {
    padding: 2.5rem 1.5rem;
    border-radius: 24px;
  }

  .socials {
    gap: 1.25rem;
    margin-top: 2rem;
  }

  /* Blobs — smaller & softer on phones */
  .blob {
    filter: blur(60px);
    opacity: 0.4;
  }
  .blob-1 { width: 190px; height: 190px; top: -50px; left: -50px; }  /* was 260px */
  .blob-2 { width: 175px; height: 175px; right: -60px; }             /* was 240px */
  .blob-3 { width: 220px; height: 220px; bottom: -80px; }            /* was 300px */
  .blob-4 { width: 160px; height: 160px; }                           /* was 220px */

  /* Footer */
  .footer {
    padding: 2rem 1.25rem;
  }

  .footer p {
    font-size: 0.9rem;
    letter-spacing: 0.06em;
  }
}

/* ======================================================
   RESPONSIVE — SMALL MOBILE (≤ 380px)
====================================================== */
@media (max-width: 380px) {
  .navbar nav ul {
    gap: 0.4rem;
  }

  .navbar nav a {
    font-size: 1rem;
  }

  .logo {
    font-size: 1.1rem;
  }

  .hero h1 {
    font-size: 1.9rem;
  }

  .lead {
    font-size: 1rem;
  }

  .stats {
    gap: 1rem;
  }

  .stats strong {
    font-size: 1.4rem;
  }

  .stats span {
    font-size: 0.82rem;
  }

  .section-head h2,
  .about h2,
  .contact-card h2 {
    font-size: 1.95rem;   /* was 1.75rem */
  }

  .card h3,
  .project h3 {
    font-size: 1.25rem;
  }

  .contact-card {
    padding: 2rem 1.25rem;
  }

  .socials {
    gap: 1rem;
  }

  .socials a {
    font-size: 0.95rem;
  }
}

/* ======================================================
   LANDSCAPE PHONES — keep hero from feeling cramped
====================================================== */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    padding: 2.5rem 1.5rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .stats {
    margin-top: 2rem;
  }
}

/* ======================================================
   ACCESSIBILITY & PREFERENCES
====================================================== */

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .blob {
    animation: none;
  }
}

/* Auto dark mode if user prefers dark & no preference saved */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #15130f;
    --surface: rgba(40, 36, 30, 0.45);
    --surface-strong: rgba(40, 36, 30, 0.82);
    --border: rgba(255, 240, 220, 0.1);
    --text: #ece4d4;
    --text-muted: #9b9382;
    --accent: #d4a67a;
    --accent-2: #a8b89a;
    --accent-3: #c9a9c2;
    --blob-1: #6b4838;
    --blob-2: #3e4a3a;
    --blob-3: #5a3d52;
    --blob-4: #6b5230;
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.25);
  }
}

/* Focus styles for keyboard navigation */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Smooth scroll offset for sticky nav */
section[id] {
  scroll-margin-top: 80px;
}

/* Selection color */
::selection {
  background: var(--accent);
  color: var(--bg);
}

/* Better tap targets on touch devices */
@media (hover: none) {
  .card:hover,
  .project:hover {
    transform: none;
  }

  .btn-primary:hover {
    transform: none;
  }

  .theme-toggle:hover {
    transform: none;
  }
}