/* ---- Design tokens ---- */
:root {
  /* Always light: also stops browsers from auto-darkening the page */
  color-scheme: only light;

  --max-width: 44rem;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Code", Menlo,
    Consolas, monospace;
  --font-logo: "Space Grotesk", var(--font-body);

  --bg: #ffffff;
  --bg-subtle: #f8fafc;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --accent: #0f766e;
  --accent-hover: #115e59;
  --accent-soft: #ccfbf1;
  --accent-soft-text: #115e59;
  --code-inline-bg: #f1f5f9;
  --code-block-bg: #0f172a;
  --code-block-text: #e2e8f0;
}

/* ---- Base ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

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

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
}

a {
  color: var(--accent);
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--accent-hover);
}

/* ---- Header / nav ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 3.75rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-logo);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.logo-mark {
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 6px;
  background: var(--accent);
  color: var(--bg);
  font-size: 0.85rem;
}

.logo:hover {
  color: var(--text);
}

.site-nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.95rem;
  font-weight: 500;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
}

/* ---- Main ---- */
main {
  padding: 3rem 0 4rem;
}

/* ---- Hero (home) ---- */
.hero {
  padding-bottom: 2.5rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  font-size: clamp(2rem, 6vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 800;
  margin: 0 0 0.75rem;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin: 0;
  max-width: 34rem;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 1.5rem;
}

/* ---- Post list ---- */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.post-card {
  display: block;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-subtle);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}

.post-card:hover {
  border-color: var(--accent);
  color: inherit;
  transform: translateY(-2px);
}

.post-card h2 {
  font-size: 1.3rem;
  line-height: 1.3;
  letter-spacing: -0.015em;
  margin: 0 0 0.4rem;
}

.post-card p {
  margin: 0.75rem 0 0;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
}

/* ---- Meta + tags ---- */
.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-soft-text);
}

/* ---- Article ---- */
.post-header {
  margin-bottom: 2.5rem;
}

.post-header h1 {
  font-size: clamp(1.9rem, 5vw, 2.4rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-weight: 800;
  margin: 0 0 1rem;
}

.article-body h2 {
  font-size: 1.5rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
  margin: 3rem 0 0.75rem;
}

.article-body h3 {
  font-size: 1.2rem;
  margin: 2rem 0 0.5rem;
}

.article-body p,
.article-body ul,
.article-body ol {
  margin: 0 0 1.25rem;
}

.article-body ul,
.article-body ol {
  padding-left: 1.4rem;
}

.article-body li + li {
  margin-top: 0.4rem;
}

.article-body strong {
  font-weight: 650;
}

.article-body blockquote {
  margin: 1.75rem 0;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-subtle);
  border-radius: 0 8px 8px 0;
}

.article-body blockquote p:last-child {
  margin-bottom: 0;
}

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--code-inline-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}

.article-body pre {
  margin: 0 0 1.5rem;
  padding: 1.1rem 1.25rem;
  border-radius: 10px;
  overflow-x: auto;
  background: var(--code-block-bg) !important;
  color: var(--code-block-text);
  font-size: 0.875rem;
  line-height: 1.6;
}

.article-body pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

.output-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: -0.75rem 0 0.4rem;
}

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

.article-body th,
.article-body td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.article-body th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.article-body td.num,
.article-body th.num {
  text-align: right;
  font-family: var(--font-mono);
}

.table-scroll {
  overflow-x: auto;
}

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
}

.article-body figure {
  margin: 2rem 0;
}

.article-body figure img {
  display: block;
  margin: 0 auto;
  padding: 0.75rem;
  background: #ffffff;
  border: 1px solid var(--border);
}

.video-embed {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}

.video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.article-body figcaption {
  margin-top: 0.6rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
}

.article-body tr.highlight td {
  font-weight: 600;
}

.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

/* ---- About page ---- */
.about-intro {
  display: flex;
  align-items: flex-start;
  gap: 1.75rem;
  margin-bottom: 1rem;
}

.about-intro p:last-child {
  margin-bottom: 0;
}

.article-body .avatar {
  flex-shrink: 0;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}

@media (max-width: 560px) {
  .about-intro {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

.article-body .skill-tags {
  padding-left: 0;
  margin-bottom: 1.25rem;
}

.article-body .skill-tags li + li {
  margin-top: 0;
}

.article-body .skill-tags .tag {
  font-size: 0.85rem;
  padding: 0.25rem 0.75rem;
}

.article-body .contact-links {
  list-style: none;
  padding-left: 0;
}

.contact-links li {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1rem;
}

.contact-links span {
  min-width: 5.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ---- Back link ---- */
.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
}

.back-link:hover {
  color: var(--accent);
}

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-top: 1.5rem;
  padding-bottom: 2.5rem;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--text-muted);
}
