/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: 'Bitter', serif;
  color: rgb(23, 29, 58);
  line-height: 1.6;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: rgb(23, 29, 58);
  text-decoration: underline;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

/* === Rainbow Background === */
.rainbow-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  background-color: rgb(229, 233, 253);
  background-image: linear-gradient(
    to right,
    rgba(255, 0, 0, 0.3),
    rgba(255, 154, 0, 0.3),
    rgba(208, 222, 33, 0.3),
    rgba(79, 220, 74, 0.3),
    rgba(63, 218, 216, 0.3),
    rgba(47, 201, 226, 0.3),
    rgba(28, 127, 238, 0.3),
    rgba(95, 21, 242, 0.3),
    rgba(186, 12, 248, 0.3),
    rgba(251, 7, 217, 0.3)
  );
}

/* === Corner Rainbow SVG === */
.corner-rainbow {
  position: fixed;
  top: 0;
  left: 0;
  width: 200px;
  height: 200px;
  z-index: 2;
  pointer-events: none;
}

/* === Layout === */
.page-wrapper {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-wrapper main {
  flex: 1;
}

@media (max-width: 768px) {
  .page-wrapper {
    z-index: 3;
  }
}

/* === Header / Nav === */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 50px 22px 115px;
  position: relative;
  z-index: 3;
}

.site-title {
  font-family: 'Shrikhand', cursive;
  font-size: 37.5px;
  font-weight: 400;
  letter-spacing: -0.75px;
  padding: 3.75px 15px;
  background-image: linear-gradient(90deg, rgb(162, 89, 247) 0%, rgb(196, 113, 245) 25%, rgb(162, 89, 247) 75%, rgb(196, 113, 245) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
  filter: drop-shadow(rgba(0, 0, 0, 0.6) 1px 2px 0px);
  white-space: nowrap;
}

.site-title:hover {
  text-decoration: none;
}

/* Desktop nav */
.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  align-items: center;
}

.nav-links a {
  color: rgb(23, 29, 58);
  font-size: 0.95rem;
  text-decoration: none;
}

.nav-links a:hover {
  text-decoration: underline;
}

.nav-links a.active {
  color: rgb(23, 29, 58);
  font-weight: 400;
  text-decoration: underline;
}

.nav-links .nav-instagram {
  display: inline-flex;
  align-items: center;
}

.nav-links .nav-instagram svg {
  width: 20px;
  height: 20px;
  fill: rgb(23, 29, 58);
}

/* Close button (mobile only) */
.nav-close-item {
  list-style: none;
  display: none;
}

.nav-close {
  display: none;
}

/* Hamburger menu */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.menu-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: rgb(23, 29, 58);
  margin: 5px 0;
  transition: transform 0.3s, opacity 0.3s;
}

.menu-toggle.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.open span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

