/* Base Styles from Portfolio */
:root {
  --primary-color: #2563eb;
  --secondary-color: #1e40af;
  --accent-color: #3b82f6;
  --dark-color: #1e293b;
  --light-color: #f8fafc;
  --gray-color: #64748b;
  --light-gray-color: #e2e8f0;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

/* Dark Theme Variables */
.dark-theme {
  --primary-color: #3b82f6;
  --secondary-color: #60a5fa;
  --accent-color: #93c5fd;
  --dark-color: #f8fafc;
  --light-color: #0f172a;
  --gray-color: #cbd5e1;
  --light-gray-color: #1e293b;
  --box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Poppins", sans-serif;
  line-height: 1.6;
  color: var(--dark-color);
  background-color: var(--light-color);
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  text-decoration: none;
  color: var(--dark-color);
  transition: var(--transition);
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

section {
  padding: 60px 0; /* Adjusted padding for sections */
}

.section-header {
  text-align: center;
  margin-bottom: 60px;
}

.section-header h2 {
  font-size: 2.5rem;
  margin-bottom: 15px;
  color: var(--dark-color);
}

.underline {
  height: 4px;
  width: 60px;
  background-color: var(--primary-color);
  margin: 0 auto;
}

.btn {
  display: inline-block;
  padding: 12px 30px;
  border-radius: 50px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  border: none;
}

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

.primary-btn:hover {
  background-color: var(--secondary-color);
  transform: translateY(-3px);
  box-shadow: var(--box-shadow);
}

.secondary-btn {
  background-color: transparent;
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
}

.secondary-btn:hover {
  background-color: var(--primary-color);
  color: white;
  transform: translateY(-3px);
  box-shadow: var(--box-shadow);
}

.small-btn {
  padding: 8px 20px;
  font-size: 0.9rem;
}

/* Header */
header {
  position: static;
  width: 100%;
  background-color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  z-index: auto;
}

.dark-theme header {
  background-color: rgba(15, 23, 42, 0.95);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
}

.logo h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
}

nav {
  display: flex;
  align-items: center;
}

.nav-links {
  display: flex;
}

.nav-links li {
  margin-left: 30px;
}

.nav-links a {
  font-weight: 500;
  position: relative;
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--primary-color);
  transition: var(--transition);
}

.nav-links a:hover {
  color: var(--primary-color);
}

.nav-links a.active {
  color: var(--primary-color);
}

.nav-links a.active::after {
  width: 100%;
}

.nav-links a:hover::after {
  width: 100%;
}

.theme-switch {
  margin-left: 30px;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--dark-color);
  transition: var(--transition);
}

.theme-switch:hover {
  color: var(--primary-color);
  transform: rotate(30deg);
}

.burger {
  display: none;
  cursor: pointer;
}

.burger div {
  width: 25px;
  height: 3px;
  background-color: var(--dark-color);
  margin: 5px;
  transition: var(--transition);
}

/* Page Specific Header for Certificates */
.page-header-section {
  text-align: center;
  padding: 40px 0 20px;
  background-color: var(--light-color);
}

.dark-theme .page-header-section {
  background-color: var(--light-color);
}

.page-header-section h1 {
  font-size: 2.5em;
  margin: 0;
  color: var(--dark-color);
}

/* Controls Section */
.controls-section {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 30px;
  background-color: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: var(--box-shadow);
}

.dark-theme .controls-section {
  background-color: #1e293b;
}

.filters-container,
.sort-container {
  flex: 1;
  min-width: 280px;
}

.filters-container h2,
.sort-container h2 {
  margin-top: 0;
  color: var(--primary-color);
  font-size: 1.5em;
  border-bottom: 2px solid var(--light-gray-color);
  padding-bottom: 10px;
  margin-bottom: 15px;
}

.filter-group {
  margin-bottom: 15px;
}

.filter-group h3 {
  margin-top: 0;
  margin-bottom: 10px;
  color: var(--dark-color);
  font-size: 1.1em;
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Specific styles for certificate filter buttons to override general .filter-btn */
#category-filters .filter-btn,
#level-filters .filter-btn {
  background-color: var(--light-gray-color);
  border: 1px solid var(--gray-color);
  color: var(--dark-color);
  padding: 8px 15px;
  border-radius: 20px;
  cursor: pointer;
  transition: background-color 0.3s ease, color 0.3s ease,
    border-color 0.3s ease;
  font-size: 0.9em;
}

#category-filters .filter-btn:hover,
#level-filters .filter-btn:hover {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

#category-filters .filter-btn.active,
#level-filters .filter-btn.active {
  background-color: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

#category-filters .filter-btn.active:hover,
#level-filters .filter-btn.active:hover {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
}

#sort-select {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--gray-color);
  border-radius: 5px;
  background-color: var(--light-gray-color);
  font-size: 1em;
  color: var(--dark-color);
  cursor: pointer;
  appearance: none; /* Remove default arrow */
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2334495e%22%20d%3D%22M287%2C197.9L159.3%2C69.2c-3.7-3.7-9.7-3.7-13.4%2C0L5.4%2C197.9c-3.7%2C3.7-3.7%2C9.7%2C0%2C13.4l13.4%2C13.4c3.7%2C3.7%2C9.7%2C3.7%2C13.4%2C0l110.7-110.7l110.7%2C110.7c3.7%2C3.7%2C9.7%2C3.7%2C13.4%2C0l13.4-13.4C290.7%2C207.6%2C290.7%2C201.6%2C287%2C197.9z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 10px top 50%;
  background-size: 12px;
}

.dark-theme #sort-select {
  background-color: #334155;
  color: var(--light-color);
  border-color: #475569;
}

#certificates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 25px;
  padding: 20px 0;
}

.certificate-card {
  background-color: white;
  border-radius: 10px;
  box-shadow: var(--box-shadow);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.dark-theme .certificate-card {
  background-color: #1e293b;
}

.certificate-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.certificate-card-image {
  width: 100%;
  height: 280px;
  box-sizing: border-box;
  padding: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--light-gray-color); /* Placeholder background */
}

