/* blog.siao.ai — extends the siao.ai homepage's visual identity
 * (ClaudeDesign/BLOG.md), not the app family's. Same literal color
 * tokens as the homepage, same editorial detailing (hairlines,
 * letter-spaced labels, the ↗ hover affordance). One serif stack for
 * everything — no separate sans face for chrome.
 */

@font-face {
  font-family: "EB Garamond";
  src: url("/fonts/eb-garamond-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: block; /* a flash of the wrong serif reads worse than a moment of nothing */
}

@font-face {
  font-family: "EB Garamond";
  src: url("/fonts/eb-garamond-latin-400-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: block;
}

@font-face {
  font-family: "EB Garamond";
  src: url("/fonts/eb-garamond-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Noto Serif TC";
  src: url("/fonts/noto-serif-tc-chinese-traditional-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: block;
}

@font-face {
  font-family: "Noto Serif TC";
  src: url("/fonts/noto-serif-tc-chinese-traditional-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: block;
}

:root {
  --paper: #faf9f6;
  --ink: #1a1a1a;
  --ink-dim: #6e6b65;
  --hairline: rgba(26, 26, 26, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "EB Garamond", "Noto Serif TC", Georgia, serif;
  font-size: 1.125rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
}

a:hover {
  border-bottom-color: var(--ink);
}

/* Fills left-to-right as the reader scrolls through a post
 * (reading-progress.js). Zero width, invisible, and inert on any page
 * without an <article> — the script is a no-op there. */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--ink);
  z-index: 10;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* Two columns — reading column plus a persistent sidebar
 * (ClaudeDesign/BLOG.md: search, tags, recent posts always visible,
 * not one click away). Stacks to one column once there isn't room for
 * both without the sidebar crowding the reading measure. */
.layout {
  display: flex;
  gap: 3rem;
  align-items: flex-start;
}

.layout main {
  flex: 1;
  min-width: 0;
  max-width: 640px;
}

@media (max-width: 720px) {
  .layout {
    flex-direction: column;
  }
  .layout main {
    max-width: none;
  }
}

/* The site header: name + the tag/archive nav ClaudeDesign/BLOG.md's
 * "personal wiki" framing asks for, present on every page. */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.25rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--hairline);
}

.site-header .name a {
  font-size: 1.4rem;
  border-bottom: none;
}

.site-nav {
  display: flex;
  gap: 1.25rem;
}

.site-nav a {
  border-bottom: none;
  color: var(--ink-dim);
}

.site-nav a:hover,
.site-nav a[aria-current] {
  color: var(--ink);
}

/* Uppercase, letter-spaced section labels — same device the homepage
 * uses above its list groups (e.g. ELSEWHERE, CONTACT). */
.label {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0 0 0.75rem;
}

h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  line-height: 1.25;
  margin: 0 0 0.5rem;
}

/* A post's own headline — deliberately larger and more confident than
 * a section-index h1 (歸檔/標籤), the same "commit to the headline"
 * move Medium makes on an article page. */
.post-title {
  font-size: clamp(2rem, 5vw, 2.75rem);
  line-height: 1.15;
}

h2 {
  font-size: 1.3rem;
  margin: 2rem 0 0.75rem;
}

.byline {
  color: var(--ink-dim);
  font-size: 0.95rem;
  margin: 0 0 1.75rem;
}

/* Post/archive/tag listings share this shape: a hairline-divided list,
 * each item a title link plus a muted excerpt or meta line. */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--hairline);
}

.post-list li {
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--hairline);
}

.post-list .title {
  font-size: 1.15rem;
}

.post-list .title a {
  border-bottom: none;
}

.post-list .title a:hover {
  border-bottom: 1px solid var(--ink);
}

.post-list .meta,
.post-list p {
  color: var(--ink-dim);
  font-style: italic;
  font-size: 0.95rem;
  margin: 0.3rem 0 0;
}

/* Tag chips — on a post page (linking to that tag's index) and on the
 * tag index itself (linking to each tag, with its post count). */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0 1.75rem;
}

.tags a {
  border: 1px solid var(--hairline);
  border-radius: 3px;
  padding: 0.15rem 0.6rem;
  font-size: 0.85rem;
  color: var(--ink-dim);
}

.tags a:hover {
  color: var(--ink);
  border-color: var(--ink);
}

/* Archive: year headings, month sub-groups. */
.archive-year {
  font-size: 1.5rem;
  margin: 2.5rem 0 0.5rem;
}

.archive-year:first-of-type {
  margin-top: 0;
}

.archive-month {
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 1.25rem 0 0.5rem;
}

/* A post's own body content. */
article {
  margin-top: 0.5rem;
}

/* A markdown `---` becomes this — a centered "· · ·" scene break
 * instead of a plain rule, Medium's section-divider convention. The
 * author already writes `---` for this in GFM; nothing new to learn. */
article hr {
  border: none;
  height: auto;
  margin: 2.5rem 0;
  text-align: center;
}

article hr::after {
  content: "· · ·";
  color: var(--ink-dim);
  letter-spacing: 0.5em;
  font-size: 1.1rem;
}

article table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

article th,
article td {
  border: 1px solid var(--hairline);
  padding: 0.4rem 0.7rem;
  text-align: left;
}

article figure {
  margin: 1.5rem 0;
  overflow-x: auto;
  border-radius: 4px;
}

article pre {
  overflow-x: auto;
  padding: 1rem;
  border-radius: 4px;
}

article code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
}

/* Language switcher, the same hairline/label device as everything
 * else — not a separate widget style. */
nav[aria-label="Languages"] {
  color: var(--ink-dim);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

nav[aria-label="Languages"] a,
nav[aria-label="Languages"] span {
  border-bottom: none;
}

/* "Referenced in" / embed-source notes render as quiet, italic asides
 * — the same register as the homepage's italic descriptions. */
p[role="note"] {
  color: var(--ink-dim);
  font-style: italic;
  font-size: 0.95rem;
}

/* Sidebar: search, tag cloud, recent posts, post count — all real
 * data, no placeholder categories (ClaudeDesign/BLOG.md). */
.sidebar {
  width: 240px;
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .sidebar {
    width: 100%;
  }
}

.widget {
  margin-bottom: 2rem;
}

.widget .label {
  margin-bottom: 0.6rem;
}

.widget-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.widget-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 0.95rem;
}

.widget-list li:last-child {
  border-bottom: none;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-cloud a {
  border: 1px solid var(--hairline);
  border-radius: 3px;
  padding: 0.15rem 0.6rem;
  font-size: 0.85rem;
  color: var(--ink-dim);
}

.tag-cloud a:hover {
  color: var(--ink);
  border-color: var(--ink);
}

.sidebar > .meta {
  color: var(--ink-dim);
  font-style: italic;
  font-size: 0.9rem;
}

#search-input {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 3px;
  padding: 0.4rem 0.6rem;
}

#search-input:focus {
  outline: none;
  border-color: var(--ink);
}

.search-results {
  list-style: none;
  margin: 0.6rem 0 0;
  padding: 0;
}

.search-results li {
  padding: 0.35rem 0;
  font-size: 0.9rem;
}

.search-results a {
  border-bottom: none;
}

.search-empty {
  color: var(--ink-dim);
  font-style: italic;
}

.site-footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--hairline);
  color: var(--ink-dim);
  font-size: 0.9rem;
}

.site-footer a {
  border-bottom: none;
  color: var(--ink-dim);
}

.site-footer a:hover {
  color: var(--ink);
}
