html,
body {
  height: 100%;
}

:root {
  --content-gap: 16px;
}

body {
  font-family: Arial, sans-serif;
  background-color: black;
  margin: 0;
  padding: 0;
  text-align: center;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden; /* keep header/footer always visible; scroll only main */
}

/* Fullscreen background canvas */
.bg-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  display: block;
}

/* Center circle mask to hide line origin */
.center-mask {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 100px;
  height: 100px;
  margin-left: -50px;
  margin-top: -50px;
  background: black;
  border-radius: 50%;
  z-index: 0; /* above canvas (-1), below regular content */
  pointer-events: none;
  box-shadow: 0 0 30px 20px rgba(0, 0, 0, 0.9);
}

header {
  font-family: Futura, sans-serif;
  background-color: rgb(19, 19, 19);
  color: yellow;
  padding: 10px;
}

main {
  padding: 20px;
  color: white;
  overflow: auto;
  min-height: 0; /* allow scrolling inside grid area across browsers */
}

/* Page content 4-col layout: 0.5fr | 1fr | 1fr | 0.5fr */
.layout-grid {
  display: grid;
  grid-template-columns: 0.5fr 1fr 1fr 0.5fr;
  gap: var(--content-gap);
  grid-template-rows: auto 1fr; /* row1: bubble, row2: articles */
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
}

/* Site logo in header - sized to match original h1 */
header .site-logo {
  display: block;
  height: 2.5em; /* Match typical h1 size */
  width: auto;
  margin: 20px auto 10px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.rail {
  color: #cccccc;
  text-align: left;
}

.rail-left { grid-column: 1; grid-row: 1 / span 2; }
.rail-right { grid-column: 4; grid-row: 1 / span 2; }
.layout-grid .articles-grid { grid-column: 2 / span 2; grid-row: 2; }

/* Speech bubble spanning the two middle columns */
.speech-bubble {
  grid-column: 2 / 4;
  grid-row: 1;
  background: #000;
  color: yellow;
  border-radius: 10px;
  border: 2px solid #fff; /* match background line thickness visually */
  box-shadow: none;
  padding: 12px 16px;
  position: relative;
  text-align: left;
}

.speech-bubble::after {
  content: "";
  position: absolute;
  bottom: 16px; /* near the bottom of the bubble */
  left: 100%; /* attach to the right-hand side */
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 10px solid #000; /* inner (fill) triangle */
}

.speech-bubble::before {
  content: "";
  position: absolute;
  bottom: 14px; /* offset to outline around the inner triangle */
  left: 100%;
  width: 0;
  height: 0;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-left: 12px solid #fff; /* white outline */
}

/* Outer columns color */
.rail-left,
.rail-right {
  background-color: #222;
  border-radius: 8px;
  padding: 12px;
}

/* Profile block in left rail */
.rail-right .profile {
  text-align: left;
  margin-bottom: 16px;
}

.rail-right .profile h3 {
  margin: 0 0 8px;
  color: yellow;
  text-align: center;
}

.rail-right .portrait {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.35);
  margin: 0 0 8px;
}

a {
  color: #0077cc;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

footer {
  background-color: rgb(19, 19, 19);
  color: white;
  padding: 5px;
  margin: 0;
  font-size: 0.9em;
}

/* Article grid */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--content-gap);
  max-width: 1000px;
  margin: 0;
  text-align: left;
  position: relative; /* create stacking context */
  z-index: 1; /* above center mask (z-index: 0) */
}

.article-card {
  display: block;
  background-color: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 0;
  color: white;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.article-image {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}

.article-card h2,
.article-card .article-meta,
.article-card .article-teaser {
  padding: 0 16px;
}

.article-meta {
  margin: 4px 0 4px;
  font-style: italic;
  color: #b3b3b3;
  font-size: 0.9rem;
}

.article-card h2 {
  margin: 16px 0 6px;
  font-size: 1.1rem;
  color: yellow;
}

.article-teaser {
  margin: 0 0 4px;
  color: #dddddd;
  padding-bottom: 0;
}

.article-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  text-decoration: none;
}

@media (max-width: 640px) {
  .articles-grid {
    grid-template-columns: 1fr;
  }
}