/* === Fonts === */
@font-face {
  font-family: "DOSfont";
  src: url("Minecraftia.woff2") format("woff2");
}

/* === General Page Styles === */
html {
  height: 100%;
  margin: 0;
  padding: 0;
  background-image: url("fallbacks/Bliss.jpg"); /* Fallback */
  background-image: -webkit-image-set(
    url("Images/Bliss.avif") type("image/avif"),
    url("fallbacks/Bliss.webp") type("image/webp"),
    url("fallbacks/Bliss.jpg") type("image/jpeg")
  );
  background-image: image-set(
    url("Images/Bliss.avif") type("image/avif"),
    url("fallbacks/Bliss.webp") type("image/webp"),
    url("fallbacks/Bliss.jpg") type("image/jpeg")
  );
  background-size: cover;
  background-attachment: fixed;
  background-position: center center;
  background-repeat: no-repeat;
  image-rendering: optimizeSpeed;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
}

body {
  min-height: 100%;
  margin: 0;
  padding: 0;
  font-family: "DOSfont", sans-serif;
  overflow: visible;
  -webkit-font-smoothing: none;
  text-rendering: optimizeSpeed;
}

/* === Layout === */
.content-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.container {
  display: grid;
  grid-template-columns: repeat(4, 150px);
  grid-template-rows: 100px;
  justify-content: center;
  margin-bottom: 20px;
  padding-top: 20px;
}

/* === Images === */
img {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: pixelated;
  -ms-interpolation-mode: nearest-neighbor;
}

.Pixelart {
  position: relative;
  width: fit-content;
}

.Pixelart img {
  position: absolute;
  bottom: 0px;
  right: -510px;
  scale: 300%;
  transform-origin: bottom right;
}

/* === Navigation Buttons === */
.button {
  font-family: "DOSfont", sans-serif;
  width: 150px;
  height: 80px;
  background-color: #ffffff;
  border: 5px solid #3b77bc;
  border-radius: 10px;
  font-weight: bold;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: black;
}

.button:hover {
  background-color: #d3e5fa;
}

/* === Main Box (Welcome Section) === */
.Box {
  display: grid;
  margin: 20px auto;
  width: 550px;
  height: 400px;
  background-color: #ffffff;
  border: 5px solid #3b77bc;
  border-radius: 10px;
  box-shadow: 5px 5px 2px rgba(0, 0, 0, 0.338);
  text-align: center;
  position: relative;
  font-size: 15px;
}

.Box h1,
.Box h2 {
  white-space: pre;
}

/* === Social Media Box === */
.AnotherBox {
  display: grid;
  width: 550px;
  height: 30px;
  background-color: #ffffff;
  border: 5px solid #3b77bc;
  border-radius: 10px;
  box-shadow: 5px 5px 2px rgba(0, 0, 0, 0.338);
  text-align: center;
  position: relative;
  padding: 50px;
  margin: 150px auto;
}

.social-media {
  width: 360px;
  display: flex;
  justify-content: space-around;
  align-items: center;
  scale: 180%;
  margin: 0 auto;
}

.social-link img {
  width: 40px;
  height: 40px;
  position: static;
  scale: 150%;
}

.social-link:hover {
  scale: 110%;
}

/* === Chicken Button === */
.chicken-button {
  position: relative;
  cursor: pointer;
  width: 21px;
  height: 17px;
  background-image: url("Images/Chicken.gif");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: pixelated;
  -ms-interpolation-mode: nearest-neighbor;
  scale: 5;
  transform-origin: center;
  z-index: 10;
}

.chicken-button:hover {
  background-image: url("fallbacks/Bliss.png"); /* Fallback */
  background-image: -webkit-image-set(
    url("Images/Chicken.webp") type("image/webp"),
    url("fallbacks/Chicken.png") type("fallbacks/png")
  );
  background-image: image-set(
    url("Images/Chicken.webp") type("image/webp"),
    url("fallbacks/Chicken.png") type("fallbacks/png")
  );
}