.certificate-card-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.certificate-card-pdf {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background-color: #f8fafc;
  color: #ef4444;
  font-size: 3rem;
}

.dark-theme .certificate-card-pdf {
  background-color: #1e293b;
  color: #f87171;
}

.certificate-card-pdf i {
  margin-bottom: 10px;
}

.certificate-card-pdf span {
  font-size: 1rem;
  font-weight: 500;
  color: var(--dark-color);
}

.dark-theme .certificate-card-pdf span {
  color: var(--light-color);
}


.certificate-card-content {
  padding: 15px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.certificate-card-content h3 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.3em;
  color: var(--dark-color);
  min-height: 2.6em; /* Ensure consistent height for titles */
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.certificate-card-content p {
  margin: 5px 0;
  font-size: 0.95em;
  color: var(--gray-color);
}

.certificate-card-content .tags {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.certificate-card-content .tag {
  background-color: #e0f2f7;
  color: #2196f3;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 0.8em;
  white-space: nowrap;
}

.dark-theme .certificate-card-content .tag {
  background-color: #1a365d;
  color: #60a5fa;
}

.certificate-card-content .level {
  background-color: #e8f5e9;
  color: #4caf50;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 0.8em;
  white-space: nowrap;
}

.dark-theme .certificate-card-content .level {
  background-color: #1f4720;
  color: #86efac;
}

.certificate-card-content a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: bold;
  margin-top: auto; /* Push link to the bottom */
  display: inline-block;
  padding-top: 10px;
}

.certificate-card-content a:hover {
  text-decoration: underline;
}

.download-section {
  text-align: center;
  margin: 40px 0;
}

#download-pdf-btn {
  background-color: var(--success-color);
  color: white;
  padding: 15px 30px;
  border: none;
  border-radius: 5px;
  font-size: 1.1em;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease;
  box-shadow: var(--box-shadow);
}

#download-pdf-btn:hover {
  background-color: #218838;
  transform: translateY(-2px);
}

/* Modal Styles */
.modal {
  display: none; /* Hidden by default */
  position: fixed; /* Stay in place */
  z-index: 1000; /* Sit on top */
  left: 0;
  top: 0;
  width: 100%; /* Full width */
  height: 100%; /* Full height */
  overflow: auto; /* Enable scroll if needed */
  background-color: rgba(0, 0, 0, 0.6); /* Black w/ opacity */
  backdrop-filter: blur(5px); /* Blur background */
  -webkit-backdrop-filter: blur(5px); /* Safari support */
  padding-top: 60px;
}

.modal-content {
  background-color: white;
  margin: 5% auto; /* 5% from the top and centered */
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  position: relative;
  max-width: 700px;
  width: 90%;
  animation: fadeIn 0.3s ease-out;
}

.dark-theme .modal-content {
  background-color: #1e293b;
}

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

.modal-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 20px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.modal-content h3 {
  font-size: 2em;
  color: var(--dark-color);
  margin-bottom: 15px;
  text-align: center;
}

.modal-content p {
  font-size: 1.1em;
  margin-bottom: 10px;
  color: var(--gray-color);
}

.modal-content p strong {
  color: var(--dark-color);
}

#modal-link-container {
  text-align: center;
  margin-top: 20px;
}

#modal-link {
  display: inline-block;
  background-color: var(--primary-color);
  color: white;
  padding: 10px 20px;
  border-radius: 5px;
  text-decoration: none;
  transition: background-color 0.3s ease;
}

#modal-link:hover {
  background-color: var(--secondary-color);
}

.close-button {
  color: var(--gray-color);
  position: absolute;
  top: 15px;
  right: 25px;
  font-size: 35px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s ease;
}

.close-button:hover,
.close-button:focus {
  color: var(--dark-color);
  text-decoration: none;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background-color: white;
  color: var(--dark-color);
  padding: 15px;
  border-radius: 5px;
  box-shadow: var(--box-shadow);
  display: flex;
  flex-direction: column;
  min-width: 300px;
  transform: translateX(400px);
  opacity: 0;
  transition: all 0.5s ease;
  z-index: 1000;
}

