
:root {
  --navy: #172d46;
  --blue: #315879;
  --pale: #f0f2f4;
  --background: #f8f9fa;
  --text: #293b4d;
  --muted: #657487;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
  line-height: 1.6;
}

/* =================================
   HEADER
================================= */

.site-header {
  background: var(--navy);
  color: white;
  padding: 25px 4%;
}

.site-header h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0.3px;
}

.site-header p {
  margin: 3px 0 0;
  color: #c6d5e3;
  font-size: 13px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* =================================
   MAIN PAGE LAYOUT
================================= */

.page-layout {
  display: grid;
  grid-template-columns: 210px minmax(300px, 1fr) 250px;
  gap: 28px;
  max-width: 1440px;
  margin: 32px auto;
  padding: 0 28px;
  align-items: start;
}

/* =================================
   LEFT SIDEBAR
================================= */

.sidebar {
  min-width: 0;
  background: var(--pale);
  padding: 20px;
  border-radius: 10px;
}

.sidebar h3,
.family-panel h3 {
  margin: 0 0 15px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

/* =================================
   HIERARCHICAL NAVIGATION
================================= */

.main-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}

.nav-item {
  width: 100%;
  min-width: 0;
}

/* Ordinary links */

.nav-link {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 7px 8px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--blue);
  text-align: left;
  text-decoration: none;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
}

.nav-link:hover {
  background: #e5ebf1;
  color: var(--navy);
}

/* Parent item: link and arrow on same line */

.nav-parent-row {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}

.nav-parent-row > .nav-link {
  flex: 1;
  min-width: 0;
}

/* Expand/collapse button */

.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 30px;
  width: 30px;
  padding: 5px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #8293a5;
  cursor: pointer;
}

.nav-toggle:hover {
  background: #e5ebf1;
  color: var(--navy);
}

/* Chevron */

.chevron {
  display: inline-block;
  font-size: 19px;
  line-height: 1;
  transition: transform 0.2s ease;
}

.nav-toggle[aria-expanded="true"] .chevron {
  transform: rotate(90deg);
}

/* Current page and active parent */

.nav-link.current-link {
  background: #dce6f0;
  color: var(--navy);
  font-weight: 650;
}

/* Highlight parent when a child page is active */

.nav-item:has(> .submenu:not([hidden])) > .nav-parent-row > .nav-link {
  color: var(--navy);
}

/* Submenus */

.submenu {
  margin: 2px 0 6px 12px;
  padding-left: 10px;
  border-left: 1px solid #d1dce6;
}

.submenu[hidden] {
  display: none;
}

/* Nested menu entries */

.submenu .nav-link {
  padding: 6px 8px;
  font-size: 13px;
}

.submenu .nav-toggle {
  flex-basis: 26px;
  width: 26px;
}

/* Further levels of nesting */

.submenu .submenu {
  margin-left: 8px;
  padding-left: 9px;
}

/* Keyboard accessibility */

.nav-link:focus-visible,
.nav-toggle:focus-visible {
  outline: 2px solid #4b8ac5;
  outline-offset: 2px;
}

/* =================================
   PEOPLE NAVIGATION
================================= */

.people-nav {
  margin-top: 30px;
}

.people-nav h3 {
  margin-bottom: 10px;
}

/* PEOPLE and OUR FAMILY headings */

.section-heading {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0 0 15px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 1.2px;
  text-align: left;
  cursor: pointer;
}

.section-heading:hover {
  color: var(--blue);
}

.section-heading:focus-visible {
  outline: 2px solid #4b8ac5;
  outline-offset: 3px;
}

/* Individual people */

.person-button {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--blue);
  text-align: left;
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}

.person-button:hover {
  background: #e0e7ee;
}

.person-button.active {
  background: #dce6f0;
  color: var(--navy);
  font-weight: 650;
}

.person-button:focus-visible {
  outline: 2px solid #4b8ac5;
  outline-offset: 2px;
}

/* =================================
   CENTRE CONTENT
================================= */

.main-content {
  min-width: 0;
}

.main-content h2 {
  margin: 0 0 18px;
  font-size: 26px;
  color: var(--navy);
}

/* Main feature photograph */

.feature-frame {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #e1e6eb;
  border-radius: 12px;
}

.feature-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Individual and family descriptions */

.person-description {
  margin-top: 18px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
}

.person-description h2,
.person-description h3 {
  color: var(--navy);
  margin-top: 22px;
}

.person-description p {
  margin: 0 0 14px;
}

.person-description ul,
.person-description ol {
  padding-left: 24px;
  margin-bottom: 16px;
}

.person-description a {
  color: var(--blue);
  text-decoration: underline;
}

.person-description a:hover {
  color: var(--navy);
}

.intro-text {
  margin-top: 20px;
}

.intro-text p {
  color: var(--muted);
  font-size: 15px;
}

/* =================================
   RIGHT FAMILY PANEL
================================= */

.family-panel {
  min-width: 0;
  background: var(--pale);
  border-radius: 10px;
  padding: 18px;
}

.family-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* Clickable family photographs */

.family-photo {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition:
    border-color 0.2s ease,
    transform 0.2s ease,
    background 0.2s ease;
}

.family-photo:hover {
  border-color: #8da8c1;
  transform: translateY(-2px);
}

.family-photo.selected {
  border-color: var(--blue);
  background: #e0e7ee;
}

.family-photo:focus-visible {
  outline: 3px solid #4b8ac5;
  outline-offset: 3px;
}

/* Family portrait images */

.family-photo img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 5px;
  background: #dce3e9;
}

/* Names under photographs */

.family-photo span {
  display: block;
  margin-top: 5px;
  padding: 2px;
  color: var(--text);
  font-size: 12px;
  text-align: center;
}

/* =================================
   FOOTER
================================= */

.site-footer {
  margin-top: 50px;
  padding: 18px;
  background: var(--navy);
  color: #c6d5e3;
  text-align: center;
  font-size: 11px;
  letter-spacing: 1px;
}

/* =================================
   TABLET LAYOUT
================================= */

@media (max-width: 950px) {

  .page-layout {
    grid-template-columns: 180px minmax(0, 1fr);
  }

  .family-panel {
    grid-column: 2;
  }

  .family-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* =================================
   MOBILE LAYOUT
================================= */

@media (max-width: 600px) {

  .page-layout {
    display: flex;
    flex-direction: column;
    padding: 0 16px;
    gap: 20px;
    margin: 20px auto;
  }

  .sidebar,
  .main-content,
  .family-panel {
    width: 100%;
  }

  /* Navigation */

  .main-nav {
    flex-direction: column;
  }

  .nav-item {
    width: 100%;
  }

  .nav-parent-row {
    width: 100%;
  }

  .submenu {
    margin-left: 12px;
  }

  /* People navigation */

  .people-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 15px;
  }

  .people-nav .section-heading {
    flex-basis: 100%;
  }

  .person-button {
    width: auto;
  }

  /* Family photographs */

  .family-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  /* Header */

  .site-header {
    padding: 20px;
  }

  .site-header h1 {
    font-size: 23px;
  }

  .site-header p {
    font-size: 11px;
    letter-spacing: 1px;
  }

  .main-content h2 {
    font-size: 23px;
  }
}
