/* ============================================
   RFF Support - Static Site Template
   Based on FRNSW Retirees Peer Support Program
   WCAG 2.1 AA compliant
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: Inter, "Open Sans", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  color: #181818;
  background-color: #f2f0ed;
  line-height: 1.7;
}

/* --- Skip to content link (WCAG 2.4.1) --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  z-index: 9999;
  padding: 14px 20px;
  background: #b50505;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 4px 0;
  white-space: nowrap;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid #ffffff;
  outline-offset: -6px;
}

/* --- Focus styles (WCAG 2.4.7, 1.4.11) --- */
/* Default: dark red outline for light backgrounds */
:focus-visible {
  outline: 3px solid #b50505;
  outline-offset: 3px;
  border-radius: 2px;
}

/* On dark backgrounds use white outline */
.site-header :focus-visible,
.sidebar-toggle:focus-visible,
.site-footer :focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 3px;
}

/* Remove default focus ring only when focus-visible is supported */
:focus:not(:focus-visible) {
  outline: none;
}

/* --- Links (WCAG 1.4.1 - not colour alone) --- */
a {
  color: #0d5d8f;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-thickness: 2px;
}

a:visited {
  color: #6b3fa0;
}

/* Nav links don't need underline - context makes them identifiable */
.sidebar-nav a,
.site-title a {
  text-decoration: none;
}

.sidebar-nav a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

h1, h2, h3, h4, h5, h6 {
  font-family: "Inter Tight", Inter, "Open Sans", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, sans-serif;
  font-weight: 600;
  color: #181818;
  line-height: 1.3;
  margin-bottom: 0.6em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.35rem; }

p {
  margin-bottom: 1.2em;
}

ul, ol {
  margin: 0 0 1.2em 1.5em;
}

/* --- Header --- */
.site-header {
  background-color: #042351;
  border-top: 10px solid #b50505;
  padding: 30px 0;
}

.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-branding {
  flex-shrink: 0;
}

/* --- Header logo --- */
.site-logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-left: 24px;
}