.dark-theme .toast {
  background-color: #1e293b;
  color: var(--light-color);
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-content {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.toast-icon {
  font-size: 1.5rem;
  color: var(--success-color);
  margin-right: 15px;
}

.toast-message {
  font-weight: 500;
}

.toast-progress {
  height: 3px;
  background-color: var(--success-color);
  width: 100%;
  animation: progress 3s linear forwards;
}

@keyframes progress {
  0% {
    width: 100%;
  }
  100% {
    width: 0%;
  }
}

/* PWA Install Prompt */
.pwa-install-prompt {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: white;
  box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.1);
  padding: 20px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  z-index: 999;
}

.dark-theme .pwa-install-prompt {
  background-color: #1e293b;
}

.pwa-install-prompt.show {
  transform: translateY(0);
}

.prompt-content {
  display: flex;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.prompt-icon {
  font-size: 2rem;
  color: var(--primary-color);
  margin-right: 20px;
}

.prompt-text {
  flex: 1;
}

.prompt-text h3 {
  font-size: 1.3rem;
  margin-bottom: 5px;
}

.prompt-text p {
  color: var(--gray-color);
  margin-bottom: 0;
}

.prompt-buttons {
  display: flex;
}

.prompt-buttons button {
  margin-left: 10px;
}

/* Footer */
footer {
  background-color: var(--dark-color);
  color: white;
  padding: 60px 0 20px;
}

.dark-theme footer {
  background-color: #0f172a;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.footer-logo,
.footer-links,
.footer-social {
  margin-bottom: 30px;
}

.footer-logo h2 {
  font-size: 2rem;
  margin-bottom: 10px;
  color: var(--primary-color);
}

.footer-links h3,
.footer-social h3 {
  font-size: 1.3rem;
  margin-bottom: 20px;
  color: white;
}

.footer-links ul li {
  margin-bottom: 10px;
}

.footer-links ul li a {
  color: #cbd5e1;
  transition: var(--transition);
}

.footer-links ul li a:hover {
  color: var(--primary-color);
  padding-left: 5px;
}

.footer-social .social-links a {
  background-color: #334155;
  color: white;
}

.footer-social .social-links a:hover {
  background-color: var(--primary-color);
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid #334155;
}

.footer-bottom p {
  color: #cbd5e1;
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: var(--primary-color);
  color: white;
  box-shadow: var(--box-shadow);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 999;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background-color: var(--secondary-color);
  transform: translateY(-3px);
}

/* Responsive Styles */
/* ========================================================================== */
/* Media queries for various screen sizes */
/* ========================================================================== */

@media screen and (max-width: 1024px) {
  header .container {
    padding: 15px 20px; /* Slightly smaller header padding */
  }

  .logo h1 {
    font-size: 1.8rem; /* Smaller logo on tablets */
  }

  section {
    padding: 80px 0; /* Slightly reduce section padding */
  }

  .section-header {
    margin-bottom: 50px; /* Adjust margin below section header */
  }

  .section-header h2 {
    font-size: 2.2rem; /* Smaller section titles */
  }

  .page-header-section {
    padding: 30px 0 15px; /* Adjust page header padding */
  }

  .page-header-section h1 {
    font-size: 2em; /* Smaller page header title */
  }

  .controls-section {
    flex-direction: column; /* Stack filters and sort vertically */
    gap: 15px;
    padding: 15px;
  }

  .filters-container,
  .sort-container {
    min-width: unset; /* Remove min-width constraint */
    width: 100%; /* Take full width */
  }

  .filters-container h2,
  .sort-container h2 {
    font-size: 1.3em; /* Smaller titles in controls */
    padding-bottom: 8px;
    margin-bottom: 10px;
  }

  .filter-group h3 {
    font-size: 1em; /* Smaller filter group titles */
    margin-bottom: 8px;
  }

  #category-filters .filter-btn,
  #level-filters .filter-btn {
    padding: 7px 12px; /* Smaller filter buttons */
    font-size: 0.85em;
  }

  #sort-select {
    padding: 8px; /* Smaller sort select padding */
    font-size: 0.9em;
  }

  #certificates-grid {
    grid-template-columns: repeat(
      auto-fill,
      minmax(250px, 1fr)
    ); /* Adjust min width for cards */
    gap: 20px; /* Slightly reduce gap */
  }

  .certificate-card-image {
    height: 180px; /* Slightly smaller image height */
  }

  .certificate-card-content {
    padding: 12px; /* Adjust internal padding of cards */
  }

  .certificate-card-content h3 {
    font-size: 1.2em; /* Smaller card title */
    min-height: 2.4em; /* Adjust min-height */
  }

  .certificate-card-content p {
    font-size: 0.9em; /* Smaller card text */
  }

  .certificate-card-content .tag,
  .certificate-card-content .level {
    font-size: 0.75em; /* Smaller tags */
    padding: 3px 6px;
  }

  .download-section {
    margin: 30px 0; /* Adjust margin for download section */
  }

  #download-pdf-btn {
    padding: 12px 25px; /* Smaller download button */
    font-size: 1em;
  }

  .modal-content {
    margin: 8% auto; /* Adjust modal margin */
    padding: 25px;
    width: 95%; /* Wider modal on tablets */
  }

  .modal-content img {
    margin-bottom: 15px; /* Adjust image margin in modal */
  }

  .modal-content h3 {
    font-size: 1.8em; /* Smaller modal title */
  }

  .modal-content p {
    font-size: 1em; /* Smaller modal text */
  }

  #modal-link {
    padding: 8px 15px; /* Smaller modal link button */
  }

  .close-button {
    font-size: 30px; /* Smaller close button */
    top: 10px;
    right: 20px;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
    gap: 20px; /* Adjust gap for footer sections */
  }

  .footer-logo h2 {
    font-size: 1.8rem;
  }

  .footer-links h3,
  .footer-social h3 {
    font-size: 1.2rem;
  }

  .footer-links ul li a:hover {
    padding-left: 0;
  }
}

@media screen and (max-width: 768px) {
  header .container {
    padding: 12px 15px; /* Even smaller header padding */
  }

  .logo h1 {
    font-size: 1.6rem; /* Even smaller logo on mobile */
  }

  .nav-links {
    top: 55px; /* Adjusted top to be below header */
    width: 80%; /* Wider mobile menu */
    padding: 40px 0;
  }

  .burger div {
    width: 22px; /* Smaller burger lines */
    height: 2px;
  }

  section {
    padding: 40px 0; /* Further reduce section padding */
  }

  .section-header {
    margin-bottom: 30px;
  }

  .section-header h2 {
    font-size: 1.8rem;
  }

  .page-header-section {
    padding: 25px 0 10px;
  }

  .page-header-section h1 {
    font-size: 1.8em;
  }

  .controls-section {
    gap: 10px;
    padding: 10px;
  }

  .filters-container h2,
  .sort-container h2 {
    font-size: 1.2em;
    padding-bottom: 5px;
    margin-bottom: 8px;
  }

  .filter-group h3 {
    font-size: 0.9em;
    margin-bottom: 5px;
  }

  #category-filters .filter-btn,
  #level-filters .filter-btn {
    padding: 6px 10px;
    font-size: 0.8em;
  }

  #sort-select {
    padding: 7px;
    font-size: 0.85em;
  }

  #certificates-grid {
    grid-template-columns: 1fr; /* Single column for certificates */
    gap: 15px;
  }

  .certificate-card-image {
    height: 160px; /* Even smaller image height */
  }

  .certificate-card-content {
    padding: 10px;
  }

  .certificate-card-content h3 {
    font-size: 1.1em;
    min-height: unset; /* Allow height to be dynamic */
    -webkit-line-clamp: 3; /* Allow more lines if needed */
  }

  .certificate-card-content p {
    font-size: 0.85em;
  }

  .certificate-card-content .tag,
  .certificate-card-content .level {
    font-size: 0.7em;
    padding: 2px 5px;
  }

  .download-section {
    margin: 20px 0;
  }

  #download-pdf-btn {
    padding: 10px 20px;
    font-size: 0.9em;
  }

  .modal-content {
    margin: 15% auto;
    padding: 15px;
  }

  .modal-content img {
    margin-bottom: 10px;
  }

  .modal-content h3 {
    font-size: 1.5em;
  }

  .modal-content p {
    font-size: 0.9em;
  }

  #modal-link {
    padding: 7px 12px;
    font-size: 0.9em;
  }

  .close-button {
    font-size: 25px;
    top: 8px;
    right: 15px;
  }

  .toast {
    bottom: 15px;
    right: 15px;
    min-width: 200px;
    padding: 10px;
  }

  .toast-icon {
    font-size: 1.1rem;
    margin-right: 8px;
  }

  .toast-message {
    font-size: 0.85rem;
  }

  .pwa-install-prompt {
    padding: 15px;
  }

  .prompt-icon {
    font-size: 1.8rem;
    margin-bottom: 8px;
  }

  .prompt-text h3 {
    font-size: 1.1rem;
  }

  .prompt-text p {
    font-size: 0.85rem;
  }

  .prompt-buttons button {
    padding: 8px 15px;
    font-size: 0.9rem;
  }

  .footer-content {
    gap: 15px;
  }

  .footer-logo h2 {
    font-size: 1.6rem;
  }

  .footer-links h3,
  .footer-social h3 {
    font-size: 1.1rem;
  }

  .back-to-top {
    width: 45px;
    height: 45px;
    bottom: 25px;
    right: 25px;
  }
}

