/* Global Styles & Typography */
:root {
  --color-primary: #b85042; /* Reddish-brown */
  --color-secondary: #a7beae; /* Muted green */
  --color-background: #e7e8d1; /* Light cream */
  --color-text-dark: #333333; /* Dark grey for general text */
  --color-text-light: #e7e8d1; /* Light cream for text on dark backgrounds */
  --color-border: #d1d1c0; /* Slightly darker cream for borders */
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--color-text-dark);
  background-color: var(--color-background);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 1rem;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.3s ease;
}

a:hover {
  color: var(--color-secondary);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--color-primary);
  margin-bottom: 0.8rem;
  line-height: 1.2;
}

h1 {
  font-size: 2.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 2rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.5rem;
  margin-top: 1.5rem;
  margin-bottom: 0.7rem;
}

p {
  margin-bottom: 1rem;
}

ul,
ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

/* Buttons */
.btn {
  display: inline-block;
  background-color: var(--color-primary);
  color: var(--color-text-light);
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.btn:hover {
  background-color: var(--color-secondary);
  transform: translateY(-2px);
}

/* Header & Navigation */
header {
  background-color: var(--color-primary);
  color: var(--color-text-light);
  padding: 1rem 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap; /* Allow wrapping on small screens */
}

.logo a {
  color: var(--color-text-light);
  font-size: 1.8rem;
  font-weight: bold;
  text-decoration: none;
  white-space: nowrap; /* Prevent logo from breaking */
}

.navbar {
  position: relative;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--color-text-light);
  font-weight: bold;
  padding: 0.5rem 0;
  transition: color 0.3s ease;
}

.nav-links a:hover {
  color: var(--color-secondary);
}

.hamburger {
  display: none; /* Hidden by default on desktop */
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  position: relative;
  z-index: 1001; /* Ensure it's above nav-links when open */
}

.hamburger .bar {
  display: block;
  width: 25px;
  height: 3px;
  background-color: var(--color-text-light);
  margin: 5px auto;
  transition: all 0.3s ease-in-out;
}

/* Hero Section */
.hero {
  background-color: var(--color-secondary);
  color: var(--color-text-light);
  padding: 4rem 1rem;
  text-align: center;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px; /* Ensure a decent height */
}

.hero h1 {
  color: var(--color-text-light);
  font-size: 3rem;
  margin-bottom: 1rem;
}

.hero p {
  font-size: 1.2rem;
  margin-bottom: 2rem;
}

.calculator-card {
  background-color: var(--color-background);
  color: var(--color-text-dark);
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  max-width: 400px;
  margin: 0 auto;
}

.calculator-card h2 {
  color: var(--color-primary);
  margin-bottom: 1rem;
}

.calculator-card p {
  margin-bottom: 1rem;
}

.calculator-card .date-input {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 5px;
  font-size: 1rem;
  font-family: Helvetica, Arial, sans-serif;
  color: var(--color-text-dark);
  background-color: var(--color-text-light);
}

.calculator-card .result {
  font-weight: bold;
  margin-top: 1.5rem;
  font-size: 1.1rem;
  color: var(--color-primary);
}

/* Main Article Section */
.article-section {
  padding: 3rem 1rem;
}

.main-article {
  background-color: var(--color-text-light);
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.main-article h2 {
  text-align: center;
  margin-bottom: 2rem;
}

.main-article blockquote {
  background-color: var(--color-secondary);
  color: var(--color-text-light);
  border-left: 5px solid var(--color-primary);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
  border-radius: 0 5px 5px 0;
}

.main-article table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  background-color: var(--color-background);
  border-radius: 5px;
  overflow: hidden; /* Ensures rounded corners apply to content */
}

.main-article th,
.main-article td {
  border: 1px solid var(--color-border);
  padding: 0.8rem;
  text-align: left;
}

.main-article th {
  background-color: var(--color-primary);
  color: var(--color-text-light);
  font-weight: bold;
}

.main-article tr:nth-child(even) {
  background-color: var(--color-text-light);
}

.main-article .highlight {
  background-color: var(--color-secondary);
  color: var(--color-text-light);
  padding: 1rem;
  margin: 1.5rem 0;
  border-radius: 5px;
  font-weight: bold;
}

.main-article .highlight p {
  margin-bottom: 0;
}

.main-article ul {
  list-style: disc;
}

.main-article ol {
  list-style: decimal;
}

/* Related Articles Section (Homepage) */
.related-articles {
  padding: 3rem 1rem;
  text-align: center;
}

.related-articles h2 {
  margin-bottom: 2rem;
}

.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.article-card {
  background-color: var(--color-text-light);
  padding: 1.5rem;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  text-align: left;
  transition: transform 0.2s ease;
}

