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

/* --- CSS variables for dark/light themes --- */
:root {
  --bg: #161616;
  --fg: #e2e2e2;
  --border: #2a2a2a;
  --muted: #888;
  --link: #e2e2e2;
}

[data-theme="light"] {
  --bg: #f7f6f2;
  --fg: #1a1a1a;
  --border: #e2ddd6;
  --muted: #999;
  --link: #1a1a1a;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.8;
  color: var(--fg);
  background: var(--bg);
  margin: 0;
  padding: 0;
  transition: background 0.25s, color 0.25s;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 4rem 2rem;
}

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

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

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

header h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}

nav {
  display: flex;
  gap: 1.5rem;
  margin-top: 0;
}

nav a {
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s;
}

nav a:hover {
  color: var(--fg);
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s;
}

a:hover {
  text-decoration-color: currentColor;
}

/* --- Section label (Archive / Recs h2) --- */
main h2 {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin: 0 0 1.5rem 0;
}

/* --- Post list --- */
.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.post-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

.post-list li:first-child {
  border-top: 1px solid var(--border);
}

.post-list a {
  text-decoration: none;
  font-weight: 400;
  transition: opacity 0.2s;
}

.post-list a:hover {
  opacity: 0.6;
}

.post-date {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

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

.post-header h1 {
  margin: 0 0 0.4rem 0;
  font-size: 2rem;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.post-subtitle {
  font-size: 1rem;
  color: var(--muted);
  margin: 0 0 0.5rem 0;
  font-weight: 400;
  letter-spacing: 0;
}

.post-meta {
  font-size: 0.75rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

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

.post-content p {
  margin: 0 0 1.4rem 0;
}

.post-content a {
  text-decoration-color: var(--muted);
}

.post-content a:hover {
  text-decoration-color: var(--link);
}

/* --- Blockquote --- */
blockquote {
  margin: 0 0 1.4rem 0 !important;
  padding: 0.1rem 0 0.1rem 1.25rem;
  border-left: 2px solid var(--muted);
  color: var(--muted);
  font-style: italic;
}

blockquote p {
  margin: 0;
}

/* --- Footer --- */
footer {
  margin-top: 5rem;
  font-size: 0.75rem;
  color: var(--muted);
}

/* --- Recs list --- */
.recs-list {
  padding: 0;
  margin: 0;
}

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

.rec-item:first-child {
  border-top: 1px solid var(--border);
}

.rec-main {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.rec-title {
  text-decoration: none;
  font-weight: 400;
  transition: opacity 0.2s;
}

.rec-title:hover {
  opacity: 0.6;
}

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

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

.rec-note {
  margin: 0.25rem 0 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
}

.rec-note p {
  margin: 0;
}

/* --- Listening / Last.fm album grid --- */
.listening {
  margin-bottom: 3.5rem;
}

.album-grid {
  display: flex;
  gap: 0.5rem;
  min-height: 80px; /* reserves space while loading */
}

.album-cover {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.album-cover:hover {
  opacity: 1;
}

/* --- Theme toggle --- */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1;
  transition: border-color 0.2s, color 0.2s;
}

.theme-toggle:hover {
  border-color: var(--muted);
  color: var(--fg);
}

/* Sun = switch to light, Moon = switch to dark */
:root .icon-dark  { display: inline; }
:root .icon-light { display: none; }

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