:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #18212b;
  --muted: #5d6874;
  --border: #e3e6ea;
  --brand: #5f6b78;
  --accent: #1f5f8b;
  --accent-2: #2b86c5;
  --accent-soft: #e6f0f8;
  --hero-from: #10324d;
  --hero-to: #1f6fa8;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
  --shadow-hover: 0 2px 4px rgba(16, 24, 40, .06), 0 16px 40px rgba(16, 24, 40, .12);
  --radius: 16px;
  --font-head: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --surface: #171e26;
    --text: #e8edf2;
    --muted: #9aa6b2;
    --border: #26303b;
    --accent: #6cb4ec;
    --accent-2: #8cc8f4;
    --accent-soft: #16293a;
    --hero-from: #0b2236;
    --hero-to: #164f78;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, .3), 0 16px 40px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--font-head); letter-spacing: -0.01em; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 760px; }

/* Header & footer */

header.site {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 68px;
}

.brand { display: block; line-height: 0; }
.brand img { height: 36px; width: auto; }

@media (prefers-color-scheme: dark) {
  .brand img, footer.site img { filter: brightness(0) invert(.92); }
}

.tagline {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--muted);
}

footer.site {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  padding: 28px 0;
  margin-top: 64px;
}

footer.site .wrap { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
footer.site img { height: 22px; width: auto; opacity: .8; }

/* Hero */

.hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(900px 400px at 85% -10%, rgba(255, 255, 255, .16), transparent 60%),
    radial-gradient(600px 300px at 0% 120%, rgba(43, 134, 197, .55), transparent 60%),
    linear-gradient(120deg, var(--hero-from), var(--hero-to));
  padding: 56px 0 120px;
}

.hero::after {
  /* Soft "G" ring echoing the logo */
  content: "";
  position: absolute;
  right: -80px;
  top: -60px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  border: 56px solid rgba(255, 255, 255, .07);
}

.hero .eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .78rem;
  font-weight: 600;
  opacity: .8;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4.5vw, 3rem);
  line-height: 1.12;
  font-weight: 800;
  max-width: 720px;
}

.hero .lead { margin: 16px 0 0; max-width: 560px; opacity: .85; font-size: 1.05rem; }

.hero.slim { padding: 40px 0 44px; }
.hero.slim h1 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); }

/* Featured (latest) post */

.featured { margin-top: -84px; position: relative; z-index: 1; }

.featured-card {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  background: var(--surface);
  border-radius: 22px;
  box-shadow: var(--shadow-hover);
  overflow: hidden;
  color: var(--text);
  transition: transform .25s ease, box-shadow .25s ease;
}

.featured-card:hover { text-decoration: none; transform: translateY(-3px); }

.featured-media {
  background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--bg);
  padding: 36px 28px;
  display: flex;
  align-items: center;
}

.window {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 20px 50px rgba(16, 40, 64, .22);
  transform: rotate(-1.5deg);
  transition: transform .35s ease;
}

.featured-card:hover .window { transform: rotate(0deg) scale(1.02); }

.window-bar { display: flex; gap: 6px; padding: 10px 12px; background: #e9edf1; }
.window-bar i { width: 10px; height: 10px; border-radius: 50%; background: #ff5f57; }
.window-bar i:nth-child(2) { background: #febc2e; }
.window-bar i:nth-child(3) { background: #28c840; }

@media (prefers-color-scheme: dark) {
  .window-bar { background: #222b35; }
}

.window-img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; }

.featured-text { padding: 40px 40px 36px; display: flex; flex-direction: column; justify-content: center; }

.badge {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #b4530f;
  background: #fff1e5;
  border-radius: 999px;
  padding: 5px 12px 5px 10px;
  margin-bottom: 16px;
}

.badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f07a1a;
  box-shadow: 0 0 0 0 rgba(240, 122, 26, .6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(240, 122, 26, 0); }
  100% { box-shadow: 0 0 0 0 rgba(240, 122, 26, 0); }
}

@media (prefers-color-scheme: dark) {
  .badge { background: #3a2312; color: #ffb27a; }
}

.featured-text h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); line-height: 1.2; margin: 10px 0 12px; font-weight: 800; }
.featured-text p { color: var(--muted); margin: 0 0 22px; font-size: 1.02rem; }

.read-more {
  align-self: flex-start;
  font-family: var(--font-head);
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 10px;
  padding: 11px 18px;
  transition: background .2s ease;
}

.read-more span { display: inline-block; transition: transform .2s ease; }
.featured-card:hover .read-more { background: var(--accent-2); }
.featured-card:hover .read-more span { transform: translateX(4px); }

@media (prefers-color-scheme: dark) {
  .read-more { color: #0f1419; }
}

/* Meta & tags */

.meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .82rem; color: var(--muted); }

.tag {
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 2px 10px;
  font-weight: 600;
}

/* Timeline list */

.list { margin-top: 56px; }

.section-title { font-size: 1.3rem; margin: 0 0 8px; }

.year {
  font-size: .85rem;
  margin: 32px 0 14px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 12px;
}

.year span {
  background: var(--text);
  color: var(--bg);
  border-radius: 999px;
  padding: 3px 12px;
  font-weight: 800;
  letter-spacing: .04em;
}

.year::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }

.timeline::before {
  content: "";
  position: absolute;
  left: 31px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}

.item { display: grid; grid-template-columns: 64px 1fr; gap: 18px; margin-bottom: 16px; position: relative; }

.date {
  position: relative;
  z-index: 1;
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-family: var(--font-head);
  transition: border-color .2s ease, color .2s ease;
}

.date .day { font-size: 1.45rem; font-weight: 800; }
.date .month { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-top: 4px; }

.item-card {
  display: grid;
  grid-template-columns: 1fr 150px;
  gap: 20px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 18px 18px 22px;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.item-card:hover { text-decoration: none; transform: translateX(4px); box-shadow: var(--shadow-hover); border-color: var(--accent); }
.item:hover .date { border-color: var(--accent); color: var(--accent); }

.item-card h3 { font-size: 1.12rem; line-height: 1.3; margin: 8px 0 6px; }
.item-card p { margin: 0; color: var(--muted); font-size: .94rem; }

.mins::before { content: "·"; margin-right: 8px; }

.item-thumb {
  width: 150px;
  height: 100px;
  border-radius: 10px;
  object-fit: contain;
  background: var(--bg);
  border: 1px solid var(--border);
}

.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 2rem;
  color: #fff;
  background: linear-gradient(135deg, var(--hero-from), var(--hero-to));
}

/* Pager */

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 36px;
  flex-wrap: wrap;
}

