@import "cleopatra/cleopatra.css";

:root {
  /* body 16px (cleopatra default is 20px via --step-0) */
  --step-0: 1rem;

  /* tight list spacing + compact meta to match dense news indexes (Upstract/Brutalist) */
  --item-py: var(--space-2);  /* 8px per item */
  --meta: 0.8125rem;     /* 13px timestamp (no cleopatra step below 16px) */
  --list-size: 0.9375rem; /* 15px list items (Inter Variable supports 500) */
  --col-height: 65vh; /* per-section scroll-pane height (arbitrary; tune later) */
}

/* Constrain and center the index; comfortable gutters */
.grid {
  max-width: var(--canvas);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  --section-gap: var(--space-7);
  gap: var(--section-gap);
  align-items: start;
}

@media (max-width: 720px) {
  .grid {
    grid-template-columns: 1fr;
  }
}
.source-col h2 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--step-1);
  margin: 0 0 var(--space-3);
  letter-spacing: -0.01em;
}
.source-col h2 .pub-icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 1.5em;
  width: 1.5em;
  flex: 0 0 auto;
  font-size: 0.7em;
  font-weight: 700;
  line-height: 1;
  border-radius: 3px;
  color: inherit;
  overflow: hidden;
}
.source-col h2 .pub-icon img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 3px;
}
/* Initials show only when the favicon fails (no-icon), never behind it,
   so transparent favicons don't reveal the letters through the image. */
.source-col h2 .pub-icon .pub-initials {
  display: none;
}
.source-col h2 .pub-icon.no-icon .pub-initials {
  display: inline;
}
.source-col {
  position: relative;
}
.source-col h2 .pub-icon.no-icon {
  background: color-mix(in srgb, currentColor 16%, transparent);
}

/* hairline divider centered in the gap between sections (desktop 2-col) */
@media (min-width: 721px) {
  .source-col:nth-child(even)::before {
    content: "";
    position: absolute;
    left: calc(var(--section-gap) / -2);
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border);
  }
  .source-col:nth-child(n+3)::after {
    content: "";
    position: absolute;
    top: calc(var(--section-gap) / -2);
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
  }
}


/* mobile 1-col: horizontal dividers between stacked sections, no vertical line */
@media (max-width: 720px) {
  .source-col:not(:first-child)::after {
    content: "";
    position: absolute;
    top: calc(var(--section-gap) / -2);
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
  }
}
.source-col h2 .stale {
  font-size: var(--step--1);
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text-muted);
  margin-left: 0;
}
.source-col ul {
  list-style: none;
  padding: 0 var(--space-2) 0 0;
  margin: 0;
  max-height: var(--col-height);
  overflow-y: auto;
}
.source-col li {
  margin: 0;
  padding: var(--item-py) 0;
  border-bottom: 1px solid var(--border);
}
.source-col li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.source-col li a {
  display: inline;
  color: var(--text-strong);
  text-decoration: none;
  font-size: var(--list-size);
  font-weight: 500;
  line-height: 1.25;
}
.source-col li a:hover {
  color: var(--accent);
  text-decoration: underline;
}
.source-col .byline {
  display: inline;
  margin: 0;
  font-size: var(--meta);
  line-height: 1.2;
  color: var(--gray-5);
}
.source-col .byline::before {
  content: " (";
}
.source-col .byline::after {
  content: ")";
}
.source-col li .tag {
  font-size: var(--meta);
}

body > header {
  width: 100%;
  padding-inline: max(var(--gutter), calc((100% - var(--canvas)) / 2 + var(--gutter)));
  padding-block: var(--space-5);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: var(--space-3);
}
/* Header: wordmark + status row (original markup) */
body > header nav {
  font-family: var(--font-sans);
  margin: 0;
  padding: 0;
}
.wordmark {
  letter-spacing: -0.02em;
}
.status {
  font-size: var(--step--1);
  color: var(--text-muted);
  display: flex;
  gap: var(--space-2);
  align-items: center;
}
#refresh {
  font: inherit;
  font-size: var(--step--1);
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px 8px;
  cursor: pointer;
}
#refresh:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.is-new {
  animation: ph-flash 3s ease-out;
}
@keyframes ph-flash {
  from {
    background: var(--accent-2);
  }
  to {
    background: transparent;
  }
}
