body {
  font-family: arial, sans-serif;
  text-align: center;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  justify-items: center;
}

/* Accessibility: Hide content visually but keep it for screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header styling */
header .tagline {
  font-size: 0.9em;
  color: #666;
  margin: -0.5rem 0 1rem 0;
  font-style: italic;
}

.form {
  margin-bottom: 2rem;
}

#wrapper {
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  padding: 1rem;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  justify-items: center;
}

.form {
  width: 100%;
  max-width: 600px;
  padding: 1em 0.5em;
  border: solid 1px #bbb;
  background-color: #f4f4f4;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  justify-items: center;
}

#quote-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  width: 100%;
  align-items: center;
}

input[type="text"] {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  box-sizing: border-box;
}

input[type="submit"] {
  padding: 0.5rem 1rem;
  white-space: nowrap;
}

#quotes {
  width: 100%;
  max-width: 700px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.quote {
  border-bottom: 1px solid #ccc;
  padding-bottom: 10px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.25rem;
  text-align: left;
}

h2 {
  margin: 0;
  padding: 0;
  font-size: 1.1em;
  justify-self: start;
}

blockquote {
  border-left: #bbb 1px solid;
  border-right: #bbb 1px solid;
  padding: 0.5em;
  background-color: #f7f7f7;
  font-weight: bold;
  margin: 0;
  width: 100%;
  max-width: 600px;
  justify-self: center;
  box-sizing: border-box;
}

.timestamp {
  color: #D3D3D3;
  cursor: pointer;
  margin-top: 4px;
  justify-self: start;
}

.timestamp a {
  color: #4169e1;
  text-decoration: underline;
}

.quote.highlight {
  background-color: #ffffcc;
  transition: background-color 2s ease;
}

@media (max-width: 768px) {
  #wrapper {
    padding: 0.5rem;
  }

  .form {
    max-width: 100%;
    padding: 0.75em 0.5em;
  }

  #quote-form {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  input[type="text"] {
    font-size: 16px; /* Prevent zoom on iOS */
  }

  input[type="submit"] {
    width: 100%;
    padding: 0.75rem;
  }

  blockquote {
    max-width: 100%;
    padding: 0.75em;
    border-left: #bbb 3px solid; /* Thicker border for mobile */
    border-right: none; /* Remove right border on mobile */
  }

  h1 {
    font-size: 1.5rem;
    margin: 0.5rem 0;
  }

  h2 {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  #wrapper {
    padding: 0.25rem;
  }

  .form {
    padding: 0.5em 0.25em;
  }

  blockquote {
    padding: 0.5em;
    font-size: 0.9rem;
  }

  .timestamp {
    font-size: 0.8rem;
  }
}

/* Loading skeleton styles */
.loading-skeleton {
  opacity: 0.7;
}

.skeleton-quote {
  animation: skeleton-pulse 1.5s ease-in-out infinite alternate;
}

.skeleton-line {
  height: 1.2rem;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
  margin: 0.5rem 0;
}

.skeleton-line.short {
  width: 60%;
}

.skeleton-timestamp {
  height: 0.9rem;
  width: 40%;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
  margin-top: 1rem;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@keyframes skeleton-pulse {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0.4;
  }
}

.quote-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
}

.share-buttons {
  display: flex;
  gap: 0.5rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.quote:hover .share-buttons {
  opacity: 1;
}

.share-btn {
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 6px;
  cursor: pointer;
  color: #666;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  width: 28px;
  height: 28px;
}

.share-btn:hover {
  background-color: #f5f5f5;
  border-color: #007acc;
  color: #007acc;
}

.share-btn:active {
  transform: scale(0.95);
}

.share-btn i {
  font-size: 14px;
}

@media (max-width: 768px) {
  .share-buttons {
    opacity: 1;
  }

  .quote-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .share-buttons {
    align-self: flex-end;
  }
}
