@import url("https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,600;0,9..40,700;1,9..40,400&family=Fraunces:opsz,wght@9..144,500;9..144,700&display=swap");

:root {
  --ink: #0e1a24;
  --muted: #5a6b78;
  --paper: #eef3f6;
  --panel: rgba(255, 255, 255, 0.78);
  --line: rgba(14, 26, 36, 0.12);
  --teal: #0f8a7a;
  --teal-deep: #0a5f54;
  --glow: #7fd9c7;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "DM Sans", "Avenir Next", sans-serif;
  --radius: 1.25rem;
  --shadow: 0 18px 50px rgba(14, 26, 36, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(900px 420px at 8% -8%, rgba(127, 217, 199, 0.45), transparent 60%),
    radial-gradient(700px 360px at 96% 4%, rgba(15, 138, 122, 0.18), transparent 55%),
    linear-gradient(180deg, #f7fafb 0%, var(--paper) 40%, #e7eef2 100%);
  line-height: 1.7;
  min-height: 100vh;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(14, 26, 36, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14, 26, 36, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
  z-index: 0;
}
a { color: var(--teal-deep); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--teal); }

.wrap { width: min(1120px, calc(100% - 2rem)); margin: 0 auto; position: relative; z-index: 1; }

.site-header {
  padding: 2.75rem 0 1.75rem;
  animation: rise 0.7s ease both;
}
.brand-block { display: grid; gap: 0.35rem; margin-bottom: 1.25rem; }
.brand {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--ink);
  text-decoration: none;
  text-underline-offset: 0;
}
.brand span { color: var(--teal); }
.tagline {
  margin: 0;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.05rem;
}
.nav-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  align-items: center;
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.nav-bar a {
  position: relative;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.nav-bar a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.25rem;
  width: 100%;
  height: 2px;
  background: var(--teal);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.nav-bar a:hover::after,
.nav-bar a.is-active::after { transform: scaleX(1); }
.flash {
  margin: 0.85rem 0 0;
  color: var(--teal-deep);
  font-weight: 600;
  animation: rise 0.45s ease both;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 2.5rem;
  padding: 2.25rem 0 3.5rem;
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
}

.content { animation: rise 0.8s 0.08s ease both; }
.sidebar { animation: rise 0.8s 0.16s ease both; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.1rem;
}

.post-list { display: grid; gap: 0; }
.post-item__cover {
  display: block;
  margin: 0 0 0.75rem;
  border-radius: 4px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #e8eef2;
}
.post-item__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.post__cover {
  margin: 0 0 1.25rem;
  border-radius: 4px;
  overflow: hidden;
  background: #e8eef2;
}
.post__cover img {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  display: block;
}
.post-item {
  padding: 1.35rem 0;
  border-bottom: 1px solid var(--line);
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.post-item:first-child { padding-top: 0.25rem; }
.post-item:hover { transform: translateX(4px); }
.post-item h2 {
  margin: 0 0 0.4rem;
  font-family: var(--serif);
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.post-item h2 a { color: inherit; text-decoration: none; }
.post-item h2 a:hover { color: var(--teal-deep); }
.meta { color: var(--muted); font-size: 0.92rem; margin: 0 0 0.55rem; }
.excerpt { margin: 0; color: #243442; }

.category-hero { margin-bottom: 1.25rem; }
.category-hero__cover {
  margin: 0 0 1rem;
  border-radius: calc(var(--radius) - 0.35rem);
  overflow: hidden;
}
.category-hero__cover img {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  display: block;
}
.category-hero__intro {
  margin: 0 0 0.75rem;
  color: #243442;
  line-height: 1.7;
}

.page-title {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  margin: 0 0 1rem;
  letter-spacing: -0.03em;
}

/* Semantic article */
.post.panel,
.post {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding: 1.5rem 1.65rem 1.85rem;
  margin-bottom: 1.1rem;
}
.post__header { margin-bottom: 1.25rem; }
.post__title {
  font-family: var(--serif);
  font-size: clamp(1.9rem, 3.2vw, 2.55rem);
  margin: 0 0 0.65rem;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.post__meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}
.post__meta time { font-variant-numeric: tabular-nums; }
.post__category { font-weight: 600; text-decoration: none; }
.post__category:hover { color: var(--teal); }

.post__toc {
  margin: 0 0 1.5rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: rgba(15, 138, 122, 0.06);
}
.post__toc-title {
  margin: 0 0 0.65rem;
  font-family: var(--serif);
  font-size: 1.05rem;
}
.post__toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.35rem;
}
.post__toc-item a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.92rem;
}
.post__toc-item a:hover { color: var(--teal-deep); }
.post__toc-item--h3 { padding-left: 0.85rem; }
.post__toc-item--h4 { padding-left: 1.7rem; }

.post__paywall {
  margin-top: 1.5rem;
  padding: 1.1rem 1.25rem;
  border: 1px solid rgba(15, 138, 122, 0.28);
  background: rgba(15, 138, 122, 0.06);
}
.post__paywall-title {
  margin: 0 0 0.4rem;
  font-size: 1.1rem;
}
.post__paywall .button {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.55rem 1rem;
  border-radius: 0.4rem;
  background: var(--teal-deep, #0f8a7a);
  color: #fff;
  text-decoration: none;
}

.post__content {
  font-size: 1.08rem;
  line-height: 1.8;
}
.post__content > *:first-child { margin-top: 0; }
.post__content h2,
.post__content h3,
.post__content h4 {
  font-family: var(--serif);
  letter-spacing: -0.02em;
  line-height: 1.3;
  scroll-margin-top: 1.25rem;
}
.post__content h2 { font-size: 1.55rem; margin: 1.75rem 0 0.75rem; }
.post__content h3 { font-size: 1.28rem; margin: 1.45rem 0 0.6rem; }
.post__content h4 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; }
.post__content p { margin: 0 0 1rem; }
.post__content img { max-width: 100%; height: auto; border-radius: 0.75rem; }
.post__content pre {
  overflow-x: auto;
  padding: 1rem 1.1rem;
  border-radius: 0.85rem;
  background: #0e1a24;
  color: #e8f2f0;
  font-size: 0.9rem;
}
.post__content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}
.post__content :not(pre) > code {
  padding: 0.1em 0.35em;
  border-radius: 0.35rem;
  background: rgba(14, 26, 36, 0.06);
}
.post__content blockquote {
  margin: 1rem 0;
  padding: 0.15rem 0 0.15rem 1rem;
  border-left: 3px solid var(--teal);
  color: var(--muted);
}
.post__footer { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.post__tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; }

.comments { margin-top: 0.25rem; }
.comments__title {
  font-family: var(--serif);
  font-size: 1.5rem;
  margin: 0 0 1rem;
}
.comment__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: baseline;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}
.comment__author { color: var(--ink); }
a.comment__author { text-decoration: none; }
a.comment__author:hover { color: var(--teal); }
.comment__body { color: #243442; }

.article-body .body { font-size: 1.05rem; }
.article-body .body > *:first-child { margin-top: 0; }
.article-body img { max-width: 100%; height: auto; border-radius: 0.75rem; }
.tag-cloud a,
.chip {
  display: inline-block;
  margin: 0 0.35rem 0.35rem 0;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(15, 138, 122, 0.08);
  color: var(--teal-deep);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}

.sidebar .panel h3 {
  margin: 0 0 0.75rem;
  font-family: var(--serif);
  font-size: 1.15rem;
}
.sidebar ul { margin: 0; padding: 0; list-style: none; }
.sidebar li { margin: 0.45rem 0; }
.sidebar li a { text-decoration: none; color: var(--ink); font-weight: 600; }
.sidebar li a:hover { color: var(--teal); }
.sidebar .note { color: var(--muted); font-size: 0.92rem; margin: 0; }

.comment {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
}
.comment:last-of-type { border-bottom: 0; }

form.stack label { display: block; margin: 0.85rem 0 0.3rem; font-weight: 600; }
form.stack input,
form.stack textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  padding: 0.75rem 0.9rem;
  font: inherit;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
form.stack input:focus,
form.stack textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 138, 122, 0.15);
}
form.stack button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
  background: linear-gradient(135deg, var(--teal), var(--teal-deep));
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1.35rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 10px 24px rgba(15, 138, 122, 0.25);
}
form.stack button:hover,
.btn:hover { transform: translateY(-1px); }

