/* =====================================
   HERO
===================================== */

.hero {
  text-align: center;

  padding: 70px 20px 35px;
}

.hero h1 {
  font-size: clamp(40px, 7vw, 75px);

  line-height: 0.95;

  letter-spacing: -4px;

  margin-bottom: 25px;

  transform: rotate(-1deg);
}

.hero h1::after {
  content: " ★";

  color: var(--pink);

  -webkit-text-stroke: 2px var(--black);
}

.hero p {
  max-width: 550px;

  margin: auto;

  font-size: 17px;

  line-height: 1.5;

  transform: rotate(1deg);
}

/* =====================================
   SEARCH
===================================== */

.search {
  width: min(600px, 90%);

  height: 58px;

  margin: 35px auto 0;

  display: flex;
  align-items: center;

  gap: 10px;

  padding: 0 18px;

  background: var(--white);

  border: 4px solid var(--black);

  border-radius: 18px;

  box-shadow: 6px 6px 0 var(--black);

  transform: rotate(-1deg);
}

.search span {
  font-size: 25px;
}

.search input {
  width: 100%;

  border: none;
  outline: none;

  background: transparent;

  font-family: inherit;

  font-size: 16px;
}

.search input::placeholder {
  color: #777;
}

/* =====================================
   CATEGORIES
===================================== */

.categories {
  width: 92%;

  margin: 10px auto 35px;

  display: flex;

  gap: 12px;

  overflow-x: auto;

  scrollbar-width: none;
}

.categories::-webkit-scrollbar {
  display: none;
}

.category {
  flex-shrink: 0;

  padding: 9px 16px;

  background: var(--white);

  border: 3px solid var(--black);

  border-radius: 14px;

  font-family: inherit;

  font-weight: bold;

  cursor: pointer;

  box-shadow: 3px 3px 0 var(--black);

  transition: 0.15s;
}

.category:nth-child(2) {
  background: var(--pink);
}

.category:nth-child(3) {
  background: var(--blue);
}

.category:nth-child(4) {
  background: var(--green);
}

.category:nth-child(5) {
  background: var(--purple);
}

.category:nth-child(6) {
  background: var(--orange);
}

.category:hover {
  transform: rotate(-3deg) translateY(-3px);
}

.category.active {
  background: var(--black);

  color: white;

  transform: rotate(2deg);
}

/* =====================================
   MASONRY GRID
===================================== */

.grid {
  width: 92%;
  max-width: 1500px;

  margin: auto;

  display: grid;

  grid-template-columns: repeat(4, minmax(0, 1fr));

  gap: 25px;

  padding-bottom: 100px;
}
/* =====================================
   CARDS
===================================== */

.card {
  position: relative;

  display: inline-block;

  width: 100%;
  height: fit-content;

  margin-bottom: 32px;

  background: var(--white);

  border: 3px solid var(--black);

  border-radius: 4px;

  overflow: visible;

  break-inside: avoid;

  cursor: zoom-in;

  /* physical paper shadow */
  box-shadow:
    5px 5px 0 var(--black),
    9px 9px 0 rgba(0, 0, 0, 0.08);

  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

/* =====================================
   RANDOM PAPER ROTATION
===================================== */

.card:nth-child(3n) {
  transform: rotate(1.2deg);
}

.card:nth-child(3n + 1) {
  transform: rotate(-1.2deg);
}

.card:nth-child(5n) {
  transform: rotate(2deg);
}

/* =====================================
   PIN
===================================== */

.card::before {
  content: "";

  position: absolute;

  top: -10px;
  left: 50%;

  width: 18px;
  height: 18px;

  transform: translateX(-50%);

  background: var(--pink);

  border: 3px solid var(--black);

  border-radius: 50%;

  box-shadow: 2px 2px 0 var(--black);

  z-index: 10;
}

/* little highlight on the pin */

.card::after {
  content: "";

  position: absolute;

  top: -5px;
  left: calc(50% - 3px);

  width: 5px;
  height: 5px;

  background: rgba(255, 255, 255, 0.7);

  border-radius: 50%;

  z-index: 11;
}

/* =====================================
   HOVER
===================================== */

.card:hover {
  transform-origin: 50% 0%;

  transform: rotate(0deg) translateY(-5px) scale(1.02);

  box-shadow:
    8px 10px 0 var(--black),
    13px 14px 0 rgba(0, 0, 0, 0.08);

  position: relative;
  z-index: 5;
}

/* =====================================
   IMAGE
===================================== */

.image-wrapper {
  position: relative;

  overflow: hidden;

  background: #ddd;
}

.image-wrapper img {
  width: 100%;

  height: auto;

  display: block;

  /* Makes photos feel less polished */
  filter: saturate(1.05) contrast(1.03);

  transition: transform 0.25s;
}

.card:hover .image-wrapper img {
  transform: scale(1.04);
}

/* =====================================
   SAVE BUTTON
===================================== */

.save-button {
  position: absolute;

  top: 12px;
  right: 12px;

  padding: 8px 13px;

  background: var(--pink);

  border: 3px solid var(--black);

  border-radius: 12px;

  font-family: inherit;

  font-weight: bold;

  cursor: pointer;

  box-shadow: 3px 3px 0 var(--black);

  opacity: 0;

  transform: rotate(3deg);

  transition: 0.15s;
}

.card:hover .save-button {
  opacity: 1;
}

.save-button:hover {
  transform: rotate(-3deg) scale(1.05);
}

/* =====================================
   CARD CONTENT
===================================== */

.card-content {
  padding: 15px 17px 17px;
}

.card-content h2 {
  font-size: 19px;

  margin-bottom: 7px;

  transform: rotate(-1deg);
}

.card-content p {
  color: var(--gray);

  font-size: 14px;

  line-height: 1.5;

  margin-bottom: 15px;
}

/* =====================================
   ADD BUTTON
===================================== */

.add-button {
  position: fixed;

  right: 30px;
  bottom: 30px;

  width: 65px;
  height: 65px;

  border: 4px solid var(--black);

  border-radius: 18px;

  background: var(--pink);

  color: var(--black);

  font-family: inherit;

  font-size: 35px;
  font-weight: bold;

  cursor: pointer;

  box-shadow: 6px 6px 0 var(--black);

  transform: rotate(4deg);

  z-index: 50;
}

.add-button:hover {
  transform: rotate(-4deg) scale(1.08);
}

/* =====================================
   LITTLE DECORATIONS
===================================== */

.hero::before {
  content: "✦";

  position: absolute;

  left: 8%;

  margin-top: 10px;

  font-size: 50px;

  color: var(--pink);

  -webkit-text-stroke: 3px var(--black);

  transform: rotate(-15deg);
}

.hero::after {
  content: "★";

  position: absolute;

  right: 8%;

  margin-top: -40px;

  font-size: 55px;

  color: var(--blue);

  -webkit-text-stroke: 3px var(--black);

  transform: rotate(15deg);
}

/* =========================
   Post Viewer
========================= */

.post-modal {
  position: fixed;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 30px;

  background: rgba(0, 0, 0, 0.72);

  opacity: 0;
  visibility: hidden;

  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;

  z-index: 1000;
}

.post-modal.open {
  opacity: 1;
  visibility: visible;
}

/* Main viewer */

.post-viewer {
  position: relative;

  width: min(1100px, 92vw);
  height: min(750px, 88vh);

  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.7fr);

  overflow: hidden;

  border-radius: 10px;

  background: #ffffff;

  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);

  transform: scale(0.96);

  transition: transform 0.2s ease;
}