.article-card:hover {
  transform: translateY(-5px);
}

.article-card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.article-card h3 a {
  color: var(--color-primary);
  font-size: 1.2rem;
}

.article-card p {
  font-size: 0.95rem;
  color: var(--color-text-dark);
  margin-bottom: 0;
}

/* Individual Article Pages */
.article-page {
  padding: 3rem 1rem;
}

.article-page h1 {
  text-align: left;
  font-size: 2.2rem;
  margin-bottom: 1rem;
}

.article-page .article-meta {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 2rem;
}

.article-page article {
  background-color: var(--color-text-light);
  padding: 2rem;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.related-articles-footer {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
}

.related-articles-footer h2 {
  text-align: center;
  margin-bottom: 1.5rem;
}

.related-articles-footer ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.related-articles-footer li {
  margin-bottom: 0;
}

.related-articles-footer a {
  display: block;
  background-color: var(--color-secondary);
  color: var(--color-text-light);
  padding: 0.7rem 1.2rem;
  border-radius: 5px;
  transition: background-color 0.3s ease;
  font-size: 0.9rem;
  white-space: nowrap;
}

.related-articles-footer a:hover {
  background-color: var(--color-primary);
}

/* General Pages (Privacy, Contact, About) */
.page-content {
  padding: 3rem 1rem;
  background-color: var(--color-text-light);
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.page-content h1 {
  text-align: left;
  font-size: 2.2rem;
  margin-bottom: 1.5rem;
}

.page-content h2 {
  margin-top: 1.5rem;
  margin-bottom: 0.8rem;
}

.contact-info p {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

/* Footer */
.footer {
  background-color: var(--color-primary);
  color: var(--color-text-light);
  padding: 1.5rem 0;
  text-align: center;
  margin-top: auto; /* Pushes footer to the bottom */
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.footer-nav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-nav a {
  color: var(--color-text-light);
  font-size: 0.9rem;
  transition: color 0.3s ease;
}

.footer-nav a:hover {
  color: var(--color-secondary);
}

/* Back to Top Button */
.back-to-top-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--color-secondary);
  color: var(--color-text-light);
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 1.8rem;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.2s ease;
  z-index: 999;
}

.back-to-top-btn.show {
  opacity: 1;
  visibility: visible;
}

.back-to-top-btn:hover {
  background-color: var(--color-primary);
  transform: translateY(-3px);
}

/* GDPR Banner */
.gdpr-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  color: var(--color-text-light);
  padding: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  z-index: 10000;
  font-size: 0.9rem;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
}

.gdpr-banner p {
  margin: 0;
  flex-grow: 1;
  text-align: center;
}

.gdpr-banner a {
  color: var(--color-secondary);
  text-decoration: underline;
}

.gdpr-banner .gdpr-btn {
  background-color: var(--color-primary);
  color: var(--color-text-light);
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  white-space: nowrap;
}

.gdpr-banner .gdpr-btn:hover {
  background-color: var(--color-secondary);
}

/* Responsive Design */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .logo {
    margin-bottom: 1rem;
  }

  .navbar {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
  }

  .hamburger {
    display: block;
  }

  .nav-links {
    display: none; /* Hidden by default on mobile */
    flex-direction: column;
    width: 100%;
    background-color: var(--color-primary);
    position: absolute;
    top: 100%; /* Position below the header */
    left: 0;
    padding: 1rem 0;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
  }

  .nav-links.active {
    display: flex;
  }

  .nav-links li {
    text-align: center;
    margin: 0.5rem 0;
  }

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

  .hero h1 {
    font-size: 2.2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .calculator-card {
    padding: 1.5rem;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.7rem;
  }

  h3 {
    font-size: 1.3rem;
  }

  .article-grid {
    grid-template-columns: 1fr; /* Stack articles on small screens */
  }

  .related-articles-footer ul {
    flex-direction: column;
    align-items: center;
  }

  .gdpr-banner {
    flex-direction: column;
    text-align: center;
    padding: 0.8rem;
  }

  .gdpr-banner p {
    margin-bottom: 0.5rem;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: 3rem 1rem;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .hero p {
    font-size: 0.9rem;
  }

  .calculator-card {
    padding: 1rem;
  }

  .btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }

  h1 {
    font-size: 1.8rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.2rem;
  }

  .main-article,
  .article-page article,
  .page-content {
    padding: 1.5rem;
  }

  .footer-nav {
    flex-direction: column;
    gap: 0.5rem;
  }

  .back-to-top-btn {
    width: 45px;
    height: 45px;
    font-size: 1.5rem;
    bottom: 15px;
    right: 15px;
  }
}
