:root {
  --card-w-min: 260px;
  --card-w: 352px;
  --gap: 0.85rem;
  --radius: 12px;
  --shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  --tbl-bg: #ffffff;
  --tbl-fg: #0f172a; /* slate-900 */
  --tbl-muted: #64748b; /* slate-500 */
  --tbl-border: #e5e7eb; /* gray-200 */
  --tbl-stripe: #f9fafb; /* gray-50 */
  --tbl-hover: #f3f4f6; /* gray-100 */
}

body {
  font-family: Helvetica, Arial, sans-serif;
  line-height: 1.6;
  max-width: 800px;
  margin: auto;
  padding: 6px;
  background-color: #e2e7dc;
  color: #0e2d58;
}

header {
  /* Set properties that span the full width of the page */
  display: flex;
  justify-content: center; /* Center the inner content */
  align-items: center; /* Align items vertically */
  position: sticky;
  top: 0;
  z-index: 2;
  margin-bottom: var(--gap);
  background: transparent;
}

.header-inner {
  /* This container will constrain the content to the body's width */
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  max-width: 800px; /* Use the same max-width as the body */
  width: 100%; /* Ensure it fills the full width of the header element */
  padding: 0.5rem 1rem; /* Adjust padding as needed, or match body padding */
  background-color: #7fb4b5;
  color: #f9dac1;
  font-weight: bold;
  border-radius: var(--radius);
}

header h1 {
  /* ... rest of the h1 styles ... */
  margin: 0; /* Remove top/bottom margin to help with centering */
}

header a.back-button {
  /* ... rest of the back-button styles ... */
  margin: 0; /* Remove margin to help with alignment */
}

header a.back-button {
  background: transparent;
  border: none;
  border-radius: var(--radius);
  font-size: 2rem;
}

header a.back-button:hover {
  background-color: #bccccf;
  border: none;
}

header h1 {
  font-weight: 400;
  font-style: normal;
  margin-left: 10px;
}

/* Mobile-first header tweaks */
header {
  padding-top: .7rem;
  height: 2rem;
}

header h1 {
  font-size: 1.25rem; /* ~20px */
  line-height: 1;
}

header a.back-button {
  font-size: 1.5rem; /* smaller icon/button text */
}

/* Medium screens (tablet-ish) */
@media (min-width: 600px) {
  header {
    padding: 0.75rem 1.5rem;
  }
  header h1 {
    font-size: 1.75rem; /* ~28px */
  }
  header a.back-button {
    font-size: 1.75rem;
  }
}

/* Larger screens (desktop, but compact) */
@media (min-width: 1024px) {
  header {
    padding: 1rem 2rem;
  }
  header h1 {
    font-size: 2rem; /* ~32px but more compact than your current */
  }
  header a.back-button {
    font-size: 2rem;
  }
}

/* Container: centers the row and hard-caps it to 3 cards wide */
#card-container {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--gap);
  justify-content: center;
  max-width: 1200px;
  margin-inline: auto;
  margin-top: 20px;
}

/* Card: fixed size, mobile-first, flat modern look */
.card {
  width: clamp(var(--card-w-min), 90vw, var(--card-w));
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid #e5e7eb; /* subtle, modern gray */
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04); /* very light shadow */
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  margin-bottom: 0.5rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Image area: fixed ratio; image fills & crops nicely */
.card__media {
  width: 100%;
  background: #f9fafb; /* lighter neutral background */
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
}

.card__media > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Content */
.card__body {
  padding: 0.85rem 0 0; /* remove extra side padding since card already has */
}

.card__title {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-weight: 600;
  color: #111827; /* modern darker neutral */
  line-height: 1.3;
}

.card__text {
  margin: 0;
  margin-top: 4px;
  color: #6b7280; /* softer gray */
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Links are clean & inherit color */
.card a {
  text-decoration: none;
  color: inherit;
}

/* Modern pill button */
.card button {
  margin-top: 0.75rem;
  align-self: start;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: none;
  background: #f3f4f6;
  font-size: 0.9rem;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: background 0.15s ease;
}

.card button:hover {
  background: #e5e7eb;
}

#back-button-container {
  display: flex;
}

/* Add spacing below headings */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin-top: 2rem;
  margin-bottom: 1rem;
}

/* Add spacing between paragraphs */
p {
  margin-bottom: 1rem;
}

/* Ensure lists have spacing and list item markers */
ul,
ol {
  margin-top: 1rem;
  margin-bottom: 1rem;
  padding-left: 20px; /* Provides indentation for list markers */
}

/* Add spacing between list items */
li {
  margin-bottom: 0.5rem;
}

table {
  width: 100%;
  border-collapse: separate; /* enables rounded corners & spacing */
  border-spacing: 0;
  background: var(--tbl-bg);
  color: var(--tbl-fg);
  font: 500 0.95rem/1.6 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu,
    Cantarell, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji",
    "Segoe UI Emoji";
  border: 1px solid var(--tbl-border);
  border-radius: 12px;
  overflow: hidden; /* rounds thead/tbody corners */
}

/* Header */
table thead th {
  text-align: left;
  padding: 0.9rem 1rem;
  letter-spacing: 0.02em;
  font-weight: 650;
  color: var(--tbl-muted);
  background: var(--tbl-stripe);
  border-bottom: 1px solid var(--tbl-border);
  white-space: nowrap;
}

/* Cells */
table td {
  padding: 0.85rem 1rem;
  vertical-align: top;
  border-bottom: 1px solid var(--tbl-border);
}

/* Zebra striping */
table tbody tr:nth-child(odd) td {
  background: var(--tbl-stripe);
}

/* Row hover */
table tbody tr:hover td {
  background: var(--tbl-hover);
}

/* Compact spacing on small screens */
@media (max-width: 640px) {
  table thead th,
  table td {
    padding: 0.7rem 0.8rem;
  }
  table {
    font-size: 0.92rem;
  }
}
