html {
  scroll-padding-top: 80px;
  scroll-behavior: smooth;
}

:root {
  --main: #24292e;
  --accent: #ff4081;
  --bg: #f4f4f4;
  --font: 'Helvetica Neue', sans-serif;
}

body {
  margin: 0;
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--main);
}

/* ===== Header ===== */
header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--main);
  color: white;
  padding: 1rem 2rem;
}
header h1 {
  margin: 0;
  font-size: 1.5rem;
  background: linear-gradient(90deg, #fff, #ff93b0, #fff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: filter .3s ease, opacity .3s ease;
}
header h1:hover { 
  filter: brightness(1.1); 
  opacity: 0.95; 
}
header nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-right: 3rem;           /* NEW: space for the toggle on the right */
  flex-wrap: nowrap;             /* NEW: avoid wrapping if possible */
}
nav a {
  color: white;
  margin-left: 1.5rem;
  text-decoration: none;
  font-weight: bold;
  transition: color 0.3s;
}
nav a:hover { 
  color: var(--accent); 
}

/* Dark mode toggle button in header */
#theme-toggle {
  position: absolute;            /* NEW */
  right: 16px;                   /* NEW */
  top: 50%;                      /* NEW */
  transform: translateY(-50%);   /* NEW: vertically center in header */
  margin-left: 0;                /* override previous margin */
  background: transparent;
  border: 1px solid rgba(255,255,255,0.4);
  color: white;
  padding: .25rem .5rem;
  border-radius: 6px;
  cursor: pointer;
  z-index: 2;  
}
#theme-toggle:hover { 
  background: rgba(255,255,255,0.1); 
}
@media (max-width: 480px) {
  header nav { gap: 0.75rem; padding-right: 2.5rem; }
}
/* ===== Sections ===== */
section {
  padding: 2rem 2rem;
  transition: background 0.4s ease;
}
section h2 {
  font-size: 1.75rem;
  line-height: 1.2;
  margin: 0 0 0.75rem;
  color: var(--main);
  font-weight: 700;
}

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .6s ease, transform .6s ease; }
.reveal.reveal-visible { opacity: 1; transform: translateY(0); }

/* ===== Hero ===== */
.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 2rem;
  background: linear-gradient(to right, #ff7e7e, #cc0000);
}
.hero img {
  width: 250px;
  border-radius: 50%;
  margin-right: 2rem;
}
.bio { max-width: 600px; }

