@import url('https://fonts.googleapis.com/css2?family=Poetsen+One&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Tagesschrift&display=swap');

#page-transition-overlay {
  pointer-events: none;
}


html {
  scroll-behavior: smooth;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  background-color: #dcdcdc;
}

/* ---------- Fonts ---------- */
.poetsen-one-regular {
  font-family: "Poetsen One", sans-serif;
}

.tagesschrift-regular {
  font-family: "Tagesschrift", system-ui;
}

#page-transition-overlay {
  position: fixed;
  inset: 0;
  background: #111; /* match your background */
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}


/* Full viewport canvas */
#bgCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  inset: 0;
  z-index: -2; 
  pointer-events: none; /* so other elements are clickable */
}


/* Keep container layout */
.container {
  position: relative;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Smooth gradient overlay (optional) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    linear-gradient(
      rgba(255,255,255,0.25),
      rgba(0,0,0,0.08)
    );
  pointer-events: none;
  z-index: -1;
}



/* ---------- Animated Background ---------- */
.container {
  height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;


}
@keyframes starfield {
  0% { background-position: 0 0; }
  100% { background-position: -200px -200px; }
}

/* ---------- Nav ---------- */
.container nav {
  background: #e4e4e4;
  border-radius: 50px;
  padding: 10px;
  box-shadow: 0 25px 20px -20px rgba(0,0,0,.4);
  transition: transform .4s, box-shadow .4s;
}

.container nav:hover {
  transform: scale(1.1);
  box-shadow: 0 25px 20px -20px rgba(0,0,0,.8);
}

.container nav ul li {
  list-style: none;
  display: inline-block;
  padding: 13px 25px;
  margin: 10px;
  font-size: 18px;
  color: #787878;
  cursor: pointer;
  position: relative;
  font-family: "Poetsen One";
  transition: color .3s, transform .3s;
}

.container nav ul li::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #b0b0b0;
  border-radius: 30px;
  opacity: 0;
  z-index: -1;
  transition: opacity .3s;
}

.container nav ul li:hover {
  color: #fff;
  transform: scale(1.15);
}

.container nav ul li:hover::after {
  opacity: 1;
}

.container nav a {
  text-decoration: none;
  color: inherit;
}
.container nav ul li a {
  display: block;
  width: 100%;
  height: 100%;
}

.container nav a:visited {
  color: inherit;
}

.container nav a:hover,
.container nav a:active {
  color: inherit;
}


/* ---------- Intro ---------- */
.intro {
  height: 100vh;
  background-color: #5e5e5e;
  display: flex;
  align-items: center;
  justify-content: center;
}

.intro p {
  font-size: 18px;
  font-family: "Poetsen One";
  color: #d1d1d1;
  margin: 0 20vh;
}

/* ---------- Search Bar ---------- */
.search-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 60px 20px 40px;
  background: #5e5e5e; /* matches card section */

}

.search-box {
  position: relative;
  width: 420px;
  max-width: 90vw;
}

.material-symbols-outlined {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  color: #888;
  pointer-events: none;
}

#cardSearch {
  width: 100%;
  padding: 14px 20px 14px 48px;
  border-radius: 999px;
  border: none;
  outline: none;

  font-family: "Poetsen One";
  font-size: 16px;
  letter-spacing: 0.5px;

  background: rgba(255,255,255,0.92);
  color: #222;

  box-shadow:
    0 10px 30px rgba(0,0,0,0.35),
    inset 0 1px 2px rgba(255,255,255,0.6);

  transition:
    box-shadow 0.35s ease,
    transform 0.35s ease,
    background 0.35s ease;
}

#cardSearch::placeholder {
  color: #888;
  letter-spacing: 0.3px;
}

/* Focus interaction */
#cardSearch:focus {
  background: #ffffff;
  transform: scale(1.02);
  box-shadow:
    0 14px 40px rgba(0,0,0,0.5),
    0 0 0 2px rgba(255,255,255,0.15);
  transition: 0.5s;
}
/* Make the input text transition smoothly */
#cardSearch {
  transition: color 0.35s ease, background 0.35s ease;
  color: #222; /* normal text color */
}

/* Hidden state for smooth fade */
#cardSearch.fade-out {
  color: transparent;
}



/* ---------- Cards Section ---------- */
.showcard {
  background: radial-gradient(
    circle at top,
    #444,
    #111
  );
  padding: 80px 40px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 80px;
  justify-items: center;
  animation: movement 18s ease-in-out infinite;
  padding-bottom: 100vh;
}


/* ---------- Card ---------- */
.card {
    position: relative;
    width: 100%;
    max-width: 380px;      /* was 320px */
    aspect-ratio: 3 / 4;
    padding: 24px;
    background: #e4e4e4;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(0,0,0,.35);
    transition: transform 0.4s ease, box-shadow 0.4s ease;

    display: flex;           /* enable flex for content */
    flex-direction: column;  /* stack h1 and p vertically */
    justify-content: center; /* vertical centering */
    align-items: center;     /* horizontal centering */
    text-align: center;      /* ensure text is centered */
    
}