@media (max-width: 768px) {
  .menu-toggle {
    display: block;
    flex-shrink: 0;
  }

  .site-title {
    font-size: clamp(20px, 7vw, 37.5px);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgb(229, 233, 253);
    background-image: linear-gradient(
      to right,
      rgba(255, 0, 0, 0.3),
      rgba(255, 154, 0, 0.3),
      rgba(208, 222, 33, 0.3),
      rgba(79, 220, 74, 0.3),
      rgba(63, 218, 216, 0.3),
      rgba(47, 201, 226, 0.3),
      rgba(28, 127, 238, 0.3),
      rgba(95, 21, 242, 0.3),
      rgba(186, 12, 248, 0.3),
      rgba(251, 7, 217, 0.3)
    );
    padding: 5rem 2rem 2rem;
    gap: 1.5rem;
    z-index: 10;
    align-items: center;
    justify-content: flex-start;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-close-item {
    display: block;
  }

  .nav-close {
    display: block;
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    background: none;
    border: none;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    color: rgb(23, 29, 58);
    padding: 0.5rem;
  }

  .nav-links a {
    font-size: 1.25rem;
  }

  .site-header {
    position: relative;
    padding: 1rem;
    z-index: 11;
  }
}

/* === Main Content === */
main {
  max-width: none;
  margin: 0 auto;
  padding: 1rem 4%;
}

/* === Home Page: Two-Column Layout === */
.home-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

@media (max-width: 768px) {
  .home-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .home-text {
    max-width: 100%;
    overflow: hidden;
  }

  .home-figurines {
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    display: block;
  }

  .home-icon {
    display: none;
  }

  .home-text {
    order: 0;
  }

  .upload-section {
    order: 1;
    text-align: center;
  }

  .home-attribution {
    order: 2;
    grid-column: 1;
  }
}

.home-text {
  text-align: center;
}

.home-text h2 {
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

.home-text p {
  margin-bottom: 0.75rem;
}

.home-text a {
  font-weight: 600;
}

.home-figurines {
  width: 435px;
  margin-bottom: 1.5rem;
}

.home-attribution {
  margin-top: 0;
  grid-column: 1;
  text-align: center;
}

.home-attribution img {
  width: 134px;
  height: 134px;
}

.home-icon {
  width: 88px;
  height: 88px;
  margin-bottom: 1rem;
}

/* === Upload Form === */
.upload-section {
  background: none;
  border-radius: 0;
  padding: 0;
}

.upload-section h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.file-drop-zone {
  border: 2px dashed rgba(162, 89, 247, 0.4);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 1rem;
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
  border-color: rgb(162, 89, 247);
  background: rgba(162, 89, 247, 0.05);
}

.file-drop-zone input[type="file"] {
  display: none;
}

.file-drop-zone .plus-icon {
  display: block;
  margin: 0 auto 0.5rem;
}

.file-drop-zone .label {
  color: #888;
  font-size: 0.9rem;
}

.file-preview {
  margin-bottom: 1rem;
}

.file-preview img {
  max-height: 150px;
  border-radius: 6px;
}

.file-preview .file-name {
  font-size: 0.85rem;
  color: #888;
  margin-top: 0.25rem;
}

.upload-section textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  min-height: 60px;
  margin-bottom: 1rem;
}

.upload-section textarea:focus {
  outline: none;
  border-color: rgb(162, 89, 247);
}

/* === Buttons === */
.btn {
  display: inline-block;
  padding: 19px 32px;
  background: rgb(23, 29, 58);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: 'Bitter', serif;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn:hover {
  background: rgb(40, 50, 80);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-danger {
  background: #e74c3c;
}

.btn-danger:hover {
  background: #c0392b;
}

/* === Form Messages === */
.form-message {
  padding: 0.75rem;
  border-radius: 6px;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.form-message.success {
  background: rgba(79, 220, 74, 0.2);
  color: #2d7a2d;
}

.form-message.error {
  background: rgba(231, 76, 60, 0.2);
  color: #c0392b;
}

/* === Gallery === */
.gallery-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.gallery-header a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.gallery-header svg {
  width: 20px;
  height: 20px;
}

.gallery-page main {
  padding-left: 0;
  padding-right: 0;
}

.gallery-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  --gallery-row-h: 200px;
}

.gallery-grid figure {
  flex-grow: 1;
  min-width: 150px;
  height: var(--gallery-row-h);
  overflow: hidden;
  cursor: pointer;
  background: #1a1a2e;
}

.gallery-grid figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s, opacity 0.3s;
  opacity: 0;
}

.gallery-grid figure img.loaded {
  opacity: 1;
}

.gallery-grid figure:hover img {
  transform: scale(1.03);
}

@media (max-width: 768px) {
  .gallery-grid {
    --gallery-row-h: 160px;
  }
  .gallery-grid figure {
    min-width: 120px;
  }
}

@media (max-width: 480px) {
  .gallery-grid {
    --gallery-row-h: 130px;
  }
  .gallery-grid figure {
    min-width: 100px;
  }
}

/* === Lightbox === */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: rgb(229, 233, 253);
  background-image: linear-gradient(
    to right,
    rgba(255, 0, 0, 0.3),
    rgba(255, 154, 0, 0.3),
    rgba(208, 222, 33, 0.3),
    rgba(79, 220, 74, 0.3),
    rgba(63, 218, 216, 0.3),
    rgba(47, 201, 226, 0.3),
    rgba(28, 127, 238, 0.3),
    rgba(95, 21, 242, 0.3),
    rgba(186, 12, 248, 0.3),
    rgba(251, 7, 217, 0.3)
  );
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 92vw;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.lightbox-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-top: 1rem;
}

.lightbox-nav button,
.lightbox-nav a {
  background: rgba(255, 255, 255, 0.85);
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1.2rem;
  font-family: 'Bitter', serif;
  font-size: 0.95rem;
  font-weight: 600;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  z-index: 101;
  color: #171d3a;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s;
}

.lightbox-nav button:hover,
.lightbox-nav a:hover {
  background: rgba(255, 255, 255, 1);
}

.lightbox-nav button:disabled {
  opacity: 0.4;
  cursor: default;
}

.lightbox-counter {
  color: #171d3a;
  font-weight: 600;
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .lightbox {
    padding: 1rem;
  }

  .lightbox img {
    max-width: 96vw;
    max-height: 65vh;
  }

  .lightbox-nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.8rem;
    margin-top: 1.2rem;
  }

  .lightbox-nav button,
  .lightbox-nav a {
    padding: 0.7rem 1.2rem;
    font-size: 0.9rem;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* === Contact Form === */
.contact-layout {
  max-width: 500px;
  margin: 1.5rem auto 0;
  text-align: center;
}

.contact-layout p {
  margin-bottom: 1.5rem;
  color: rgb(23, 29, 58);
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
}

.contact-form label {
  font-weight: 600;
  font-size: 0.9rem;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  padding: 0.6rem;
  border: 2px solid #ccc;
  border-radius: 6px;
  font-family: 'Bitter', serif;
  font-size: 1rem;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: #1c7fee;
}

.contact-form textarea {
  min-height: 120px;
  resize: vertical;
}

/* === Review Page === */
.review-page .page-wrapper {
  display: block;
  min-height: auto;
}

.password-gate {
  max-width: 300px;
  margin: 3rem auto;
  text-align: center;
}

.password-gate input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.submissions-list {
  display: grid;
  gap: 1.5rem;
}

.submission-card {
  background: rgba(255, 255, 255, 0.6);
  border-radius: 8px;
  padding: 1rem;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1rem;
  align-items: start;
}

.submission-card img {
  width: 100%;
  border-radius: 6px;
}

.submission-card .meta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.submission-card .actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

@media (max-width: 600px) {
  .submission-card {
    grid-template-columns: 1fr;
  }
}

/* === 404 === */
.not-found {
  text-align: center;
  padding: 4rem 2rem;
}

.not-found h1 {
  font-size: 4rem;
  color: rgb(162, 89, 247);
}

.not-found p {
  margin-top: 1rem;
}

/* === Loading Spinner === */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 0.4rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === Site Footer === */
.site-footer {
  text-align: center;
  padding: 3rem 1rem 1rem;
  font-size: 0.8rem;
}

.site-footer a {
  color: #888;
}

.site-footer a:hover {
  color: #171d3a;
}

/* === Admin Bar === */
.admin-bar {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.75rem;
  z-index: 50;
}

.admin-bar a {
  font-size: 0.8rem;
  color: #666;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.85);
  padding: 0.3rem 0.6rem;
  border-radius: 4px;
}

.admin-bar a:hover {
  color: #171d3a;
  background: rgba(255, 255, 255, 1);
}

/* === Giveaway === */
.giveaway-layout {
  max-width: 500px;
  margin: 1.5rem auto 0;
  text-align: center;
}

.giveaway-icon {
  display: block;
  margin: 0 auto 0.5rem;
}

.giveaway-layout h2 {
  margin-bottom: 0.5rem;
}

.rainbow-shimmer {
  background: linear-gradient(
    90deg,
    #ff0000, #ff9a00, #d0de21, #4fdc4a, #3fdad8, #1c7fee, #800080, #ff0000
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
  to { background-position: 200% center; }
}

.giveaway-layout > p {
  margin-bottom: 1.5rem;
  color: rgb(23, 29, 58);
}

.giveaway-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
}

.giveaway-form label {
  font-weight: 600;
  font-size: 0.9rem;
}

.giveaway-form input {
  padding: 0.6rem;
  border: 2px solid #ccc;
  border-radius: 6px;
  font-family: 'Bitter', serif;
  font-size: 1rem;
}

.giveaway-form input:focus {
  border-color: #1c7fee;
  outline: none;
}

.giveaway-privacy {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: #666;
}

.giveaway-patreon {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 0.95rem;
  color: rgb(23, 29, 58);
}

.giveaway-thankyou {
  max-width: 500px;
  margin: 2rem auto 0;
  text-align: center;
}

.giveaway-thankyou .giveaway-icon {
  margin-bottom: 1rem;
}

.giveaway-thankyou h2 {
  margin-bottom: 0.5rem;
}

.giveaway-thankyou p {
  margin-bottom: 1rem;
  color: rgb(23, 29, 58);
}

.giveaway-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1.5rem;
}

.btn-patreon {
  background: #ff424d;
  color: white;
}

.btn-patreon:hover {
  background: #e03a44;
}

/* === Privacy Policy === */
.privacy-layout {
  max-width: 600px;
  margin: 1.5rem auto 0;
}

.privacy-layout h2 {
  text-align: center;
  margin-bottom: 1.5rem;
}

.privacy-layout h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.privacy-layout p,
.privacy-layout li {
  color: rgb(23, 29, 58);
  line-height: 1.6;
}

.privacy-layout ul {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
}

.privacy-updated {
  margin-top: 2rem;
  font-size: 0.85rem;
  color: #888;
  text-align: center;
}
