/* Base Styles & Reset */
* {
  box-sizing: border-box;
  margin: 0; /* Ensure there's no default margin */
}

html {
  font-family: Cambria, Cochin, Georgia, Times, "Times New Roman", serif;
  font-size: 16px;
  background: #C0C0C0;
  color: #333;
}

body {
  margin: 0; /* Prevent body margin causing alignment issues */
}

a {
  color: #004d7a;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Layout Wrapper */
.wrapper {
  width: 100%; /* Ensure the wrapper spans full width */
  max-width: 1800px; /* Max width of the content */
  margin: 0 auto; /* Center the wrapper */
  padding: 0.1rem;
}

/* Header */
header {
  background: url('../images/modern_munro.gif') repeat; /* Background image */
  color: #ffffff;
  text-shadow: 1px 1px 2px #000000;
  padding: 1rem 1rem;
  border-radius: 8px;
  text-align: center;
  width: 100%; /* Ensure the header spans the full width */
  position: relative; /* To position image absolutely */
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

header h2 {
  font-size: 1.5rem;
  margin-top: 0;
}

/* Image positioning inside the header */
header img {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 5em;
  height: auto;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  header img {
    width: 4em;
    top: 0.5rem;
    right: 0.5rem;
  }

  header h1 {
    font-size: 2rem;
  }

  header h2 {
    font-size: 1.25rem;
  }

  .main {
    flex-direction: column;
  }

  nav ul {
    flex-direction: column;
    align-items: center;
  }

  nav li {
    margin: 0.3rem 0;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 1.5rem;
  }

  .content, .sidebar {
    padding: 1rem;
  }

  footer {
    font-size: 0.8rem;
  }
}

/* Navigation */
nav {
  background: url('../images/munro-ancient-tartan.gif') repeat;
  background-size: auto;
  border-radius: 6px;
  margin: 0.2rem 0;
}

nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  padding: 0.2rem;
  list-style: none;
}

nav li {
 margin: 0 0.5em;
}

nav a {
  color: #ffffff;
  font-weight: bold;
  padding: 0.5rem;
  border-radius: 4px;
}

nav a:hover {
  background-color: #003653;
}

/* Main Content Layout */
.main {
  display: flex;
  gap: 1rem;
  margin-top: 0.4rem;
}

.content, .sidebar, footer {
  background: url('../images/paper2.gif') repeat;
  padding: 1.5rem;
  border-radius: 8px;
}

.content {
  flex: 3;
  box-shadow: 0 0 5px rgba(0,0,0,0.08);
}

.sidebar {
  flex: 0.4;
}

footer {
  text-align: center;
  margin-top: 0.4rem;
  padding: 0.4rem;
  font-size: 0.9rem;
}

/* Image Layout */
.responsive-img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem auto;
}

.img-caption {
  text-align: center;
  font-size: 0.9rem;
  max-width: 900px;
  margin: 0 auto;
}

/* Responsive side-by-side image layout */
.image-row {
  display: flex;
  justify-content: center; 
  gap: 0;
  flex-wrap: wrap;
  margin: 0 auto;
  padding: 5px
}

.image-row img {
  height: 250px;
  width: auto;
  object-fit: cover;
}


.image-row figure {
    margin-right: 20px; /* Adjust this value to your desired space between images */
}

.image-row figure:last-child {
    margin-right: 0; /* Prevents margin on the last figure */
}
 /* Adds space between the figures */
 /* =========================================================
   Names Index
   ========================================================= */

.names-index {
    position: relative;
}


/* Search */

.names-search {
    position: sticky;
    top: 0;
    z-index: 1000;

    padding: 10px;
    margin-bottom: 10px;

    background: inherit;
}

.names-search label {
    font-weight: bold;
    margin-right: 8px;
}

.names-search input {
    width: min(400px, 70%);
    padding: 7px 10px;
    font-size: 1rem;
}


/* Alphabet navigation */

.alphabet-nav {
    position: sticky;
    top: 55px;
    z-index: 999;

    display: flex;
    flex-wrap: wrap;
    gap: 5px;

    padding: 8px;

    background: inherit;
}

.alphabet-nav a {
    display: inline-block;

    min-width: 28px;
    padding: 4px 8px;

    text-align: center;

    text-decoration: none;

    color: white;

    background-image: url("../images/munro-ancient-tartan.gif");
    background-repeat: repeat;

    border: 1px solid #333;
    border-radius: 4px;

    text-shadow:
        1px 1px 2px #000;
}

.alphabet-nav a:hover {
    color: white;
    text-decoration: underline;
}


/* Search count */

.names-search-count {
    margin: 10px 0;
    font-style: italic;
}


/* Table */

.names-table-container {
    width: 100%;
    overflow-x: auto;
}

.names-table {
    width: 100%;
    border-collapse: collapse;
}

.names-table th,
.names-table td {
    padding: 7px 9px;

    text-align: left;
    vertical-align: top;

    border-bottom: 1px solid #ccc;
}

.names-table th {
    font-weight: bold;
}

.names-table th:nth-child(1) {
    width: 18%;
}

.names-table th:nth-child(2) {
    width: 18%;
}

.names-table th:nth-child(3) {
    width: 32%;
}

.names-table th:nth-child(4) {
    width: 32%;
}


/* Back to top */

.back-to-top {
    position: fixed;

    right: 40px;
    bottom: 40px;

    z-index: 2000;

    padding: 8px 12px;

    text-decoration: none;

    color: white;

    background-image: url("../images/munro-ancient-tartan.gif");
    background-repeat: repeat;

    border: 1px solid #333;
    border-radius: 5px;

    text-shadow:
        1px 1px 2px #000;
}

.back-to-top:hover {
    color: white;
    text-decoration: underline;
}


/* Mobile */

@media (max-width: 700px) {

    .names-table th:nth-child(1),
    .names-table td:nth-child(1) {
        min-width: 130px;
    }

    .names-table th:nth-child(2),
    .names-table td:nth-child(2) {
        min-width: 130px;
    }

    .names-table th:nth-child(3),
    .names-table td:nth-child(3),
    .names-table th:nth-child(4),
    .names-table td:nth-child(4) {
        min-width: 220px;
    }

    .names-search input {
        width: 90%;
        margin-top: 6px;
    }

}
/* =========================================================
   Surname Index
   ========================================================= */

.surname-index {
    width: 100%;
}

.surname-count {
    margin-bottom: 1em;
    font-size: 0.9em;
}


/*
   Responsive surname grid.

   The browser creates as many columns as will
   comfortably fit the available screen width.
*/
.surname-grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fit,
            minmax(140px, 1fr)
        );

    gap: 6px 18px;

    width: 100%;
}


/*
   Individual surname links.
*/
.surname-link {
    display: block;

    padding: 4px 7px;

    text-decoration: none;

    border-radius: 3px;

    line-height: 1.25;
}


/*
   Hover effect.
*/
.surname-link:hover {
    text-decoration: underline;
}


/*
   Smaller screens.

   Allow the grid items to become narrower.
*/
@media (max-width: 700px) {

    .surname-grid {

        grid-template-columns:
            repeat(
                auto-fit,
                minmax(110px, 1fr)
            );

        gap: 4px 10px;
    }

    .surname-link {
        padding: 3px 5px;
    }
}