.pagination { margin-top: 1.5rem; }
.pagination nav { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.site-footer {
  padding: 1.5rem 0 3rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.92rem;
}
.site-footer a { color: inherit; }

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

@media (max-width: 860px) {
  .wrap { width: calc(100% - 1.25rem); }
  .site-header { padding: 1.15rem 0 0.65rem; }
  .brand-block { margin-bottom: 0.75rem; gap: 0.2rem; }
  .brand { font-size: clamp(1.7rem, 8vw, 2.15rem); }
  .tagline { font-size: 0.92rem; max-width: none; }
  .nav-bar {
    gap: 0.45rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.55rem 0;
    scrollbar-width: none;
    border-block-width: 1px;
  }
  .nav-bar::-webkit-scrollbar { display: none; }
  .nav-bar a {
    flex: 0 0 auto;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    background: rgba(15, 138, 122, 0.1);
    font-size: 0.86rem;
  }
  .nav-bar a::after { display: none; }
  .layout {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 1.1rem 0 2rem;
  }
  .content, .sidebar { animation: none; }
  .panel {
    padding: 0.95rem 1rem;
    border-radius: 1rem;
    box-shadow: none;
    margin-bottom: 0.75rem;
  }
  .post-item {
    padding: 0.95rem 0;
  }
  .post-item:hover { transform: none; }
  .post-item h2 { font-size: 1.28rem; }
  .page-title { font-size: 1.5rem; margin-bottom: 0.75rem; }
  .excerpt { font-size: 0.95rem; }
  .sidebar .panel h3 { font-size: 1rem; margin-bottom: 0.55rem; }
  .sidebar ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
  }
  .sidebar li { margin: 0; }
  .sidebar li a {
    display: inline-block;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(14, 26, 36, 0.05);
    font-size: 0.86rem;
  }
  .sidebar .note { font-size: 0.86rem; }
  form.stack input,
  form.stack textarea,
  form.stack button { font-size: 1rem; }
  form.stack button { width: 100%; margin-top: 0.85rem; }
  .site-footer { padding: 1rem 0 2rem; font-size: 0.85rem; }
  body::before { opacity: 0.12; background-size: 28px 28px; }
}

@media (max-width: 480px) {
  .wrap { width: calc(100% - 1rem); }
  .brand { font-size: 1.55rem; }
  .meta { font-size: 0.82rem; }
  .article-body .body { font-size: 0.98rem; line-height: 1.7; }
  .chip { font-size: 0.8rem; padding: 0.15rem 0.55rem; }
}

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