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

/* Minimal scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--divider) transparent;
}

*::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: var(--divider);
  border-radius: 4px;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

:root {
  --bg: #1c1917;
  --text: #e7e5e4;
  --text-secondary: #a8a29e;
  --accent: #e7e5e4;
  --link: #e7e5e4;
  --link-hover: #a8a29e;
  --divider: #44403c;
  --track-bg: #292524;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'IBM Plex Sans', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

main {
  max-width: 640px;
  width: 100%;
  padding: 4rem 1.5rem 3rem;
}

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

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.name-hover {
  position: relative;
  cursor: default;
}

.name-img {
  position: absolute;
  top: 50%;
  left: calc(100% + 12px);
  transform: translateY(-50%) translateX(4px);
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 10;
}

.name-hover:hover .name-img {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.cv-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-secondary);
  border: 1px solid var(--divider);
  border-radius: 4px;
  padding: 0.3rem 0.6rem;
  transition: color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
  margin-top: 0.25rem;
}

.cv-btn:hover {
  color: var(--text);
  border-color: var(--text-secondary);
}

h1 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 0.15rem;
}

/* Sections */
section {
  margin-bottom: 2.5rem;
}

.intro p {
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.intro p:last-child {
  margin-bottom: 0;
}

.stack-hover {
  position: relative;
  cursor: default;
}

.stack-hover::before {
  content: '';
  position: absolute;
  inset: -0.75rem -0.5rem;
}

.stack-img {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  width: 200px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 10;
}

.stack-hover:hover .stack-img {
  opacity: 1;
  transform: translateY(0);
}

.hike-hover {
  position: relative;
  cursor: pointer;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  color: var(--link);
  transition: color 0.15s ease;
}

.hike-hover:hover {
  color: #4a8a35;
}

.hike-img {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: 200px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 10;
}

.hike-hover:hover .hike-img {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.music-hover {
  position: relative;
  cursor: pointer;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  color: var(--link);
  transition: color 0.15s ease;
}

.music-hover:hover {
  color: #1DB954;
}

.music-img {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: 200px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 10;
}

.music-hover:hover .music-img {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ph-hover {
  position: relative;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.ph-hover:hover {
  color: var(--text);
}

/* PHP elePHPant hover */
.php-hover {
  position: relative;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.php-hover:hover {
  color: var(--text);
}

.php-hover::before {
  content: '';
  position: absolute;
  inset: -0.75rem -0.5rem;
}

.php-text {
  transition: color 0.3s ease;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.php-hover:hover .php-text {
  color: #777BB3;
}

.scenery {
  position: absolute;
  bottom: 100%;
  left: 0;
  width: 100%;
  height: 50px;
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.php-hover:hover .scenery {
  opacity: 1;
}

.elephpant {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.elephpant.visible {
  opacity: 1;
}

.elephpant.visible .leg-fl { animation: leg-swing 0.6s ease-in-out infinite alternate; }
.elephpant.visible .leg-fr { animation: leg-swing 0.6s ease-in-out infinite alternate-reverse; }
.elephpant.visible .leg-bl { animation: leg-swing 0.6s ease-in-out infinite alternate-reverse; }
.elephpant.visible .leg-br { animation: leg-swing 0.6s ease-in-out infinite alternate; }

.elephpant-wrap {
  display: inline-block;
}

@keyframes leg-swing {
  0% { transform: rotate(-15deg); transform-origin: top center; }
  100% { transform: rotate(15deg); transform-origin: top center; }
}

.ph-hover::before {
  content: '';
  position: absolute;
  inset: -0.75rem -0.5rem;
}

.ph-text {
  transition: color 0.3s ease, text-shadow 0.3s ease;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.pixie-dust {
  position: absolute;
  border-radius: 50%;
  background: #ffd700;
  box-shadow: 0 0 4px #ffd700, 0 0 8px rgba(255, 215, 0, 0.4);
  pointer-events: none;
  animation: dust-float ease-out forwards;
  z-index: 20;
}

@keyframes dust-float {
  0% {
    opacity: 1;
    transform: translate(0, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx), var(--dy)) scale(0);
  }
}

.ph-hover:hover .ph-text {
  color: #ffd700;
  text-shadow: 0 0 6px rgba(255, 215, 0, 0.6), 0 0 16px rgba(255, 215, 0, 0.4), 0 0 32px rgba(255, 215, 0, 0.2);
}

.ph-img {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  width: 220px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 10;
}

.ph-hover:hover .ph-img {
  opacity: 1;
  transform: translateY(0);
}

strong {
  font-weight: 500;
}

h2 {
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

h3 {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.divider {
  height: 1px;
  background: var(--divider);
  margin-bottom: 1.25rem;
}

/* Links */
a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--link-hover);
}

/* Skills */
.skill-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 2rem;
}

@media (max-width: 500px) {
  .skill-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

.skill-group h3 {
  font-size: 0.8rem;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
}

.skill-group p {
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Career */
.timeline {
  list-style: none;
}

.timeline-item {
  margin-bottom: 1.25rem;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.timeline-header strong {
  font-size: 0.95rem;
  font-weight: 500;
}

.timeline-header time {
  font-size: 0.8rem;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--text-secondary);
  white-space: nowrap;
}

.timeline-company {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.1rem;
}

.timeline-desc {
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* Projects */
.project-list {
  list-style: none;
}

.project-item {
  margin-bottom: 1rem;
}

.project-item:last-child {
  margin-bottom: 0;
}

.project-header a {
  font-size: 0.95rem;
}

.project-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.15rem;
  line-height: 1.5;
}

/* Posts grid */
.posts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

@media (max-width: 500px) {
  .posts-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

.post-list {
  list-style: none;
}

.post-list li {
  margin-bottom: 0.6rem;
  display: flex;
  flex-direction: column;
}

.post-list a {
  font-size: 0.95rem;
  line-height: 1.4;
}

.view-all {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.8rem;
  font-family: 'IBM Plex Mono', monospace;
  text-decoration: none;
  color: var(--text-secondary);
}

.view-all:hover {
  color: var(--text);
}

.post-list time {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-family: 'IBM Plex Mono', monospace;
}

/* Now playing border glow */
.now-playing.glow {
  animation: border-glow 4s ease;
}

@keyframes border-glow {
  0% { box-shadow: 0 0 0 0 transparent; }
  10% { box-shadow: 0 0 12px 3px var(--text-secondary); }
  50% { box-shadow: 0 0 12px 3px var(--text-secondary); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* Now playing */
.now-playing {
  display: flex;
  gap: 1rem;
  background: var(--track-bg);
  border-radius: 8px;
  padding: 1rem;
  text-decoration: none;
  color: var(--text);
  transition: opacity 0.15s ease;
  align-items: center;
}

.now-playing:hover {
  color: var(--text);
  opacity: 0.8;
}

.album-art-wrap {
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  border-radius: 6px;
  overflow: visible;
  background: var(--divider);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.album-art-ambient {
  position: absolute;
  inset: -8px;
  width: calc(100% + 16px);
  height: calc(100% + 16px);
  object-fit: cover;
  border-radius: 10px;
  filter: blur(16px) saturate(1.5);
  opacity: 0;
  transition: opacity 0.6s ease;
  z-index: 0;
  pointer-events: none;
}

.album-art-ambient.loaded {
  opacity: 0.6;
}

.album-art-wrap .ripple {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
}

.album-art-wrap .ripple.active {
  animation: ripple-out 2s ease-out infinite;
}

.album-art-wrap .ripple-2.active {
  animation-delay: 0.7s;
}

.album-art-wrap .ripple-3.active {
  animation-delay: 1.4s;
}

@keyframes ripple-out {
  0% {
    transform: scale(1);
    opacity: 0.5;
    box-shadow: 0 0 0 0 var(--ripple-color, rgba(120, 120, 120, 0.4));
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
    box-shadow: 0 0 12px 6px var(--ripple-color, rgba(120, 120, 120, 0.4));
  }
}

.album-art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  position: relative;
  z-index: 1;
  border-radius: 6px;
}

.album-art.loaded {
  display: block;
}

.album-art.loaded + .album-art-placeholder {
  display: none;
}

.album-art-placeholder {
  color: var(--text-secondary);
  opacity: 0.4;
}

.track-details {
  flex: 1;
  min-width: 0;
}

.track-top {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  margin-bottom: 0.5rem;
}

.track-name {
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.artist-name {
  font-size: 0.82rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.album-name {
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-bottom {
  margin-bottom: 0.35rem;
}

.progress-bar {
  height: 3px;
  background: var(--divider);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.progress-fill {
  height: 100%;
  background: var(--text-secondary);
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s ease;
}

.track-time {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--text-secondary);
  opacity: 0.7;
}

.listen-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.listen-status {
  font-size: 0.7rem;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.spotify-icon {
  color: #1DB954;
  opacity: 0.8;
  flex-shrink: 0;
}

@media (max-width: 500px) {
  .album-art-wrap {
    width: 56px;
    height: 56px;
  }
}

/* Writing page */
.back-link {
  font-size: 0.85rem;
  font-family: 'IBM Plex Mono', monospace;
  text-decoration: none;
  color: var(--text-secondary);
  display: inline-block;
  margin-bottom: 1.5rem;
}

.back-link:hover {
  color: var(--text);
}

.filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-btn {
  font-size: 0.75rem;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  background: none;
  border: 1px solid var(--divider);
  border-radius: 4px;
  padding: 0.3rem 0.7rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.filter-btn:hover {
  color: var(--text);
  border-color: var(--text-secondary);
}

.filter-btn.active {
  color: var(--text);
  border-color: var(--text);
  background: var(--track-bg);
}

.writing-list {
  list-style: none;
}

.writing-item {
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--divider);
}

.writing-item:last-child {
  border-bottom: none;
}

.writing-item[data-hidden="true"] {
  display: none;
}

.writing-item.visited {
  opacity: 0.55;
}

.writing-item.visited:hover {
  opacity: 0.7;
}

.writing-meta {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.writing-meta time {
  font-size: 0.8rem;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--text-secondary);
}

.writing-category {
  font-size: 0.7rem;
  font-family: 'IBM Plex Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  border: 1px solid var(--divider);
  border-radius: 3px;
  padding: 0.1rem 0.4rem;
}

.writing-item {
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.writing-item:hover {
  opacity: 0.7;
}

.writing-item h3 {
  font-size: 0.95rem;
  font-weight: 500;
  margin-bottom: 0.2rem;
}

.writing-snippet {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 100;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--bg);
  border: 1px solid var(--divider);
  border-radius: 8px;
  max-width: 520px;
  width: 100%;
  padding: 1.75rem;
  position: relative;
}

.modal h3 {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
  padding-right: 1.5rem;
}

.modal-body {
  max-height: 60vh;
  overflow-y: auto;
}

.modal-divider {
  height: 1px;
  background: var(--divider);
  margin-bottom: 0.75rem;
}

.modal-body p {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}

.modal-body p:last-child {
  margin-bottom: 0;
}

.modal-body h4 {
  font-size: 0.85rem;
  font-weight: 500;
  margin-top: 1rem;
  margin-bottom: 0.3rem;
  color: var(--text);
}

.modal-body ul {
  list-style: disc;
  padding-left: 1.25rem;
  margin-bottom: 0.6rem;
}

.modal-body li {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 0.2rem;
}

.modal-body pre {
  background: var(--track-bg);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 0.6rem;
  overflow-x: auto;
}

.modal-body pre code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  line-height: 1.6;
  background: none;
  padding: 0;
  border-radius: 0;
  color: var(--text-secondary);
}

.modal-body .writing-video,
.modal-body .writing-photo {
  width: 100%;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

.modal-body .writing-photo {
  object-fit: cover;
  max-height: 300px;
}

.modal-body code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.82rem;
  background: var(--track-bg);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}

.modal-body strong {
  color: var(--text);
}

.modal-body em {
  font-style: italic;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.15s ease;
}

.modal-close:hover {
  color: var(--text);
}

/* Elsewhere */
.elsewhere p {
  font-size: 0.95rem;
}

/* Footer */
footer {
  margin-top: 3rem;
}

footer p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}
