/*
 * Confluxys — style.css v1-revised
 * Clean v1 layout with better category/article distinction.
 */

/* ── Tokens ───────────────────────────────────────────── */
:root {
  --cx-night-0: #2E3440;
  --cx-night-1: #3B4252;
  --cx-night-2: #434C5E;
  --cx-night-3: #4C566A;
  --cx-snow-0: #D8DEE9;
  --cx-snow-1: #E5E9F0;
  --cx-snow-2: #ECEFF4;
  --cx-frost-0: #8FBCBB;
  --cx-frost-1: #88C0D0;
  --cx-frost-2: #81A1C1;
  --cx-frost-3: #5E81AC;
  --cx-aurora-red:    #BF616A;
  --cx-aurora-orange: #D08770;
  --cx-aurora-yellow: #EBCB8B;
  --cx-aurora-green:  #A3BE8C;
  --cx-aurora-purple: #B48EAD;
  --cx-font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --cx-font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
}

/* ── Reset ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--cx-font-body);
  background: var(--cx-night-0);
  color: var(--cx-snow-1);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--cx-aurora-orange);
  color: var(--cx-night-0);
}

a { color: var(--cx-frost-1); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--cx-frost-0); }

/* ── Layout ───────────────────────────────────────────── */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ── Header ───────────────────────────────────────────── */
.site-header {
  padding: 2rem 0 0;
  border-bottom: 1px solid var(--cx-night-3);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.header-mark { width: 36px; height: 45px; flex-shrink: 0; }

.header-title {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--cx-snow-2);
}
.header-title .ys { color: var(--cx-aurora-orange); }

.header-tagline {
  font-size: 0.8rem;
  font-style: italic;
  color: var(--cx-night-3);
  margin-left: auto;
}

/* ── Nav ──────────────────────────────────────────────── */
.site-nav {
  padding: 0.75rem 0;
}

.site-nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.site-nav a {
  display: block;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--cx-snow-0);
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}

.site-nav a:hover,
.site-nav a.active {
  background: var(--cx-night-2);
  color: var(--cx-snow-2);
}

/* ── Main ─────────────────────────────────────────────── */
main { padding: 2.5rem 0 4rem; }

/* ── Hero (index only) ────────────────────────────────── */
.hero {
  text-align: center;
  padding: 3rem 0 3.5rem;
  margin-bottom: 3rem;
  border-bottom: 1px solid var(--cx-night-2);
}

.hero-mark { width: 56px; height: 70px; margin-bottom: 1.5rem; }

/* SVG path draw-on animation */
.hero-mark .path-confluxis {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: drawPath 1s ease-out 0.2s forwards;
}

.hero-mark .path-confluxys {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: drawPath 1s ease-out 0.8s forwards;
}

@keyframes drawPath {
  to { stroke-dashoffset: 0; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero h1 {
  font-size: 2.5rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
  opacity: 0;
  animation: fadeIn 0.8s ease 1.5s forwards;
}
.hero h1 .ys { color: var(--cx-aurora-orange); }
.hero h1 .base { color: var(--cx-snow-2); }

.hero-sub {
  font-size: 1rem;
  color: var(--cx-snow-0);
  font-style: italic;
  margin-bottom: 1.75rem;
  opacity: 0;
  animation: fadeIn 0.8s ease 1.9s forwards;
}

.hero-rule {
  width: 60px;
  height: 2px;
  margin: 0 auto 2rem;
  background: linear-gradient(90deg, var(--cx-frost-3), var(--cx-aurora-orange));
  border: none;
  opacity: 0;
  animation: fadeIn 0.6s ease 2.3s forwards;
}

.hero-blurb {
  max-width: 580px;
  margin: 0 auto;
  font-size: 0.95rem;
  color: var(--cx-snow-0);
  line-height: 1.7;
  opacity: 0;
  animation: fadeIn 0.8s ease 2.6s forwards;
}

.hero-blurb strong { color: var(--cx-snow-2); font-weight: 600; }

/* ── Section titles ───────────────────────────────────── */
.section-heading {
  font-size: 0.7rem;
  font-family: var(--cx-font-mono);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cx-night-3);
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--cx-night-2);
}

h2.page-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--cx-snow-2);
  margin-bottom: 2rem;
}

/* ── Categories grid (compact pills on homepage) ──────── */
.categories-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 3rem;
}

.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 1rem;
  background: var(--cx-night-1);
  border: 1px solid var(--cx-night-3);
  border-radius: 4px;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s;
}

.category-pill:hover {
  background: var(--cx-night-2);
  border-color: var(--cx-frost-2);
}

.category-pill a {
  color: var(--cx-snow-2);
  font-weight: 500;
  font-size: 0.85rem;
}

.category-pill:hover a { color: var(--cx-aurora-orange); }

.category-pill .count {
  font-family: var(--cx-font-mono);
  font-size: 0.6rem;
  color: var(--cx-snow-0);
  background: var(--cx-night-2);
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  min-width: 1.4rem;
  text-align: center;
}

/* ── Article cards (list on homepage) ─────────────────── */
.article-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 2.5rem;
}

.article-card {
  background: var(--cx-night-1);
  padding: 1.25rem 1.5rem;
  transition: background 0.2s;
}

.article-card:hover { background: var(--cx-night-2); }

