/* CSS Custom Properties - Theme System */

:root {
  --bg: #0a0a0a;
  --fg: #e4e4e7;
  --muted: #71717a;
  --accent: #a855f7;
  --border: #27272a;
  --fg-strong: #fafafa;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --fg: #e4e4e7;
  --muted: #71717a;
  --accent: #a855f7;
  --border: #27272a;
  --fg-strong: #fafafa;
}

[data-theme="light"] {
  --bg: #fafafa;
  --fg: #3f3f46;
  --muted: #a1a1aa;
  --accent: #a855f7;
  --border: #e4e4e7;
  --fg-strong: #18181b;
}

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

/* Typography */
html {
  font-size: 15px;
  line-height: 1.6;
}

body {
  font-family: "JetBrains Mono", monospace;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--fg);
  background-color: var(--bg);
  min-height: 100vh;
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.5em;
  color: var(--fg-strong);
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }

p {
  margin-bottom: 1rem;
}

/* Links */
a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s ease;
}

@media (hover: hover) {
  a:hover {
    opacity: 0.8;
  }
}

a:focus {
  outline: none;
}

.muted {
  color: var(--muted);
}

/* Code */
code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9em;
  background-color: var(--border);
  padding: 0.125em 0.25em;
  border-radius: 3px;
}

pre {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.85rem;
  background-color: var(--border);
  padding: 1rem;
  border-radius: 4px;
  overflow-x: auto;
  margin-bottom: 1rem;
}

pre code {
  background-color: transparent;
  padding: 0;
}

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

li {
  margin-bottom: 0.25rem;
}

/* Blockquotes */
blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 1rem;
  margin-left: 0;
  margin-bottom: 1rem;
  color: var(--muted);
  font-style: italic;
}

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

::selection {
  background-color: var(--accent);
  color: var(--bg);
}

/* ─── Layout ─── */

main {
  padding: 0 1.5rem 2rem;
  max-width: 40rem;
  margin: 0 auto;
}

/* ─── Site Header ─── */

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  max-width: 40rem;
  margin: 0 auto;
}

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

.back-link {
  font-size: 1.25rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

@media (hover: hover) {
  .back-link:hover {
    color: var(--fg-strong);
    opacity: 1;
  }
}

.site-name-surname {
  color: inherit;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

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

.nav-link {
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: none;
  transition: color 0.2s ease;
}

@media (hover: hover) {
  .nav-link:hover {
    color: var(--fg-strong);
    opacity: 1;
  }
}

.nav-link--active {
  color: var(--fg-strong);
}

/* ─── Theme Toggle ─── */

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background-color: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease;
}

@media (hover: hover) {
  .theme-toggle:hover {
    color: var(--fg-strong);
  }
}

.theme-toggle:focus {
  outline: none;
}

[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* ─── Site Footer ─── */

.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 1.5rem;
  max-width: 40rem;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.75rem;
}

.rss-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--muted);
  font-size: 0.75rem;
  transition: color 0.2s ease;
}

.rss-link:hover {
  color: var(--accent);
  opacity: 1;
}

/* ─── Homepage ─── */

.homepage {
  max-width: 40rem;
  margin: 0 auto;
}

.bio {
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

.bio-role {
  color: var(--fg-strong);
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.bio-text {
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
}

.bio-links {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
}

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

.bio-links a:hover {
  opacity: 0.7;
}

/* ─── Section Labels ─── */

.section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.home-section {
  margin-top: 3rem;
}

/* ─── Home Lists ─── */

.home-list {
  list-style: none;
  padding-left: 0;
  margin-bottom: 0;
}

.home-list li {
  margin-bottom: 0;
}

.home-list-link {
  display: inline-flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.35rem 0;
  color: var(--fg);
  text-decoration: none;
  transition: color 0.15s ease;
}

@media (hover: hover) {
  .home-list-link:hover {
    color: var(--fg-strong);
    opacity: 1;
  }

  .home-list-link:hover .home-list-title {
    color: var(--accent);
  }

  .home-list-link:hover .home-list-date {
    color: var(--fg);
  }
}

.home-list-date {
  color: var(--muted);
  font-size: 0.75rem;
  flex-shrink: 0;
  min-width: 5.5rem;
}

.home-list-title {
  font-weight: 500;
  font-size: 0.875rem;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.home-list-link .home-list-title {
  color: var(--accent);
}

@media (hover: hover) {
  .home-list-link:hover .home-list-title {
    color: var(--fg-strong);
  }
}

.home-list-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.home-list-book {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.35rem 0;
}

/* ─── Link Row ─── */

.link-row {
  display: flex;
  gap: 1.25rem;
  font-size: 0.8rem;
}

.link-row a {
  color: var(--muted);
  transition: color 0.15s ease;
}

.link-row a:hover {
  color: var(--accent);
  opacity: 1;
}

/* ─── Blog Post Layout ─── */

.post {
  max-width: 60ch;
  margin: 0 auto;
}

.post-header {
  margin-bottom: 2rem;
}

.post-title {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.post-date {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.post-content {
  line-height: 1.7;
}

.post-content h2 {
  margin-top: 2rem;
}

.post-content h3 {
  margin-top: 1.5rem;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.post-content a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ─── Blog List Page ─── */

.blog-list {
  max-width: 60ch;
  margin: 0 auto;
}

.blog-list h1 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.post-list {
  list-style: none;
  padding-left: 0;
}

.post-item {
  margin-bottom: 0;
}

.post-link {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.35rem 0;
  color: var(--fg);
  text-decoration: none;
  transition: color 0.15s ease;
}

.post-link:hover {
  color: var(--accent);
  opacity: 1;
}

.post-item-title {
  font-weight: 500;
  font-size: 0.875rem;
}

.post-item-date {
  color: var(--muted);
  font-size: 0.75rem;
  flex-shrink: 0;
  min-width: 5.5rem;
}

/* ─── Reading List Page ─── */

.reading-list {
  max-width: 60ch;
  margin: 0 auto;
}

.reading-list h1 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.reading-list > p {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.reading-list h2 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--muted);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.book-list {
  list-style: none;
  padding-left: 0;
  margin-bottom: 0;
}

.book-item {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  padding: 0.35rem 0;
  margin-bottom: 0;
}

.book-title {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--fg);
}

.book-author {
  color: var(--muted);
  font-size: 0.8rem;
}

/* ─── Responsive ─── */

@media (max-width: 480px) {
  .site-header {
    padding: 1rem;
  }

  main {
    padding: 0 1rem 2rem;
  }

  .site-footer {
    padding: 2rem 1rem;
  }

}
