:root {
  --primary-color: #1846A3;
  --primary-color-dark: #123570;
  --primary-color-light: rgba(24, 70, 163, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f9f9f9;
}

header {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.header-top {
  background: white;
  text-align: center;
  padding: 2rem 1rem 1.5rem;
}

.header-logo {
  max-width: 480px;
  width: 80%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.header-main {
  background: var(--primary-color);
  color: white;
  text-align: center;
  padding: 0.75rem 1rem;
}

.header-main p {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  font-family: Arial, sans-serif;
  letter-spacing: 0.5px;
}

main {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1rem;
}

section {
  background: white;
  padding: 2rem;
  margin-bottom: 2rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

h2 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-size: 1.8rem;
  border-bottom: 2px solid var(--primary-color);
  padding-bottom: 0.5rem;
}

.archive-notice {
  font-size: 0.9rem;
  color: #666;
  font-style: italic;
  margin: -0.5rem 0 1rem 0;
  padding: 0.5rem;
  background: #f8f9fa;
  border-left: 3px solid var(--primary-color);
  border-radius: 2px;
}

/* Carousel Styles */
.carousel-container {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.5rem;
}

.carousel-wrapper {
  flex: 1;
  overflow: hidden;
}

.carousel {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 1rem 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) #f1f1f1;
}

.carousel::-webkit-scrollbar {
  height: 8px;
}

.carousel::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.carousel::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}

.carousel::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color-dark);
}

.carousel-item {
  flex: 0 0 auto;
  text-align: center;
}

.carousel-item a {
  display: block;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.carousel-item a:hover {
  transform: translateY(-5px);
}

.carousel img {
  width: 200px;
  height: auto;
  border: 3px solid #ddd;
  border-radius: 4px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
  transition: all 0.3s ease;
  display: block;
}

.carousel img:hover {
  border-color: var(--primary-color);
  box-shadow: 0 6px 16px var(--primary-color-light);
}

.issue-date {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: #666;
  font-weight: 500;
}

.carousel-nav {
  background: var(--primary-color);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  flex-shrink: 0;
}

.carousel-nav:hover:not(:disabled) {
  background: var(--primary-color-dark);
  transform: scale(1.1);
}

.carousel-nav:disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 0.5;
}

.carousel-nav:active:not(:disabled) {
  transform: scale(0.95);
}

/* PDF Viewer Styles */
#pdf-viewer-section {
  margin-top: 2rem;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.viewer-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.viewer-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.control-btn {
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  border: none;
  border-radius: 4px;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.control-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.control-btn:active {
  transform: translateY(0);
}

.share-btn {
  background: #0066cc;
  color: white;
}

.share-btn:hover {
  background: #0052a3;
}

#open-new-tab-btn {
  background: #f0f0f0;
  color: #333;
  border: 1px solid #ddd;
}

#open-new-tab-btn:hover {
  background: #e0e0e0;
}

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

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

#pdf-frame {
  display: block;
  width: 100%;
  max-width: 850px;        /* or whatever fits your layout best */
  aspect-ratio: 8.5 / 11;  /* 0.7727 */
  border: 2px solid #ddd;
  border-radius: 4px;
  background: white;
  margin: 0 auto;
}

/* Instructions */
ul {
  list-style-position: inside;
  padding-left: 0;
}

li {
  margin-bottom: 0.5rem;
  line-height: 1.8;
}

kbd {
  background: #f4f4f4;
  border: 1px solid #ccc;
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
  font-family: monospace;
  font-size: 0.9em;
}

/* Contribution Section Styles */
.contribute-section {
  background: #fafafa;
  border: none;
}

.contribute-section h2 {
  color: var(--primary-color);
}

.contribute-section p {
  line-height: 1.8;
}

.readme-link {
  color: var(--primary-color);
  text-decoration: underline;
  font-weight: 600;
}

.readme-link:hover {
  color: var(--primary-color-dark);
}

.contact-email {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  padding: 0.4rem 0.8rem;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  display: inline-block;
  transition: all 0.2s ease;
}

.contact-email:hover {
  background: #e8e8e8;
  border-color: var(--primary-color);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

footer {
  text-align: center;
  padding: 2rem 1rem;
  background: white;
  margin-top: 2rem;
  border-top: 2px solid var(--primary-color);
}

footer a {
  color: var(--primary-color);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .header-top {
    padding: 1.5rem 0.5rem 1rem;
  }

  .header-logo {
    max-width: 320px;
    width: 80%;
  }

  .header-main p {
    font-size: 0.85rem;
  }

  section {
    padding: 1.5rem;
  }

  h2 {
    font-size: 1.4rem;
  }

  .carousel-container {
    flex-direction: column;
    gap: 0.5rem;
  }

  .carousel-nav {
    display: none; /* Hide nav buttons on mobile, use swipe instead */
  }

  .carousel-wrapper {
    width: 100%;
  }

  .carousel {
    gap: 15px;
    padding: 1rem 0;
  }

  .carousel img {
    width: 150px;
  }

  .viewer-controls {
    flex-direction: column;
    align-items: flex-start;
  }

  .viewer-buttons {
    width: 100%;
    justify-content: flex-start;
  }

  .control-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    flex: 1;
    justify-content: center;
    min-width: 80px;
  }

  /*
  #pdf-frame {
    height: 70vh;
  }
  */
  
  #pdf-title {
    font-size: 1.2rem;
  }

  .contact-email {
    font-size: 1rem;
    padding: 0.5rem 0.75rem;
  }
}

@media (max-width: 480px) {
  main {
    margin: 1rem auto;
  }

  section {
    padding: 1rem;
    margin-bottom: 1rem;
  }

  .header-logo {
    max-width: 320px;
    width: 85%;
  }

  .header-main p {
    font-size: 0.75rem;
  }

  .carousel img {
    width: 130px;
  }

  #pdf-frame {
    height: 60vh;
  }

  .viewer-buttons {
    flex-direction: column;
  }

  .control-btn {
    width: 100%;
  }
}
