body, html {
  height: 100%;
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  padding-top: 0 !important; /* Remove global body padding for view pages */
}

* {
  box-sizing: border-box;
}

/* --- Background and Text Effects --- */
.bg-image {
  height: 50%;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

.bottomright {
  position:fixed; right:16px; bottom:16px; z-index:10000; background:rgba(24,58,90,0.92); color:#fff; padding:0.5em 1em; border-radius:0.5em; font-size:0.95em; box-shadow:0 2px 8px rgba(0,0,0,0.08);
}

.bg-text {
  background-color: rgba(0,0,0, 0.0);
  color: rgba(255,255,255, 0.0);
  font-weight: bold;
  font-size: 60px;
  border: 10px solid rgba(255,255,255, 0.0);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  width: 300px;
  padding: 20px;
  text-align: center;
  animation: myfade 3s 2 alternate;
}

@keyframes myfade {
  0% {background-color: rgba(0,0,0, 0.0); color: rgba(255,255,255, 0.0); border: 10px solid rgba(255,255,255, 0.0); font-size: 30px;}
  50% {background-color: rgba(0,0,0, 0.4); color: rgba(255,255,255, 1); border: 10px solid rgba(255,255,255, 1); font-size: 60px;}
  100% {background-color: rgba(0,0,0, 0.0); color: rgba(255,255,255, 0.0); border: 10px solid rgba(255,255,255, 0.0); font-size: 30px;}
}

/* --- Nautical Flags and Letters --- */
.nautical-flag, .letter-image {
  position: fixed;
  z-index: 2;
  width: 10%;
  padding: 2%;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
}
.letter-image {
  z-index: 3;
  background-color: rgba(255,255,255, 0.4);
}
.flag1 { content: url("/images/nautical-a.png"); top: 0%; left: 0%; animation: myflya 3s 1 normal; }
.flag2 { content: url("/images/nautical-p.png"); top: 0%; left: 10%; animation: myflyb 4s 1 normal; }
.flag3 { content: url("/images/nautical-c.png"); top: 0%; left: 20%; animation: myflyc 5s 1 normal; }
.letter1 { content: url("/images/letter-a.png"); top: 0%; left: 0%; opacity: 0.0; animation: myfadea 12s infinite; animation-delay: 6s; }
.letter2 { content: url("/images/letter-p.png"); top: 0%; left: 10%; opacity: 0.0; animation: myfadeb 12s infinite; animation-delay: 6s; }
.letter3 { content: url("/images/letter-c.png"); top: 0%; left: 20%; opacity: 0.0; animation: myfadec 12s infinite; animation-delay: 6s; }

@keyframes myflya {
  from {top: 25%; left: 50%; width: 30%; opacity: 0.0}
  to {top: 0%; left: 0%; width: 10%;}
}
@keyframes myflyb {
  from {top: 50%; left: 50%; width: 30%; opacity: 0.0}
  to {top: 0%; left: 10%; width: 10%;}
}
@keyframes myflyc {
  from {top: 75%; left: 50%; width: 30%; opacity: 0.0}
  to {top: 0%; left: 20%; width: 10%;}
}
@keyframes myfadea {
  0% {opacity: 0.0}
  50% {opacity: 1.0}
  100% {opacity: 0.0}
}
@keyframes myfadeb {
  0% {opacity: 0.0}
  50% {opacity: 1.0}
  100% {opacity: 0.0}
}
@keyframes myfadec {
  0% {opacity: 0.0}
  50% {opacity: 1.0}
  100% {opacity: 0.0}
}

/* --- Dropdown Menu --- */
.dropdown {
  position: fixed;
  top: 0;
  right: 0;
  display: inline-block;
  z-index: 4;
}
.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  background-color: rgba(255,255,255, 0.4);
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
  z-index: 4;
}
.dropdown-content a {
  text-decoration: none;
}
.dropdown-content a:hover {
  text-decoration: underline;
  text-decoration-color: rgba(0,0,0, 1);
}
.dropdown:hover .dropdown-content {
  display: block;
}

/* --- General Layout --- */
.desc {
  padding: 15px;
  text-align: center;
  font-weight: bold;
  font-size: 20px;
  color: rgba(0,0,0, 1);
}
.heading {
  display: block;
  font-size: 2em;
  margin-block-start: 3em;
  margin-block-end: 3em;
  font-weight: bold;
  text-align: center;
}
.media-table, .thumbtable {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}
.thumbtitle {
  font-style: italic;
}

