/* --- Skip Link (Accessibility) --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #fff;
  z-index: 100;
  font-size: 0.85rem;
}

@media (prefers-color-scheme: dark) {
  .skip-link {
    color: #141414;
  }
}

.skip-link:focus {
  top: 0;
  text-decoration: none;
  outline: none;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --text: #1a1a1a;
  --text-secondary: #555;
  --bg: #fafafa;
  --bg-code: #f0f0f0;
  --border: #ddd;
  --accent: #0a5e61;
  --focus-ring: #0a5e61;
  --max-width: 680px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #e0e0e0;
    --text-secondary: #a0a0a0;
    --bg: #141414;
    --bg-code: #1e1e1e;
    --border: #333;
    --accent: #5bbfc2;
    --focus-ring: #5bbfc2;
  }
}

html {
  font-size: 18px;
  line-height: 1.7;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial,
    sans-serif;
  color: var(--text);
  background: var(--bg);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* --- Typography --- */
h1,
h2,
h3 {
  line-height: 1.3;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

h1 {
  font-size: 1.8rem;
}

h2 {
  font-size: 1.35rem;
}

h3 {
  font-size: 1.1rem;
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

a:focus-visible {
  border-radius: 2px;
}

blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

code {
  font-family: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
  font-size: 0.85rem;
  background: var(--bg-code);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
}

pre {
  background: var(--bg-code);
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin: 1.5rem 0;
}

pre code {
  background: none;
  padding: 0;
}

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

img {
  max-width: 100%;
  height: auto;
}

ul,
ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.35rem;
}

strong {
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

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

th {
  font-weight: 600;
}

/* --- Header / Nav --- */
header {
  margin-bottom: 3rem;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.site-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

.site-name:hover {
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.nav-links a:hover {
  color: var(--text);
}

/* --- Homepage Intro --- */
.site-intro {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  line-height: 1.6;
}

/* --- About Page Photo --- */
.about-photo {
  float: right;
  width: 200px;
  height: auto;
  margin: 0 0 1.5rem 1.5rem;
  border-radius: 6px;
}

@media (max-width: 500px) {
  .about-photo {
    float: none;
    display: block;
    width: 100%;
    max-width: 280px;
    margin: 0 auto 1.5rem;
  }
}

/* --- Post List (Homepage) --- */
.post-list {
  list-style: none;
  padding: 0;
}

.post-list li {
  margin-bottom: 1.75rem;
}

.post-list a {
  color: var(--text);
  font-weight: 600;
  font-size: 1.15rem;
}

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

.post-list time {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.post-list .description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* --- Single Post --- */
.post-header {
  margin-bottom: 2rem;
}

.post-header h1 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.post-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.post-meta .updated,
.post-meta .reading-time {
  white-space: nowrap;
}

.post-header time {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.tags {
  margin-top: 0.5rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.75rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
}

.post-body h2:first-child {
  margin-top: 0;
}

/* --- Post Images --- */
.post-body figure {
  margin: 2rem 0;
}

.post-body figure img {
  border-radius: 4px;
  display: block;
}

.post-body figcaption {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  text-align: center;
  font-style: italic;
}

/* --- Author Card --- */
.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.author-card {
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.author-photo {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.author-card .author-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.author-card .author-bio {
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

/* --- Post Navigation --- */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.post-nav-link {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-width: 48%;
  text-decoration: none;
}

.post-nav-link:hover .post-nav-title {
  text-decoration: underline;
}

.post-nav-newer {
  margin-left: auto;
  text-align: right;
}

.post-nav-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.post-nav-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

/* --- Footer --- */
footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.footer-links {
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: var(--text-secondary);
}

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

.footer-sep {
  margin: 0 0.35rem;
}
