/* SaveToWaybackMachine - Main Stylesheet
 * KB Huisstijl compliant design
 * WCAG 2.1 Level AA accessible
 */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* KB Huisstijl Color Variables */
:root {
  --kb-gold: #cba052;
  --kb-gold-dark: #8f6a2a;
  --kb-blue: #407ec9;
  --kb-blue-dark: #001a70;
  --kb-pink: #ef6079;
  --kb-pink-dark: #621323;
  --kb-beige: #ecdcc8;
  --kb-teal: #9cdbd9;
  --kb-light-blue: #96bded;
  --kb-text: #222330;
  --kb-text-light: #545560;
  --kb-bg-light: #f5f5f5;
}

/* WCAG 2.1 compliant focus styles */
:focus {
  outline: 3px solid var(--kb-blue);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--kb-blue);
  outline-offset: 2px;
}

/* Skip to main content link for screen readers */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--kb-blue-dark);
  color: #fff;
  padding: 8px 16px;
  z-index: 100;
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  line-height: 1.6;
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
  color: var(--kb-text);
  background: #fff;
  font-size: 100%;
}

/* WCAG AA compliant link colors using KB blue */
a {
  color: var(--kb-blue-dark);
  text-decoration: underline;
}

a:hover, a:focus {
  color: var(--kb-blue);
  text-decoration: none;
}

a:visited {
  color: var(--kb-pink-dark);
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid var(--kb-gold);
  padding-bottom: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 15px;
}

.header h1 {
  margin: 0;
  font-size: 1.5em;
}

.header h1 a {
  color: var(--kb-text);
  text-decoration: none;
}

.header h1 a:hover,
.header h1 a:focus {
  color: var(--kb-blue-dark);
  text-decoration: underline;
}

.header img {
  height: 50px;
  width: auto;
}

/* Breadcrumb with ARIA support */
.breadcrumb {
  background: var(--kb-beige);
  padding: 10px 15px;
  border-radius: 5px;
  margin-bottom: 20px;
  font-size: 0.9em;
}

.breadcrumb ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.breadcrumb li {
  display: flex;
  align-items: center;
}

.breadcrumb li:not(:last-child)::after {
  content: "/";
  color: #666;
  margin: 0 8px;
}

.breadcrumb a {
  text-decoration: none;
}

.breadcrumb a:hover,
.breadcrumb a:focus {
  text-decoration: underline;
}

.breadcrumb .current {
  color: #666;
}

.nav-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.nav-card {
  display: block;
  position: relative;
  border: 1px solid #e1e4e8;
  border-radius: 8px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
  background: #fff;
}

.nav-card:hover,
.nav-card:focus {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: translateY(-2px);
  border-color: var(--kb-gold);
}

.nav-card h3 {
  margin: 0 0 10px 0;
  color: var(--kb-blue-dark);
  font-size: 1.1em;
}

.nav-card:hover h3,
.nav-card:focus h3 {
  color: var(--kb-blue);
}

.nav-card p {
  margin: 0;
  color: var(--kb-text-light);
  font-size: 0.9em;
}

.nav-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  object-position: top;
  border-radius: 4px;
  margin-bottom: 12px;
  border: 1px solid #e1e4e8;
}

.nav-card .archive-date {
  position: absolute;
  bottom: 12px;
  right: 12px;
  font-size: 0.75em;
  font-style: italic;
  color: #666;
}

.content {
  overflow-x: auto;
}

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

.content h1 {
  font-size: 1.8em;
  margin-top: 0;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.content h2 {
  font-size: 1.4em;
  margin-top: 30px;
}

/* Tables with responsive behavior */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 0.9em;
}

th, td {
  border: 1px solid #e1e4e8;
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--kb-beige);
  font-weight: 600;
}

/* WCAG: Ensure table has proper scope */
th[scope="col"] {
  background: var(--kb-beige);
}

/* Image gallery tables */
table img {
  display: block;
  margin: 0 auto;
}

/* All clickable images in content area */
.content img:not(.nav-card img) {
  cursor: pointer;
  transition: opacity 0.2s;
}

.content img:not(.nav-card img):hover {
  opacity: 0.8;
}

/* Lightbox styles with WCAG compliance */
.lightbox {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
}

.lightbox.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox img {
  max-width: 90%;
  max-height: 85%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 30px;
  color: #fff;
  font-size: 40px;
  font-weight: bold;
  cursor: pointer;
  z-index: 1001;
  background: none;
  border: none;
  padding: 10px;
  line-height: 1;
}

.lightbox-close:hover,
.lightbox-close:focus {
  color: #ccc;
}

.lightbox-caption {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 0.9em;
  text-align: center;
  max-width: 80%;
  padding: 10px 20px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 4px;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  font-size: 60px;
  font-weight: bold;
  cursor: pointer;
  padding: 20px;
  user-select: none;
  z-index: 1001;
  opacity: 0.7;
  transition: opacity 0.2s;
  background: none;
  border: none;
}

