/* Styles specific to article pages */

/* Article layout */
.article-container {
  max-width: min(1100px, 65ch); /* limit line length and cap width */
  width: calc(100% - 2rem);
  margin: 1.25rem auto;
  background: var(--article-bg);
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 6px 18px var(--article-shadow);
  color: var(--text-color);
  box-sizing: border-box;
  /* match nav's backdrop for a unified translucent surface */
  backdrop-filter: var(--surface-blur, blur(6px));
} 

.article-content pre {
  background: var(--code-bg);
}

.article-meta { color: var(--muted-color); }

.article-content { color: var(--text-color); }

.article-footer { color: var(--muted-color); }
.article-meta { color: var(--muted-color); }

.article-content { color: var(--text-color); }

.article-footer { color: var(--muted-color); }
@media (min-width: 1400px) {
  .article-container { max-width: 1300px; padding: 3rem 3.5rem; }
}

.article-header {
  margin-bottom: 1rem;
}

.article-header h1 {
  font-size: 2.25rem;
  line-height: 1.05;
  margin-bottom: 0.25rem;
}

.article-meta {
  color: var(--muted-color);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.article-description {
  color: var(--text-color);
  opacity: 0.95;
  margin-bottom: 1.25rem;
}

.article-content {
  text-align: left;
  line-height: 1.8;
  font-size: 1.05rem;
  color: var(--text-color);
}

.article-content h2,
.article-content h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.article-content p {
  margin-bottom: 1rem;
}

/* Lists: keep bullets inside article padding and aligned nicely */
.article-content ul,
.article-content ol {
  margin: 0 0 1rem 1.25rem; /* top/right/bottom/left */
  padding: 0;
  list-style-position: outside;
}

.article-content li {
  margin-bottom: 0.5rem;
}

.article-content ul ul,
.article-content ol ol {
  margin-left: 1rem;
}

.article-content pre {
  background: var(--code-bg);
  padding: 1.1rem 1.2rem;
  border-radius: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, 'Roboto Mono', 'Courier New', monospace;
  font-size: 0.95rem;
  line-height: 1.6;
  white-space: pre;
}
@media (max-width: 640px) {
  .article-content pre { white-space: pre-wrap; word-break: break-word; }
}
.article-content pre code { background: transparent; padding: 0; display: block; }
.article-content pre code { background: transparent; padding: 0; display: block; }

.article-content code {
  background: var(--inline-code-bg);
  padding: 0.12rem 0.5rem;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, 'Roboto Mono', 'Courier New', monospace;
  font-size: 0.95em;
  vertical-align: baseline;
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

.article-content table th,
.article-content table td {
  border: 1px solid var(--border-muted);
  padding: 0.6rem;
}

.article-content blockquote {
  border-left: 4px solid var(--border-muted);
  padding: 0.75rem 1rem;
  margin: 1rem 0;
  background: rgba(0,0,0,0.06);
}

.article-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0.75rem auto;
  border-radius: 6px;
}

/* Make tables horizontally scrollable on small screens without changing markup */
.article-content table {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Improve touch targets for nav and buttons */
.site-nav a, .theme-toggle, .aoc-nav a { padding: 0.45rem 0.6rem; min-height: 44px; display: inline-flex; align-items: center; }

/* Responsive heading sizing */
.article-header h1 { font-size: clamp(1.6rem, 4.5vw, 2.25rem); }

/* Slightly tighter spacing on very small screens */
@media (max-width: 640px) {
  .article-container { padding: 0.9rem; margin: 0.5rem; }
  .article-content { font-size: 1rem; line-height: 1.5; }
}


.article-footer {
  margin-top: 2rem;
  color: var(--muted-color);
  font-size: 0.95rem;
  border-top: 1px solid var(--border-muted);
  padding-top: 1rem;
}

/* Article list / index */
.post-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-card {
  background: var(--article-bg);
  padding: 1rem;
  border-radius: 10px;
  min-height: 140px;
}

.post-card h3 {
  margin: 0 0 0.5rem 0;
}

.post-card p.excerpt {
  margin-top: 0.5rem;
  color: var(--muted-color);
}

/* Small screens tweaks */
@media (max-width: 640px) {
  .article-header h1 { font-size: 1.6rem; }
  .article-container { padding: 1rem; margin: 0.5rem; }
}

/* Prevent long unbroken strings (URLs) from breaking layout on small screens */
.article-container, .article-content { min-width: 0; }
.article-content a,
.article-content p,
.article-content li,
.article-content td,
.article-content th,
.article-content code,
.article-content pre {
  overflow-wrap: anywhere;
  word-break: break-word;
  -webkit-hyphens: auto;
  hyphens: auto;
}

/* Collapsible code blocks for mobile */
.collapsible-code { margin: 0.65rem 0; border-radius: 8px; overflow: hidden; }
.collapsible-code summary {
  list-style: none;
  cursor: pointer;
  background: rgba(0,0,0,0.04);
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border-muted);
}
.collapsible-code summary::-webkit-details-marker { display: none; }
.collapsible-code pre { margin: 0; padding: 1rem; border-radius: 0; }

/* Make sure summary looks like a small button on light/dark */
.collapsible-code summary { color: inherit; }

@media (prefers-reduced-motion: reduce) {
  .collapsible-code, .collapsible-code summary { transition: none; }
} 

/* AoC day nav */
.aoc-nav{
  display:flex;
  justify-content:space-between;
  gap:1rem;
  margin-top:1rem;
}
.aoc-nav a{ color: var(--accent); text-decoration:none; padding:0.2rem 0.5rem; border-radius:4px; }
.aoc-nav a:focus{ outline: 2px solid var(--accent); outline-offset:3px }
.aoc-nav a.prev{ text-align:left }
.aoc-nav a.next{ text-align:right }
