/* --- Global Resets & Styling --- */
:root {
  --main-color-light: #de9eb5;
  --main-color-dark: #8B0000;
  --main-color-hover: #D2B48C;
  --nav-bg: #FFFFFF;
  --nav-bg-hover: #8B0000;
  --vintage-text-shadow-color: rgba(139, 0, 0, 0.4);
}

body {
  margin: 0;
  background-image: url('motionbg2.jpg');
  background-attachment: fixed;
  background-position: center;
  background-size: cover;
  scroll-behavior: smooth;
  overflow-x: hidden;
  font-family: MAIN, sans-serif;
  min-height: 100vh;
}

/* --- Fonts --- */
@font-face { font-family: MAIN; src: url('birds.ttf') format('truetype'); font-weight: normal; }
@font-face { font-family: AMIGH; src: url('amigh.ttf') format('truetype'); font-weight: normal; }
@font-face { font-family: SUB; src: url('MAIN.otf') format('opentype'); font-weight: normal; }
@font-face { font-family: bold; src: url('theboldfont.ttf') format('opentype'); font-weight: normal; }

/* --- Headings --- */
h1 {
  font-family: MAIN, sans-serif;
  color: var(--main-color-dark);
  text-align: center;
  margin-top: clamp(1rem, 5vw, 3rem);
  letter-spacing: clamp(1px, 0.5vw, 3px);
  text-shadow: 2px 2px 0 var(--vintage-text-shadow-color);
  font-size: clamp(2rem, 8vw, 4rem);
}

h2 {
  font-family: MAIN, sans-serif;
  background-color: var(--main-color-light);
  width: fit-content;
  text-align: center;
  border-radius: 200px;
  margin: 0 auto;
  padding: 10px 20px;
  color: var(--nav-bg);
  font-size: clamp(1rem, 4vw, 1.5rem);
  text-shadow: 1px 1px 0 var(--vintage-text-shadow-color);
}

h3 {
  font-family: SUB, sans-serif;
  color: var(--main-color-dark);
  text-align: center;
  width: fit-content;
  margin: 0 auto;
  padding: 8px 16px;
  font-size: clamp(0.6rem, 2vw, 1rem);
}

h4 {
  font-family: MAIN, sans-serif;
  color: white;
  transition: color 0.4s ease;
  font-size: clamp(0.8rem, 3vw, 1.2rem);
}
h4:hover { color: rgb(186, 63, 113); }

p {
  font-family: SUB, sans-serif;
  color: var(--main-color-dark);
  line-height: 1.6;
  font-size: clamp(0.8rem, 2vw, 1rem);
}

/* --- Navigation --- */
nav {
  background-color: rgb(225, 181, 199);
  padding: 0px;
  border-radius: 10px;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 100;
}
ul {
  list-style-type: none;
  display: flex;
  justify-content: space-around;
  margin: 0;
  padding: 0;
}
nav > ul > li > a {
  font-family: bold, sans-serif;
  color: rgb(171, 34, 71);
  text-decoration: none;
  display: block;
  text-shadow: 1px 1px 2px rgb(255, 255, 255);
  padding: clamp(10px, 2vw, 15px);
}
.about a,
.projects > a { transition: color 0.4s ease; }
.about a:hover,
.projects > a:hover { color: rgb(255, 255, 255); background-color: transparent; }

/* --- Dropdown --- */
.dropdown { position: relative; }
.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 160px;
  background-color: rgb(247, 198, 210);
  box-shadow: 0 8px 16px rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  z-index: 101; /* Higher z-index for touch menus */
}
.dropdown-content a {
  color: rgb(231, 130, 160);
  font-family: AMIGH;
  padding: 12px 16px;
  display: block;
  margin: 5px 10px;
  text-shadow: none;
  transition: background-color 0.3s, padding 0.3s;
}
.dropdown-content a:hover {
  background-color: #943d57;
  color: white;
  border-radius: 10px;
  padding: 12px 16px;
}
.dropdown:hover .dropdown-content { display: block; }

/* --- Email --- */
.email {
  display: flex;
  align-items: center; 
  font-family: AMIGH;
}
.email a {
  font-family: AMIGH, sans-serif;
  color: white;
  text-decoration: none;
  transition: color 0.4s ease;
  font-size: clamp(0.8rem, 2.5vw, 1.2rem);
}
.email a:hover { color: rgb(186, 63, 113); }