.lightbox-nav:hover,
.lightbox-nav:focus {
  opacity: 1;
}

.lightbox-prev {
  left: 10px;
}

.lightbox-next {
  right: 10px;
}

/* Image counter for lightbox */
.lightbox-counter {
  position: absolute;
  top: 20px;
  left: 20px;
  color: #fff;
  font-size: 0.9em;
  background: rgba(0, 0, 0, 0.6);
  padding: 5px 10px;
  border-radius: 4px;
}

pre, code {
  background: #f6f8fa;
  border-radius: 3px;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 0.85em;
}

pre {
  padding: 15px;
  overflow-x: auto;
}

code {
  padding: 2px 5px;
}

pre code {
  padding: 0;
  background: none;
}

.footer {
  margin-top: 40px;
  padding: 40px 20px 20px;
  background: #000;
  color: #fff;
  font-size: 0.9em;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
}

.footer-section h4 {
  color: #fff;
  margin-bottom: 15px;
  font-size: 1em;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-section li {
  margin-bottom: 8px;
}

.footer a {
  color: #fff;
  text-decoration: none;
}

.footer a:hover,
.footer a:focus {
  color: #ccc;
  text-decoration: underline;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.footer-logo img {
  height: 40px;
  width: auto;
}

.social-icons {
  display: flex;
  gap: 12px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.social-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border-radius: 50%;
  transition: opacity 0.2s;
}

.social-icons a:hover {
  opacity: 0.7;
}

.social-icons img {
  width: 20px;
  height: 20px;
}

.compliance-badges {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 15px;
}

.compliance-badges img {
  height: 32px;
  width: auto;
}

.footer-bottom {
  max-width: 1200px;
  margin: 30px auto 0;
  padding-top: 20px;
  border-top: 1px solid #333;
  text-align: center;
  font-size: 0.85em;
  color: #fff;
}

.footer-bottom a {
  color: #fff;
}

hr {
  border: none;
  border-top: 1px solid #e5e5e5;
  margin: 30px 0;
}

/* Tablet breakpoint */
@media (max-width: 768px) {
  body {
    padding: 15px;
  }

  .nav-cards {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
  }

  .lightbox-nav {
    font-size: 40px;
    padding: 15px;
  }
}

/* Mobile breakpoint */
@media (max-width: 600px) {
  body {
    padding: 12px;
    font-size: 95%;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header img {
    height: 40px;
  }

  .nav-cards {
    grid-template-columns: 1fr;
  }

  .nav-card {
    padding: 15px;
  }

  .nav-card img {
    height: 120px;
  }

  table {
    font-size: 0.8em;
  }

  th, td {
    padding: 6px 8px;
  }

  .lightbox-nav {
    font-size: 30px;
    padding: 10px;
  }

  .lightbox-close {
    font-size: 30px;
    top: 10px;
    right: 15px;
  }

  .lightbox-caption {
    font-size: 0.8em;
    padding: 8px 15px;
    bottom: 10px;
  }

  .breadcrumb {
    font-size: 0.85em;
    padding: 8px 12px;
  }
}

/* Small mobile / portrait */
@media (max-width: 400px) {
  body {
    padding: 10px;
  }

  .content h1 {
    font-size: 1.5em;
  }

  .content h2 {
    font-size: 1.2em;
  }
}

/* Landscape orientation adjustments */
@media (max-height: 500px) and (orientation: landscape) {
  .lightbox img {
    max-height: 80%;
  }

  .lightbox-caption {
    bottom: 5px;
    padding: 5px 10px;
    font-size: 0.75em;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  a {
    text-decoration: underline;
  }

  .nav-card {
    border-width: 2px;
  }

  th {
    background: #000;
    color: #fff;
  }
}

/* Dark mode support (optional enhancement) */
@media (prefers-color-scheme: dark) {
  :root {
    --kb-text: #e0e0e0;
    --kb-text-light: #b0b0b0;
    --kb-bg-light: #2a2a2a;
  }

  body {
    background: #1a1a1a;
    color: #e0e0e0;
  }

  a {
    color: var(--kb-light-blue);
  }

  a:visited {
    color: var(--kb-pink);
  }

  .header h1 a {
    color: #e0e0e0;
  }

  .header {
    border-bottom-color: var(--kb-gold-dark);
  }

  .nav-card {
    background: #2a2a2a;
    border-color: #444;
  }

  .nav-card:hover,
  .nav-card:focus {
    border-color: var(--kb-gold);
  }

  .nav-card h3 {
    color: var(--kb-light-blue);
  }

  .nav-card p {
    color: #b0b0b0;
  }

  .breadcrumb {
    background: var(--kb-gold-dark);
    color: #fff;
  }

  th {
    background: var(--kb-gold-dark);
    color: #fff;
  }

  th, td {
    border-color: #444;
  }

  hr {
    border-color: #444;
  }

  pre, code {
    background: #2a2a2a;
  }
}

/* Print styles */
@media print {
  .header img {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .nav-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
  }

  .lightbox {
    display: none !important;
  }
}