/* --- About Page Grid Styles --- */
.aboutwrapper {
  display: grid;
  grid-template-columns: 1fr 2fr;
  grid-gap: 1rem;
  padding: 2rem;
}
.aboutvideocell {
  grid-column: 1;
  background-color: darkblue;
  box-shadow: 0.5rem 0.25rem 1rem black;
  display: flex;
  align-items: center;
  justify-content: center;
  border: .25rem solid black;
}
.vidplayer1 {
  width: 20rem;
}
.infowrapper {
  display: grid;
  background-color: gray;
  grid-template-columns: 1fr 3fr;
  grid-gap: 1rem;
}
.infocell {
  background-color: darkblue;
  color: whitesmoke;
  box-shadow: 0.5rem 0.25rem 1rem black;
  padding: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  border: .25rem solid black;
  font-size: 2rem;
}
.infoheadercell {
  grid-column: 1 / 4;
  grid-row: 1;
  font-size: 3rem;
}
.infocategory {
  grid-column: 1;
}
.infoinfo {
  grid-column: 2 / 4;
}

/* --- Error Page Styles --- */
.error-page {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  height: 100vh;
  background: linear-gradient(135deg, #f9f9f9, #9caec2);
  padding: 20px;
}
.error-container {
  max-width: 600px;
  background: #fff;
  border: 1px solid #b0b8c9;
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 4px 16px rgba(15, 8, 64, 0.10);
  text-align: center;
  margin: 0 auto;
  transition: transform 0.3s, box-shadow 0.3s;
}
.error-container:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(15, 8, 64, 0.18);
}
.error-logo {
  max-width: 120px;
  margin-bottom: 20px;
}
.error-container h2 {
  font-size: 28px;
  margin-bottom: 15px;
  color: #0f0840;
}
.error-container p {
  font-size: 16px;
  color: #555;
  margin-bottom: 20px;
  line-height: 1.6;
}
.btn {
  display: inline-block;
  background-color: #0f0840;
  color: whitesmoke;
  padding: 8px 18px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: bold;
  transition: background-color 0.3s ease, transform 0.3s ease;
  border: none;
  font-size: 1rem;
  box-shadow: 0 2px 8px rgba(15, 8, 64, 0.10);
}
.btn:hover {
  background-color: #2a3a6c;
  transform: scale(1.05);
}