/* --- Comic & Overlay --- */
.comic {
  position: relative;
  width: 90%;
  max-width: 1200px;
  min-height: 500px;
  margin: 20px auto;
  padding-top: 40px;
}
.comicmoved {
  position: absolute;
  top: 10%;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: auto;
  box-shadow: none;
  transition: transform 0.5s ease-in-out;
  animation: oscillate 5s steps(1, end) infinite alternate;
  border: none;
}
.overlay-text {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  text-shadow: 2px 2px 0 rgba(139, 0, 0, 0.4);
  font-size: clamp(1.2rem, 4vw, 2rem);
  background-color: rgb(228, 233, 228);
  border-radius: 20px;
  border: 5px double rgb(208, 169, 190);
  width: 80%;
  max-width: 400px;
  height: auto;
  padding: 10px;
  box-sizing: border-box;
}
.overlay-text .motion-font { font-family: SUB, sans-serif; position: relative; }
.overlay-text .graphics-font {
  font-family: MAIN, sans-serif;
  color: var(--main-color-light);
  font-size: clamp(1rem, 3vw, 1.5em);
  letter-spacing: 5px;
  position: relative;
  top: unset;
}

/* --- Video & Content --- */
.content {
  margin-top: 40px;
  padding: 20px;
  position: relative;
}
.video-row {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 0;
  gap: 20px;
}
.video-container {
  width: 100%;
  padding: 10px;
  transition: transform 0.3s ease;
  border-radius: 15px;
}
.video-container:hover { transform: scale(1.05); box-shadow: none; }
.video-info {
  width: 90%;
  height: auto;
  min-height: 400px;
  position: relative;
  margin: 20px auto;
  transform: none;
  text-align: center;
  background-image: url('papers.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
  box-sizing: border-box;
  gap: 10px;
}
.responsive-video {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border: var(--nav-bg) solid;
  border-width: 10px;
  border-style: double;
}
.responsive-video.square { padding-bottom: 100%; }
.responsive-video video { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }

/* --- Video background --- */
#myVideo {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -1;
  transform: scale(1.05);
}

/* --- Desktop and Tablet adjustments (768px and up) --- */
@media (min-width: 768px) {
  .video-row.left { flex-direction: row; }
  .video-row.right { flex-direction: row-reverse; }
  .video-container { flex: 1; }
  .video-info {
    width: 60%;
    transform: rotate(2.8deg) scale(1);
    top: 0;
    left: 0;
  }
  .video-info:hover {
    transform: rotate(2.8deg) scale(1.05);
  }
}

/* --- Larger screen adjustments (1024px and up) --- */
@media (min-width: 1024px) {
  .comicmoved {
    position: absolute;
    top: 20%;
    left: 20%;
    width: 60%;
    transform: none;
  }
  .overlay-text {
    position: absolute;
    top: 46%;
    left: 48.5%;
    transform: translate(-50%, -45%);
    width: 30%;
    height: 15%;
    max-width: none;
  }
  .overlay-text .graphics-font {
    top: -19px;
  }
  .polaroid1, .polaroid2 {
    display: block;
    position: absolute;
    width: auto;
    height: auto;
  }
  .polaroid1 {
    top: -2%;
    left: 12%;
    transform: scale(0.25) rotate(-15deg);
  }
  .polaroid2 {
    top: -2%;
    left: 40%;
    transform: scale(0.25) rotate(15deg);
  }
}

/* --- Hide comic and polaroids on smaller screens --- */
@media (max-width: 1023px) {
  .comicmoved,
  .polaroid1,
  .polaroid2 {
    display: none;
  }
}

/* --- Mobile and very small screen adjustments (767px and below) --- */
@media (max-width: 900px) {
  /* Headings */
  h1 { font-size: clamp(2.5rem, 10vw, 4rem); letter-spacing: -1px; }
  h2 { font-size: clamp(1.2rem, 5vw, 1.5rem); }
  h3 { font-size: clamp(0.7rem, 3vw, 1rem); }
  h4 { font-size: clamp(1rem, 4vw, 1.2rem); }
  
  /* Text */
  p { font-size: clamp(0.9rem, 3vw, 1rem); line-height: 1.4; }

  /* Navigation adjustments for stacking */
  nav > ul {
    flex-direction: column;
    align-items: center;
  }
  nav > ul > li {
    width: 100%;
    text-align: center;
  }
  nav > ul > li > a {
    padding: clamp(8px, 3vw, 12px);
  }
  .email {
    padding: clamp(8px, 3vw, 12px);
  }
  .email a {
    font-size: clamp(1rem, 3.5vw, 1.2rem);
  }
  
  /* Remove comic and overlay */
  .comic, .comicmoved, .overlay-text { display: none; }

  /* Video row adjustments */
  .video-row { flex-direction: column; }

  /* Video info box adjustments */
  .video-info {
    width: 95%; /* Use a larger percentage for full-screen appearance */
    min-height: 300px; /* Adjust height for mobile */
    padding: 20px; /* Reduce padding */
  }

  /* Overlay text cleanup (if it were ever visible here) */
  .overlay-text {
    width: 90%;
    padding: 8px;
  }
}