/* ===== Portfolio ===== */
.portfolio { background: linear-gradient(to right, #95a8fe, #0003cc); }
.project {
  background: white;
  padding: 1rem;
  border: 1px solid #ccc;
  border-radius: 10px;
  scroll-snap-align: start;
  flex: 0 0 300px;
  box-sizing: border-box;
  transition: transform 0.2s ease-in-out;
}
.project img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}
.project a {
  display: inline-block;
  margin-top: 0.5rem;
  margin-right: 1rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: bold;
}
.project a:hover { text-decoration: underline; }

/* Hover scale on tiles */
.project:hover,
.art-card:hover {
  transform: scale(1.05);
  z-index: 2;
}

/* Tech badges */
.tech-badges { margin: .5rem 0 0.25rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.tech-badges span {
  font-size: .75rem;
  padding: .2rem .5rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.85);
  border: 1px solid rgba(0,0,0,0.08);
}

/* Carousel scaffolding */
.carousel-wrapper { position: relative; }
.scroll-container {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  gap: 1.5rem;
  padding: 1rem 0;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.scroll-container::-webkit-scrollbar { display: none; }

.carousel-wrapper:hover .scroll-btn { opacity: 1; }
.scroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(255, 255, 255, 0.6);
  border: 2px solid var(--main);
  color: var(--main);
  font-size: 1.75rem;
  font-weight: bold;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  z-index: 10;
  transition: all 0.3s ease;
  width: 40px;
  height: 40px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
}
.scroll-btn svg { stroke: var(--main); width: 24px; height: 24px; }
.scroll-btn:hover svg { stroke: white; }
.scroll-btn:hover { background-color: var(--accent); color: white; border-color: var(--accent); }
.scroll-btn.left { left: 10px; }
.scroll-btn.right { right: 10px; }
@media (max-width: 600px) {
  .scroll-btn.left { left: 5px; }
  .scroll-btn.right { right: 5px; }
}

/* ===== Art ===== */
.art { background: linear-gradient(to right, #a3ffa8, #1c8b00); }
.art-card {
  background: white;
  padding: 1rem;
  border: 1px solid #ccc;
  border-radius: 10px;
  scroll-snap-align: start;
  flex: 0 0 300px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  font-family: var(--font);
  transition: transform 0.2s ease-in-out;
}
.art-card img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.art-card h3 {
  margin: 0.5rem 0 0.25rem;
  font-size: 1.2rem;
  color: var(--main);
}
.art-card p { font-size: 0.95rem; color: var(--main); }

/* ===== Resume / Contact ===== */
.resume {
  background: linear-gradient(to right, #ffdc89, #9c8f00);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 2rem;
  padding: 2rem;
}

.resume-left {
  background: rgba(183, 167, 109, 0.4);
  backdrop-filter: blur(5px);
  padding: 1rem 1.5rem 3rem 1.5rem;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  max-width: 300px;
  min-height: 200px;
  text-align: left;
  font-family: var(--font);
  color: var(--main);
}
.resume-left h2 {
  font-size: 1.75rem;
  line-height: 1.2;
  margin: 0 0 0.75rem;
  color: var(--main);
  font-weight: 700;
}
.resume-left p,
.resume-left a { margin-bottom: 1rem; }

.resume-button {
  background-color: var(--accent);
  color: white;
  padding: 0.75rem 1.5rem;
  border: none;
  text-decoration: none;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
}

.contact-card {
  background: rgba(183, 167, 109, 0.4);
  backdrop-filter: blur(5px);
  padding: 1rem 1.5rem;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  max-width: 300px;
  text-align: left;
  font-family: var(--font);
  color: var(--main);
}
.contact-card h3 {
  font-size: 1.75rem;
  line-height: 1.2;
  margin: 0 0 0.75rem;
  color: var(--main);
  font-weight: 700;
}
.contact-card a {
  color: var(--accent);
  text-decoration: none;
  display: inline-block;
  margin-bottom: 0.5rem;
  font-weight: bold;
}
.contact-card a:hover { 
  text-decoration: underline; 
}

@media (max-width: 700px) {
  .resume { flex-direction: column; align-items: flex-start; }
  .contact-card { margin: 2rem 0 0; }
}

/* ===== Modal (Contact) ===== */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  display: none; 
  align-items: center; 
  justify-content: center;
  z-index: 1000; 
  padding: 1rem;
}
.modal.show { 
  display: flex; 
}
.modal-dialog {
  width: 100%; 
  max-width: 520px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(6px);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.25);
  padding: 1.25rem;
  color: var(--main);
  position: relative;
  max-width: 90%; /* Keeps the modal fitting small screens */
  box-sizing: border-box;
}
.modal-dialog input[type="text"],
.modal-dialog input[type="email"],
.modal-dialog textarea {
  width: 100%;        /* Fill the available space */
  max-width: 100%;    /* Never exceed the modal width */
  box-sizing: border-box; /* Include padding/borders in width calc */
  margin-top: 0.25rem;
  margin-bottom: 1rem;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-family: var(--font);
  font-size: 1rem;
}

/* Keep labels from pushing content too wide */
.modal-dialog label {
  display: block;
  font-weight: bold;
  margin-top: 0.5rem;
}
.modal-close {
  position: absolute; right: 1.25rem; top: 1.25rem;
  background: transparent; 
  border: none; 
  font-size: 1.2rem; 
  cursor: pointer;
}
.modal form { 
  display: grid; 
  gap: .75rem; 
}
.modal input, .modal textarea {
  width: 100%; 
  padding: .6rem .7rem; 
  border-radius: 8px; 
  border: 1px solid #ccc;
  font-family: var(--font); 
  font-size: 1rem;
}

/* ===== Footer ===== */
footer {
  background-color: var(--main);
  color: white;
  text-align: center;
  padding: 1rem;
}

/* ===== Dark Mode ===== */
body.dark {
  --main: #e6e6e6;
  --bg: #0f1115;
}
body.dark header,
body.dark footer { background-color: #0a0c10; color: #e6e6e6; }
body.dark .project,
body.dark .art-card,
body.dark .resume-left,
body.dark .contact-card { box-shadow: 0 6px 14px rgba(0,0,0,0.45); }
body.dark .tech-badges span {
  background: rgba(20,20,20,0.7);
  border-color: rgba(255,255,255,0.08);
  color: #e6e6e6;
}
