/* === Template 4 — Full-width / Magazine with Hero === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&family=Source+Serif+4:ital,wght@0,400;0,600;1,400&display=swap');

:root {
  --bg: #f8f7f4;
  --bg-white: #ffffff;
  --text: #1e1e1e;
  --text-mid: #444444;
  --text-muted: #888888;
  --border: #e4e0d8;
  --accent: #e63946;
  --accent-hover: #c1121f;
  --accent-light: #fff1f2;
  --header-bg: #1e1e1e;
  --hero-overlay: rgba(15,15,15,0.72);
  --toc-bg: #f1ede6;
  --font-head: 'Montserrat', -apple-system, sans-serif;
  --font-body: 'Source Serif 4', Georgia, serif;
}

html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); line-height: 1.75; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
img { max-width: 100%; height: auto; display: block; }

/* === Progress bar === */
#progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: var(--accent);
  width: 0%;
  z-index: 9999;
  transition: width 0.1s linear;
}

/* === Header === */
#masthead {
  background: var(--header-bg);
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header-inner {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}
.site-title {
  font-family: var(--font-head);
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}
.site-title span { color: var(--accent); }
.site-title:hover { text-decoration: none; opacity: 0.9; }
nav.main-nav ul { list-style: none; display: flex; gap: 6px; }
nav.main-nav a {
  font-family: var(--font-head);
  font-size: 0.78rem;
  font-weight: 600;
  color: #aaaaaa;
  padding: 6px 10px;
  border-radius: 4px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
nav.main-nav a:hover { color: #fff; background: rgba(255,255,255,0.08); text-decoration: none; }

/* === Hero === */
.post-hero {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  position: relative;
  overflow: hidden;
  padding: 80px 32px 64px;
}
.post-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 40px,
    rgba(255,255,255,0.015) 40px,
    rgba(255,255,255,0.015) 80px
  );
}
.post-hero-inner {
  max-width: 860px;
  margin: 0 auto;
  position: relative;
}
.hero-label {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-head);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 2px;
  margin-bottom: 20px;
}
.hero-title {
  font-family: var(--font-head);
  font-size: 2.6rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}
.hero-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  font-family: var(--font-head);
  font-size: 0.78rem;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.02em;
}
.hero-meta .sep { color: rgba(255,255,255,0.2); }
.hero-meta a { color: rgba(255,255,255,0.55); }
.hero-meta a:hover { color: #fff; text-decoration: none; }

/* === Page layout — full width, no sidebar === */
#page { max-width: 860px; margin: 0 auto; padding: 0 24px 80px; }

/* === TOC === */
.toc {
  background: var(--toc-bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 24px 28px;
  margin: 36px 0 40px;
}
.toc-title {
  font-family: var(--font-head);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.toc ol {
  padding-left: 1.2em;
  list-style: decimal;
}
.toc li {
  margin-bottom: 6px;
  font-family: var(--font-head);
  font-size: 0.88rem;
  font-weight: 500;
}
.toc a { color: var(--text); }
.toc a:hover { color: var(--accent); text-decoration: none; }

/* === Article content === */
.entry-content {
  font-size: 1.05rem;
  line-height: 1.85;
  color: var(--text-mid);
}
.entry-content p { margin-bottom: 1.5em; }

.entry-content h2 {
  font-family: var(--font-head);
  font-size: 1.45rem;
  font-weight: 800;
  margin: 2.5em 0 0.8em;
  color: var(--text);
  letter-spacing: -0.02em;
  padding-top: 0.5em;
  border-top: 2px solid var(--border);
}
.entry-content h3 {
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 700;
  margin: 1.8em 0 0.6em;
  color: var(--text);
}

.entry-content ul, .entry-content ol {
  padding-left: 1.6em;
  margin-bottom: 1.5em;
}
.entry-content li { margin-bottom: 0.5em; }
.entry-content strong { font-weight: 700; color: var(--text); font-family: var(--font-head); }

.entry-content table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-head);
  font-size: 0.87rem;
  margin-bottom: 2em;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.entry-content th {
  background: var(--header-bg);
  color: #fff;
  padding: 12px 16px;
  text-align: left;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.entry-content td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-mid);
}
.entry-content tr:last-child td { border-bottom: none; }
.entry-content tr:nth-child(even) td { background: #faf9f6; }

.entry-content blockquote {
  position: relative;
  padding: 24px 28px 24px 40px;
  margin: 2em 0;
  background: var(--accent-light);
  border-radius: 8px;
  font-style: italic;
  color: var(--text-mid);
  font-size: 1.05rem;
}
.entry-content blockquote::before {
  content: '"';
  position: absolute;
  left: 14px;
  top: 10px;
  font-size: 3rem;
  color: var(--accent);
  font-family: Georgia, serif;
  line-height: 1;
}

/* === Info box === */
.info-box {
  background: #f0f7ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 20px 24px;
  margin: 1.8em 0;
  font-family: var(--font-head);
  font-size: 0.9rem;
  color: #1e3a5f;
}
.info-box strong { color: #1d4ed8; }

/* === Entry footer === */
.entry-footer {
  font-family: var(--font-head);
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 2px solid var(--border);
  margin-top: 48px;
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.entry-footer a {
  display: inline-block;
  background: var(--bg);
  color: var(--text-mid);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 0.77rem;
  font-weight: 600;
  margin: 2px 4px 2px 0;
}
.entry-footer a:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  text-decoration: none;
}

/* === Homepage: 2-column grid === */
.posts-header {
  padding: 40px 0 28px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 32px;
}
.posts-header h1 {
  font-family: var(--font-head);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.posts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}
.post-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.1);
}
.post-card-body { padding: 22px 22px 18px; }
.post-card-label {
  font-family: var(--font-head);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
  display: block;
}
.post-card .entry-title {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
.post-card .entry-title a { color: inherit; }
.post-card .entry-title a:hover { color: var(--accent); text-decoration: none; }
.post-card .excerpt {
  font-family: var(--font-head);
  font-size: 0.83rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 14px;
}
.post-card-meta {
  font-family: var(--font-head);
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.post-card-meta .sep { color: var(--border); }
.post-card:first-child {
  grid-column: 1 / -1;
}
.post-card:first-child .post-card-body { padding: 28px 28px 22px; }
.post-card:first-child .entry-title { font-size: 1.4rem; }
.post-card:first-child .excerpt { font-size: 0.9rem; }

/* === Homepage layout (no sidebar) === */
#page-home { max-width: 1100px; margin: 0 auto; padding: 0 24px 80px; }

/* === Footer === */
#colophon {
  background: var(--header-bg);
  padding: 28px;
  text-align: center;
  font-family: var(--font-head);
  font-size: 0.78rem;
  color: #666;
  letter-spacing: 0.02em;
}
#colophon a { color: #666; }
#colophon a:hover { color: var(--accent); }

/* === Responsive === */
@media (max-width: 720px) {
  .hero-title { font-size: 1.8rem; }
  .posts-grid { grid-template-columns: 1fr; }
  .post-card:first-child { grid-column: auto; }
  .site-header-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
  nav.main-nav ul { flex-wrap: wrap; gap: 2px; }
  #masthead { position: static; }
}
