/* === RESET === */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { overflow-y: scroll; }

:root {
  --accent: #8cc7ff;
  --accent-strong: #4fa4ff;
  --card-glow: rgba(140, 199, 255, 0.25);
  --muted: rgba(255, 255, 255, 0.72);
}

body[data-section="vinyl"] {
  --accent: #8cc7ff;
  --accent-strong: #4fa4ff;
  --card-glow: rgba(140, 199, 255, 0.25);
}

body[data-section="furnishing"] {
  --accent: #f3b68a;
  --accent-strong: #e58a57;
  --card-glow: rgba(243, 182, 138, 0.28);
}

body {
  font-family: "Space Grotesk", sans-serif;
  color: #fff;
  background: #0b0b0b;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-image: url("background2.jpg");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  overflow-x: hidden;
  position: relative;
}

/* === OVERLAY === */
.overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(140deg, rgba(5, 5, 5, 0.86), rgba(10, 10, 10, 0.3));
  backdrop-filter: blur(4px);
  z-index: 0;
  pointer-events: none;
}

.overlay::before {
  content: "";
  position: absolute;
  inset: -15%;
  background:
    radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.18), transparent 45%),
    radial-gradient(circle at 85% 10%, rgba(255, 196, 128, 0.2), transparent 40%),
    radial-gradient(circle at 70% 85%, rgba(140, 199, 255, 0.18), transparent 50%);
  opacity: 0.6;
}

/* === HEADER === */
header {
  text-align: center;
  z-index: 2;
  margin-top: 2.2rem;
  animation: headerFloat 0.8s ease both;
}

#tagline {
  font-size: 1rem;
  color: var(--muted);
  margin: 0.6rem 0 1.4rem;
}

@keyframes headerFloat {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === NAVIGATION === */
.mode-switch {
  width: min(680px, 92vw);
  margin: 0 auto 1.4rem;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
  padding: 0.35rem;
  background: rgba(8, 8, 8, 0.6);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.mode-switch a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.95rem 0;
  font-size: 1.05rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  border-radius: 999px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.7);
  transition: background 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

.mode-switch a:hover {
  color: #fff;
  transform: translateY(-1px);
}

.mode-switch a.active {
  background: var(--accent);
  color: #111;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.primary-nav,
.sub-nav {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  font-weight: 700;
}

.sub-nav {
  gap: 1.8rem;
  font-size: 0.95rem;
  padding: 0.4rem 1.2rem 0;
}

.sub-nav.hidden {
  display: none;
}

.sub-nav a {
  color: #cfcfcf;
  text-decoration: none;
  position: relative;
  transition: color 0.3s ease;
}

.sub-nav a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 0%;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
  transform: translateX(-50%);
  transition: width 0.3s ease;
}

.sub-nav a:hover { color: #fff; }

.sub-nav a.active { color: #fff; }

.sub-nav a.active::after { width: 100%; }

/* === SEARCH === */
#controls {
  width: 90%;
  max-width: 620px;
  margin: 1.5rem auto 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

#search-container {
  position: relative;
  display: flex;
  align-items: center;
}

#search {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  outline: none;
  background: rgba(15, 15, 15, 0.5);
  color: #fff;
  backdrop-filter: blur(6px);
  transition: background 0.3s, border 0.3s;
}

#search:focus {
  background: rgba(15, 15, 15, 0.65);
  border-color: rgba(255, 255, 255, 0.2);
}

#search::placeholder { color: rgba(255, 255, 255, 0.6); }

#clear-btn {
  position: absolute;
  right: 0.5rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s, color 0.3s;
}

#clear-btn:hover { color: var(--accent-strong); }

#section-note {
  font-size: 0.92rem;
  color: var(--muted);
  text-align: center;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#section-note.visible {
  opacity: 1;
  transform: translateY(0);
}

/* === GRID WRAPPER === */
#item-grid-wrapper {
  position: relative;
  width: 90%;
  max-width: 1050px;
  margin: 2rem auto 3rem;
  z-index: 2;
}

/* === LOADER === */
#loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

#loader.visible { opacity: 1; }

.dot {
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  opacity: 0.6;
  animation: dotPulse 1.2s infinite ease-in-out;
}

.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
  0%,100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.5); opacity: 1; }
}

/* === ITEM GRID === */
#item-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem;
  transition: opacity 0.4s ease-in-out;
}


.empty-state {
  text-align: center;
  opacity: 0.8;
  padding: 2rem 0;
}

/* === CARD === */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.04));
  border-radius: 18px;
  text-align: center;
  backdrop-filter: blur(6px);
  transition: transform 0.2s ease, box-shadow 0.3s ease;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 10px 0;
}

.card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.4), 0 0 18px var(--card-glow);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.cover {
  display: flex;
  justify-content: center;
  padding: 1rem 1rem 0.4rem;
  position: relative;
}

.img-frame {
  position: relative;
  width: 100%;
  max-width: 240px;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.4);
}

.img-frame::after {
  content: "";
  position: absolute;
  inset: 50%;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--accent);
  transform: translate(-50%, -50%);
  animation: spin 0.8s linear infinite;
  opacity: 0.8;
}

.img-frame.loaded::after {
  opacity: 0;
}

.img-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease, opacity 0.3s ease;
  opacity: 0;
}

.img-frame.loaded img { opacity: 1; }

.card:hover img { transform: scale(1.05); }

.info {
  padding: 0.6rem 0 1rem;
}

.info h3 {
  margin: 0.3rem 0 0.2rem;
  font-size: 1rem;
  font-weight: 600;
}

.info p {
  margin: 0;
  font-size: 0.83rem;
  color: #d3d3d3;
}

/* === FURNISHING CARD === */
.card--furnishing {
  padding: 0;
  text-align: left;
}

.card--furnishing .info {
  padding: 0.8rem 1rem 1.1rem;
}

.card--furnishing .cover {
  padding: 1rem 1rem 0.6rem;
}

.card--furnishing .img-frame {
  max-width: 100%;
  aspect-ratio: 4 / 3;
}

.meta {
  font-size: 0.86rem;
  color: var(--muted);
}

.note {
  margin-top: 0.4rem;
  font-size: 0.83rem;
  color: #d9d1c7;
}

.actions {
  margin-top: 0.8rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.9rem;
  background: var(--accent);
  color: #1a1a1a;
  text-decoration: none;
  font-weight: 600;
  border-radius: 999px;
  font-size: 0.85rem;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

.priority {
  position: absolute;
  top: 0.8rem;
  left: 0.8rem;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 0.2rem 0.6rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 999px;
}

.priority--need {
  background: rgba(239, 154, 93, 0.85);
}

.priority--nice {
  background: rgba(140, 199, 255, 0.85);
}

.priority--later {
  background: rgba(196, 196, 196, 0.75);
  color: #2d2d2d;
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
  #item-grid { grid-template-columns: repeat(2, 1fr); }
  .sub-nav { gap: 1.4rem; }
}

@media (max-width: 600px) {
  #item-grid { grid-template-columns: 1fr; gap: 1rem; }
  .img-frame { max-width: 90%; }
  header { margin-top: 2rem; }
  .mode-switch { gap: 0.25rem; padding: 0.3rem; }
  .mode-switch a { font-size: 0.9rem; letter-spacing: 0.14em; }
  .sub-nav { flex-wrap: wrap; gap: 1.1rem; }
  body { background-attachment: scroll; }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