.post-modal.open .post-viewer {
  transform: scale(1);
}

/* Image */

.post-image {
  min-width: 0;
  min-height: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  background: #111111;
}

.post-image img {
  width: 100%;
  height: 100%;

  object-fit: contain;
}

/* Details */

.post-details {
  display: flex;
  flex-direction: column;

  padding: 32px;

  background: #ffffff;
}

/* Author */

.post-author {
  display: flex;
  align-items: center;
  gap: 12px;

  padding-bottom: 24px;

  border-bottom: 1px solid #eeeeee;
}

.post-avatar {
  width: 38px;
  height: 38px;

  display: flex;
  align-items: center;
  justify-content: center;

  flex-shrink: 0;

  border-radius: 50%;

  background: #f0f0f0;
  color: #333333;

  font-size: 14px;
}

.post-author strong {
  display: block;

  color: #222222;
  font-size: 14px;
}

.post-author span {
  display: block;

  margin-top: 3px;

  color: #999999;
  font-size: 12px;
}

/* Description */

.post-description {
  padding-top: 28px;
}

.post-description h2 {
  margin: 0 0 10px;

  color: #111111;

  font-size: 24px;
  font-weight: 600;
}

.post-description p {
  margin: 0;

  color: #777777;

  font-size: 14px;
  line-height: 1.7;
}

/* Like */

.post-actions {
  margin-top: auto;

  padding-top: 24px;

  border-top: 1px solid #eeeeee;
}

.post-like {
  display: flex;
  align-items: center;
  gap: 8px;

  padding: 9px 13px;

  border: 1px solid #eeeeee;
  border-radius: 6px;

  background: #ffffff;

  color: #555555;

  font-family: inherit;
  font-size: 14px;

  cursor: pointer;

  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease;
}

.post-like:hover {
  background: #fafafa;
  border-color: #dddddd;
  color: #111111;
}

/* Close button */

.post-close {
  position: absolute;
  top: 14px;
  right: 14px;

  width: 34px;
  height: 34px;

  display: flex;
  align-items: center;
  justify-content: center;

  border: none;
  border-radius: 50%;

  background: rgba(255, 255, 255, 0.9);

  color: #333333;

  font-size: 24px;
  line-height: 1;

  cursor: pointer;

  z-index: 2;

  transition:
    background 0.2s ease,
    transform 0.2s ease;
}

.post-close:hover {
  background: #ffffff;
  transform: scale(1.05);
}

/* =====================================
   TABLET
===================================== */

@media (max-width: 900px) {
  .nav {
    display: none;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* =====================================
   MOBILE
===================================== */

@media (max-width: 600px) {
  .hero {
    padding-top: 55px;
  }

  .hero h1 {
    letter-spacing: -2px;
  }

  .hero::before,
  .hero::after {
    display: none;
  }

  .grid {
    width: 94%;

    columns: 2 150px;

    column-gap: 15px;
  }

  .card {
    margin-bottom: 20px;

    box-shadow: 5px 5px 0 var(--black);
  }

  .card-content {
    padding: 12px;
  }

  .card-content h2 {
    font-size: 16px;
  }

  .add-button {
    right: 18px;
    bottom: 18px;
  }

  .post-modal {
    padding: 15px;
  }

  .post-viewer {
    width: 100%;
    height: auto;
    max-height: 94vh;

    display: flex;
    flex-direction: column;

    overflow-y: auto;
  }

  .post-image {
    height: 55vh;
    min-height: 250px;
  }

  .post-details {
    padding: 24px;
  }

  .post-description h2 {
    font-size: 20px;
  }
}

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