.article-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.article-card h3 a { color: var(--cx-snow-2); }
.article-card h3 a:hover { color: var(--cx-aurora-orange); }

.article-meta {
  font-family: var(--cx-font-mono);
  font-size: 0.7rem;
  color: var(--cx-night-3);
  letter-spacing: 0.03em;
}

.article-meta a { color: var(--cx-frost-2); }

.article-summary {
  margin-top: 0.4rem;
  font-size: 0.875rem;
  color: var(--cx-snow-0);
}

/* ── Category page (full card style for listing) ──────── */
.category-article-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 2px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 2.5rem;
}

.category-article-card {
  background: var(--cx-night-1);
  padding: 1.5rem;
  transition: background 0.2s;
}

.category-article-card:hover { background: var(--cx-night-2); }

.category-article-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.category-article-card h3 a { color: var(--cx-snow-2); }
.category-article-card h3 a:hover { color: var(--cx-aurora-orange); }

.category-article-card .article-meta { margin-bottom: 0.4rem; }

.category-article-card .article-summary {
  font-size: 0.85rem;
  color: var(--cx-snow-0);
  line-height: 1.5;
}

/* ── Webring ──────────────────────────────────────────── */
.webring {
  border: 1px solid var(--cx-night-3);
  border-radius: 6px;
  padding: 2rem;
  margin-bottom: 2.5rem;
}

.webring h2 {
  font-size: 0.7rem;
  font-family: var(--cx-font-mono);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cx-night-3);
  margin-bottom: 0.75rem;
}

.webring p {
  font-size: 0.875rem;
  color: var(--cx-snow-0);
  margin-bottom: 1.25rem;
}

.webring-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.webring-link {
  display: inline-block;
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--cx-snow-0);
  background: var(--cx-night-1);
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}

.webring-link:hover {
  background: var(--cx-night-2);
  color: var(--cx-snow-2);
}

/* ── Article page ─────────────────────────────────────── */
.back-link {
  display: inline-block;
  font-family: var(--cx-font-mono);
  font-size: 0.75rem;
  color: var(--cx-night-3);
  margin-bottom: 2rem;
  letter-spacing: 0.03em;
}

.back-link:hover { color: var(--cx-frost-1); }

.article-content {
  max-width: 680px;
}

.article-content h1 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--cx-snow-2);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.article-header-meta {
  font-family: var(--cx-font-mono);
  font-size: 0.75rem;
  color: var(--cx-night-3);
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--cx-night-2);
}

.article-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--cx-snow-2);
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}

.article-content h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--cx-snow-2);
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

.article-content p {
  font-size: 1rem;
  line-height: 1.75;
  margin-bottom: 1.25rem;
  color: var(--cx-snow-1);
}

.article-content a { border-bottom: 1px solid transparent; }
.article-content a:hover { border-bottom-color: var(--cx-frost-1); }

.article-content strong { color: var(--cx-snow-2); font-weight: 600; }
.article-content em { color: var(--cx-snow-0); }

.article-content ul, .article-content ol {
  margin: 0 0 1.25rem 1.5rem;
  color: var(--cx-snow-1);
}

.article-content li {
  margin-bottom: 0.35rem;
  line-height: 1.65;
}

.article-content blockquote {
  border-left: 3px solid var(--cx-aurora-orange);
  padding: 0.75rem 0 0.75rem 1.25rem;
  margin: 1.5rem 0;
  color: var(--cx-snow-2);
  font-weight: 500;
}

.article-content code {
  font-family: var(--cx-font-mono);
  font-size: 0.875em;
  background: var(--cx-night-1);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  color: var(--cx-frost-0);
}

.article-content pre {
  background: var(--cx-night-1);
  border: 1px solid var(--cx-night-3);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  overflow-x: auto;
}

.article-content pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--cx-snow-0);
}

.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.article-content th {
  text-align: left;
  padding: 0.6rem 1rem;
  border-bottom: 2px solid var(--cx-night-3);
  color: var(--cx-snow-2);
  font-weight: 600;
  font-size: 0.8rem;
}

.article-content td {
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--cx-night-2);
  color: var(--cx-snow-0);
}

.article-content tr:hover td { background: var(--cx-night-1); }

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

.article-content hr {
  border: none;
  height: 1px;
  background: var(--cx-night-3);
  margin: 2.5rem 0;
}

/* ── Footer ───────────────────────────────────────────── */
.site-footer {
  padding: 2.5rem 0;
  border-top: 1px solid var(--cx-night-3);
  text-align: center;
}

.footer-rule {
  width: 60px;
  height: 2px;
  margin: 0 auto 1.25rem;
  background: linear-gradient(90deg, var(--cx-frost-3), var(--cx-aurora-orange));
  border: none;
}

.site-footer p {
  font-family: var(--cx-font-mono);
  font-size: 0.7rem;
  color: var(--cx-night-3);
  letter-spacing: 0.04em;
}

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 640px) {
  .header-tagline { display: none; }
  .hero h1 { font-size: 2rem; }
  .hero-mark { width: 44px; height: 55px; }
  .categories-grid { gap: 0.35rem; }
  .category-pill { padding: 0.4rem 0.75rem; }
  .webring-links { flex-direction: column; }
  .webring-link { text-align: center; }
}
