/* Keep the classic centered layout */

#hearts {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.heart {
  position: absolute;
  bottom: -20px;
  font-size: 14px;
  opacity: 0.6;
  animation: floatUp 8s linear infinite;
}

@keyframes floatUp {
  0% {
    transform: translateY(0) scale(0.8);
    opacity: 0;
  }
  10% {
    opacity: 0.6;
  }
  100% {
    transform: translateY(-110vh) scale(1.2);
    opacity: 0;
  }
}

body {
  margin: 0;
  padding: 40px 16px;
  text-align: center;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #fff0f6; /* softer pink than default */
  color: #222;
  /* Fix for horizontal scroll issues on mobile */
  overflow-x: hidden; 
}

/* Gate overlay */
#gate {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, #fff0f6, #fff0f7);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 999;
  gap: 12px;
  padding: 20px;
}

#gate h1 {
  font-weight: 600;
  letter-spacing: 0.3px;
  /* Prevents long strings of text from breaking layout */
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

#gate button {
  font-size: 1rem;
  padding: 8px 16px;
  margin: 0 8px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: white;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

#gate button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Main content */
#main {
  text-align: center;
}

/* Headings keep HTML-ish feel */
h1 {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 12px;
}

/* Cat image - UPDATED for better responsiveness */
#cat-index {
  width: 100%;
  max-width: 500px; /* Adjusted to prevent excessive size */
  height: auto;
  margin: 24px auto;
  display: block;
  transform-style: preserve-3d;
  animation: spin3d 10s linear infinite;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.15));
}

/* Buttons feel default-but-nice */
.home-buttons {
  margin-top: 16px;
  display: flex;
  justify-content: center;
  gap: 16px;
}

.home-buttons button {
  font-size: 1rem;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: white;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.home-buttons button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Keep your 3D spin */
@keyframes spin3d {
  0% {
    transform: perspective(800px) rotateY(0deg);
  }
  100% {
    transform: perspective(800px) rotateY(360deg);
  }
}

#gate {
  transition: opacity 1.5s ease, transform 1.5s ease;
}

#gate.hide {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

#main {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

#main.show {
  opacity: 1;
  transform: translateY(0);
}

/* Home Page */
.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  max-width: 700px;
  margin: 40px auto 0;
  padding: 0 12px;
}

.home-card {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 20px 16px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
}

/* Scrap book style */
.scrapbook-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.scrapbook-nav .tab {
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid #ddd;
  background: white;
  cursor: pointer;
  font-size: 0.95rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.scrapbook-nav .tab.active {
  background: hotpink;
  color: white;
  border-color: hotpink;
}

.scrapbook-content {
  max-width: 800px;
  margin: 30px auto;
  padding: 0 14px;
}

.tab-panel {
  display: none;
  background: rgba(255,255,255,0.85);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 6px 14px rgba(0,0,0,0.08);
}

.tab-panel.active {
  display: block;
}

/* places grid */
.places-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.place-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 14px rgba(0,0,0,0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.place-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

/* polaroid styling */
.memory-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 20px;
  justify-content: center;
}

.polaroid {
  background: white;
  padding: 10px 10px 20px 10px;
  width: 180px;
  box-shadow: 0 10px 20px rgba(0,0,0,0.2);
  border-radius: 6px;
  transform: rotate(-2deg);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.polaroid img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 4px;
}

/* MODAL FOR SCRAPBOOK */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: white;
  padding: 16px;
  border-radius: 12px;
  max-width: 90vw;
  max-height: 90vh;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  animation: popIn 0.25s ease;
}

.modal-content img {
  max-width: 80vw;
  max-height: 70vh;
  border-radius: 6px;
  display: block;
  margin: 0 auto;
}

/* Notes style */
/* Notes style */
.note-card {
  width: 160px;
  height: 160px;
  padding: 15px;
  border-radius: 4px;
  box-shadow: 2px 4px 10px rgba(0,0,0,0.15);
  transform: rotate(var(--tilt));
  cursor: pointer;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  
  /* Font Stack */
  font-family: "Segoe Print", "Bradley Hand", "Chalkboard SE", "Comic Neue", cursive;
  font-size: 0.95rem;
  line-height: 1.4;
  color: #333;
  
  /* LAYOUT FIXES */
  display: flex;
  flex-direction: column;    /* Stack elements vertically */
  justify-content: center;   /* Center the main message */
  align-items: center;       /* Center text horizontally */
  text-align: center;
  word-wrap: break-word;
  overflow: hidden;
}

.note-card:hover {
  transform: scale(1.1) rotate(0deg);
  z-index: 10;
  box-shadow: 0 12px 24px rgba(0,0,0,0.2);
}

/* Fix for the Author/Date at the bottom */
.note-card small {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.7rem;
  opacity: 0.7;
}

/* Fix for the Delete (X) button positioning */
.note-card .delete-btn {
  position: absolute;
  top: 5px;
  right: 8px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  line-height: 1;
  padding: 5px;
  color: rgba(0, 0, 0, 0.3);
  transition: color 0.2s ease;
}

.note-card .delete-btn:hover {
  color: #ff4d4d; /* Turns red when hovering over the X */
}

.note-white { background: #ffffff; }
.note-yellow { background: #fff6a9; }
.note-pink   { background: #ffd6e8; }
.note-blue   { background: #d6ecff; }
.note-purple { background: #e6d9ff; }
.note-green  { background: #ddfbe4; }

/* -------------------- MOBILE RESPONSIVENESS -------------------- */

@media (max-width: 600px) {
  body {
    padding: 20px 8px;
  }

  h1 {
    font-size: 1.6rem;
    padding: 0 10px;
  }

  /* Ensure the gate H1 doesn't cause overflow */
  #gate h1 {
    font-size: 1.4rem;
  }

  #cat-index {
    width: 95%;
  }

  .home-grid {
    grid-template-columns: 1fr;
    gap: 16px;
    max-width: 95%;
  }

  .home-card, .polaroid, .note-card, .place-card {
    width: 100%;
    max-width: 280px; /* Limits size so cards don't look giant on mobile */
    margin: 10px auto;
  }

  .memory-row, #notes-grid, .places-grid {
    flex-direction: column;
    display: flex;
    align-items: center;
  }

  /* Improved button layout for thumbs */
  .home-buttons {
    flex-direction: column;
    align-items: center;
  }

  .home-buttons button, #gate button {
    width: 85%;
    font-size: 1.1rem;
    padding: 12px 0;
    margin: 8px 0;
  }

  .scrapbook-nav {
    flex-direction: column;
    width: 90%;
    margin: 20px auto;
  }
}