/* Base */
:root {
  --bg: #f8f4ef;            /* light warm background */
  --bg-1: #f8f4ef;
  --bg-2: #f4eee7;
  --bg-3: #efe7de;
  --card: #ffffff;
  --muted: #6b4f3a;         /* medium brown for secondary text */
  --text: #2a1d12;          /* dark brown for primary text */
  --brand: #8b5e34;         /* primary brown */
  --brand-contrast: #5a3b22;/* deeper brown */
  --accent: #c38e63;        /* accent brown */
  --border: #e7dcd0;        /* warm border */
  --shadow: rgba(64, 40, 24, 0.08);
  --header-h: 64px;         /* sticky header height offset */
  --hero-pos-x: 95%;        /* push image to the far right */
  --hero-pos-y: 30%;        /* center vertically */
  --overlay-left: rgba(42, 29, 18, 0.65);
  --overlay-mid: rgba(42, 29, 18, 0.45);
  --overlay-fade: rgba(42, 29, 18, 0.10);
}

/* Dark theme variables */
:root.dark {
  --bg: #0e0b09;
  --bg-1: #0e0b09;
  --bg-2: #120f0c;
  --bg-3: #17120f;
  --card: #14110e;
  --muted: #d9c6b6;
  --text: #f7efe8;
  --brand: #a47148;
  --brand-contrast: #8b5e34;
  --accent: #cfa37f;
  --border: #2a2019;
  --shadow: rgba(0, 0, 0, 0.3);
  --overlay-left: rgba(15, 10, 7, 0.75);
  --overlay-mid: rgba(15, 10, 7, 0.5);
  --overlay-fade: rgba(15, 10, 7, 0.12);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

.container {
  width: min(1100px, 92%);
  margin: 0 auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(120%) blur(6px);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }
.brand { color: var(--text); text-decoration: none; font-weight: 700; letter-spacing: 0.2px; }
.nav a { color: var(--muted); text-decoration: none; margin-left: 18px; font-weight: 500; }
.nav a:hover { color: var(--text); }
/* Theme toggle button in nav */
.nav #theme-toggle { margin-left: 18px; padding: 8px 12px; line-height: 1; }

/* Mobile nav */
.nav-toggle { display: none; width: 40px; height: 36px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); position: relative; }
.nav-toggle span { position: absolute; left: 10px; right: 10px; height: 2px; background: var(--text); transition: transform .2s ease, opacity .2s ease; }
.nav-toggle span:nth-child(1) { top: 10px; }
.nav-toggle span:nth-child(2) { top: 17px; }
.nav-toggle span:nth-child(3) { top: 24px; }
.nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-menu { display: flex; align-items: center; }

@media (max-width: 820px) {
  .nav-menu { position: absolute; top: 56px; right: 4%; left: 4%; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 10px; display: none; flex-direction: column; align-items: stretch; box-shadow: 0 16px 40px -20px var(--shadow); }
  .nav-menu a, .nav-menu #theme-toggle { margin: 6px 0; }
  .nav-toggle { display: inline-block; }
  .nav-menu.is-open { display: flex; }
}

/* Sections */
.section { padding: 64px 0; }
.section h2 { margin: 0 0 16px; font-size: 28px; }
.subtitle { color: var(--muted); margin-top: 8px; }