.card:hover {
    transform: scale(1.03);
    box-shadow: 0 12px 30px rgba(0,0,0,.45);
}




.card .photo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;             /* behind text */
    transition: filter 0.5s ease;
}


.card:hover .photo,
.card.is-active .photo {
    filter: saturate(0.5) blur(6px) brightness(0.7);
}
.card:hover h1,
.card.is-active h1,
.card:hover p,
.card.is-active p {
    opacity: 1;
}
@media (hover: none) and (pointer: coarse) {

  .card:hover .photo {
    filter: none;
  }

  .card:hover h1,
  .card:hover p {
    opacity: 0;
  }

}


.card .photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}



/* ---------- Card Text ---------- */
.card h1,
.card p {
    position: relative;     /* above photo */
    z-index: 10;
    opacity: 0;             /* hidden initially */
    transition: opacity 0.4s ease;
    color: #fff;
    margin: 0; 
}
.card h1 {
  font-family: "Poetsen One";
  font-size: 1.9rem;
}

.card p {
  top: 10%;
  font-family: "Tagesschrift";
  font-size: 15px;
  width: 80%;
}



.card {
  transition: opacity 0.35s ease, transform 0.35s ease;
  opacity: 1; /* default fully visible */
}

/* Dim unmatched cards */
.card.faded {
  display: none;           /* visually dim */
  pointer-events: none;     /* disable hover/click */
  cursor: default;          /* show normal cursor */
  transition: opacity 0.3s ease;
}

/* Optional: slightly scale matched cards to highlight */
.card:not(.faded) {
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.3s ease, opacity 0.3s ease;
}




.detail-btn {
  margin-top: 60px;
  padding: 10px 22px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  z-index: 10;
  font-family: "Poetsen One";
  font-size: 14px;
  letter-spacing: 0.5px;
  text-decoration: none;
  background: rgba(255,255,255,0.9);
  color: #111;

  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease,
    background 0.3s ease;
}

.card:hover .detail-btn {
  opacity: 1;
  transform: translateY(0);
}

.detail-btn:hover {
  background: #fff;
}

.clear-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  color: #888;
  opacity: 0.7;
  transition: opacity 0.3s ease;
  padding: 0;
  line-height: 1;
}

.clear-btn:hover {
  opacity: 1;
}


/* ---------- Responsive ---------- */
@media (max-width: 1500px) {
  .intro p { margin: 0 15vh; }
  .card h1 { font-size: 1.7rem; }
  .card p { font-size: 14px; }
}



@media (max-width: 550px) {
  .card {
    width: 90vw;
    max-width: 360px;
    height: auto;
  }

  .intro p { margin: 0 5vh; }

  .card h1 { font-size: 1.5rem; }
  .card p { font-size: 13px; }
}

@media (max-width: 700px) {
    .container {
    display: none;
  }
}

.card.is-active h1,
.card.is-active p {
  opacity: 1;
}

.card.is-active .photo {
  filter: saturate(0.5) blur(6px) brightness(0.7);
}

/* Disable hover effects on touch devices */
@media (hover: none) and (pointer: coarse) {

  .card:hover {
    transform: none;
    box-shadow: 0 0 20px rgba(0,0,0,.35);
  }

  .card:hover .photo {
    filter: none;
  }

  .card h1,
  .card p {
    opacity: 1;
    transform: none;
  }
}
/* Apply filter when card is tapped (for touch devices) */
@media (hover: none) and (pointer: coarse) {
  .card.is-active .photo {
    filter: saturate(0.5) blur(6px) brightness(0.7);
    transition: filter 0.5s ease;
  }

  .card.is-active h1,
  .card.is-active p {
    opacity: 1;
    transition: opacity 0.4s ease;
  }

  .card.is-active .detail-btn {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
}




/* Prevent click/focus from locking card state */
.card:focus,
.card:focus-within {
  outline: none;
}

.card:not(:hover) h1,
.card:not(:hover) p {
  opacity: 0;
  transform: translateY(12px);
}

.card:not(:hover) .photo {
  filter: none;
}

.card.card-exit {
  transform: scale(1.15);
  opacity: 0;
  transition:
    transform 0.45s ease,
    opacity 0.45s ease;
}

.detail-page {
  animation: fadeIn 0.6s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Full-page fade-out */
.page-fade-out {
  animation: pageFadeOut 0.5s forwards;
}

@keyframes pageFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.card.card-exit {
  transform: scale(1.15);
  opacity: 0;
  transition: transform 0.5s ease, opacity 0.5s ease;
}

.no-result {
  display: none;          /* hidden by default */
  text-align: center;
  font-family: "Poetsen One", sans-serif;
  font-size: 1.5rem;
  color: #fff;
  margin-top: 40px;
  opacity: 0;
  transition: opacity 0.4s ease;
}

/* Show when active */
.no-result.active {
  display: block;
  opacity: 1;
}