/* === Popup Windows === */
.window-box {
  background-color: #ffffff;
  border: 5px solid #3b77bc;
  border-radius: 10px;
  box-shadow: 5px 5px 2px rgba(0, 0, 0, 0.338);
  z-index: 1000;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.window-header {
  padding: 10px;
  background-color: #3b77bc;
  color: white;
  cursor: move;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.close-button {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
}

.window-content {
  padding: 20px;
  max-height: 411px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

.window-content h2,
.window-content h3,
.window-content p {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

/* === Window Banner === */
.window-banner {
  position: absolute;
  top: -12px;
  left: 80%;
  transform: translateX(-50%);
  z-index: 999;
}

.window-banner-image {
  position: static;
  scale: 300%;
}

/* === Window Icons === */
.window-icon {
  width: fit-content;
  height: fit-content;
  position: static;
  scale: 300%;
}

/* === Scrollbar Styling === */
.window-content::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.window-content::-webkit-scrollbar-track {
  background: #ffffff;
  border-radius: 10px;
}

.window-content::-webkit-scrollbar-thumb {
  background-color: #3b77bc;
  border-radius: 10px;
  border: 3px solid #ffffff;
}

.window-content::-webkit-scrollbar-thumb:hover {
  background-color: #d3e5fa;
}

/* === Image Viewer Window === */
.window-box.image-viewer {
  width: min(800px, 95vw);
  height: min(658px, 92vh);
  z-index: 2000;
  padding: 0;
  box-sizing: border-box;
}

.window-box.image-viewer.opening {
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.image-viewer .window-content {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  width: 100%;
  height: calc(100% - 49px);
  max-height: none;
  overflow: hidden;
}

.image-viewer #viewerImage,
.image-viewer .window-content img {
  position: static;
  display: block;
  margin: auto;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform: none !important;
  scale: 1 !important;
}

/* === Portfolio Items === */
.portfolio-item {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 5px;
  border-bottom: 2px solid #3b77bc;
}

.portfolio-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.portfolio-info h3 {
  margin: 0;
  color: #3b77bc;
}

.portfolio-info a {
  color: #3b77bc;
  text-decoration: none;
}

.portfolio-info a:hover {
  text-decoration: underline;
}

.portfolio-image img {
  position: static;
  width: 100%;
  height: auto;
  border-radius: 5px;
  box-shadow: 3px 3px 2px rgba(0, 0, 0, 0.2);
  image-rendering: initial;
}

.project-description {
  margin: 8px 0;
  font-size: 0.9em;
  line-height: 1.4;
}

/* === Gallery Images === */
.gallery-image img {
  position: static;
  width: 100%;
  height: auto;
  scale: 90%;
  border-radius: 5px;
  box-shadow: 3px 3px 2px rgba(0, 0, 0, 0.2);
}

/* === Dragging === */
.dragging {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  cursor: grabbing !important;
}

/* === 404 Page === */
.video-container {
  position: relative;
  border: 7px solid #3b77bc;
  border-radius: 15px;
  overflow: hidden;
  max-width: 800px;
  width: 90%;
  aspect-ratio: 16 / 9;
  box-shadow: 0 0 15px black;
}

.video-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

#playButton {
  position: absolute;
  inset: 0;
  background-color: #ffffff;
  color: black;
  border: none;
  font-family: "DOSfont", sans-serif;
  font-size: 2em;
  cursor: pointer;
}

#playButton:hover {
  background-color: #d3e5fa;
}

/* ============================================
   Media Queries — behavior driven by body classes
   set by JS: body.mobile / body.tablet / body.desktop
   To change breakpoints, edit MOBILE_MAX and TABLET_MAX in main.js
   ============================================ */

/* === Desktop === */
body.desktop .window-box {
  position: fixed;
  width: 700px;
  height: 500px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
body.desktop .chicken-button {
  display: block;
  scale: 6;
  position: absolute;
  bottom: 178px;
  left: 90px;
}

body.desktop .window-header {
  cursor: grab;
}

body.desktop .window-header:active {
  cursor: grabbing;
}

/* === Tablet and Mobile shared — drawer behavior === */
body.mobile .window-box,
body.tablet .window-box {
  position: fixed;
  bottom: -100vh;
  left: 0;
  right: 0;
  top: auto;
  width: 100%;
  max-width: 100%;
  height: 85vh;
  max-height: 85vh;
  margin: 0;
  border-radius: 16px 16px 0 0;
  transform: none;
  transition: bottom 0.4s ease-in-out;
  overflow-y: auto;
  z-index: 1000;
  box-sizing: border-box;
}

body.mobile .window-box.active,
body.tablet .window-box.active {
  bottom: 0;
}

body.mobile .window-header,
body.tablet .window-header {
  cursor: default;
  position: sticky;
  top: 0;
  z-index: 10;
}

body.mobile .window-content,
body.tablet .window-content {
  max-height: none;
  height: auto;
  padding: 15px;
  overflow-y: visible;
}

body.mobile .window-banner,
body.tablet .window-banner {
  display: none;
}

body.mobile .window-content h2,
body.mobile .window-content h3,
body.mobile .window-content h4,
body.mobile .window-content p,
body.mobile .window-content a,
body.tablet .window-content h2,
body.tablet .window-content h3,
body.tablet .window-content h4,
body.tablet .window-content p,
body.tablet .window-content a {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  -webkit-font-smoothing: none;
  text-rendering: optimizeSpeed;
  display: inline-block;
}

body.mobile .window-box *,
body.tablet .window-box * {
  max-width: 100%;
  box-sizing: border-box;
}

/* === Tablet only — side by side portfolio, bigger buttons === */
body.tablet .container {
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 15px;
  width: 100%;
  box-sizing: border-box;
}

body.tablet .button {
  width: 100%;
  height: 70px;
  font-size: 0.85em;
}

body.tablet .Box {
  width: 90%;
  padding: 10px;
}

body.tablet .Box h1 {
  font-size: 3em;
}
body.tablet .Box h2 {
  font-size: 1.8em;
}

body.tablet .Pixelart {
  display: block;
  position: absolute;
  bottom: 0;
  right: 0;
  width: fit-content;
}

body.tablet .Pixelart img {
  position: static;
  scale: 300%;
  transform-origin: bottom right;
  bottom: auto;
  right: auto;
}

body.tablet .AnotherBox {
  width: calc(100% - 40px);
  height: auto;
  padding: 20px;
  margin: 50px auto;
  box-sizing: border-box;
}

body.tablet .social-media {
  width: 60%;
  scale: 2;
  justify-content: space-around;
}

body.tablet .social-link img {
  scale: 1;
  width: 28px;
  height: 28px;
}

body.tablet .chicken-button {
  display: block;
  scale: 4;
  position: absolute;
  bottom: 96px;
  left: 40px;
}

body.tablet .portfolio-item {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

body.tablet .portfolio-info {
  order: unset;
}

body.tablet .portfolio-image,
body.tablet .gallery-image {
  order: unset;
  width: unset;
  margin-top: 0;
}

body.tablet .portfolio-image img,
body.tablet .gallery-image img {
  width: 100%;
  height: auto;
  scale: 1;
  image-rendering: initial;
}

/* === Mobile only — stacked portfolio, smaller everything === */
body.mobile .container {
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  gap: 5px;
}

body.mobile .button {
  width: 100%;
  min-width: 0;
  font-size: 0.85em;
  padding: 0px;
  height: 60px;
  border-width: 4px;
}

body.mobile .Box {
  width: 90%;
  padding: 1px;
}

body.mobile .Box h1,
body.mobile .Box h2 {
  white-space: normal;
  word-break: break-word;
  font-size: 1.5em;
}

body.mobile .Pixelart {
  display: block;
  position: absolute;
  bottom: 0;
  right: 0;
  width: fit-content;
}

body.mobile .Pixelart img {
  position: static;
  scale: 300%;
  transform-origin: bottom right;
  bottom: auto;
  right: auto;
}

body.mobile .AnotherBox {
  width: calc(100% - 20px);
  padding: 15px;
  height: auto;
  margin: 50px auto;
  box-sizing: border-box;
}

body.mobile .social-media {
  width: 60%;
  scale: 1.75;
  gap: 0;
  justify-content: space-around;
}

body.mobile .social-link img {
  scale: 1;
  width: 35px;
  height: 35px;
}

body.mobile .chicken-button {
  display: block;
  scale: 4;
  position: absolute;
  bottom: 96px;
  left: 30px;
}

body.mobile .portfolio-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

body.mobile .portfolio-info {
  order: 1;
}

body.mobile .portfolio-image,
body.mobile .gallery-image {
  order: 2;
  width: 100%;
  margin-top: 5px;
}

body.mobile .portfolio-image img,
body.mobile .gallery-image img {
  width: 100%;
  height: auto;
  scale: 1;
}
