/* Site-wide styles for The Survival Problem */

/* Reset some basic elements */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: #222;
  background-color: #fafafa;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.content {
  flex: 1;
  width: 90%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 0;
}

/* Header & Navigation */
.site-header {
  background: #303030;
  color: #fff;
  padding: 0.5rem 1rem;
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-title {
  display: flex;
  align-items: center;
}

/* Logo image in the site header */
.site-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  margin-right: 0.6rem;
  border-width: 2px;
  border-style: solid;
  border-color: #D16527;
  border-radius: 7px;
}

.logo-link {
  display: flex;
  align-items: center;
}

/* Screen-reader only text */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

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

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

.site-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.site-nav ul {
  list-style: none;
  display: flex;
  gap: 1rem;
}

.site-nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.site-nav a:hover,
.site-nav a:focus {
  color: #19c37d;
}

/* Mobile navigation */
.nav-toggle {
  display: none;
}

.nav-toggle-label {
  display: none;
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  position: relative;
}

.nav-toggle-label span,
.nav-toggle-label span::before,
.nav-toggle-label span::after {
  content: "";
  background: #fff;
  height: 2px;
  width: 100%;
  position: absolute;
  left: 0;
  transition: transform 0.3s ease;
}

.nav-toggle-label span::before {
  top: -0.6rem;
}

.nav-toggle-label span::after {
  top: 0.6rem;
}

/* When checkbox checked, transform hamburger to X */
.nav-toggle:checked + .nav-toggle-label span {
  transform: rotate(45deg);
}

.nav-toggle:checked + .nav-toggle-label span::before {
  transform: rotate(90deg) translateX(0.6rem);
}

.nav-toggle:checked + .nav-toggle-label span::after {
  opacity: 0;
}

@media (max-width: 768px) {
  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    background: #303030;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .site-nav ul {
    flex-direction: column;
    gap: 0;
  }

  .site-nav li {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }

  .site-nav a {
    display: block;
    padding: 1rem;
  }

  .nav-toggle-label {
    display: block;
  }

  .nav-toggle:not(:checked) ~ .site-nav {
    max-height: 0;
  }

  .nav-toggle:checked ~ .site-nav {
    max-height: 500px; /* large enough */
  }
}

/* Footer */
.site-footer {
  background: #303030;
  color: #fff;
  text-align: center;
  padding: 1rem 0;
}

/* News feed */
.news-feed {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.news-item {
  background: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: box-shadow 0.2s ease;
  color: inherit;
  text-decoration: none;
}

.news-item:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.news-item img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 4px;
}

/* Card title */
.news-item .title {
  color: #111;
  font-weight: 600;
  font-size: 1.1rem;
  text-decoration: none;
}

.news-item:hover .title {
  text-decoration: underline;
}

.news-meta {
  font-size: 0.85rem;
  color: #555;
}

/* Forms */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 400px;
  margin: 0 auto;
}

input[type="text"],
input[type="email"],
input[type="date"] {
  padding: 0.7rem 0.9rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
}

button[type="submit"] {
  padding: 0.8rem 1rem;
  background: #19c37d;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s ease;
}

button[type="submit"]:hover {
  background: #13a26a;
}

/* AI Bill of Rights */
.rights-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  padding: 0;
  max-width: 900px;
  margin: 0 auto;
}

.rights-list li {
  background: #fff;
  border-left: 6px solid #19c37d;
  padding: 1rem 1.2rem 1rem 1.5rem;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: relative;
  counter-increment: item;
}

.rights-list li::before {
  content: counter(item);
  position: absolute;
  left: -2.2rem;
  top: 50%;
  transform: translateY(-50%);
  background: #19c37d;
  color: #fff;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* About section */
.about-section {
  background: linear-gradient(135deg, #f1f5f9 0%, #ffffff 100%);
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 2rem;
  margin-bottom: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.additional-reading-list {
  list-style: disc inside;
  margin-top: 0.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-left: 0; /* remove the default indent */
}

/* Legal documents (Terms, Privacy, etc.) */
.legal-doc {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 2rem 1.5rem;
  max-width: 900px;
  margin: 0 auto 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  /* Maintain natural block flow */
  line-height: 1.65;
}

.legal-doc h2 {
  margin-bottom: 1rem;
}

.legal-doc h3 {
  margin-top: 1.2rem;
  margin-bottom: 0.3rem;
  font-size: 1.15rem;
}

.legal-doc p {
  margin-bottom: 0.8rem;
}

.legal-doc ul {
  list-style: disc inside;
  margin-left: 1rem;
  margin-bottom: 0.8rem;
}

.legal-doc li {
  margin-bottom: 0.4rem;
}

.about-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .about-grid {
    gap: 1rem;
  }
}

.about-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 1.2rem;
  align-items: start;
}

@media (max-width: 600px) {
  .about-row {
    grid-template-columns: 1fr;
  }
}

/* Archive filters */
.archive-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}

.archive-filter input[type="text"],
.archive-filter input[type="date"] {
  flex: 1; /* allow fields to shrink */
}

/* Utility */
.text-center {
  text-align: center;
}

.mb-1 {
  margin-bottom: 1rem;
}
.mb-2 {
  margin-bottom: 2rem;
}