/* --- APC Navbar/Header Styles --- */
.apc-header, .apc-navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2em;
  height: 64px;
  background: #183a5a;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.apc-header-left {
  display: flex;
  align-items: center;
  gap: 0.5em;
  flex: 0 0 auto;
  height: 64px;
}
.apc-flag {
  height: 40px;
  width: auto;
  margin-right: 0.2em;
  opacity: 0;
  animation: flag-flyin 0.8s forwards;
}
.flag-a { animation-delay: 0.1s; }
.flag-p { animation-delay: 0.3s; }
.flag-c { animation-delay: 0.5s; }
@keyframes flag-flyin {
  0% { transform: translateY(-40px) scale(0.7); opacity: 0; }
  80% { transform: translateY(4px) scale(1.05); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
.apc-letters {
  display: flex;
  align-items: center;
  margin-left: 0.5em;
  font-size: 2rem;
  font-weight: bold;
  letter-spacing: 0.1em;
  color: #fff;
}
.apc-letter {
  opacity: 0;
  animation: letter-flyin 0.8s forwards, letter-fade 3s 1.2s infinite alternate;
  margin-right: 0.1em;
}
.letter-a { animation-delay: 0.7s, 1.2s; }
.letter-p { animation-delay: 0.9s, 1.4s; }
.letter-c { animation-delay: 1.1s, 1.6s; }
@keyframes letter-flyin {
  0% { transform: translateY(-30px) scale(0.7); opacity: 0; }
  80% { transform: translateY(4px) scale(1.05); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes letter-fade {
  0% { opacity: 1; }
  50% { opacity: 0.3; }
  100% { opacity: 1; }
}
.apc-nav {
  display: flex;
  align-items: center;
  gap: 2em;
  margin-left: auto;
  margin-right: 0;
  flex: 0 0 auto;
  height: 64px;
  justify-content: flex-end;
}
.apc-nav-link {
  color: #fff;
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 500;
  padding: 0.3em 0.7em;
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}
.apc-nav-link:hover {
  background: rgba(255,255,255,0.12);
  color: #aee0ff;
}
.apc-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 1100;
  margin-left: auto;
  align-self: flex-start;
  top: 0;
  padding: 0;
}
.apc-hamburger span {
  width: 22px;
  height: 3px;
  margin: 3px 0;
  background: #fff;
  border-radius: 2px;
  transition: 0.3s;
}
.apc-mobile-nav {
  display: none;
  position: fixed;
  top: 64px;
  right: 0;
  left: auto;
  width: auto;
  min-width: 140px;
  max-width: 90vw;
  background: #183a5a;
  box-shadow: 0 2px 12px rgba(0,0,0,0.18);
  flex-direction: column;
  align-items: flex-end;
  padding: 1em 0.5em 1em 1em;
  z-index: 1050;
  border-radius: 0 0 0.5em 0.5em;
  margin-right: 0;
}
.apc-mobile-nav.open {
  display: flex;
}
.apc-mobile-nav .apc-nav-link {
  font-size: 1.2rem;
  margin: 0.5em 0;
  color: #fff;
  width: 100%;
  text-align: right;
}

.index-thumb {
  width: 300px;
  height: 200px;
  object-fit: cover;
  border-radius: 0.5em;
  box-shadow: 0 2px 8px #0002;
}


/* --- Gallery/Grid Styles --- */
.img-thumb, .photo-thumb, .video-thumb {
  width: 220px;
  height: 160px;
  object-fit: cover;
  border-radius: 0.5em;
  box-shadow: 0 2px 8px #0002;
  background: #eee;
  display: block;
}
.video-thumb {
  background: #222;
}
.photo-grid, .video-grid, .gallery-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1em;
  justify-content: center;
}
.photo-grid {
  padding-top: 70px;
}

.photo-item, .video-item {
  background: #fff;
  border-radius: 0.7em;
  box-shadow: 0 2px 8px #0001;
  padding: 0.5em;
  margin: 0.5em 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: box-shadow 0.2s;
}
.photo-item:hover, .video-item:hover {
  box-shadow: 0 4px 16px #0003;
}

/* --- Gallery Item Info/Meta Styles --- */
.photo-info, .video-info {
  width: 100%;
  background: rgba(24,58,90,0.08);
  border-radius: 0.5em;
  margin-top: 0.5em;
  padding: 0.6em 0.8em 0.7em 0.8em;
  box-sizing: border-box;
  text-align: left;
  font-size: 0.98em;
  min-height: 2.5em;
  box-shadow: 0 1px 4px #0001;
}
.photo-date, .video-date {
  display: block;
  color: #335599;
  font-size: 0.97em;
  font-weight: 500;
  margin-bottom: 0.2em;
  margin-top: 0.2em;
  letter-spacing: 0.01em;
}
.photo-description, .video-description {
  color: #ddd;
  font-size: 0.97em;
  margin-top: 0.1em;
  word-break: break-word;
  line-height: 1.4;
}

/* --- Center gallery headers and stats --- */
.gallery-header, .gallery-stats, .gallery-actions, .gallery-filters, .gallery-search {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  display: block;
  width: 100%;
  max-width: 900px;
}

/* --- Viewer Page Styles --- */
.viewer-container {
  position: relative;
  width: 100vw;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  box-sizing: border-box;
  padding: 0;
}
.viewer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 98vw;
}
.photo-display, .video-display {
  max-width: 90vw;
  max-height: 80vh;
  margin-bottom: 8px;
  border-radius: 0.5em;
  box-shadow: 0 2px 12px #0008;
}
.photo-info, .video-info {
  margin: 0;
  padding: 0.7em 1em 0.7em 1em;
  background: rgba(24,58,90,0.92);
  color: #fff;
  border-radius: 0.7em;
  box-shadow: 0 2px 8px #0002;
  width: 100%;
  max-width: 420px;
  text-align: left;
  font-size: 1em;
}

.nav-button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  padding: 1em;
  cursor: pointer;
  border-radius: 0.5em;
  font-size: 1.2em;
  transition: background 0.2s;
}
.nav-button:hover {
  background: rgba(0,0,0,0.9);
}
.nav-button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.nav-prev { left: 1em; }
.nav-next { right: 1em; }
.nav-close {
  position: absolute;
  top: 1em;
  right: 1em;
  background: rgba(0,0,0,0.7);
  color: #fff;
  border: none;
  padding: 0.5em 1em;
  cursor: pointer;
  border-radius: 0.3em;
  font-size: 1em;
  margin-top: 0.5em;
  margin-right: 0.5em;
}
.nav-close:hover {
  background: rgba(0,0,0,0.9);
}
.keyboard-hint {
  position: absolute;
  top: 1em;
  left: 1em;
  background: rgba(0,0,0,0.7);
  color: #ccc;
  padding: 0.5em 1em;
  border-radius: 0.3em;
  font-size: 0.8em;
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

/* --- Pagination --- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.5em;
  margin: 2em 0 1em 0;
  font-size: 1.08em;
}
.pagination a {
  color: #335599;
  background: #f5f8ff;
  padding: 0.35em 1em;
  border-radius: 0.4em;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  border: 1px solid #cce0ff;
}
.pagination a:hover {
  background: #335599;
  color: #fff;
}
.pagination .current {
  background: #335599;
  color: #fff;
  padding: 0.35em 1em;
  border-radius: 0.4em;
  font-weight: bold;
  border: 1px solid #335599;
}

.back-link {
  display: flex;
  justify-content: center;
  margin: 2em 0 1em 0;
}
.back-link a {
  display: inline-block;
  background: #335599;
  color: #fff;
  padding: 0.6em 1.5em;
  border-radius: 0.5em;
  text-decoration: none;
  font-weight: 500;
  font-size: 1.08em;
  box-shadow: 0 2px 8px #0001;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.back-link a:hover {
  background: #183a5a;
  color: #aee0ff;
  transform: translateY(-2px) scale(1.04);
}

/* --- Responsive Styles --- */
@media (max-width: 900px) {
  .apc-header, .apc-navbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .apc-header-left {
    flex: 0 0 auto;
    justify-content: flex-start;
    align-items: center;
    margin-bottom: 0;
    text-align: left;
    height: 48px;
  }
  .apc-nav {
    display: none;
  }
  .apc-hamburger {
    display: flex;
    position: absolute;
    right: 1em;
    top: 16px;
    margin-left: 0;
    align-self: flex-start;
  }
}
@media (max-width: 800px) {
  .aboutwrapper {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    padding: 1.2rem 0.5rem 0.5rem 0.5rem;
    grid-gap: 0;
  }
  .aboutvideocell {
    width: 100%;
    margin-bottom: 1.2rem;
    border-radius: 0.5em;
    box-shadow: 0 2px 12px #0008;
    padding: 0.5rem;
  }
  .vidplayer1 {
    width: 100%;
    max-width: 100vw;
    height: auto;
  }
  .infowrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    background: gray;
    border-radius: 0.5em;
    box-shadow: 0 2px 12px #0008;
    padding: 0.5rem;
    gap: 0.5rem;
  }
  .infocell {
    font-size: 1.1rem;
    padding: 0.7em 0.5em;
    border-radius: 0.3em;
    margin: 0.1em 0;
  }
  .infoheadercell {
    font-size: 1.5rem;
    margin-bottom: 0.5em;
  }
}
@media (max-width: 768px) {
  .viewer-container {
    padding-top: 0;
    margin-top: 0;
  }
  .nav-button { padding: 0.7em; font-size: 1em; }
  .photo-info, .video-info { font-size: 0.8em; }
}