.header-logo {
  max-height: 130px;
  max-width: 130px;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Responsive: shrink logo on tablet */
@media (max-width: 960px) {
  .header-logo {
    max-height: 130px;
    max-width: 130px;
  }
}

/* On mobile, centre both branding and logo vertically and reduce logo */
@media (max-width: 768px) {
  .site-logo {
    margin-left: 12px;
  }

  .header-logo {
    max-height: 130px;
    max-width: 130px;
  }
}

/* Site title uses <p> so each page has exactly one <h1> (the page title) */
.site-title {
  font-family: "Inter Tight", Inter, "Open Sans", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, sans-serif;
  font-size: 1.875rem;
  font-weight: 600;
  text-transform: uppercase;
  line-height: 1.2;
  margin: 0;
}

.site-title a {
  color: #ffffff;
  text-decoration: none;
}

.site-title a:hover {
  opacity: 0.9;
}

.site-description {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.875rem;
  margin-top: 4px;
}

/* --- Content Layout --- */
.site-content-wrapper {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 40px;
}

.wrapper-frame {
  background-color: #ffffff;
  padding: 40px;
  display: flex;
  gap: 0;
  min-height: 60vh;
}

/* --- Sidebar --- */
.site-sidebar {
  width: 250px;
  flex-shrink: 0;
  padding-right: 40px;
}

.sidebar-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-nav li {
  background-color: #f2f2f2;
  border-bottom: 1px solid #c2c2c2;
}

.sidebar-nav li:first-child {
  border-top: 1px solid #c2c2c2;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  /* Minimum 44px touch target (WCAG 2.5.5) */
  min-height: 44px;
  padding: 10px 20px;
  color: #181818;
  font-size: 0.9375rem;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.sidebar-nav li a:hover {
  color: #b50505;
  border-left-color: #b50505;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Active / current page item (WCAG 2.4.8) */
.sidebar-nav li.active a,
.sidebar-nav li a[aria-current="page"] {
  color: #b50505;
  border-left-color: #b50505;
  font-weight: 600;
}

/* --- Mobile hamburger toggle --- */
.sidebar-toggle {
  display: none;
  background: #042351;
  color: #ffffff;
  border: none;
  /* Minimum 44px touch target (WCAG 2.5.5) */
  min-height: 44px;
  padding: 10px 16px;
  font-size: 1rem;
  cursor: pointer;
  align-items: center;
  gap: 10px;
  font-family: inherit;
  font-weight: 600;
  width: 100%;
  text-align: left;
}

.sidebar-toggle:hover {
  background: #063070;
}

.hamburger-icon {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  width: 20px;
  flex-shrink: 0;
}

.hamburger-icon span {
  display: block;
  height: 2px;
  background: #ffffff;
  border-radius: 1px;
}

/* --- Main Content --- */
.site-main {
  flex: 1;
  min-width: 0;
}

/* Removes default browser outline when programmatically focused (skip link target) */
.site-main:focus {
  outline: none;
}

.page-title {
  font-size: 2.5rem;
  margin-bottom: 0.8em;
}

.entry-content p {
  font-size: 1rem;
  line-height: 1.7;
}

.entry-content ul,
.entry-content ol {
  margin-bottom: 1.2em;
}

.entry-content li {
  margin-bottom: 0.3em;
}

.entry-content img {
  margin-bottom: 1.5em;
  border-radius: 2px;
}

/* --- Footer --- */
.site-footer {
  background-color: #042351;
  border-top: 10px solid #b50505;
  padding: 30px 40px;
  text-align: center;
  /* rgba(255,255,255,0.85) over #042351 achieves ~10:1 contrast ratio */
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.875rem;
}

.site-footer a {
  color: rgba(255, 255, 255, 0.85);
}

.site-footer a:hover {
  color: #ffffff;
}

.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
}

/* --- Responsive --- */

/* Tablet */
@media (max-width: 960px) {
  .header-inner {
    padding: 0 24px;
  }

  .site-content-wrapper {
    padding: 0 24px;
  }

  .wrapper-frame {
    padding: 30px;
  }

  .site-sidebar {
    width: 220px;
    padding-right: 30px;
  }

  h1, .page-title {
    font-size: 2rem;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .header-inner {
    padding: 0 16px;
  }

  .site-title {
    font-size: 1.875rem;
  }

  .site-content-wrapper {
    padding: 0;
  }

  .wrapper-frame {
    flex-direction: column;
    padding: 0;
  }

  /* Hamburger visible on mobile */
  .sidebar-toggle {
    display: flex;
  }

  .site-sidebar {
    width: 100%;
    padding-right: 0;
  }

  /* Nav hidden until hamburger opens it */
  .sidebar-nav {
    display: none;
  }

  .sidebar-nav.open {
    display: block;
  }

  .site-main {
    padding: 24px 16px;
  }

  h1, .page-title {
    font-size: 1.6rem;
  }

  .site-footer {
    padding: 24px 16px;
  }
}

/* --- Accessibility: Reduced motion (WCAG 2.3.3) --- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* --- Accessibility: High contrast preference (WCAG 1.4.6) --- */
@media (prefers-contrast: more) {
  .sidebar-nav li {
    border-color: #000000;
  }

  .sidebar-nav li a {
    color: #000000;
    border-left-color: transparent;
  }

  .sidebar-nav li a:hover,
  .sidebar-nav li.active a,
  .sidebar-nav li a[aria-current="page"] {
    color: #7a0000;
    border-left-color: #7a0000;
    text-decoration: underline;
  }

  .site-footer {
    color: #ffffff;
  }

  .site-description {
    color: #ffffff;
  }

  a {
    text-decoration-thickness: 2px;
  }
}

/* --- Accessibility: Windows High Contrast / Forced Colours --- */
@media (forced-colors: active) {
  .skip-link {
    border: 2px solid ButtonText;
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
  }

  .sidebar-toggle {
    border: 2px solid ButtonText;
    forced-color-adjust: none;
    background: ButtonFace;
    color: ButtonText;
  }

  .hamburger-icon span {
    background: ButtonText;
  }

  .sidebar-nav li a[aria-current="page"] {
    border-left-color: Highlight;
    color: Highlight;
  }

  .site-header {
    border-top: 5px solid Highlight;
    forced-color-adjust: none;
    background: Canvas;
  }

  .site-title a {
    color: CanvasText;
  }
}