/* Brown-highlighted section (e.g., Skills) */
.section-brown { background: linear-gradient(180deg, #f3e7db 0%, #efe1d4 100%); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-brown h2 { color: #3a291c; }
.section-brown .skills-grid .skill-card { background: #fffaf5; border-color: #e7dcd0; }
.section-brown .skill-card h3 { color: #3a291c; }
.section-brown .skill-card p { color: #6b4f3a; }

/* Dark mode variant */
.dark .section-brown { background: linear-gradient(180deg, #1a120d 0%, #140e0a 100%); border-color: #2a2019; }
.dark .section-brown h2 { color: #f7efe8; }
.dark .section-brown .skills-grid .skill-card { background: #1d140f; border-color: #2a2019; }
.dark .section-brown .skill-card h3 { color: #f7efe8; }
.dark .section-brown .skill-card p { color: #d9c6b6; }

/* Hero */
.hero { padding: 96px 0 72px; }
.hero-inner { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 32px; align-items: center; }
.hero-text h1 { font-size: 40px; line-height: 1.15; margin: 0; }
.hero-cta { margin-top: 20px; display: flex; gap: 12px; }
.btn { display: inline-block; padding: 10px 16px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); text-decoration: none; background: #fffdfb; text-align: center; }
.btn.primary { background: linear-gradient(180deg, var(--brand) 0%, #a47148 100%); border-color: transparent; color: #fffaf5; box-shadow: 0 10px 24px -12px rgba(139, 94, 52, 0.35); }
.btn:hover { background: #f8fafc; }
.btn.primary:hover { filter: brightness(1.05); }
.avatar { display: none; }
.hero-image { display: none; }

/* Hero full-width background */
.hero-cover { position: relative; height: calc(100vh - var(--header-h)); padding: 0; }
.hero-cover::before { content: ""; position: absolute; inset: 0; background: #000 no-repeat center/cover; background-position: var(--hero-pos-x) var(--hero-pos-y); background-image: var(--hero-image, none); filter: saturate(108%); }
.hero-overlay { position: relative; z-index: 1; background: linear-gradient(90deg, var(--overlay-left) 0%, var(--overlay-mid) 35%, var(--overlay-fade) 55%, rgba(42,29,18,0.00) 100%); height: 100%; display: flex; align-items: center; justify-content: flex-start; }
.hero-centered { display: grid; grid-template-columns: 1fr; text-align: left; }
.hero-centered .hero-text { max-width: 820px; margin: 0; }
.hero-centered .hero-cta { margin-top: 20px; }

/* Left-align hero container within overlay */
.hero .container { width: 100%; margin: 0; padding-left: 4%; padding-right: 4%; }
.hero .subtitle { color: #faefe5; }
.hero .hero-text h1, .hero .hero-text, .hero .btn { color: #ffffff; }
.hero .btn { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.4); }
.hero .btn:hover { background: rgba(255,255,255,0.18); }

/* Layout helpers */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.center { text-align: center; }

/* About */
.about-highlights { list-style: none; padding: 0; margin: 16px 0 0; }
.about-highlights li { margin: 8px 0; color: var(--muted); }
.current-list { margin: 8px 0 0; padding-left: 18px; }

/* Skills */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.skill-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; box-shadow: 0 10px 24px -16px var(--shadow); }
.skill-card h3 { margin: 0 0 8px; font-size: 18px; }
.skill-card p { margin: 0; color: var(--muted); }

/* Projects */
.projects-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.project-card { 
  background: var(--card); 
  border: 1px solid var(--border); 
  border-radius: 12px; 
  padding: 18px; 
  box-shadow: 0 10px 24px -16px var(--shadow);
  min-height: 200px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: start;
}

.project-content {
  /* Normal content display */
}

.project-image-container {
  display: none;
  position: relative;
  width: 300px;
  height: 200px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.project-image-container.show {
  display: block;
}

.project-image { 
  width: 100%; 
  height: 100%; 
  object-fit: cover; 
}

.toggle-image {
  margin-top: 12px;
  background: var(--brand);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.toggle-image:hover {
  background: var(--brand-contrast);
}

.close-image {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.7);
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.close-image:hover {
  background: rgba(0,0,0,0.9);
}

@media (max-width: 920px) {
  .project-card {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .project-image-container {
    width: 100%;
    height: 200px;
  }
}

/* Journey */
.timeline { list-style: none; padding: 0; margin: 8px 0 0; }
.timeline li { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; display: flex; justify-content: space-between; gap: 12px; }
.timeline .time { font-weight: 600; }
.timeline .desc { color: var(--muted); }

/* Contact */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.contact-list { list-style: none; padding: 0; margin: 0; }
.contact-list li { margin: 8px 0; }
.contact-list a { color: var(--text); text-decoration: none; border-bottom: 1px dashed var(--border); }
.contact-card { background: #fffdfa; border: 1px solid var(--border); border-radius: 12px; padding: 18px; }

/* CTA */
.cta { padding: 72px 0; border-top: 1px solid var(--border); background: #f6efe7; }
.cta .btn { transition: transform 200ms ease, box-shadow 200ms ease, filter 200ms ease; }
.cta .btn:hover { transform: translateY(-1px); box-shadow: 0 8px 24px -14px rgba(0,0,0,0.25); }
.cta .btn.primary { background: linear-gradient(180deg, var(--brand) 0%, var(--brand-contrast) 100%); }
.cta .btn.primary:hover { filter: brightness(1.07); box-shadow: 0 18px 32px -18px rgba(139, 94, 52, 0.45); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 14px 0; color: var(--muted); background: #f8f4ef; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; }
.back-to-top { color: var(--muted); text-decoration: none; }
.back-to-top:hover { color: var(--text); }

/* Dark mode refinements for CTA, contact, and footer */
.dark .cta { background: linear-gradient(90deg, #1a120d 0%, #140e0a 100%); border-top-color: #231a14; }
.dark .cta h2 { color: var(--text); }
.dark .cta p { color: #e7d9cc; }
.dark .cta .btn { background: rgba(255,255,255,0.06); color: #f7efe8; border-color: #3a2b20; }
.dark .cta .btn:hover { background: rgba(255,255,255,0.12); box-shadow: 0 10px 26px -16px rgba(0,0,0,0.6); }
.dark .cta .btn.primary { background: linear-gradient(180deg, #a47148 0%, #8b5e34 100%); color: #fff6ee; box-shadow: 0 12px 28px -14px rgba(164, 113, 72, 0.45); }
.dark .cta .btn.primary:hover { filter: brightness(1.08); box-shadow: 0 20px 36px -16px rgba(164, 113, 72, 0.55); }

.dark .contact-card { background: #1a120d; border-color: #2a2019; }
.dark .site-footer { background: #120e0b; color: #cbb4a0; border-top-color: #2a2019; }
.dark .back-to-top { color: #cbb4a0; }
.dark .back-to-top:hover { color: #f7efe8; }
.metrics-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.metric-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; text-align: center; }
.metric-value { font-size: 24px; font-weight: 800; color: var(--text); }
.metric-label { color: var(--muted); }

.testimonials-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.testimonial-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.testimonial-card p { margin: 0 0 8px; color: var(--text); }
.testimonial-card .who { color: var(--muted); font-size: 14px; }

@media (max-width: 920px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .testimonials-grid { grid-template-columns: 1fr; }
}

/* Floating back-to-top button */
.back-to-top-fab { position: fixed; right: 18px; bottom: 18px; width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--text); box-shadow: 0 14px 36px -18px var(--shadow); display: none; align-items: center; justify-content: center; cursor: pointer; }
.back-to-top-fab:hover { filter: brightness(1.05); }
.show-back-to-top { display: flex; }
.dark .back-to-top-fab { background: #1a120d; border-color: #2a2019; color: #f7efe8; }

/* Lightbox styles */
dialog.lightbox-dialog { border: none; padding: 0; background: rgba(0,0,0,0.7); width: 100vw; height: 100vh; max-width: none; max-height: none; }
dialog.lightbox-dialog::backdrop { background: rgba(0,0,0,0.7); }
.lightbox-dialog .lightbox-img { max-width: 92vw; max-height: 80vh; display: block; margin: 8vh auto 0; border-radius: 8px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); }
.lightbox-close { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 999px; border: 1px solid #000; background: #fff; cursor: pointer; font-size: 18px; line-height: 1; }
.dark .lightbox-close { background: #1a120d; color: #f7efe8; border-color: #2a2019; }

/* Fullscreen image overlay */
.fullscreen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.fullscreen-overlay.show {
  display: flex;
}

.fullscreen-image {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.fullscreen-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  backdrop-filter: blur(10px);
}

.fullscreen-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Make offering images clickable */
.project-image {
  cursor: pointer;
  transition: transform 0.2s ease;
}

.project-image:hover {
  transform: scale(1.02);
}

/* Responsive */
@media (max-width: 920px) {
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .two-col { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .projects-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  :root { --hero-pos-x: 90%; --hero-pos-y: 55%; }
}

@media (max-width: 520px) {
  .hero-text h1 { font-size: 32px; }
  .btn { width: 100%; text-align: center; }
}

/* Mobile hero adjustments */
@media (max-width: 820px) {
  .hero-cover { height: calc(100vh - var(--header-h)); }
  .hero-overlay { background: linear-gradient(180deg, var(--overlay-left) 0%, var(--overlay-mid) 35%, var(--overlay-fade) 65%, rgba(42,29,18,0.00) 100%); align-items: flex-start; padding-top: 12vh; }
  .hero .container { padding-left: 6%; padding-right: 6%; }
  .hero-centered .hero-text { max-width: 100%; margin: 0 0 24px 0; }
  .hero .subtitle { opacity: 0.95; }
}


