:root {
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #666666;
  --rule: #e6e6e6;
  --link: #1a5cff; /* will update with theme */
  --link-hover: #123db1;
  --maxw: 720px;
}

/* Dark mode overrides via .dark on html element */
.dark {
  --bg: #0f1320;        /* comfortable midnight */
  --fg: #e9edf5;
  --muted: #aab3c5;
  --rule: #273044;
}

* {
  box-sizing: border-box;
}

html, body {
  padding: 0;
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: Outfit, Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  transition: background-color .25s ease, color .25s ease;
}

/* Global link colors follow current sheep theme */
a {
  color: var(--link);
  text-decoration: none;
  transition: color .25s ease;
}
a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}
a:visited {
  color: var(--link);
}

/* Ensure paragraph links are always visibly links */
p a {
  text-decoration: underline;
}
p a:hover {
  text-decoration: underline;
}

html {
  scroll-behavior: smooth;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px 20px 56px;
  transition: background-color .25s ease, color .25s ease;
}

.nav {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.nav-links {
  display: flex;
  gap: 16px;
}

.nav-link {
  color: var(--link);
  text-decoration: none;
  opacity: 1;
  transition: color .25s ease;
}

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

.nav-link.active {
  text-decoration: underline;
}

.badge-wrap {
  position: relative;
  width: 56px; /* leave room for lamp overlay */
  height: 56px;
  isolation: isolate; /* isolate stacking/transform contexts within */
}

.site-badge {
  position: absolute;
  top: 4px;   /* center 48px inside 56px box */
  left: 4px;
  width: 48px;
  height: 48px;
  object-fit: cover;
  cursor: pointer;
  transition: transform .15s ease, filter .2s ease;
  z-index: 1;
  will-change: transform;
  display: block;
  transform-origin: center center;
  user-select: none;
  -webkit-user-select: none;
}

.site-badge:hover {
  transform: translateY(-2px) rotate(-3deg);
}

.site-badge:active {
  transform: translateY(0) scale(0.96);
}

/* Idle animation for sheep */
@keyframes wiggle {
  0% { transform: translateY(0) rotate(0deg); }
  20% { transform: translateY(-3px) rotate(-6deg); }
  40% { transform: translateY(2px) rotate(4deg); }
  60% { transform: translateY(-2px) rotate(-4deg); }
  80% { transform: translateY(1px) rotate(3deg); }
  100% { transform: translateY(0) rotate(0deg); }
}

#sheep {
  display: block;
  animation: wiggle 2s cubic-bezier(.68,-.55,.265,1.55) infinite;
}

.animate-wiggle {
  animation: wiggle 2s cubic-bezier(.68,-.55,.265,1.55) infinite;
}

@media (prefers-reduced-motion: reduce) {
  #sheep { animation: none; }
}

/* Lamp styles */
.lamp {
  width: 38px;
  height: 38px;
  object-fit: contain;
  cursor: pointer;
  transition: transform .15s ease, opacity .22s ease;
  position: fixed !important; /* pin to viewport, not badge-wrap */
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  pointer-events: auto;
  display: block;
  user-select: none;
  -webkit-user-select: none;
}

/* Optional: toggle this by adding class "debug-badge" to .badge-wrap in DevTools */
.badge-wrap.debug-badge { outline: 1px dashed #e63946; background: rgba(230,57,70,0.06); }
.badge-wrap.debug-badge .site-badge { outline: 1px solid #2a9d8f; }
.badge-wrap.debug-badge .lamp { outline: 1px solid #1a5cff; }

.lamp:hover { transform: translateY(-1px); }
.lamp:active { transform: scale(0.96); }

.title {
  font-size: 48px;
  line-height: 1.1;
  font-weight: 700;
  margin: 24px 0 8px;
  text-transform: lowercase;
}

.tagline {
  margin: 0 0 16px;
  color: var(--muted);
}

.blurb {
  margin: 0 0 10px;
}

.social {
  display: flex;
  gap: 16px;
  margin-top: 10px;
}

.social-link {
  color: var(--link);
  text-decoration: none;
  transition: color .25s ease;
}

.social-link:hover {
  text-decoration: underline;
  color: var(--link-hover);
}

/* Elements that should follow the current theme color */
.themed { color: var(--link); }

.rule {
  margin: 28px 0;
  border: none;
  border-top: 1px solid var(--rule);
  transition: border-color .25s ease;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  text-transform: lowercase;
  margin: 0 0 8px;
}

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

section {
  margin-bottom: 32px;
}

.tab-section[hidden] {
  display: none !important;
}

.tab-active {
  display: block;
}

.site-footer {
  margin-top: 48px;
  transition: color .25s ease;
}

@media (max-width: 480px) {
  .title {
    font-size: 36px;
  }
}

/* PDF-like card for CV content */
.cv-card {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  padding: 20px 20px 24px;
  margin-top: 8px;
  overflow: hidden;
}

.cv-header { display: grid; gap: 6px; margin-bottom: 14px; }
.cv-name { margin: 0; font-size: 20px; line-height: 1.2; font-weight: 700; color: var(--fg); }
.cv-contact { display: flex; flex-wrap: wrap; gap: 10px; font-size: 14px; color: var(--muted); }
.cv-contact a { color: var(--link); text-decoration: underline; }

.cv-section { margin-top: 18px; }
.cv-section-title { margin: 0 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--fg); }
.cv-item { margin-bottom: 12px; }
.cv-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.cv-title { font-weight: 600; }
.cv-meta { color: var(--muted); font-size: 13px; white-space: nowrap; }
.cv-bullets { margin: 6px 0 0 18px; padding: 0; }
.cv-bullets li { margin: 4px 0; }
.cv-bullets.tight li { margin: 2px 0; }

@media (max-width: 480px) {
  .cv-row { flex-direction: column; align-items: flex-start; gap: 2px; }
}