@import url("https://fonts.googleapis.com/css2?family=Fraunces:wght@600;700&family=IBM+Plex+Sans:wght@400;500;600&family=Source+Serif+4:opsz,wght@8..60,400;8..60,500;8..60,600;8..60,700&display=swap");

:root {
  color-scheme: light dark;
  --bg: #0a1221;
  --fg: #e6eefc;
  --muted: #9db0ca;
  --card: #111c30;
  --link: #7ab8ff;
  --border: rgba(255, 255, 255, 0.12);
  --accent: #3b82f6;
  --shadow: rgba(4, 10, 20, 0.55);
  --max: 1200px;
  --font-body: "Source Serif 4", "Georgia", serif;
  --font-display: "Fraunces", "Source Serif 4", serif;
  --font-ui: "IBM Plex Sans", "Helvetica Neue", sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f2f6ff;
    --fg: #0f172a;
    --muted: #4b607a;
    --card: #ffffff;
    --link: #1d4ed8;
    --border: rgba(15, 23, 42, 0.12);
    --accent: #2563eb;
    --shadow: rgba(15, 23, 42, 0.1);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-body);
  line-height: 1.7;
  background:
    radial-gradient(1200px 900px at 12% -10%, color-mix(in oklab, var(--card), var(--link) 20%), transparent 60%),
    radial-gradient(900px 700px at 100% -20%, color-mix(in oklab, var(--card), var(--accent) 18%), transparent 55%),
    var(--bg);
  color: var(--fg);
  font-optical-sizing: auto;
}

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

.container { max-width: var(--max); margin: 0 auto; padding: 0 18px; }

.site-header {
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, color-mix(in oklab, var(--card), var(--link) 6%), color-mix(in oklab, var(--bg), var(--card) 35%));
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; gap: 16px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  font-family: var(--font-display);
  color: var(--fg);
}
.brand__logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 24px -18px var(--shadow);
  background: color-mix(in oklab, var(--card), var(--link) 14%);
}
.brand__text { font-size: 1.05rem; }
.nav { display: flex; gap: 12px; flex-wrap: wrap; font-family: var(--font-ui); font-weight: 500; }
.nav a { color: var(--fg); opacity: 0.9; }
.nav a:hover { opacity: 1; }

h1, h2, h3, h4 { line-height: 1.2; font-family: var(--font-display); font-weight: 600; letter-spacing: 0.2px; }
h1 { margin: 22px 0 14px; font-size: clamp(2.1rem, 3vw, 2.6rem); }