@media screen and (max-width: 480px) {
  .container {
    padding: 0 10px; /* Smallest container padding */
  }

  header .container {
    padding: 10px 10px;
  }

  .logo h1 {
    font-size: 1.4rem;
  }

  .nav-links {
    top: 50px;
    width: 90%; /* Almost full width for menu */
    padding: 30px 0;
  }

  section {
    padding: 30px 0;
  }

  .section-header h2 {
    font-size: 1.6rem;
  }

  .page-header-section h1 {
    font-size: 1.6em;
  }

  .controls-section {
    padding: 8px;
  }

  .filters-container h2,
  .sort-container h2 {
    font-size: 1.1em;
  }

  .filter-group h3 {
    font-size: 0.85em;
  }

  #category-filters .filter-btn,
  #level-filters .filter-btn {
    padding: 5px 8px;
    font-size: 0.75em;
  }

  #sort-select {
    padding: 6px;
    font-size: 0.8em;
  }

  .certificate-card-image {
    height: 140px; /* Smallest image height */
  }

  .certificate-card-content {
    padding: 8px;
  }

  .certificate-card-content h3 {
    font-size: 1em;
  }

  .certificate-card-content p {
    font-size: 0.8em;
  }

  .certificate-card-content .tag,
  .certificate-card-content .level {
    font-size: 0.65em;
    padding: 2px 4px;
  }

  #download-pdf-btn {
    padding: 8px 15px;
    font-size: 0.8em;
  }

  .modal-content {
    margin: 20% auto;
    padding: 10px;
  }

  .modal-content img {
    margin-bottom: 8px;
  }

  .modal-content h3 {
    font-size: 1.3em;
  }

  .modal-content p {
    font-size: 0.8em;
  }

  #modal-link {
    padding: 6px 10px;
    font-size: 0.8em;
  }

  .close-button {
    font-size: 20px;
    top: 5px;
    right: 10px;
  }

  .toast {
    bottom: 10px;
    right: 10px;
    min-width: 180px;
    padding: 8px;
  }

  .toast-icon {
    font-size: 1rem;
    margin-right: 5px;
  }

  .toast-message {
    font-size: 0.8rem;
  }

  .pwa-install-prompt {
    padding: 10px;
  }

  .prompt-icon {
    font-size: 1.5rem;
  }

  .prompt-text h3 {
    font-size: 1rem;
  }

  .prompt-text p {
    font-size: 0.8rem;
  }

  .prompt-buttons button {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  .footer-content {
    gap: 10px;
  }

  .footer-logo h2 {
    font-size: 1.4rem;
  }

  .footer-links h3,
  .footer-social h3 {
    font-size: 1rem;
  }

  .back-to-top {
    width: 40px;
    height: 40px;
    bottom: 20px;
    right: 20px;
  }
}

/* Match the portfolio header behavior at every viewport size. */
@media screen and (max-width: 1200px) {
  header .container {
    padding: 15px 20px;
  }

  .nav-links {
    position: fixed;
    top: 68px;
    right: 0;
    display: flex;
    width: min(380px, 85vw);
    height: min(calc(100vh - 68px), 92vh);
    height: min(calc(100dvh - 68px), 92dvh);
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    gap: 6px;
    padding: 15px 0;
    background: var(--light-color);
    box-shadow: -5px 0 16px rgba(15, 23, 42, 0.12);
    transform: translateX(105%);
    transition: var(--transition);
    z-index: 1001;
  }

  .nav-links li {
    margin: 0;
  }

  .nav-links a {
    line-height: 1.48;
  }

  .burger {
    display: block;
  }
}

.achievement-archive {
  padding-top: 58px;
  padding-bottom: 70px;
}

.achievement-archive-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 28px;
}

.achievement-archive-heading h2 {
  margin-bottom: 10px;
  color: var(--dark-color);
  font-size: clamp(1.8rem, 3vw, 2.7rem);
  line-height: 1.15;
}

.achievement-archive-heading p {
  color: var(--gray-color);
}

