/* Universal styles */
@import url(variables.css);

* {
  margin: 0;
  padding: 0;
  list-style-type: none;
  text-decoration: none;
}

body {
  background-color: var(--background);
  color: var(--on-background);
  position: relative;
}

main {
  margin: 2rem;
  display: flex;
  flex-direction: column;
  gap: 6.25rem;
}

@media screen and (min-width: 1400px) {
  main {
    max-width: 1300px;
    margin: 0 auto;
  }
}

img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}


/* Typography */
h1, h2, h3, label {
  font-family: var(--ff-heading);
}

p, input, textarea {
  font-family: var(--ff-body);
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--secondary);
  text-align: center;
}

h2 {
  font-size: 1.875rem;
  font-weight: 600;
  text-transform: capitalize;
}

h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--secondary);
}

p {
  font-size: 1.25rem;
  font-weight: 400;
}

.subtitle {
  font-size: 1rem;
  font-weight: 400;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: 2rem;
}

hr {
  width: 200px;
  color: var(--secondary);
  margin-top: .5rem;
  margin-bottom: .5rem;
}

form {
  display: flex;
  flex-direction: column;
  margin: 2rem auto;
  max-width: 600px;
  position: relative;
}

label {
  margin-bottom: .5rem;
  font-weight: 600;
  font-size: 1.5rem;
}

input,
textarea {
  padding: 1rem;
  margin-bottom: 3rem;
  background-color: var(--container);
  border: 2px solid var(--primary);
  border-radius: 6px;
  color: var(--on-container);
  outline: none;
  font-size: 1rem;
}

textarea {
  height: 300px;
  resize: none;
}

input:focus,
textarea.focus {
  border: 2px solid var(--secondary);
  box-shadow: 0 0 5px var(--secondary);
}


/* Header */
header {
  display: flex;
  justify-content: space-between;
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  background-color: var(--background);
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  padding: 2rem;
  z-index: 50;
}

.logo {
  font-family: var(--ff-heading);
  font-weight: 700;
  font-size: 2.125rem;
  text-transform: capitalize;
}

#menu-btn {
  color: var(--on-background);
  cursor: pointer;
}

#menu-btn:hover {
  color: var(--primary);
}

nav {
  background-color: var(--container);
  position: fixed;
  top: 0;
  right: -300px;
  height: 100%;
  z-index: 100; 
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  transition: right 0.3s ease-in-out;
}

nav.show {
  right: 0;
}

.close-btn {
  cursor: pointer;
}

.close-btn:hover {
  color: var(--secondary);
}

nav ul {
  display: grid;
}

nav li {
  padding: 2rem;
  text-align: center;
  cursor: pointer;
}

nav li:first-child {
  margin-left: auto;
}

nav li:not(:first-child) {
  padding: 3rem 6rem;
}

nav li:hover:not(:first-child) {
  background-color: var(--secondary);
  color: var(--on-secondary);
}

a {
  color: inherit;
}


/* Footer */
footer {
  background-color: var(--container);
  padding: 3.75rem;
  margin-top: 6.25rem;
  text-align: center;
}

footer p {
  opacity: .8;
}


/* Buttons and text-links */
button {
  background: none;
  border: none;
  cursor: pointer;
}

.primary-btn,
.secondary-btn {
  font-size: 1.25rem;
  font-weight: 500;
  padding: .8rem;
  text-transform: capitalize;
  box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
  border: none;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.primary-btn {
  background-color: var(--primary);
  color: var(--on-primary);
}

.primary-btn:hover {
  background-color: var(--primary-hover);
}

form .primary-btn {
  width: 300px;
  margin: 0 auto;
}

.secondary-btn {
  background-color: var(--secondary);
  color: var(--on-secondary);
}

.secondary-btn:hover {
  background-color: var(--secondary-hover);
}

.chevron-btn {
  color: var(--secondary);
  cursor: pointer;
}

.chevron-btn:hover {
  color: var(--secondary-hover);
}

.edit-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
}

@media screen and (min-width: 656px) {
  .edit-btns {
    justify-content: space-between;
  }
}

.edit-btns button {
  width: 280px;
}

.link-message {
  text-align: center;
}

.text-link {
  font-weight: 700;
}

.top-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: none;
  background-color: #333;
  color: var(--secondary);
  border: none;
  padding: 1rem;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
  transition: opacity 0.3s ease-in-out;
}

.top-btn:hover {
  background-color: #555;
}


/* Overlays */
.overlay-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 4;
}

.overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--container);
  color: var(--on-container);
  padding: 3rem;
  border-radius: 6px;
  box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);
  z-index: 5;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.overlay label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 400;
}

.overlay label input {
  margin: 0;
  padding: 0;
  width: 16px;
  height: 16px;
}

input[type="checkbox"] {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--primary);
  border-radius: 4px;
  display: inline-block;
  position: relative;
  cursor: pointer;
}

input[type="checkbox"]:checked {
  background-color: var(--primary);
}

input[type="checkbox"]::before {
  content: "\f00c"; 
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 14px;
  color: var(--on-background);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
}

input[type="checkbox"]:checked::before {
  opacity: 1;
}

/* Loading spinner and API error */
.loading-spinner {
  margin: 2rem auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.loading-spinner i {
  animation: pump 0.6s ease-in-out infinite;
}

  @keyframes pump {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
  }

.loading-spinner p {
  margin: 1rem auto;
}

.hidden {
  display: none;
}

#post-container .error-message,
#edit-section .error-message {
  margin-top: 6rem;
}