/* Reset and base styles */

/* Remove default margin and padding from all elements and pseudo-elements */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  /* Include padding and border in element's total width and height */
}

/* Set base font properties and background color for the html element */
html {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.4;
  color: #222;
  -webkit-font-smoothing: antialiased;
  /* Improve font rendering on WebKit */
  -moz-osx-font-smoothing: grayscale;
  /* Improve font rendering on Firefox */
}

/* Set base styles for body */
body {
  min-height: 100vh;
  text-rendering: optimizeSpeed;
  /* Optimize text rendering for speed */
}

/* Remove default styles from links */
a {
  color: inherit;
  text-decoration: none;
}

/* Add underline on hover and focus for better accessibility */
a:hover,
a:focus {
  text-decoration: none;
  outline: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0px;
  padding: 0px;
}

/* Remove default list styles */
ul,
ol {
  list-style: none;
}

/* Remove default button styles */
button {
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  /* Inherit font styles for consistency */
}

/* Style form inputs and textareas */
input,
textarea {
  font: inherit;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 0.5em;
  resize: vertical;
  /* Allow vertical resizing only */
}

/* Make images responsive */
img {
  max-width: 100%;
  display: block;
  height: auto;
}

/* main style */

.board {
  min-height: 100vh;
  padding: 2rem;
  background: #f0e6d2;
  box-shadow: inset 0 0 20px #d1c4a1;
}


.head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.head h1 {
  font-size: 2rem;
  color: #333;
}

.head a {
  padding: 0.5rem 3rem;
  background-color: #222;
  border: none;
  color: white;
  font-weight: bold;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.head a:hover {
  background-color: #222222bc;
}

.messages {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem 1.5rem;
  perspective: 1200px;
  /* for 3d depth */
}


.item {
  border-radius: 2px;

  box-shadow:
    3px 7px 10px rgba(0, 0, 0, 0.25),
    inset 0 0 10px rgba(255, 255, 255, 0.7);

  color: #333;
  font-weight: 400;
  font-size: 1.3rem;


  transform-style: preserve-3d;
  transform: rotateX(3deg) rotateY(calc(-5deg + 10deg * var(--rotate))) rotateZ(calc(-3deg + 6deg * var(--rotate)));

  transition: transform 0.3s ease, box-shadow 0.3s ease;

  min-height: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;

  cursor: grab;
  user-select: none;
}


.item:hover {
  transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale(1.05);
  box-shadow:
    5px 15px 20px rgba(0, 0, 0, 0.35),
    inset 0 0 15px rgba(255, 255, 255, 0.8);
  cursor: grabbing;
  z-index: 100;
}

.item a {
  display: block;
  width: 100%;
  height: 100%;
  padding: 15px 20px;
  cursor: grab;

  white-space: normal;
  /* اجازه میده متن به خطوط بعدی بره */
  word-wrap: break-word;
  /* شکستن کلمات بلند */
  overflow-wrap: break-word;
  /* استاندارد جدید برای شکستن کلمات */
}

.detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem 4rem;
  box-shadow: 0px 2px 10px 2px rgba(26, 24, 24, 0.558);
  border-radius: 2px;
}

.detail .inf {
  white-space: pre-wrap;
  /* preserve line breaks and wrap text */
  word-wrap: break-word;
  /* allow breaking long words */
  overflow-wrap: break-word;
  /* for new expelorer */
  hyphens: auto;
  /* جاهایی که ممکنه کلمه رو بشکنه */
}

.inf {
  font-size: 1.3rem;
  font-weight: 500;
}

.backBtn {
  text-align: center;
  color: white;
  font-size: 1.4rem;
  font-weight: 500;
  background-color: #222;
  padding: 10px;
  border-radius: 5px;
  text-decoration: none;
  transition: background-color 3ms ease-in;
}

.backBtn:hover {
  text-decoration: none;
  background-color: #222222cf;
}

.notFound {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

@media (max-width: 1068px) {
  .messages {
    grid-template-columns: repeat(3, 1fr);
  }
}


@media (max-width: 768px) {
  .messages {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail {
    padding: 15px;
  }
}


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

  .detail {
    padding: 15px;
  }

  .head {
    display: flex;
    flex-direction: column;
    gap: 15px;
  }
}