/* ──────────────────────────────────────────────
   Patrick Collison-inspired minimalist theme
   Shared across every page of the site.
   ────────────────────────────────────────────── */

:root[data-theme="light"] {
  --bg: #ffffff;
  --text: #333333;
  --link: #0864c7;
  --muted: #aaaaaa;
  --rule: #eeeeee;
  --tooltip-bg: #555555;
  --toggle-bg: #cccccc;
  --toggle-knob: #ffffff;
  --toggle-bg-active: #333333;
}

:root[data-theme="dark"] {
  --bg: #1a1a1a;
  --text: #e8e0d4;
  --link: #6eaaee;
  --muted: #888888;
  --rule: #333333;
  --tooltip-bg: #888888;
  --toggle-bg: #555555;
  --toggle-knob: #ffffff;
  --toggle-bg-active: #e8e0d4;
}

html {
  transition: background-color 0.3s ease, color 0.3s ease;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 11px;
  letter-spacing: 0.1px;
  color: var(--text);
  background-color: var(--bg);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ── Navigation menu (right-floated, à la patrickcollison.com) ── */
#menu {
  float: right;
  margin-top: 30px;
  margin-right: 20px;
  text-align: right;
  width: 150px;
  font-family: inherit;
}

#menu .title {
  display: block;
  margin-bottom: 10px;
}

#menu ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

#menu li a {
  display: inline-block;
  color: var(--link);
  text-decoration: none;
  transition: color 0.3s ease;
}

#menu li a:hover {
  text-decoration: underline;
}

/* ── Layout columns ── */
#left {
  height: 1px;
  float: left;
  display: block;
  min-width: 0;
  overflow: hidden;
  width: 200px;
  margin: 0;
  padding: 0;
}

#content {
  margin-top: 15px;
  float: left;
  width: 500px;
}

/* ── Content typography ── */
#content h1,
#content h2,
#content h3 {
  font-family: inherit;
  font-weight: 600;
  letter-spacing: -0.2px;
}

#content h1 {
  font-size: 15px;
  margin: 0 0 0.4em 0;
}

#content h2 {
  font-size: 12px;
  margin: 2em 0 1em 0;
}

#content h3 {
  font-size: 11px;
  margin: 2em 0 0.6em 0;
}

#content p,
#content ul,
#content ol {
  color: var(--text);
  line-height: 1.65;
}

#content p {
  margin: 0 0 1em 0;
}

#content p.notop {
  margin-top: 0;
}

#content ul,
#content ol {
  margin: 0 0 1.5em 0;
  padding-left: 20px;
}

#content li {
  margin-bottom: 0.7em;
}

#content a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.3s ease;
}

#content a:hover {
  text-decoration: underline;
}

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

/* ── Bylines / dates / small notes ── */
#content .date,
#content .byline,
#content .note {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 2em;
}

/* ── About-page profile image ── */
.profile-img {
  height: 130px;
  width: auto;
  margin-bottom: 1.5em;
}

/* ── Blog index ── */
.post {
  margin-bottom: 1.5em;
}

.post .date {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 0.3em;
}

.post .title {
  margin-bottom: 0.3em;
}

.post .title a {
  color: var(--link);
  text-decoration: none;
}

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

.post .excerpt {
  color: var(--muted);
  font-size: 11px;
}

/* ── Theme toggle switch ── */
.theme-toggle {
  position: fixed;
  top: 30px;
  left: 30px;
  z-index: 100;
}

.theme-toggle input {
  display: none;
}

.toggle-label {
  display: block;
  width: 34px;
  height: 18px;
  background: var(--toggle-bg);
  border-radius: 18px;
  cursor: pointer;
  position: relative;
  transition: background 0.3s ease;
}

.toggle-label::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: var(--toggle-knob);
  border-radius: 50%;
  transition: transform 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.theme-toggle input:checked + .toggle-label {
  background: var(--toggle-bg-active);
}

.theme-toggle input:checked + .toggle-label::after {
  transform: translateX(16px);
}

/* ── Background-music button ── */
#musicBtn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  font-size: 14px;
  cursor: pointer;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

:root[data-theme="light"] #musicBtn {
  background: rgba(255, 255, 255, 0.85);
  color: #333;
  border: 1px solid #ccc;
}

:root[data-theme="dark"] #musicBtn {
  background: rgba(40, 40, 40, 0.85);
  color: #e8e0d4;
  border: 1px solid #555;
}

#musicBtn:hover {
  transform: scale(1.1);
}

#musicBtn.playing {
  animation: pulse 2.5s infinite ease-in-out;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15); }
  50%      { box-shadow: 0 2px 18px rgba(8, 100, 199, 0.35); }
}

/* ── Tooltip (about-page joke link) ── */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 120px;
  background-color: var(--tooltip-bg);
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -60px;
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 12px;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  #menu {
    float: none;
    width: auto;
    margin: 20px;
    text-align: left;
  }

  #left {
    display: none;
  }

  #content {
    float: none;
    width: auto;
    margin: 20px;
  }

  .theme-toggle {
    top: 20px;
    left: auto;
    right: 20px;
  }

  #musicBtn {
    bottom: 20px;
    right: 20px;
  }
}