.achievement-total {
  display: grid;
  min-width: 170px;
  gap: 2px;
  padding: 15px 20px;
  border: 1px solid rgba(37, 99, 235, .16);
  border-radius: 16px;
  background: linear-gradient(135deg, #eff6ff, #fff);
}

.dark-theme .achievement-total {
  background: linear-gradient(135deg, #172d50, #111d31);
}

.achievement-total strong {
  color: var(--primary-color);
  font-size: 2.1rem;
  line-height: 1;
}

.achievement-total span {
  color: var(--dark-color);
  font-size: .9rem;
  font-weight: 600;
}

.achievement-total small {
  color: var(--gray-color);
  font-size: .75rem;
}

.achievement-year-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 22px;
}

.achievement-year-filters button {
  padding: 8px 15px;
  border: 1px solid var(--light-gray-color);
  border-radius: 999px;
  background: transparent;
  color: var(--dark-color);
  font: inherit;
  font-size: .88rem;
  cursor: pointer;
  transition: var(--transition);
}

.achievement-year-filters button:hover,
.achievement-year-filters button.active {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: #fff;
}

.all-wins-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.win-card {
  position: relative;
  display: flex;
  min-height: 238px;
  flex-direction: column;
  padding: 20px;
  overflow: hidden;
  border: 1px solid rgba(37, 99, 235, .12);
  border-radius: 18px;
  background: linear-gradient(145deg, #fff, #f8fbff);
  box-shadow: 0 8px 28px rgba(30, 64, 175, .06);
  transition: transform .25s ease, box-shadow .25s ease;
}

.dark-theme .win-card {
  border-color: rgba(147, 197, 253, .14);
  background: linear-gradient(145deg, #172338, #111d31);
}

.win-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px rgba(30, 64, 175, .13);
}

.win-card-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.win-photo {
  display: block;
  width: 100%;
  max-height: 220px;
  margin: 14px auto 0;
  border: 1px solid rgba(148, 163, 184, .2);
  border-radius: 12px;
  background: #eef2f7;
  object-fit: contain;
}

.win-year {
  color: var(--gray-color);
  font-size: .82rem;
  font-weight: 700;
}

.win-place {
  padding: 6px 10px;
  border: 1px solid rgba(37, 99, 235, .14);
  border-radius: 999px;
  background: rgba(37, 99, 235, .08);
  color: var(--primary-color);
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}

.place-1 .win-place { background: rgba(245, 190, 70, .15); border-color: rgba(245, 190, 70, .35); color: #9a6900; }
.place-2 .win-place { background: rgba(148, 163, 184, .18); border-color: rgba(148, 163, 184, .35); color: #475569; }
.place-3 .win-place { background: rgba(180, 105, 56, .12); border-color: rgba(180, 105, 56, .3); color: #9a4f25; }
.dark-theme .place-1 .win-place { color: #f4c96b; }
.dark-theme .place-2 .win-place { color: #cbd5e1; }
.dark-theme .place-3 .win-place { color: #f0a77d; }

.win-medal-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  margin-top: 17px;
  border-radius: 12px;
  background: rgba(37, 99, 235, .09);
  color: var(--primary-color);
}

.place-1 .win-medal-icon { background: rgba(245, 190, 70, .17); color: #b47b00; }
.place-2 .win-medal-icon { background: rgba(148, 163, 184, .2); color: #64748b; }
.place-3 .win-medal-icon { background: rgba(180, 105, 56, .14); color: #a95b2c; }
.dark-theme .place-1 .win-medal-icon { color: #f4c96b; }
.dark-theme .place-2 .win-medal-icon { color: #cbd5e1; }
.dark-theme .place-3 .win-medal-icon { color: #f0a77d; }

.win-card h3 {
  margin: 14px 0 8px;
  color: var(--dark-color);
  font-size: 1.04rem;
  line-height: 1.4;
}

.win-category,
.win-highlight {
  margin: 0 0 13px;
  color: var(--gray-color);
  font-size: .84rem;
}

.win-highlight {
  color: var(--primary-color);
  font-weight: 600;
}

.win-proof-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--primary-color);
  font-size: .84rem;
  font-weight: 700;
}

.win-proof-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: auto;
  padding-top: 13px;
}

.wins-loading {
  grid-column: 1 / -1;
  padding: 30px;
  color: var(--gray-color);
  text-align: center;
}

@media screen and (max-width: 900px) {
  .all-wins-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media screen and (max-width: 640px) {
  .achievement-archive-heading { align-items: flex-start; flex-direction: column; }
  .achievement-total { min-width: 0; width: 100%; }
  .all-wins-grid { grid-template-columns: 1fr; }
}

.featured-achievement {
  display: grid;
  grid-template-columns: minmax(280px, .9fr) minmax(320px, 1.1fr);
  align-items: center;
  gap: clamp(28px, 5vw, 64px);
  margin-bottom: 34px;
  padding: clamp(16px, 2.5vw, 28px);
  overflow: hidden;
  border: 1px solid rgba(37, 99, 235, .12);
  border-radius: 28px;
  background: linear-gradient(120deg, #fff 30%, #eff6ff 100%);
  box-shadow: 0 24px 70px rgba(30, 64, 175, .12);
}

.dark-theme .featured-achievement {
  background: linear-gradient(120deg, #111d31 20%, #172d50 100%);
  border-color: rgba(147, 197, 253, .16);
}

.featured-achievement-photo {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.featured-achievement-photo img {
  display: block;
  width: 100%;
  max-width: 440px;
  height: auto;
  aspect-ratio: 3 / 4;
  border-radius: 20px;
  background: #0b1730;
  object-fit: contain;
  object-position: center;
  box-shadow: 0 16px 40px rgba(4, 12, 28, .2);
  transition: transform .7s ease;
}

.featured-achievement:hover .featured-achievement-photo img {
  transform: scale(1.01);
}

.achievement-photo-tag {
  align-self: center;
  padding: 9px 13px;
  border: 1px solid rgba(147, 197, 253, .28);
  border-radius: 999px;
  background: rgba(37, 99, 235, .1);
  color: var(--primary-color);
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .12em;
}

.featured-achievement-copy {
  padding: 14px clamp(4px, 2vw, 24px) 14px 0;
}

.achievement-eyebrow {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--primary-color);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.featured-achievement-copy h2 {
  margin-bottom: 16px;
  color: var(--dark-color);
  font-size: clamp(1.8rem, 3.5vw, 3rem);
  line-height: 1.12;
}

.featured-achievement-copy p {
  max-width: 520px;
  margin-bottom: 24px;
  color: var(--gray-color);
  font-size: 1.05rem;
  line-height: 1.8;
}

.featured-achievement-copy .btn i {
  margin-left: 8px;
}

@media screen and (max-width: 768px) {
  .featured-achievement {
    grid-template-columns: 1fr;
    gap: 24px;
    border-radius: 22px;
  }

  .featured-achievement-photo {
    width: 100%;
  }

  .featured-achievement-copy {
    padding: 0 8px 12px;
  }
}

/* Achievement archive refresh */
.page-header-section {
  position: relative;
  padding: clamp(58px, 8vw, 100px) 20px clamp(48px, 7vw, 82px);
  overflow: hidden;
  background: radial-gradient(ellipse at 50% -15%, rgba(45, 212, 191, .22), transparent 45%), linear-gradient(135deg, #0b1830, #113d68 58%, #126477);
  color: #fff;
}
.page-header-section .achievement-eyebrow { color: #62e3d1; font-size: .72rem; font-weight: 800; letter-spacing: .17em; }
.page-header-section h1 { margin: 10px 0 8px; color: #fff; font-size: clamp(2.8rem, 7vw, 5rem); font-weight: 800; letter-spacing: -.045em; }
.page-header-section p { max-width: 620px; margin: 0 auto; color: rgba(239,246,255,.75); font-size: clamp(.98rem, 2vw, 1.15rem); }
.journey-archive { position: relative; padding: 58px 0 32px; overflow: hidden; background: linear-gradient(180deg, rgba(226,244,249,.42), transparent 55%); }
.dark-theme .journey-archive { background: linear-gradient(180deg, rgba(23,45,66,.45), transparent 55%); }
.journey-intro { padding-top: 8px; padding-bottom: 12px; text-align: center; }
.journey-intro h2 { margin: 8px 0; color: var(--dark-color); font-size: clamp(1.9rem,4vw,3rem); letter-spacing: -.04em; }
.journey-intro > p { max-width: 650px; margin: 0 auto; color: var(--gray-color); }
.journey-shortcuts { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 22px; }
.journey-shortcuts a { display: inline-flex; align-items: center; gap: 9px; padding: 10px 16px; border: 1px solid rgba(14,147,141,.22); border-radius: 999px; background: var(--light-color); color: var(--dark-color); font-size: .86rem; font-weight: 700; transition: transform .2s ease, background .2s ease; }
.journey-shortcuts a:hover { transform: translateY(-2px); background: rgba(20,168,154,.09); }
.journey-archive .activity-archive { padding-top: 24px; }
.journey-archive .achievement-archive { padding-top: 40px; }
.achievement-hero-link { display: inline-flex; align-items: center; gap: 10px; margin-top: 24px; padding: 11px 17px; border: 1px solid rgba(255,255,255,.28); border-radius: 999px; color: #fff; font-size: .88rem; font-weight: 700; transition: background .2s ease, transform .2s ease; }
.achievement-hero-link:hover { transform: translateY(-2px); background: rgba(255,255,255,.12); }
.achievement-hero-stats { display: flex; justify-content: center; gap: clamp(28px,7vw,90px); margin: 38px auto 0; }
.achievement-hero-stats div { display: grid; gap: 2px; }
.achievement-hero-stats strong { color: #fff; font-size: clamp(1.5rem,3vw,2rem); line-height: 1; }
.achievement-hero-stats span { color: rgba(239,246,255,.68); font-size: .78rem; }
.achievement-archive { max-width: 1280px; }
.achievement-archive-heading { align-items: center; }
.achievement-archive-heading h2 { letter-spacing: -.035em; }
.achievement-total { min-width: 195px; padding: 18px 22px; border-radius: 20px; box-shadow: 0 14px 34px rgba(30,64,175,.08); }
.achievement-year-filters { margin: 0 0 16px; }
.achievement-year-filters button,.wins-place-filters button { min-height: 40px; padding: 8px 15px; font-weight: 650; }
.wins-visible-count { margin: 0 0 12px; color: var(--gray-color); font-size: .84rem; }
.wins-toolbar { display: grid; grid-template-columns: minmax(220px,1fr) auto; align-items: center; gap: 14px; margin-bottom: 24px; padding: 16px; border: 1px solid rgba(148,163,184,.2); border-radius: 20px; background: var(--light-color); box-shadow: 0 12px 32px rgba(15,23,42,.045); }
.wins-search { display: flex; min-width: 0; height: 46px; align-items: center; gap: 11px; padding: 0 14px; border: 1px solid var(--light-gray-color); border-radius: 13px; background: var(--light-color); color: var(--gray-color); }
.wins-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--dark-color); font: inherit; font-size: .9rem; }
.wins-search:focus-within { border-color: #14a89a; box-shadow: 0 0 0 3px rgba(20,168,154,.12); }
.wins-place-filters { display: flex; flex-wrap: wrap; gap: 7px; }
.wins-place-filters button { border: 1px solid var(--light-gray-color); border-radius: 999px; background: transparent; color: var(--dark-color); font: inherit; font-size: .8rem; cursor: pointer; transition: var(--transition); }
.wins-place-filters button:hover,.wins-place-filters button.active { border-color: #0e938d; background: #0e938d; color: #fff; }
.wins-export-button { display: inline-grid; grid-template-columns: 42px auto; grid-template-rows: auto auto; align-items: center; column-gap: 11px; min-height: 58px; padding: 8px 16px 8px 9px; border: 0; border-radius: 15px; background: linear-gradient(135deg,#0b817f,#1569a8); color: #fff; text-align: left; cursor: pointer; box-shadow: 0 8px 20px rgba(14,147,141,.2); transition: transform .2s ease, box-shadow .2s ease; }
.wins-export-button:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(14,147,141,.28); }
.wins-export-button > i { display: grid; grid-row: 1 / 3; width: 42px; height: 42px; place-items: center; border: 1px solid rgba(255,255,255,.2); border-radius: 12px; background: rgba(255,255,255,.12); }
.wins-export-button span { font-size: .84rem; font-weight: 750; }
.wins-export-button small { color: rgba(255,255,255,.7); font-size: .68rem; }
.all-wins-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; }
.win-card { min-height: 270px; padding: 22px; border-color: rgba(148,163,184,.2); border-radius: 22px; box-shadow: 0 12px 34px rgba(15,23,42,.055); }
.win-card::before { position: absolute; top: 0; right: 0; left: 0; height: 3px; background: linear-gradient(90deg,#18b9aa,#5685ee); content: ""; }
.win-card.place-1::before { background: linear-gradient(90deg,#f6bd4a,#f08c3b); }
.win-card.place-2::before { background: linear-gradient(90deg,#94a3b8,#64748b); }
.win-card.place-3::before { background: linear-gradient(90deg,#cf8b62,#9a4f25); }
.win-card h3 { font-size: 1.08rem; }
.win-organization { display: -webkit-box; margin: 0 0 12px; overflow: hidden; color: var(--gray-color); font-size: .76rem; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.win-proof-links { margin-top: auto; padding-top: 15px; }
.win-proof-link { gap: 9px; padding: 9px 12px; border: 1px solid rgba(37,99,235,.14); border-radius: 11px; background: rgba(37,99,235,.055); }
.win-proof-link:hover { border-color: rgba(14,147,141,.3); background: rgba(14,147,141,.1); color: #087b79; }
.win-proof-missing { color: var(--gray-color); font-size: .75rem; }
.wins-empty { display: grid; grid-column: 1/-1; justify-items: center; gap: 9px; padding: 55px 20px; border: 1px dashed var(--light-gray-color); border-radius: 20px; color: var(--gray-color); text-align: center; }
.wins-empty i { color: #0e938d; font-size: 1.5rem; }
.wins-empty strong { color: var(--dark-color); }
.dark-theme .wins-toolbar { border-color: rgba(148,163,184,.13); background: #111d31; }
.dark-theme .wins-search { background: #172338; }
.dark-theme .win-proof-link { border-color: rgba(147,197,253,.18); background: rgba(37,99,235,.12); }
.wins-print-heading { display: none; }

/* Persisted portfolio styles also carry through to the credentials archive. */
body[data-portfolio-style="terminal"] { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; --primary-color: #16834a; --secondary-color: #0f6539; --accent-color: #34d399; }
body[data-portfolio-style="terminal"] .win-card, body[data-portfolio-style="terminal"] .certificate-card { border-radius: 8px; }
body[data-portfolio-style="terminal"] .achievement-eyebrow::before { content: "> "; }
body[data-portfolio-style="cyber"] { --primary-color: #7c3aed; --secondary-color: #db2777; --accent-color: #22d3ee; }
body[data-portfolio-style="cyber"] .win-card, body[data-portfolio-style="cyber"] .certificate-card { border-color: color-mix(in srgb, var(--accent-color) 35%, transparent); box-shadow: 0 0 22px color-mix(in srgb, var(--accent-color) 10%, transparent); }
body[data-portfolio-style="professional"] { --primary-color: #123b63; --secondary-color: #0c2c4c; --accent-color: #b88948; }
body[data-portfolio-style="professional"] .win-card, body[data-portfolio-style="professional"] .certificate-card { border-radius: 8px; }
body.dark-theme[data-portfolio-style="professional"] { --primary-color: #7eb5e8; --secondary-color: #4f91cc; --accent-color: #d5ac70; }
body[data-portfolio-style="minimal"] { --primary-color: #475569; --secondary-color: #334155; --accent-color: #64748b; }
@media screen and (max-width: 980px) {
  .wins-toolbar { grid-template-columns: 1fr auto; }
  .wins-search { grid-column: 1/-1; }
  .all-wins-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media screen and (max-width: 680px) {
  .page-header-section { padding: 48px 18px 42px; }
  .journey-archive { padding-top: 42px; }
  .achievement-hero-stats { gap: 22px; margin-top: 30px; }
  .achievement-hero-stats span { max-width: 90px; font-size: .68rem; }
  .achievement-archive { padding-top: 38px; padding-bottom: 48px; }
  .achievement-total { width: auto; min-width: 0; }
  .wins-toolbar { grid-template-columns: 1fr; padding: 13px; border-radius: 16px; }
  .wins-search { grid-column: auto; }
  .wins-place-filters { gap: 7px; }
  .wins-place-filters button { flex: 1 1 auto; }
  .wins-export-button { width: 100%; }
  .all-wins-grid { grid-template-columns: 1fr; gap: 13px; }
  .win-card { min-height: 0; padding: 19px; }
}

@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff !important; color: #172033 !important; font-family: Arial, sans-serif !important; }
  header,.page-header-section,.featured-achievement,.wayfinder-dialog,.wins-toolbar,.achievement-year-filters,.wins-visible-count,.pwa-install-prompt,.toast,.back-to-top,footer { display: none !important; }
  main { display: block; width: 100%; }
  .achievement-archive.container { width: 100%; max-width: none; margin: 0; padding: 0; }
  .achievement-archive-heading { align-items: center; margin-bottom: 18px; }
  .achievement-archive-heading h2 { margin: 0 0 5px; color: #10243d !important; font-size: 25pt; }
  .achievement-archive-heading p { color: #526176 !important; font-size: 9pt; }
  .achievement-total { min-width: 125px; padding: 12px; border-color: #d7e2ed; background: #f4f8fc !important; box-shadow: none; }
  .achievement-total strong { font-size: 23pt; }
  .wins-print-heading { display: block; margin: 0 0 22px; padding-bottom: 14px; border-bottom: 2px solid #0e938d; }
  .wins-print-heading span { color: #0e817f; font-size: 8pt; font-weight: 700; letter-spacing: 1.6pt; }
  .wins-print-heading h2 { margin: 5px 0 2px; color: #10243d; font-size: 20pt; }
  .wins-print-heading p { margin: 0; color: #526176; font-size: 9pt; }
  .all-wins-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .win-card { min-height: 0; padding: 14px; border: 1px solid #dce4ec; border-radius: 10px; background: #fff !important; box-shadow: none; break-inside: avoid; page-break-inside: avoid; }
  .win-card:hover { transform: none; }
  .win-card h3 { color: #172033 !important; font-size: 10pt; }
  .win-year,.win-category,.win-organization { color: #526176 !important; }
  .win-highlight { color: #087f81 !important; }
  .win-place { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .win-proof-link { padding: 0; border: 0; background: transparent !important; color: #155e9a !important; text-decoration: underline; }
  .win-proof-missing { color: #64748b !important; }
}

/* Keep legacy achievement preview dialogs centered on every viewport. */
.modal { padding: 24px; }
.modal-content { margin: 0 auto; max-height: calc(100dvh - 48px); overflow-y: auto; }
@media (max-width: 560px) {
  .modal { padding: 12px; }
  .modal-content { width: 100%; max-height: calc(100dvh - 24px); margin: 0 auto; }
}

/* Unified, stable site header: same height and scroll behavior on every page. */
:root { --portfolio-header-height: 76px; }
header { position: sticky !important; top: 0; z-index: 1100; width: 100%; min-height: var(--portfolio-header-height); }
header .container { width: min(1440px, 100%); min-height: var(--portfolio-header-height); padding: 8px clamp(12px, 2vw, 28px); }
header nav { min-width: 0; gap: 6px; }
header .nav-links { align-items: center; gap: 0; }
header .nav-links li { margin-left: clamp(8px, .9vw, 16px); }
header .nav-links a { white-space: nowrap; font-size: clamp(.76rem, .82vw, .92rem); }
header .burger { border: 0; padding: 8px; background: transparent; }
header .burger div { border-radius: 2px; }
section[id] { scroll-margin-top: calc(var(--portfolio-header-height) + 12px); }
@media (max-width: 1200px) {
  header .container { min-height: var(--portfolio-header-height); padding: 8px 18px; }
  header .nav-links { position: fixed; top: var(--portfolio-header-height); right: 0; width: min(380px, 88vw); height: calc(100vh - var(--portfolio-header-height)); height: calc(100dvh - var(--portfolio-header-height)); overflow-y: auto; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 6px; padding: 16px; background: var(--light-color); box-shadow: -5px 8px 22px rgba(15,23,42,.16); transform: translateX(105%); transition: transform .22s ease; z-index: 1099; }
  header .nav-links li { margin: 0; }
  header .nav-links a { display: flex; min-height: 44px; align-items: center; padding: 8px 12px; white-space: normal; font-size: .95rem; }
  header .nav-links.active { transform: translateX(0); }
  header .burger { display: block; cursor: pointer; }
}
@media (max-width: 560px) { header .container { padding: 8px 12px; } header .logo h1 { font-size: 1.55rem; } }
@media (max-width: 768px) { .scroll-down { display: none; } }

/* Activity archive */
.activity-archive { padding-top: 24px; padding-bottom: 72px; }
.activity-archive-heading { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; margin-bottom:26px; }
.activity-archive-heading h2 { margin:8px 0; }
.activity-archive-heading p { max-width:680px; margin:0; opacity:.78; }
.activity-counts { display:flex; flex-wrap:wrap; gap:10px; }
.activity-counts span { padding:10px 14px; border:1px solid rgba(100,116,139,.22); border-radius:14px; background:rgba(255,255,255,.62); font-size:.9rem; }
.activity-toolbar { display:flex; align-items:center; gap:12px; margin:22px 0; flex-wrap:wrap; }
.activity-toolbar input { flex:1 1 260px; min-height:46px; padding:10px 15px; border:1px solid rgba(100,116,139,.3); border-radius:12px; background:var(--light-color,#fff); color:inherit; font:inherit; }
.activity-filters { display:flex; flex-wrap:wrap; gap:8px; }
.activity-filters button { border:1px solid rgba(100,116,139,.28); border-radius:999px; padding:9px 14px; background:transparent; color:inherit; cursor:pointer; font:inherit; }
.activity-filters button.active { background:#2563eb; border-color:#2563eb; color:white; }
.activity-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; }
.activity-card { min-width:0; padding:21px; border:1px solid rgba(100,116,139,.2); border-radius:18px; background:var(--light-color,#fff); box-shadow:0 10px 30px rgba(15,23,42,.045); }
.activity-card-top { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:14px; }
.activity-kind { color:#2563eb; font-size:.75rem; font-weight:700; letter-spacing:.06em; text-transform:uppercase; }
.activity-date { color:#64748b; font-size:.82rem; white-space:nowrap; }
.activity-card h3 { margin:0 0 12px; font-size:1.08rem; line-height:1.4; }
.activity-results { display:flex; flex-wrap:wrap; gap:7px; margin-bottom:5px; }
.activity-result { display:inline-flex; margin-bottom:12px; padding:6px 10px; border-radius:999px; background:rgba(37,99,235,.1); color:#1d4ed8; font-size:.84rem; font-weight:600; }
.activity-repeat-note { margin:0 0 12px; color:var(--text-secondary,#64748b); font-size:.82rem; }
.activity-meta { margin:5px 0 0; color:#64748b; font-size:.86rem; line-height:1.5; }
.dark-theme .activity-card, .dark-theme .activity-counts span { background:#111827; border-color:rgba(148,163,184,.22); }
.dark-theme .activity-toolbar input { background:#111827; border-color:rgba(148,163,184,.3); }
.dark-theme .activity-meta, .dark-theme .activity-date { color:#a8b4c5; }
@media(max-width:1000px) { .activity-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:620px) { .activity-archive-heading { align-items:flex-start; flex-direction:column; } .activity-grid { grid-template-columns:1fr; } }
