/* css/style.css */

:root {
  --bg: #fdfaf5; 
  --brdr: #3d3d5c; 
  --btn: #a3d977; 
  --btn-dark: #2d4f1e;
  --txt: #3d3d5c;
  --water: #7fbef5;
  --shelf-color: #836559;
}

@font-face {
    font-family: "Amaranth";
    src: url("../assets/fonts/Amaranth-Regular.ttf") format("truetype");
    font-weight: 400;
}

@font-face {
    font-family: "Amaranth";
    src: url("../assets/fonts/Amaranth-Bold.ttf") format("truetype");
    font-weight: 700;
}

/* ----------- Base ----------- */

body {
  font-family: "Amaranth", sans-serif;  
  text-align: center;
  background-color: var(--bg);
  color: var(--txt);
  overflow-x: hidden;
  overflow-y: auto;
  transition: background-color 0.8s ease;
  -webkit-user-drag: none;
}

header {
  display: flex;
  justify-content: center;
}

.title-svg {
  z-index: 998;
  pointer-events: none;
  width: 500px;
  max-width: 90vw;
  margin-top: 1rem;
  margin-bottom: -4.5rem;
  animation: floatTitle 3s ease-in-out infinite;
}

@keyframes floatTitle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(12px); }
}

a {
  color: var(--txt);
  text-decoration: none;
  font-weight: 700;
}

/* ----------- Window ----------- */

#window {
  width: min(90vw, 25rem);
  height: min(70vh, 35rem);
  margin: 0 auto 2rem;
  border-radius: 20px;
  border: 4px solid var(--brdr);
  box-shadow: 8px 8px 0px 0px rgba(61, 61, 92, 0.1);
  overflow: hidden;
  position: relative;
  background-color: white;
}

/* ----------- Sky ----------- */

#sky {
  height: 65%;
  background: linear-gradient(to bottom, #e8f8ff, #bfe9ff);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.8s ease;
}

body.night #sky {
  background: linear-gradient(to bottom, #4a5f99, #2c3461);
}

body::after {
  z-index: 999;
  content: "";
  position: fixed;
  inset: 0;
  background-color: #1c2540;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

body.night::after {
  opacity: 0.4;
}

/* ----------- Sun / Moon ----------- */

#themeToggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

#themeToggle img {
  width: 10rem;
  height: 10rem;
  margin-top: -10rem;
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.rotate-out {
  transform: rotate(180deg) scale(0.5);
  opacity: 0;
}

/* ----------- Shelf ----------- */

#shelf {
  height: 35%;
  background-color: var(--shelf-color);
  border-top: 6px solid rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  position: relative;
}

#plant {
  pointer-events: none;
  width: 280px;
  margin-bottom: 20px;
  transition: filter 0.5s ease;
}

#plant img {
  width: 100%;
}

.watering {
  animation: bounce 0.4s ease;
}

@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05, 0.95); }
}

/* ----------- Bars ----------- */

#thirstBarContainer, #sunBarContainer {
  position: relative;
  width: min(85vw, 23rem);
  margin: 0 auto 1.2rem;
  height: 28px;
  border-radius: 20px;
  overflow: hidden;
  background-color: #e0e0e0;
  border: 3px solid var(--brdr);
}

#thirstBar {
  height: 100%;
  width: 100%;
  background: linear-gradient(to bottom, rgba(255,255,255,0.3), transparent), var(--water);
  transition: width 1s linear, background 0.5s ease;
}

#thirstBar.dry {
  background: linear-gradient(to bottom, rgba(255,255,255,0.3), transparent), #f09a79;
}

#sunBarContainer {
  background: linear-gradient(to right, #7ba5f3, #f09a79, #e6e0b6);
}

#sunBar {
  position: relative;
  height: 100%;
  width: 50%;
  background: transparent;
  border-right: 4px solid var(--brdr);
}

/* ----------- Water Button ----------- */

#water-btn {
  min-height: 50px;
  min-width: 140px;
  padding: 10px 25px;
  background-color: var(--btn);
  font-family: "Amaranth", sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--btn-dark);
  border-radius: 15px;
  border: 3px solid var(--btn-dark);
  box-shadow: 0px 6px 0px 0px var(--btn-dark);
  cursor: pointer;
  transition: all 0.1s ease;
  margin-bottom: 2rem;
}

#water-btn:hover {
  filter: brightness(1.05);
}

#water-btn:active {
  transform: translateY(4px);
  box-shadow: 0px 2px 0px 0px var(--btn-dark);
}

/* ----------- Footer ----------- */

footer {
  padding: 2rem;
}

footer p {
  z-index: 998;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  opacity: 0.6;
  padding: 0.4rem 0.8rem;
  border-radius: 12px;
  border: 2px solid var(--brdr);
  background-color: white;
  transition: all 0.3s ease;
}

footer p:hover {
  opacity: 1;
  transform: scale(1.05);
  border-color: var(--btn);
}

/* Mobile Tweaks */
@media (max-width: 600px) {
  .title-svg { margin-bottom: -3rem; }
  #themeToggle img { width: 7rem; height: 7rem; margin-top: -6rem; }
  footer p { position: static; margin-top: 2rem; display: inline-block; }
}
