/* Shared styles */

:root {
  --bg: #0a0b0a;
  --bg-card: #101210;
  --bg-card-hover: #131611;
  --fg: #e6e8e3;
  --muted: #7d857b;
  --muted-dim: #565d54;
  --accent: #35d46a;
  --accent-soft: rgba(53, 212, 106, 0.12);
  --accent-line: rgba(53, 212, 106, 0.35);
  --rule: #1d211c;
  --tag-bg: #141712;
  --warn: #e6b93d;
  --radius: 8px;
  --mono:
    "SF Mono", "JetBrains Mono", "Menlo", "Consolas", "Liberation Mono",
    monospace;
}
html.light {
  --bg: #f3f4f0;
  --bg-card: #ffffff;
  --bg-card-hover: #fafaf7;
  --fg: #181a17;
  --muted: #6b7268;
  --muted-dim: #9a9f96;
  --accent: #0e8a3c;
  --accent-soft: rgba(14, 138, 60, 0.08);
  --accent-line: rgba(14, 138, 60, 0.3);
  --rule: #e3e5df;
  --tag-bg: #f0f2ed;
}
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
}
body {
  font-family: var(--mono);
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition:
    background-color 0.2s ease,
    color 0.2s ease;
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Topbar */
#topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 22px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
#topbar .brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  white-space: nowrap;
}
#topbar .brand b {
  color: var(--fg);
  font-weight: 700;
}
#topbar .brand .cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
#topbar .right {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
}
#topbar .quote-box {
  background: var(--tag-bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 5px 12px;
  font-style: italic;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  cursor: default;
}

/* Theme switch */
.switch {
  --switch-size: 2rem;
  --radius: 8px;
  --hiddenPosition: 105%;
  --visiblePosition: 25%;

  position: relative;
  display: inline-block;

  width: var(--switch-size);
  height: var(--switch-size);

  cursor: pointer;

  background: var(--tag-bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.slider .icon-wrapper {
  position: absolute;

  display: flex;

  flex-direction: column;

  align-items: center;

  justify-content: space-between;

  width: 100%;
  height: 100%;
}

.sun,
.moon {
  transition: transform 0.18s ease;
}

.sun {
  transform: translateY(var(--visiblePosition));
}

.moon {
  transform: translateY(var(--hiddenPosition));
}

/* Light mode -> show Moon (switch to dark) */
.switch input:not(:checked) + .slider .sun {
  transform: translateY(var(--hiddenPosition));
}

.switch input:not(:checked) + .slider .moon {
  transition-delay: 0.18s;
  transform: translateY(var(--visiblePosition));
}

/* Dark mode -> show Sun (switch to light) */
.switch input:checked + .slider .sun {
  transition-delay: 0.18s;
  transform: translateY(var(--visiblePosition));
}

.switch input:checked + .slider .moon {
  transform: translateY(var(--hiddenPosition));
}

.switch svg {
  width: 1rem;
  height: 1rem;
}

.sun svg * {
  fill: #f59e0b;
  transition: fill 0.2s;
}

.moon svg * {
  fill: #0d0d0e;
  transition: fill 0.2s;
}

@media (max-width: 560px) {
  #topbar .quote-box {
    display: none;
  }
}

/* Footer */
footer {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 22px 40px;
  color: var(--muted-dim);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

@media (prefers-reduced-motion: reduce) {
  .cursor {
    animation: none;
  }
  * {
    scroll-behavior: auto !important;
  }
}