@media (min-width: 769px) {
  .photo-display, .video-display {
    padding-top: 70px;
  }
  .aboutwrapper {
    padding-top: 70px;
  }
}
@media (max-width: 600px) {
  .apc-header, .apc-navbar {
    flex-direction: row;
    height: auto;
    padding: 0.5em 0.5em;
  }
  .apc-header-left {
    margin-bottom: 0;
    text-align: left;
    flex: 0 0 auto;
    justify-content: flex-start;
    align-items: center;
    height: 48px;
  }
  .apc-nav {
    gap: 1em;
  }
  .apc-flag {
    height: 28px;
  }
  .apc-letters {
    font-size: 1.2rem;
  }
  .viewer-container {
    padding-top: 58px;
    padding-bottom: 16px;
  }
  .viewer-content {
    gap: 5px;
  }
  .photo-display, .video-display {
    max-width: 98vw;
    max-height: 60vh;
    margin-bottom: 5px;
  }
  .photo-info, .video-info {
    padding: 0.5em 0.5em 0.5em 0.5em;
    font-size: 0.97em;
    max-width: 98vw;
  }
  .dropdown-content, .apc-mobile-nav {
    max-width: 100vw;
    min-width: unset;
    overflow-x: auto;
    right: 0;
    left: auto;
  }
  body, html {
    height: auto !important;
    overflow-y: auto !important;
    overflow-x: hidden;
  }
  .aboutwrapper {
    padding: 0.5rem 0.2rem 0.2rem 0.2rem;
  }
  .infocell {
    font-size: 1rem;
    padding: 0.5em 0.2em;
  }
  .infoheadercell {
    font-size: 1.1rem;
  }
}