.post-list { display: grid; gap: 14px; margin: 16px 0 28px; }
.post-list__item { padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
.post-list__item--has-media { display: grid; grid-template-columns: 180px 1fr; gap: 14px; align-items: start; }
.post-list__media { display: block; border-radius: 12px; overflow: hidden; }
.post-list__media img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.post-list__body { min-width: 0; }
.post-list__title { margin: 0 0 6px; font-size: 1.25rem; }
.post-list__meta { display: flex; gap: 10px; color: var(--muted); font-size: 0.92rem; flex-wrap: wrap; }
.post-list__desc { margin: 10px 0 0; color: color-mix(in oklab, var(--fg), var(--muted) 35%); }

.post { margin: 24px 0 46px; }
.post__head {
  padding: 22px 22px 10px;
  border: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  background: linear-gradient(180deg, color-mix(in oklab, var(--card), var(--accent) 10%), var(--card));
  box-shadow: 0 18px 40px -30px var(--shadow);
}
.post__head h1 { margin: 0 0 12px; }
.post__meta { display: flex; gap: 10px; color: var(--muted); font-size: 0.95rem; flex-wrap: wrap; margin-bottom: 12px; }
.post__desc { margin: 0 0 14px; color: color-mix(in oklab, var(--fg), var(--muted) 35%); }
.post__content {
  padding: 10px 24px 30px;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 18px 18px;
  background: linear-gradient(180deg, color-mix(in oklab, var(--card), var(--accent) 6%), var(--card) 40%);
  box-shadow: 0 18px 40px -30px var(--shadow);
  font-size: 1.05rem;
  line-height: 1.8;
}
.post__content > * { margin-top: 0; }
.post__content > * + * { margin-top: 1.1rem; }
.post__content p { margin: 0; max-width: 72ch; }
.post__content h2 {
  margin-top: 2.4rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
  font-size: clamp(1.5rem, 2.2vw, 1.85rem);
}
.post__content h2:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.post__content h3 {
  margin-top: 1.6rem;
  font-size: 1.25rem;
  color: color-mix(in oklab, var(--fg), var(--accent) 25%);
  border-left: 3px solid color-mix(in oklab, var(--accent), var(--fg) 20%);
  padding-left: 0.6rem;
}
.post__content h4 {
  margin-top: 1.2rem;
  font-size: 1.1rem;
  color: color-mix(in oklab, var(--fg), var(--muted) 20%);
}
.post__content ul,
.post__content ol {
  padding-left: 1.4rem;
  margin: 0.6rem 0 1.4rem;
}
.post__content ul { list-style: disc; }
.post__content ol { list-style: decimal; }
.post__content li { margin: 0.35rem 0; padding-left: 0.2rem; }
.post__content li::marker { color: var(--accent); font-weight: 600; }
.post__content table {
  width: 100%;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in oklab, var(--card), var(--accent) 4%);
  margin: 1.2rem 0 2rem;
  font-family: var(--font-ui);
  font-size: 0.98rem;
  line-height: 1.5;
}
.post__content table th,
.post__content table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  vertical-align: top;
  word-break: normal;
  hyphens: auto;
}
.post__content table th:last-child,
.post__content table td:last-child { border-right: none; }
.post__content table tr:last-child td { border-bottom: none; }
.post__content table thead th {
  background: color-mix(in oklab, var(--card), var(--accent) 18%);
  font-family: var(--font-ui);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: left;
  letter-spacing: 0.3px;
}
.post__content table tbody tr:nth-child(even) {
  background: color-mix(in oklab, var(--card), var(--fg) 2%);
}
.post__content img { max-width: 100%; height: auto; border-radius: 12px; }
.post__content figure { margin: 1.6rem 0; }
.post__content .post__video {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000000;
}
.post__content .post__video iframe {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  display: block;
}
.post__content pre {
  overflow: auto;
  padding: 14px;
  border-radius: 12px;
  background: color-mix(in oklab, #000000, var(--card) 35%);
}
.post__content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: color-mix(in oklab, var(--card), var(--fg) 8%);
  padding: 0.08rem 0.3rem;
  border-radius: 6px;
  border: 1px solid color-mix(in oklab, var(--border), var(--fg) 10%);
}
.post__content pre code {
  padding: 0;
  border: none;
  background: none;
}
.post__content blockquote {
  margin: 1.4rem 0;
  padding: 0.6rem 1rem;
  border-left: 3px solid var(--accent);
  background: color-mix(in oklab, var(--card), var(--accent) 6%);
  color: color-mix(in oklab, var(--fg), var(--muted) 30%);
}
.post__content hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

.footer { border-top: 1px solid var(--border); padding: 18px 0 26px; color: var(--muted); }

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

@keyframes post-fade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: no-preference) {
  .post__head { animation: post-rise 0.6s ease-out both; }
  .post__content > * { animation: post-fade 0.5s ease-out both; }
  .post__content > *:nth-child(1) { animation-delay: 0.04s; }
  .post__content > *:nth-child(2) { animation-delay: 0.08s; }
  .post__content > *:nth-child(3) { animation-delay: 0.12s; }
  .post__content > *:nth-child(4) { animation-delay: 0.16s; }
  .post__content > *:nth-child(5) { animation-delay: 0.2s; }
  .post__content > *:nth-child(6) { animation-delay: 0.24s; }
  .post__content > *:nth-child(7) { animation-delay: 0.28s; }
  .post__content > *:nth-child(8) { animation-delay: 0.32s; }
}

@media (max-width: 640px) {
  .post-list__item--has-media { grid-template-columns: 1fr; }
  .brand__logo { width: 38px; height: 38px; }
  .brand__text { font-size: 0.98rem; }
}

@media (max-width: 720px) {
  .post__content { overflow-x: auto; }
  .post__content table { min-width: 720px; }
  .post__content table th,
  .post__content table td { min-width: 160px; }
}
