*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --text: #1a1a1a;
  --text-secondary: #555;
  --text-muted: #888;
  --bg: #fafafa;
  --surface: #fff;
  --border: #e5e5e5;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --tag-bg: #f0f0f0;
  --tag-text: #444;
  --tag-hover-bg: #e0e7ff;
  --tag-hover-text: #2563eb;
  --code-bg: #f4f4f5;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e5e5e5;
    --text-secondary: #a3a3a3;
    --text-muted: #737373;
    --bg: #111;
    --surface: #1a1a1a;
    --border: #2a2a2a;
    --accent: #60a5fa;
    --accent-hover: #93bbfd;
    --tag-bg: #252525;
    --tag-text: #a3a3a3;
    --tag-hover-bg: #1e293b;
    --tag-hover-text: #60a5fa;
    --code-bg: #1e1e1e;
  }
}

html {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1.5rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- NAV ---- */

.site-header {
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
}

.site-title:hover {
  color: var(--accent);
}

/* ---- MAIN ---- */

main {
  flex: 1;
}

/* ---- MEMO LIST ---- */

.memo-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.memo-item {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
}

.memo-item:first-child {
  padding-top: 0;
}

.memo-item-title {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.memo-item-title a {
  color: var(--text);
  text-decoration: none;
}

.memo-item-title a:hover {
  color: var(--accent);
}

.memo-item-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.35rem;
  flex-wrap: wrap;
}

.memo-item-meta time {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.memo-item-desc {
  margin-top: 0.4rem;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ---- TAGS ---- */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  list-style: none;
}

.tags a {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
  background: var(--tag-bg);
  color: var(--tag-text);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.tags a:hover {
  background: var(--tag-hover-bg);
  color: var(--tag-hover-text);
}

.tag-cloud {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.tag-cloud .tags {
  gap: 0.4rem;
}

.tag-cloud .tags a {
  font-size: 0.8125rem;
  padding: 0.25rem 0.7rem;
}

/* ---- PAGE HEADERS ---- */

.page-heading {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

.page-heading em {
  font-style: normal;
  color: var(--accent);
}

/* ---- ARTICLE (memo page) ---- */

.memo-header {
  margin-bottom: 2.5rem;
}

.memo-header h1 {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
}

.memo-header time {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.memo-header .tags {
  margin-top: 0.6rem;
}

article {
  line-height: 1.8;
}

article h1,
article h2,
article h3,
article h4 {
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

article h1 { font-size: 1.75rem; }
article h2 { font-size: 1.35rem; }
article h3 { font-size: 1.125rem; }

article p {
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
}

article a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}

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

article ul,
article ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
  color: var(--text-secondary);
}

article li {
  margin-bottom: 0.35rem;
}

article blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 1rem;
  margin: 1.5rem 0;
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
}

article blockquote p {
  margin-bottom: 0;
  color: var(--text-secondary);
}

article code {
  font-family: "JetBrains Mono", "Fira Code", "SF Mono", Consolas, monospace;
  font-size: 0.875em;
  background: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 4px;
}

article pre {
  background: var(--code-bg) !important;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
}

article pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

article img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

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

/* ---- BACK LINK ---- */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

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

/* ---- FOOTER ---- */

.site-footer {
  margin-top: 4rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-muted);
}
