html {
  height: 100%;
  box-sizing: border-box;
}

body {
  font-family: "Raleway", Arial, sans-serif;
  margin: 0;
  padding: 0;
  height: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

h1 {
  font-family: "Raleway", Arial, sans-serif;
  letter-spacing: 6px;
}

* {
  box-sizing: inherit;
}
section {
  height: 100%;
}

.wrapper {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.w3-content {
  max-width: 1400px;
  margin: auto;
}

.page-header,
.page-footer {
    padding: 20px;
}

.page-body {
    padding: 20px;
}

#tsparticles {
  height: 100%;
  width: 100%;
  position: absolute;
  z-index: -1;
}

/* Note: table styling now targets tables inside the post content (`.w3-large`). */

/* Tables inside post content should size to content and be centered on desktop. */
.w3-large table,
.page-body .w3-large table {
  width: auto; /* size to content on desktop so it can be centered */
  max-width: none; /* avoid constraining by parent */
  border-collapse: collapse;
  table-layout: auto; /* let columns size naturally */
  margin-left: auto;
  margin-right: auto; /* center table on wider viewports */
}

.w3-large table th,
.w3-large table td {
  padding: 0.75em;
  border: 1px solid #ddd;
  /* allow wrapping inside cells by default — prevents extreme horizontal overflow */
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.w3-large table th {
  background-color: #f7f7f7;
  text-align: left;
}

.w3-large table tr:nth-child(even) {
  background-color: #f9f9f9;
}

@media (max-width: 640px) {
  /* Reduce table cell padding on small viewports */
  .w3-large table th,
  .w3-large table td {
    padding: 0.45em;
  }
}

/* Compact table rules for very small viewports: reduce padding and font-size,
   use a fixed layout so columns share the available width and long content
   wraps. This makes the table visually smaller and easier to read on phones. */
@media (max-width: 480px) {
  .w3-large table,
  .page-body .w3-large table {
    width: 100% !important;     /* fit the content column */
    table-layout: fixed;        /* share width across columns */
    font-size: 0.92rem;         /* slightly smaller text */
  }

  .w3-large table th,
  .w3-large table td {
    padding: 0.35em !important; /* less padding to reduce height */
    line-height: 1.25;
    white-space: normal;        /* allow wrapping */
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* Reduce header prominence on very small screens */
  .w3-large table th {
    font-size: 0.95em;
    font-weight: 600;
  }

  /* By using table-layout:fixed + wrapping we make the table fit the column
     and avoid horizontal overflow in most cases. */
}



.w3-large table,
.page-body .w3-large table {
  display: table; /* keep native table layout so columns size naturally */
  width: auto;    /* size to content so tables can be centered on desktop */
  max-width: none;
  margin-left: auto;
  margin-right: auto; /* center fallback tables */
  border-collapse: collapse;
  table-layout: auto;
}

.w3-large table th,
.w3-large table td {
  white-space: normal; /* allow wrapping inside the fallback tables */
  overflow-wrap: anywhere;
  word-break: break-word;
  padding: 0.75em;
  border: 1px solid #ddd;
}

/* ===== Blog cards equal-height grid =====
   The blog page uses a scoped grid container `.blog-cards-grid` and
   `.post-card` wrappers. Each `.w3-card` inside a `.post-card` becomes a
   vertical flex container with `height:100%` so all cards in the same
   grid row match the height of the tallest card. */
.blog-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
  align-items: stretch; /* ensure grid cells stretch to same row height */
}

.post-card {
  /* grid item wrapper */
  display: block;
}

.post-card .w3-card {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.post-card-image {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
}

.post-card-body {
  flex: 1 1 auto; /* fill remaining space */
  display: flex;
  flex-direction: column;
}

/* Push the small "Read" button to the bottom of the card body */
.post-card-body .w3-right {
  margin-top: auto;
}

@media (max-width: 480px) {
  /* Slightly smaller image on very small screens to reduce vertical space */
  .post-card-image {
    height: 140px;
  }
}