.pager .nums { display: flex; gap: 6px; }

.pager .num, .pager .step {
  font-family: var(--font-head);
  font-weight: 700;
  border-radius: 10px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: .92rem;
}

.pager a:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.pager .num.current { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager .step.disabled { opacity: .4; }
.pager-info { text-align: center; color: var(--muted); font-size: .85rem; margin: 14px 0 0; }

@media (prefers-color-scheme: dark) {
  .pager .num.current { color: #0f1419; }
}

/* Post page */

.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 20; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #f07a1a); }

.post-hero {
  background: linear-gradient(180deg, var(--accent-soft), var(--bg));
  padding: 32px 0 28px;
  margin-bottom: 8px;
}

.post-hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.15; margin: 14px 0 12px; font-weight: 800; }

.back { display: inline-block; margin-bottom: 18px; font-size: .92rem; font-weight: 600; }

.byline { color: var(--muted); font-size: .9rem; margin: 0; display: flex; gap: 16px; flex-wrap: wrap; }

article p { margin: 0 0 1.1em; font-size: 1.05rem; }

article .body { overflow-wrap: anywhere; }

article .body img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
  margin: 16px 0;
}

article .body h2 { font-size: 1.5rem; margin: 2.2em 0 .6em; }
article .body h3, article .body h4, article .body h5 { margin: 1.6em 0 .5em; }
article .body li { margin-bottom: .4em; }
article .body table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
article .body td, article .body th { border: 1px solid var(--border); padding: 6px 10px; }
article .body blockquote { border-left: 3px solid var(--accent); margin: 1em 0; padding: 0 0 0 16px; color: var(--muted); }
article .body h2[id], article .body h3[id] { scroll-margin-top: 84px; }

article .body figure { margin: 20px 0 24px; }
article .body figure img { margin: 0; border: 1px solid var(--border); box-shadow: var(--shadow); }
article .body figcaption { color: var(--muted); font-size: .88rem; margin-top: 8px; }

.callout {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 20px 0;
}

.callout p { margin: 0; }
.callout.warn { background: #fdf0e6; border-left-color: #d9731f; }
.callout.danger { background: #fdecec; border-left-color: #c62828; }
.callout.next { background: #e9f6ee; border-left-color: #2e8b57; }

@media (prefers-color-scheme: dark) {
  .callout.warn { background: #3a2715; }
  .callout.danger { background: #3b1a1a; }
  .callout.next { background: #16301f; }
}

.link-list { list-style: none; padding: 0; margin: 16px 0 0; }

.link-list li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 10px;
}

.link-list a { font-weight: 600; display: block; }
.link-list span { color: var(--muted); font-size: .95rem; }

.checklist { list-style: none; padding: 0; }
.checklist li { padding-left: 28px; position: relative; }
.checklist li::before { content: "✓"; position: absolute; left: 4px; color: var(--accent); font-weight: 700; }

.toc li { margin-bottom: .2em; }

.source { color: var(--muted); font-size: .95rem; }

.origin {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .9rem;
}

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 48px; }

.post-nav a {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  color: var(--text);
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.35;
}

.post-nav a span { display: block; font-size: .78rem; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.post-nav a:hover { text-decoration: none; border-color: var(--accent); }
.post-nav .newer { text-align: right; }

/* Small screens */

@media (max-width: 760px) {
  .featured-card { grid-template-columns: 1fr; }
  .featured-media { padding: 24px 20px; }
  .featured-text { padding: 24px 22px 28px; }
  .item-card { grid-template-columns: 1fr; }
  .item-thumb { display: none; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .newer { text-align: left; }
}

@media (max-width: 480px) {
  .tagline { display: none; }
  .item { grid-template-columns: 52px 1fr; gap: 12px; }
  .date { width: 52px; height: 56px; }
  .timeline::before { left: 25px; }
  .pager .step { flex: 1; text-align: center; }
  .pager .nums { order: -1; width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
